kafka相关命令
2020-12-17 本文已影响0人
boyiis
# 启动zookeeper
bin/zookeeper-server-start.sh config/zookeeper.properties
# 后台启动zookeeper
/opt/kafka_2.13-2.6.0/bin/zookeeper-server-start.sh -daemon /opt/kafka_2.13-2.6.0/config/zookeeper.properties
# 停止zookeeper
/opt/kafka_2.13-2.6.0/bin/zookeeper-server-stop.sh
# 启动kafka
bin/kafka-server-start.sh config/server.properties
# 后台启动kafka
/opt/kafka_2.13-2.6.0/bin/kafka-server-start.sh -daemon /opt/kafka_2.13-2.6.0/config/server.properties
#停止kafka
/opt/kafka_2.13-2.6.0/bin/kafka-server-stop.sh
# 创建topic test
bin/kafka-topics.sh -create --bootstrap-server localhost:9092 -replication-factor 3 --partitions 3 --topic test
# 删除topic
/bin/kafka-topics.sh --delete --zookeeper localhost:2181 --topic test
# 查看topic列表
bin/kafka-topics.sh --list --zookeeper 192.168.137.100:2181
# 查看topic test 的信息
bin/kafka-topics.sh --describe --topic test --bootstrap-server 192.168.137.100:9092
# 生产者
/opt/kafka_2.13-2.6.0/bin/kafka-console-producer.sh --topic test --bootstrap-server 192.168.137.100:9092
# 消费者
/opt/kafka_2.13-2.6.0/bin/kafka-console-consumer.sh --topic test --from-beginning --bootstrap-server localhost:9092