使用kafka内置zk启动以及测试
功能验证:
启动kafka内嵌的zk(前台启动):bin/zookeeper-server-start.sh config/zookeeper.properties
启动kafka服务: bin/kafka-server-start.sh config/server.properties
创建 topic :
bin/kafka-topics.sh --zookeeper localhost:2181 --create --topic test1 --partitions 3 --replication-factor 1
查看topic信息:
bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic test1
查看topic列表:
bin/kafka-topics.sh --list --zookeeper localhost:2181
发送消息:
bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test1
接收消息:
bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test1(亲测可用,version:kafka_2.11-2.1.0)
Tips:
lsof -i:2181 (查看2181端口是否被监听)
lsof -i:9092(查看9092端口是否被监听)