开启kafka服务(确保开启zookeeper bin/zkServer.sh start): bin/kafka-server-start.sh -daemon config/server.properties 查看所有主题: bin/kafka-topics.sh --zookeeper hadoop101:2181 --list 创建主题(3分区,2副本): bin/kafka-topics.sh --zookeeper hadoop101:2181 --create --topic topicname–partitions 3 --replication-factor 2 删除主题: bin/kafka-topics.sh --zookeeper hadoop101:2181 --delete --topic topicname 查看主题信息: bin/kafka-topics.sh --zookeeper hadoop101:2181,hadoop102:2181,hadoop103:2181 --describe --topic topicname 开启生产者: bin/kafka-console-producer.sh --broker-list hadoop101:9092 --topic topicname 开启消费者: bin/kafka-console-consumer.sh --bootstrap-server hadoop101:9092 --from-beginning --topic topicname bin/kafka-console-consumer.sh --zookeeper hadoop101:2181 --topic topicname
|