kafka安装使用和遇到的坑

下载安装

参考:https://segmentfault.com/a/1190000012730949

https://kafka.apache.org/quickstart

关闭服务

关闭zookeeper bin/zookeeper-server-stop.sh

关闭kafka bin/kafka-server-stop.sh

遇到的坑

问题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后又关闭了

解决方法

1、单独在一个linux终端运行bin/zookeeper-server-start.sh config/zookeeper.properties 启动zk,再开一个linux终端启动kakfa服务,然后再开一个linux终端创建topic

2、使用守护进程启动zk和kafka

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

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

posted @ 2018-04-08 11:44  游云浪天  阅读(1043)  评论(0编辑  收藏  举报