我尝试在AWS EC2 Windows 10实例上设置Zookeeper,然后从实例和单独的计算机连接Kafka 2.11-1.1.0。
在虚拟桌面中,我跑了:
bin\windows\zookeeper-server-start.bat config\zookeeper.properties
bin\windows\kafka-server-start.bat config\server.properties
在另一台PC上,只运行第二个命令。这些是每台计算机上的server.properties文件的修改部分,位于虚拟桌面上......
broker.id=0
listeners=PLAINTEXT://(AWS private DNS):9092
advertised.listeners=PLAINTEXT://(AWS public DNS):9092
zookeeper.connect=(AWS private DNS):2181
......在另一台电脑上:
broker.id=1
listeners=PLAINTEXT://(local IPv4):9092
advertised.listeners=PLAINTEXT://(public IPv4):9092
zookeeper.connect=(AWS public DNS):2181
Zookeeper和Kafka在虚拟PC中工作,但当我试图在另一台计算机上启动Kafka时,我收到了这个错误:
ERROR Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)
kafka.zookeeper.ZooKeeperClientTimeoutException: Timed out waiting for connection while in state: CONNECTING