windows下安装zookeeper

1、安装JAVA-JDK,从oracle下载最新的SDK安装(我用的是1.8的) 
2、安装zookeeper3.3.6,下载地址:http://apache.fayea.com/zookeeper/ 
3、重命名conf/zoo_sample.cfg 为conf/zoo.cfg 
4、编辑 conf/zoo.cfg,修改dataDir=D:\zookeeper-3.3.6\data\ 
4、运行bin/zkServer.cmd

启动结果如下:

Golang之发送消息至kafka_Go教程

安装kafka

2、打开config目录下的server.properties, 修改log.dirs为D:\kafka_logs,

3、修改advertised.host.name=服务器ip

4、启动kafka ./bin/windows/kafka-server-start.bat ./config/server.preperties

kafka链接zookeeper

kafka也提供了一个命令行消费者,接受消息并打印到标准输出。

bin/kafka-console-consumer.bat --zookeeper 127.0.0.1:2181 --topic nginx_log
golang写入kafka

goland运行结果:

Golang之发送消息至kafka_Go教程_02

kafka收到的数据:

Golang之发送消息至kafka_Go教程_03