kafka安裝使用和遇到的坑

下載安裝

參考:http://www.javashuo.com/article/p-zrsmulrt-es.htmljava

https://kafka.apache.org/quickstartlinux

關閉服務

關閉zookeeper bin/zookeeper-server-stop.shapache

關閉kafka bin/kafka-server-stop.shsegmentfault

遇到的坑

問題1

[2018-04-08 11:20:32,999] WARN Session 0x0 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:744)
    at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)
    at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1141)

上面問題說明沒法鏈接到zookeeper服務中,緣由是沒有啓動zk,或者啓動zk後又關閉了socket

解決方法

一、單獨在一個linux終端運行bin/zookeeper-server-start.sh config/zookeeper.properties 啓動zk,再開一個linux終端啓動kakfa服務,而後再開一個linux終端建立topicui

二、使用守護進程啓動zk和kafka.net

bin/zookeeper-server-start.sh -daemon config/zookeeper.propertiescode

bin/kafka-server-start.sh -daemon config/server.propertiesserver

相關文章
相關標籤/搜索