#kafka收发消息测试
#9092为内网访问方式 service的端口,外网访问使用Nodeport端口30901
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kafka-service-1 NodePort 10.0.0.133 <none> 9092:30901/TCP 5d22h
kafka-service-2 NodePort 10.0.0.8 <none> 9092:30902/TCP 5d22h
kafka-service-3 NodePort 10.0.0.16 <none> 9092:30903/TCP 5d22h
kubernetes ClusterIP 10.0.0.1 <none> 443/TCP 16d
mysql NodePort 10.0.0.162 <none> 3306:31422/TCP 47h
zoo1 ClusterIP 10.0.0.228 <none> 2181/TCP,2888/TCP,3888/TCP 5d22h
zoo2 ClusterIP 10.0.0.190 <none> 2181/TCP,2888/TCP,3888/TCP 5d22h
zoo3 ClusterIP 10.0.0.37 <none> 2181/TCP,2888/TCP,3888/TCP 5d22h
kafka-console-producer.sh --broker-list [kafka的service的clusterIP]:9092 --topic test
kafka-console-consumer.sh --bootstrap-server [kafka的service的clusterIP]:9092 --topic test --from-beginning
---
bash-5.1# kafka-console-producer.sh --broker-list 10.0.0.133:9092 --topic test
>
bash-5.1#kafka-console-consumer.sh --bootstrap-server 10.0.0.133:9092 --topic test --from-beginning
#查看topic
kafka-topics.sh --list --zookeeper 10.0.0.228:2181
#查看topic中是否有数据
./kafka-console-consumer.sh --bootstrap-server 10.0.0.133:9092 --topic test --from-beginning
#查看topic
kafka-topics.sh --describe --zookeeper 10.0.0.228:2181 --topic test