eucuepo / vagrant-kafka

Vagrant config to setup a partitioned Apache Kafka installation with clustered Apache Zookeeper
103 stars 89 forks source link

Cannot connect to zookeeper node with openjdk-jre #16

Closed BenedictRasmussen closed 6 years ago

BenedictRasmussen commented 6 years ago

I was getting this error when trying to create a topic after starting the VMs.

[2017-01-15 18:49:40,997] WARN Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect (org.apache.zookeeper.
ClientCnxn)
java.net.NoRouteToHostException: No route to host
        at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
        at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
        at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)

This initial issue was caused by zookeeper not being started when the VM came up. I fixed this by manually starting ZK on each VM. However, this led to a new issue- I was timing out after 30 seconds trying to create a topic.

After perusing some of the previously closed issues (specifically #5 and #6) I found that some fiddling had been done to the version of Java being installed. In issue #6 it was suggested to query the JVM using jps, a tool that is available with the JDK but not the JRE. I found that the JRE is installed when issuing -su -c "yum -y install java-1.8.0-openjdk". To get the JDK, you must append -devel.

After changing the yum installation to install the JDK, running a vagrant destroy and a vagrant up, and lastly manually starting the ZK nodes again, topic creation worked and I was able to query the JVM and see QuorumPeerMain.

imarios commented 6 years ago

Hey @BenedictRasmussen that sounds like a great addition. Do you want to issue a PR with whatever changes you made? Thank you for looking into this is such detail.

BenedictRasmussen commented 6 years ago

Sure thing. This is my first contribution to an open source, so if I managed to mess something up please let me know. I only committed the change for utilizing the JDK- if I have a little extra time I may come back around and see if I can figure out why the zookeeper nodes aren't starting.

imarios commented 6 years ago

Addressed by #17. Thank you @BenedictRasmussen !