Renato Bueno
Renato Bueno

Reputation: 31

Zookeeper client not connecting

I'm trying to connect with the client to Apache Zookeeper 3.8 using WSL (windows sub system) and

when I run bin/ZkCli.sh I got Connection refused

Here is the output:

Welcome to ZooKeeper!

2022-08-21 09:42:24,372 [myid:localhost:2181] - INFO [main-SendThread(localhost:2181):o.a.z.ClientCnxn$SendThread@1171] - Opening socket connection to server localhost/127.0.0.1:2181.

2022-08-21 09:42:24,373 [myid:localhost:2181] - INFO [main-SendThread(localhost:2181):o.a.z.ClientCnxn$SendThread@1173] - SASL config status: Will not attempt to authenticate using SASL (unknown error)

2022-08-21 09:42:24,408 [myid:localhost:2181] - WARN [main-SendThread(localhost:2181):o.a.z.ClientCnxn$SendThread@1292] - Session 0x0 for server localhost/127.0.0.1:2181, Closing socket connection. Attempting reconnect except it is a SessionExpiredException.

java.net.ConnectException: Connection refused

    at java.base/sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
    at java.base/sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:777)
    at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:344)
    at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1282)

JLine support is enabled

[zk: localhost:2181(CONNECTING) 0] 2022-08-21 09:42:25,512 [myid:localhost:2181] - INFO [main-SendThread(localhost:2181):o.a.z.ClientCnxn$SendThread@1171] - Opening socket connection to server localhost/127.0.0.1:2181.

2022-08-21 09:42:25,512 [myid:localhost:2181] - INFO [main-SendThread(localhost:2181):o.a.z.ClientCnxn$SendThread@1173] - SASL config status: Will not attempt to authenticate using SASL (unknown error)

2022-08-21 09:42:25,515 [myid:localhost:2181] - WARN [main-SendThread(localhost:2181):o.a.z.ClientCnxn$SendThread@1292] - Session 0x0 for server localhost/127.0.0.1:2181, Closing socket connection. Attempting reconnect except it is a SessionExpiredException.

java.net.ConnectException: Connection refused at java.base/sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) at java.base/sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:777) at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:344) at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1282)

Can anyone suggest something?

Upvotes: 0

Views: 3028

Answers (1)

Renato Bueno
Renato Bueno

Reputation: 31

I resolved. I realized that I did not configure my conf/zoo_sample.cfg

I renamed the zoo_sample.cfg to zoo.cfg

Then I changed the dataDir to

dataDir=/mnt/c/testes/apache-zookeeper-3.8.0-bin/logs

then I ran server again using sudo bin/zkServer.sh start

And sudo bin/zkCli.sh

It worked!

Upvotes: 0

Related Questions