使用confluent本地安装和使用kafka
https://blog.csdn.net/zzq900503/article/details/83419245
查看topics
浏览器访问或者curl都可以
http://192.168.11.91:8082/topics
查看集群的brokers
curl http://192.168.11.91:8082/brokers
注册consumer group
curl -X POST -H "Content-Type: application/vnd.kafka.v2+json" -H "Accept: application/vnd.kafka.v2+json" --data '{"name": "my_consumer_instance", "format": "json", "auto.offset.reset": "earliest"}' http://localhost:8082/consumers/my_test_consumer
把topic和消费者my_consumer关联起来
curl -X POST -H "Content-Type: application/vnd.kafka.v2+json" --data '{"topics":["bear"]}' http://localhost:8082/consumers/my_test_consumer/instances/my_consumer_instance/subscription
通过rest接口向bear push数据
curl -X POST -H "Content-Type: application/vnd.kafka.json.v2+json" --data '{"records":[{"value":{"name": "testUser"}}]}' "http://localhost:8082/topics/bear"
通过rest接口消费数据
curl -X GET -H "Accept: application/vnd.kafka.json.v2+json" http://localhost:8082/consumers/my_test_consumer/instances/my_consumer_instance/records
删除注册的consumer实例:
curl -X DELETE -H "Accept: application/vnd.kafka.v2+json" http://localhost:8082/consumers/my_test_consumer/instances/my_consumer_instance