Failed to connect to zookeeper within 2x zookeeper

2019-08-17 12:40发布

问题:

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 :)