如果需要用户名和密码进行认证,可以通过设置 --command-config 参数指定认证配置文件,文件内容包括
security.protocol=SASL_PLAINTEXT
sasl.mechanism=PLAIN
sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="zhanghao" password="mima";
#创建topic
./kafka-topics.sh --create --topic article_info --partitions 6 --replication-factor 1 --bootstrap-server 1222.22.22:9092 --command-config client.properties
#查看指定topic的信息【包括分区】
./kafka-topics.sh --describe --topic article_info_test_0302 --bootstrap-server 2222.222.222.2:9092 --command-config client.properties
#消费
./kafka-console-consumer.sh --bootstrap-server 222.22.222.2:9092 --topic article_info --from-beginning --command-config client.properties
#查看指定GroupId的消费信息【包括消费是哪个主题, 每个分区已经消费了多少数据量,还有多少信息量未消费等】
./kafka-consumer-groups.sh --bootstrap-server 222.2222.22:9092 --describe --group groupID_article03 --command-config client.properties
kafka_2.12 认证的命令行信息
最新推荐文章于 2024-07-22 10:17:44 发布