0

我正在使用“confluent-kafka-python”客户端将 avro 数据写入 kafka 主题。

我已经写入了数据,但是当我尝试使用以下命令读取数据时:kafka-avro-console-consumer 出现错误:

 [2017-05-02 13:38:11,387] ERROR Unknown error when running consumer:  (kafka.tools.ConsoleConsumer$:105)
org.apache.kafka.common.errors.SerializationException: Error deserializing Avro message for id 4
Caused by: java.net.ConnectException: Connection refused (Connection refused)
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
        at java.net.Socket.connect(Socket.java:589)
        at java.net.Socket.connect(Socket.java:538)
        at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
        at sun.net.www.http.HttpClient.<init>(HttpClient.java:242)
        at sun.net.www.http.HttpClient.New(HttpClient.java:339)
        at sun.net.www.http.HttpClient.New(HttpClient.java:357)

显然它无法解码数据。有任何想法吗 ?

4

1 回答 1

1

看起来它无法连接到架构注册表。您确定您已启动并运行它并为您的消费者连接 URL 和端口吗?

尝试将以下内容添加到您的控制台使用者

--property schema.registry.url=您的架构注册表的地址

于 2017-05-03T02:37:53.547 回答