tcpconsulgetsockopt

Dial tcp 127.0.0.1:8500: getsockopt: connection refused in consul


I am getting this error when I am running any "consul members" on consul server and clients. The port is in LISTENING state and I made sure there is no firewall blocking. I get this error when in run the same in the consul client:

Error retrieving members: Get http://127.0.0.1:8500/v1/agent/members:
dial tcp 127.0.0.1:8500: connectex: No connection could be made because the target machine actively refused it.

When I make the above request with the private IP, I get the required output. Can I change the configuration anywhere so that it listens on the private IP for requests?


Solution

  • It seems that your consul members lacks the option -http-addr=....

    Example

    consul members -http-addr=10.10.10.10:8500

    while assuming you use the standard port 8500 of the consul agent and that you started consul via:

    consul agent -client=10.10.10.10 #...

    Where to find the documentation?