0
Failed to connect to zookeeper (10.10.10.205:2181) within 2x zookeeper timeout period 30000

I'm trying to run geomesa client on my local system. I've setup hadoop, accumulo and zookeeper in my virtual machine (whose ip is 10.10.10.205) I can see that my zookeeper is running.

2187 Jps
24929 NameNode
25610 Main
25729 Main
25203 SecondaryNameNode
25055 DataNode
30767 QuorumPeerMain

But when I am trying to connect through client. I keep getting this error.

java.lang.RuntimeException: Failed to connect to zookeeper (10.10.10.205:2181) within 2x zookeeper timeout period 30000
    at org.apache.accumulo.fate.zookeeper.ZooSession.connect(ZooSession.java:124)
    at org.apache.accumulo.fate.zookeeper.ZooSession.getSession(ZooSession.java:164)
    at org.apache.accumulo.fate.zookeeper.ZooReader.getSession(ZooReader.java:43)
    at org.apache.accumulo.fate.zookeeper.ZooReader.getZooKeeper(ZooReader.java:47)
    at org.apache.accumulo.fate.zookeeper.ZooCache.getZooKeeper(ZooCache.java:75)
    at org.apache.accumulo.fate.zookeeper.ZooCache.access$800(ZooCache.java:50)
    at org.apache.accumulo.fate.zookeeper.ZooCache$2.run(ZooCache.java:318)
    at org.apache.accumulo.fate.zookeeper.ZooCache$2.run(ZooCache.java:295)
    at org.apache.accumulo.fate.zookeeper.ZooCache$ZooRunnable.retry(ZooCache.java:190)
    at org.apache.accumulo.fate.zookeeper.ZooCache.get(ZooCache.java:347)
    at org.apache.accumulo.fate.zookeeper.ZooCache.get(ZooCache.java:282)
    at org.apache.accumulo.core.client.ZooKeeperInstance.getInstanceID(ZooKeeperInstance.java:169)
    at org.apache.accumulo.core.client.ZooKeeperInstance.<init>(ZooKeeperInstance.java:159)
    at org.apache.accumulo.core.client.ZooKeeperInstance.<init>(ZooKeeperInstance.java:140)
    at org.locationtech.geomesa.accumulo.data.AccumuloDataStoreFactory$.buildAccumuloConnector(AccumuloDataStoreFactory.scala:109)
    at org.locationtech.geomesa.accumulo.data.AccumuloDataStoreFactory$$anonfun$1.apply(AccumuloDataStoreFactory.scala:43)
    at org.locationtech.geomesa.accumulo.data.AccumuloDataStoreFactory$$anonfun$1.apply(AccumuloDataStoreFactory.scala:43)
    at scala.Option.getOrElse(Option.scala:121)
    at org.locationtech.geomesa.accumulo.data.AccumuloDataStoreFactory.createDataStore(AccumuloDataStoreFactory.scala:42)
    at org.locationtech.geomesa.accumulo.data.AccumuloDataStoreFactory.createDataStore(AccumuloDataStoreFactory.scala:31)
    at org.geotools.data.DataAccessFinder.getDataStore(DataAccessFinder.java:130)
    at org.geotools.data.DataStoreFinder.getDataStore(DataStoreFinder.java:89)
    at com.hps.GeomesaClient.<init>(GeomesaClient.java:50)
    at com.hps.GeomesaTest.setup(GeomesaTest.java:71)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.junit.internal.runners.ClassRoadie.runBefores(ClassRoadie.java:49)
    at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:36)
    at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
    at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
    at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
    at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

I am clueless here. I don't know what to do to solve it. This is my cfg file below:

tickTime=2000
initLimit=10
syncLimit=5
dataDir=/var/zookeeper
clientPort=2181

Updated

this is the output of jps -ml

    Picked up _JAVA_OPTIONS: -Djava.net.preferIPv4Stack=true
4334 org.apache.accumulo.start.Main master --address localhost
5644 org.apache.hadoop.hdfs.server.namenode.NameNode
24363 sun.tools.jps.Jps -ml
5944 org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode
5778 org.apache.hadoop.hdfs.server.datanode.DataNode
4192 org.apache.accumulo.start.Main tserver --address localhost
24253 org.apache.zookeeper.server.quorum.QuorumPeerMain /opt/zookeeper/bin/../conf/zoo.cfg

this is the updated output after applying java_options of netstat -tlnp | grep java

