apache-kafkaconfluent-platform

Unable to get Kafka working due to address issue


I'm trying to follow a cloud guru course on kafka but when I setup the server and try and run it I get this error in the kafka server.log file:

WARN Cannot open channel to 2 at election address zoo2/172.31.21.241:3888 (org.apache.zookeeper.server.quorum.QuorumCnxManager)

It looks wrong as it seems to be putting the ip address after the name that I have defined in the host file shown below

127.0.0.1 localhost

172.31.30.11 zoo1 blaaaa.mylabserver.com
172.31.21.241 zoo2
172.31.22.75 zoo3

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback

My zookeeper.properties file looks like this, it previously had the 0.0.0.0 as zoo1 but read somewhere that it could cause an issue but still no luck getting it working.

tickTime=2000
dataDir=/var/lib/zookeeper/
clientPort=2181
initLimit=5
syncLimit=2
server.1=0.0.0.0:2888:3888
server.2=zoo2:2888:3888
server.3=zoo3:2888:3888
autopurge.snapRetainCount=3
autopurge.purgeInterval=24

Any help would be greatly appreciated!


Solution

  • I believe I have corrected the issue, it would seem that I had to explicitly allow the ports as follows

    Check what firewall ports are open

    sudo ufw status verbose
    

    Add the following ports

    sudo ufw allow 2888
    sudo ufw allow 3888
    sudo ufw allow 9092
    sudo ufw allow 2181