kakfa常用命令

    xiaoxiao2025-04-22  15

    1.kafka依赖于zookeeper,所以先启动zookeeper 进入到kafka目录 bin/zookeeper-server-start.sh config/zookeeper.properties 2.启动kafka bin/kafka-server-start.sh config/server.properties 3.创建一个topic bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test 查看topic的运行状况 bin/kafka-topics.sh --describe --zookeeper localhost:2181 --topic test 4.查看所有topic列表 bin/kafka-topics.sh --list --zookeeper localhost:2181 5.生产者,发送消息到kafka,使用topic test bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test 6.消费者 消费kafka消息 bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic test --from-beginning #192.168.100.81:9092 kafka地址 #topic :assistant_message_topic ./kafka-simple-consumer-shell.sh --topic assistant_message_topic --broker-list 192.168.100.81:9092 ./kafka-simple-consumer-shell.sh --broker-list brokerhost:9092 --topic myTopic --partition 0 --max-messages 1查看原文:http://www.baowenwei.com/archives/924
    转载请注明原文地址: https://ju.6miu.com/read-1298322.html
    最新回复(0)