tcp        0      0 127.0.0.1:9997          0.0.0.0:*               LISTEN      4192/java
tcp        0      0 127.0.0.1:9999          0.0.0.0:*               LISTEN      4334/java
tcp        0      0 127.0.0.1:10001         0.0.0.0:*               LISTEN      4334/java
tcp        0      0 127.0.0.1:10002         0.0.0.0:*               LISTEN      4192/java
tcp        0      0 0.0.0.0:50070           0.0.0.0:*               LISTEN      5644/java
tcp        0      0 0.0.0.0:50010           0.0.0.0:*               LISTEN      5778/java
tcp        0      0 0.0.0.0:50075           0.0.0.0:*               LISTEN      5778/java
tcp        0      0 0.0.0.0:39233           0.0.0.0:*               LISTEN      24253/java
tcp        0      0 0.0.0.0:50020           0.0.0.0:*               LISTEN      5778/java
tcp        0      0 0.0.0.0:2181            0.0.0.0:*               LISTEN      24253/java
tcp        0      0 0.0.0.0:9000            0.0.0.0:*               LISTEN      5644/java
tcp        0      0 0.0.0.0:50090           0.0.0.0:*               LISTEN      5944/java

Please help if anyone know what the problem is. Thanks :)

Saif Ali Khan
  • 818
  • 3
  • 9
  • 34
  • 1
    are you trying to connect from your virtual machine, or from a different machine? possibly your VM is not accepting outside connections. – Emilio Lahr-Vivaz Dec 11 '17 at 13:26
  • @EmilioLahr-Vivaz Yes, I am trying to connect from my virtual machine. how do I make sure it is not accepting outside connections? If not, How do I allow it to connect outside connection. – Saif Ali Khan Dec 11 '17 at 13:32
  • I believe zookeeper will bind to all interfaces by default, so if there is an issue it would likely be with your VM. Can you browse zookeeper using the included `zkCli.sh`? – Emilio Lahr-Vivaz Dec 11 '17 at 19:28
  • @EmilioLahr-Vivaz Ya. I am able to do it. `[zk: localhost:2181(CONNECTED) 0] ` – Saif Ali Khan Dec 12 '17 at 05:06
  • Suggest showing JPS output with `jps -ml`, and netstat output of `netstat -tlnp | grep java` – Christopher Dec 12 '17 at 09:56
  • @Christopher I've updated my question and included the output of `jps -ml` .and `netstat -tlnp | grep java` – Saif Ali Khan Dec 12 '17 at 11:53
  • From the client side of things, are you able to connect to: http://10.10.10.205:50070 ? If you get a similar error, the problem is your VM networking. If you can, it might be because your VM is only routing IPv4, and ZooKeeper is listening on IPv6. If the latter, you could try adding `-Djava.net.preferIPv4Stack=true` in your ZK's java.env. – Christopher Dec 14 '17 at 03:44
  • @Christopher As you said, I've updated the .bashrc file and added java_options. But still showing the above error.Also, I can't connect to 10.10.10.205:50070 from my client side. – Saif Ali Khan Dec 14 '17 at 05:50
  • @SaifAliKhan Sounds like the problem is most likely your VM's network configuration. Try getting a basic web server to run inside your VM on each of those ports, to verify you can access it from your web browser outside the VM, before you run the big data software stack inside the guest. Also check for any firewall running inside the guest that might be blocking ports. Try searching for network configuration guides for your VM software. – Christopher Dec 15 '17 at 06:33
  • @Christopher Now, I've tried creating connections.. I am able to communicate between both the machines. Tried nc command in both and is working. How do I check that I am able to connect to zookeeper or not? – Saif Ali Khan Dec 19 '17 at 05:09
  • I am getting this error `ClientService request failed null, retrying ... org.apache.thrift.transport.TTransportException: Failed to connect to a server` – Saif Ali Khan Dec 19 '17 at 13:26
  • @SaifAliKhan Given that error message, it doesn't sound like you've ruled out networking issues, and I don't know what nc commands you've tried, or what VM you're using, or very many other details regarding your environment. So, this might not be the best forum to help you on. StackOverflow works best when the questions are narrow and require specific expertise. Your problem seems to require broad expertise and detailed broad knowledge of your specific environment. – Christopher Dec 20 '17 at 22:41
  • @Christopher Hey christopher, I have identified the problem afterwards, it was the problem of accumullo configuration. Now, its running. thanks you so much for your help. – Saif Ali Khan Dec 21 '17 at 09:39
  • @SaifAliKhan Glad you got it working. Which Accumulo configuration was incorrect, and how did you fix it? Perhaps we can try to add a better message in the Accumulo logs to make the problem more easily identified by other users? – Christopher Dec 22 '17 at 15:53
  • Actually the problem was here. ` instance.zookeeper.host localhost:2181 comma separated list of zookeeper servers ` I was adding 0.0.0.0:2181 instead of localhost. ` fs.default.name hdfs://localhost:9000/ dfs.permissions false ` Also, in here, I have added 0.0.0.0:9000 instead of localhost. – Saif Ali Khan Dec 22 '17 at 16:59

0 Answers0