hrchu / ansible-kafka

Deploy multinode kafka cluster based on Confluent guide
1 stars 0 forks source link

Zookeeper cannot connect to ports 2888 and 3888 #1

Open sshahar1 opened 4 years ago

sshahar1 commented 4 years ago

Since the Zookeeper image doesn't expose this port it is impossible to connect to these ports

[2020-06-17 12:45:59,391] INFO Resolved hostname: <one host> to address: <one host>/<host IP> (org.apache.zookeeper.server.quorum.QuorumPeer) [2020-06-17 12:45:59,391] INFO Notification time out: 12800 (org.apache.zookeeper.server.quorum.FastLeaderElection) [2020-06-17 12:46:17,197] WARN Cannot open channel to 2 at election address <one host>/<host IP>:3888 (org.apache.zookeeper.server.quorum.QuorumCnxManager) java.net.SocketTimeoutException: connect timed out at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at org.apache.zookeeper.server.quorum.QuorumCnxManager.connectOne(QuorumCnxManager.java:558) at org.apache.zookeeper.server.quorum.QuorumCnxManager.connectAll(QuorumCnxManager.java:610) at org.apache.zookeeper.server.quorum.FastLeaderElection.lookForLeader(FastLeaderElection.java:838) at org.apache.zookeeper.server.quorum.QuorumPeer.run(QuorumPeer.java:958)

If Zookeeper doesn't start Kafka doesn't start, so the playbook doesn't work.

hrchu commented 4 years ago

Hi, you have to add your nodes in the hosts file. By default, we assume that you have three nodes named kafka01, kafka02, and kakfa03.

sshahar1 commented 4 years ago

@hrchu I did. It doesn't matter if the ports are not exposed

hrchu commented 4 years ago

Hi @sshahar1 , The issue does not relate to port exposure since we use host network mode here. https://github.com/hrchu/ansible-kafka/blob/master/roles/kafka/files/docker-compose.yml#L13

All service ports are available, as you can see in my setup: 圖片

Yes, from your log message, you indeed have the connection problem between zookeeper instances, but it's not about port exposure. I recommend you to check host file config, hostname resolution, firewall, and routing, things like that.