连接已开启SASL的Kafka专享实例 ./kafkaconsoleproducer.sh brokerlist 10.xxx.xxx.202:9093,10.xxx.xxx.197:9093,10.xxx.xxx.68:9093 topic topicdemo producer.config ../config/producer.properties >hello >DMS >Kafka! >^C[root@ecskafka bin] 如需停止生产使用Ctrl+C命令退出。 执行如下命令消费消息。 ./kafkaconsoleconsumer.sh bootstrapserver ${连接地址} topic ${Topic名称} group ${消费组名称} frombeginning consumer.config ../config/consumer.properties 参数说明如下: 连接地址:从前提条件获取的连接地址。 Topic名称:Kafka实例下创建的Topic名称。 消费组名称:根据您的业务需求,设定消费组名称。 示例如下: [root@ecskafka bin] ./kafkaconsoleconsumer.sh bootstrapserver 10.xxx.xxx.202:9093,10.xxx.xxx.197:9093,10.xxx.xxx.68:9093 topic topicdemo group ordertest frombeginning consumer.config ../config/consumer.properties hello Kafka! DMS hello ^CProcessed a total of 4 messages [root@ecskafka bin] 如需停止消费使用Ctrl+C命令退出。