Zookeeper或Kafka连接错误,显示Kazoo :: VersionNotSupported错误

时间:2016-03-22 11:56:53

标签: ruby apache-kafka apache-zookeeper kazoo

我正在使用Kafka和zookeeper,并在它们之间建立连接但是当我尝试创建新的 Kafka :: Consumer

时连接会一次又一次地掉线
ZOOKEEPER = '127.0.0.1:2181'
CLIENT_ID = '************'
TOPICS    = ['*****']

@consumer = Kafka::Consumer.new(CLIENT_ID, TOPICS, zookeeper: ZOOKEEPER, logger: nil)

我还检查了zookeeper和kafka日志文件,并在我尝试创建新的Kafka :: Consumer时删除了我的kafka到zookeeper的连接

Kafka Log:

  ...
  [2016-03-04 16:14:47,553] INFO [Group Metadata Manager on Broker 0]: Removed 0 expired offsets in 0 milliseconds. (kafka.coordinator.GroupMetadataManager)
  [2016-03-04 16:16:11,419] INFO Unable to read additional data from server sessionid 0x1533ff65f850003, likely server has closed socket, closing socket connection and attempting reconnect (org.apache.zookeeper.ClientCnxn)
  [2016-03-04 16:16:11,520] INFO zookeeper state changed (Disconnected) (org.I0Itec.zkclient.ZkClient)
  [2016-03-04 16:16:13,128] INFO Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error) (org.apache.zookeeper.ClientCnxn)
  [2016-03-04 16:16:13,129] WARN Session 0x1533ff65f850003 for server null, unexpected error, closing socket connection and attempting reconnect (org.apache.zookeeper.ClientCnxn)
  java.net.ConnectException: Connection refused
    at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
    at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
    at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)
    at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081)
  ...

Zookeeper日志:

...
2016-04-04 10:30:30,577 - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:ZooKeeperServer@839] - Client attempting to establish new session at /127.0.0.1:51152
2016-04-04 10:30:30,579 - INFO  [SyncThread:0:FileTxnLog@199] - Creating new log file: log.725
2016-04-04 10:30:30,668 - INFO  [SyncThread:0:ZooKeeperServer@595] - Established session 0x153df9fc2a70000 with negotiated timeout 6000 for client /127.0.0.1:51152
2016-04-04 10:30:31,714 - INFO  [ProcessThread(sid:0 cport:-1)::PrepRequestProcessor@627] - Got user-level KeeperException when processing sessionid:0x153df9fc2a70000 type:delete cxid:0x26 zxid:0x728 txntype:-1 reqpath:n/a Error Path:/admin/preferred_replica_election Error:KeeperErrorCode = NoNode for /admin/preferred_replica_election
2016-04-04 10:30:31,883 - INFO  [ProcessThread(sid:0 cport:-1)::PrepRequestProcessor@627] - Got user-level KeeperException when processing sessionid:0x153df9fc2a70000 type:create cxid:0x2d zxid:0x729 txntype:-1 reqpath:n/a Error Path:/brokers Error:KeeperErrorCode = NodeExists for /brokers
...

已安装的宝石

  • 使用ione 1.2.3
  • 使用json 1.8.3
  • 使用thor 0.19.1
  • 使用zookeeper 1.4.11
  • 使用poseidon 0.0.5
  • 使用bundler 1.11.2
  • 使用cassandra-driver 2.1.5
  • 使用kazoo-ruby 0.4.0
  • 使用kafka-consumer 0.1.2

我完全无法获得版本问题

获取错误:

~/../kazoo-ruby-0.4.0/lib/kazoo/broker.rb:83:in `from_json': Kazoo::VersionNotSupported
~/../kazoo-ruby-0.4.0/lib/kazoo/cluster.rb:38:in `block (3 levels) in brokers'

1 个答案:

答案 0 :(得分:0)

得到了解决方案,我使用的是Kafka版本0.9.0.1或0.8.0 Beta,它正在创建一些版本问题。现在,我下载并安装了适用于我的scala版本2.11版本的Kafka 0.8.2.2。