How to start ZooKeeper Command Line Interface?

0

I want to implement an hbase database and I have seen that I need ZooKeeper. I followed tutorialspoint.com tutorial but when I try to start ZooKeeper Command Line Interface (CLI) I got the following error:

mike@mike-thinks:~/zookeeper-3.4.10$ ./bin/zkCli.sh
Connecting to localhost:2181
2017-12-04 12:57:29,539 [myid:] - INFO  [main:Environment@100] - Client environment:zookeeper.version=3.4.10-39d3a4f269333c922ed3db283be479f9deacaa0f, built on 03/23/2017 10:13 GMT
2017-12-04 12:57:29,543 [myid:] - INFO  [main:Environment@100] - Client environment:host.name=mike-thinks
2017-12-04 12:57:29,543 [myid:] - INFO  [main:Environment@100] - Client environment:java.version=1.8.0_151
2017-12-04 12:57:29,545 [myid:] - INFO  [main:Environment@100] - Client environment:java.vendor=Oracle Corporation
2017-12-04 12:57:29,546 [myid:] - INFO  [main:Environment@100] - Client environment:java.home=/usr/lib/jvm/java-8-oracle/jre
2017-12-04 12:57:29,546 [myid:] - INFO  [main:Environment@100] - Client environment:java.class.path=/home/mike/zookeeper-3.4.10/bin/../build/classes:/home/mike/zookeeper-3.4.10/bin/../build/lib/*.jar:/home/mike/zookeeper-3.4.10/bin/../lib/slf4j-log4j12-1.6.1.jar:/home/mike/zookeeper-3.4.10/bin/../lib/slf4j-api-1.6.1.jar:/home/mike/zookeeper-3.4.10/bin/../lib/netty-3.10.5.Final.jar:/home/mike/zookeeper-3.4.10/bin/../lib/log4j-1.2.16.jar:/home/mike/zookeeper-3.4.10/bin/../lib/jline-0.9.94.jar:/home/mike/zookeeper-3.4.10/bin/../zookeeper-3.4.10.jar:/home/mike/zookeeper-3.4.10/bin/../src/java/lib/*.jar:/home/mike/zookeeper-3.4.10/bin/../conf:
2017-12-04 12:57:29,547 [myid:] - INFO  [main:Environment@100] - Client environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
2017-12-04 12:57:29,547 [myid:] - INFO  [main:Environment@100] - Client environment:java.io.tmpdir=/tmp
2017-12-04 12:57:29,547 [myid:] - INFO  [main:Environment@100] - Client environment:java.compiler=<NA>
2017-12-04 12:57:29,547 [myid:] - INFO  [main:Environment@100] - Client environment:os.name=Linux
2017-12-04 12:57:29,547 [myid:] - INFO  [main:Environment@100] - Client environment:os.arch=amd64
2017-12-04 12:57:29,547 [myid:] - INFO  [main:Environment@100] - Client environment:os.version=4.10.0-40-generic
2017-12-04 12:57:29,547 [myid:] - INFO  [main:Environment@100] - Client environment:user.name=mike
2017-12-04 12:57:29,548 [myid:] - INFO  [main:Environment@100] - Client environment:user.home=/home/mike
2017-12-04 12:57:29,548 [myid:] - INFO  [main:Environment@100] - Client environment:user.dir=/home/mike/zookeeper-3.4.10
2017-12-04 12:57:29,549 [myid:] - INFO  [main:ZooKeeper@438] - Initiating client connection, connectString=localhost:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@1a86f2f1
Welcome to ZooKeeper!
2017-12-04 12:57:29,574 [myid:] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1032] - Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
JLine support is enabled
2017-12-04 12:57:29,652 [myid:] - WARN  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1162] - Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: Connection refused
    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)
    at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1141)
[zk: localhost:2181(CONNECTING) 0] 2017-12-04 12:57:30,758 [myid:] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1032] - Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
2017-12-04 12:57:30,759 [myid:] - WARN  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1162] - Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
    
asked by ThePassenger 04.12.2017 в 13:09
source

1 answer

1

First confirm that you have ZooKeeper running, you can do this by launching the ruok command with netcat:

echo ruok|nc localhost 2181

If this does not answer, try stopping the firewall and discarding this external cause of error.

Additionally, try to check the configuration file zoo.cfg that you should find in the path $ZOOKEEPER_HOME/conf , it is possible that we have written wrong the ip to which we link or some similar data.

    
answered by 09.03.2018 в 12:33