方案: 2个经纪人-2主机 Java客户端 - org.apache.kafka.clients.producer.KafkaProducer或org.apache.kafka.clients.consumer.KafkaConsumer Bootsrap服务器属性包含2个ip地址(2个代理) Zookeeper - 分布式协调员
构造函数中的调用方法org.apache.kafka.clients.ClientUtil#parseAndValidateAddresses仅检查没有验证实例的网络服务器(检查损坏的状态服务器或不启动)
答案 0 :(得分:0)
默认情况下,Zookeeper会保留所有已连接节点和可访问代理的跟踪。您可以查询ZK以查看当前连接的节点。
# Connect to ZooKeeper
bin/zookeeper-shell.sh localhost:2181
Connecting to localhost:2181
Welcome to ZooKeeper!
JLine support is disabled
WATCHER::
WatchedEvent state:SyncConnected type:None path:null
>> ls /brokers/ids
[1, 2, 3]
>> ls /brokers/topics
[myTopic, __consumer_offsets]
>> get /brokers/ids/0
Node does not exist: /brokers/ids/0
>> get /brokers/ids/1
{"listener_security_protocol_map":{"PLAINTEXT":"PLAINTEXT","SSL":"SSL"},"endpoints":["PLAINTEXT://172.31.4.17:9092","SSL://18.216.252.106:9093"],"jmx_port":9999,"host":"172.31.4.17","timestamp":"1522349056258","port":9092,"version":4}
cZxid = 0x3000005f3
ctime = Thu Mar 29 18:44:16 UTC 2018
mZxid = 0x3000005f3
mtime = Thu Mar 29 18:44:16 UTC 2018
pZxid = 0x3000005f3
cversion = 0
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x2625d127c0b0003
dataLength = 234
numChildren = 0