解压
复制zookeeper配置文件zoo_sample.cfg改名为zoo.cfg(默认配置文件名称)
# The number of milliseconds of each tick
# 服务器之间或客户端与服务器之间维持心跳的时间间隔
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
# 超过10个心跳的时间连接超时
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
# 超过5个心跳请求和应答超时
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
# 保存数据的目录
dataDir=/tmp/zookeeper
# the port at which the clients will connect
# 客户端连接端口
clientPort=2181
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# Be sure to read the maintenance section of the
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1
启动zkServer.cmd脚本(不要关闭窗口)
添加系统变量ZOOKEEPER_HOME
cmd进入kafka的bin目录执行cmd命令
.\bin\windows\kafka-server-start.bat .\config\server.properties
创建生产者
.\bin\windows\kafka-console-producer.bat --broker-list localhost:9092 --topic test
创建消费者
.\bin\windows\kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic test --from-beginning
生产者窗口输入任意内容,查看消费者窗口是否接收