Kafka控制台使用者在HDP 3中阅读Avro消息

问题描述 投票:0回答:1

尝试使用来自控制台使用者的kafka Avro消息,并且不确定如何反序列化消息。

sh /usr/hdp/current/kafka-broker/bin/kafka-console-consumer.sh --bootstrap-server localhost:6667 --topic test --consumer.config /home/user/kafka.consumer.properties --from-beginning --value-deserializer ByteArrayDeserializer

测试主题的架构注册表中的Avro架构是:

{
 "type": "record",
 "namespace": "test",
 "name": "TestRecord",
 "fields": [
  {
   "name": "Name",
   "type": "string",
   "default": "null"
  },
  {
   "name": "Age",
   "type": "int",
   "default": -1
  }
 ]
}

使用HDP 3.1版本和Kafka-clients-2.0.0.3.1.0.0-78

有人可以帮助我从控制台读取Avro消息的反序列化器是什么。

apache-kafka kafka-consumer-api cloudera hdp
1个回答
0
投票

使用kafka-avro-console-consumer

例如

sh /usr/hdp/current/kafka-broker/bin/kafka-avro-console-consumer.sh \
--bootstrap-server localhost:6667 \
--topic test \
--from-beginning \
--property schema.registry.url=http://localhost:8081
© www.soinside.com 2019 - 2024. All rights reserved.