telnet: Unable to connect to remote host: Connection refused

50,420

Solution 1

Verify zookeeper is actually running, via

ps aux | grep -i zookeeper

If it is, then it may not be bound to 127.0.0.1 or 0.0.0.0. So check which IP address it's actually bound to,

netstat -tlpn

Then try to telnet to it using that address.

Solution 2

check your ubuntu system log with this command

sudo gedit /var/log/syslog

and if you will see this error "execv( /usr/sbin/tcpd ) failed: No such file or directory" then run this command

sudo apt-get install tcpd

it will solve your problem (if not then you need to search your system error on google)

Share:
50,420

Related videos on Youtube

Avinash
Author by

Avinash

I’m passionate about applying my knowledge of computer science and machine learning to areas in machine learning and deep learning where we can really engineer better solutions for helping people to have a better life. I believe, machine learning and computer science really have the power to make the computers understand real-life problems and produce great solutions for humanity which has never been seen. If you are working in some innovative Data Science field, feel free to reach out to me.

Updated on September 18, 2022

Comments

  • Avinash
    Avinash over 1 year

    I am inside docker and I have installed zookeeper and trying to test it using telnet But it is not working

    $ telnet localhost 2181
    Trying ::1...
    Trying 127.0.0.1...
    telnet: Unable to connect to remote host: Connection refused
    

    I tried these also

    telnet 127.0.0.1 2181
    telnet 172.17.0.2 2181
    

    But same error.

    netstat status

    # netstat -tlpn
    Active Internet connections (only servers)
    Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
    

    Please help.

  • Avinash
    Avinash about 7 years
    Just now I found even telnet locahost is not working. Has same error.
  • TLin
    TLin about 7 years
    Simply using telnet localhost would attempt to connect to a local server process listening port 23. Most servers/containers I know don't enable telnet servers by default since it's insecure.
  • Avinash
    Avinash about 7 years
    Any idea how to fix it.
  • TLin
    TLin about 7 years
    Can you update your post with the output of netstat -tlpn
  • Avinash
    Avinash about 7 years
    I have updated.
  • TLin
    TLin about 7 years
    It's clear from your netstat output that there's no server process listening. Are you sure zookeeper is running? I suggest trying out this guide if you haven't already: zookeeper.apache.org/doc/r3.3.3/zookeeperStarted.html
  • thewebjackal
    thewebjackal about 7 years
    Did you check your firewall?