下载KAFKA和zookeeper
KAFKA下载地址:
zookeeper下载地址:
启动zookeeper
运行zookeeper的bin目录的zkServer.cmd
修改kafka配置
config\server.properties
advertised.listeners=PLAINTEXT://192.168.0.10:9092 //配置对应的ip
log.dirs=E:\kafka_2.12-1.1.0\kafka-logs //配置对应的路径
启动kafka
启动cmd,进人到解压的kafka目录下运行下面命令:
.\BIN\windows\kafka-server-start.bat .\config\server.properties
创建一个topic:
.\bin\windows\kafka-topics.bat --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic pms_cc
WARNING: Due to limitations in metric names, topics with a period ('.') or under
score ('_') could collide. To avoid issues it is best to use either, but not bot
h.
Created topic "pms_cc".
启动消费端:
.\bin\windows\kafka-console-consumer.bat --zookeeper 127.0.0.1:2181 --topicpms_cc
查看消费端列表:
.\bin\windows\kafka-consumer-groups.bat --zookeeper 127.0.0.1:2181 --list
Note: This will only show information about consumers that use ZooKeeper (not th
ose using the Java consumer API).
console-consumer-59686
查看消费端具体的信息:
.\bin\windows\kafka-consumer-groups.bat --zookeeper 127.0.0.1:2181 --group console-consumer-59686 --describe
Note: This will only show information about consumers that use ZooKeeper (not th
ose using the Java consumer API).
Error: Could not fetch offset from zookeeper for group 'console-consumer-59686'
partition 'pms_cc-0' due to missing offset data in zookeeper.
TOPIC PARTITION CURRENT-OFFSET LOG-END-OFFSET LAG CONSU
MER-ID
pms_cc 0 - 0 - conso
le-consumer-59686_WRGHO-20181016O-1542109588575-ae591d12