Error connecting to Consul agent: dial tcp 127.0.0.1:8400: connection refused

5,667 views
Skip to first unread message

Scott Pearson

unread,
Jun 19, 2015, 5:26:51 PM6/19/15
to consu...@googlegroups.com
Hi,

I have attempts to build a Consul server cluster using several different methods in both a public and private AWS subnet, however no matter what I try I can not get the other servers I configure to join the bootstrapped original server.


The initial server is up and running:

ubuntu@ip-10-129-0-96:~$ consul members
ip-10-129-0-96  10.129.0.96:8301  alive  role=consul,dc=dc1,vsn=1,vsn_min=1,vsn_max=1,port=8300,bootstrap=1
ubuntu@ip-10-129-0-96:~$

However, when I attempt to join the cluster I get the following error:

Error connecting to Consul agent: dial tcp 127.0.0.1:8400: connection refused
ubuntu@ip-10-129-0-21:~$

Any suggestions would be greatly appreciated.

Thank you,
Scott

Darron Froese

unread,
Jun 19, 2015, 5:33:46 PM6/19/15
to Scott Pearson, consu...@googlegroups.com
Scott,

That error indicates that the Consul agent isn't running on ip-10-129-0-21 OR that your consul agent isn't listening on 127.0.0.1.

You may be able to target the agent by using this flag:

-client=ip.address.goes.here

But you'll need to know what IP address it's listening on.

As far as the other agents not connecting to the Consul server - you need to make sure a number of ports are open - at a minimum:

8300 TCP and UDP
8301 TCP and UDP

Ports on BOTH machines need to be open - all Consul nodes need to be able to talk to each other.

That help?

--
You received this message because you are subscribed to the Google Groups "Consul" group.
To unsubscribe from this group and stop receiving emails from it, send an email to consul-tool...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Bright Zheng

unread,
Aug 17, 2016, 5:52:24 AM8/17/16
to Consul
I got this error also.
My finding was: once the agent enables the parameter of -client, we can issue commands like "consul members" or "consul join" in other agents where "-client" was not used.

For example:
Host 1: 192.168.56.119
$ consul agent -server -bootstrap-expect 1 -data-dir /tmp/consul -node=node1 -bind=192.168.56.119 -config-dir /etc/consul.d -ui -client=192.168.56.119

Host 2: 192.168.56.118
$ consul agent -data-dir /tmp/consul -node=node2 -bind=192.168.56.118 -config-dir /etc/consul.d

Now you can issue "consul members" in Host 2 and will get the error like yours when you're trying in Host 1.
Have a try or you may share with me your startup commands for further discussions.

Bright
Reply all
Reply to author
Forward
0 new messages