04.Kafka常见命令

it2023-09-05  67

#启动ZK并指定配置文件 bin/zookeeper-server-start.sh config/zookeeper.properties #启动Kafka并指定配置文件 bin/kafka-server-start.sh config/server.properties #停止Kafka bin/kafka-server-stop.sh #创建一个名为test的主题(只有一个分区一个副本) bin/kafka-topics.sh --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1 --topic test #查看主题 bin/kafka-topics.sh --list --bootstrap-server localhost:9092 #发送消息,默认情况下,每行将作为单独的消息发送。 bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test This is a message This is another message #消费消息 bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning
最新回复(0)