etcdctl insists on connecting to localhost for no apparent reason

Created on 19 Feb 2017  路  3Comments  路  Source: etcd-io/etcd

Here are the settings I have in etcd.conf:

ETCD_NAME=loader1
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
ETCD_LISTEN_PEER_URLS="http://10.11.51.166:2380"
ETCD_LISTEN_CLIENT_URLS="http://10.11.51.166:2379"
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://10.11.51.166:2380"
ETCD_INITIAL_CLUSTER="loader1=http://10.11.51.166:2380,loader2=http://10.11.51.174:2380,loader3=http://10.11.51.231:2380,loader4=http://10.11.51.243:2380"
ETCD_INITIAL_CLUSTER_STATE="new"
ETCD_ADVERTISE_CLIENT_URLS="http://10.11.51.166:2379"

when I run systemctl start etcd it starts w/o errors, however once I run etcdctl --debug cluster-health I get

Cluster-Endpoints: http://127.0.0.1:4001, http://127.0.0.1:2379
cURL Command: curl -X GET http://127.0.0.1:4001/v2/members
cURL Command: curl -X GET http://127.0.0.1:2379/v2/members
cluster may be unhealthy: failed to list members
Error:  client: etcd cluster is unavailable or misconfigured
error #0: dial tcp 127.0.0.1:4001: getsockopt: connection refused
error #1: dial tcp 127.0.0.1:2379: getsockopt: connection refused

How do I make it not talk to 127.0.0.1? Why does it think it needs to talk to localhost if in all configuration parameters it is told to run in a different network?

PS. I'm trying to set up etcd version 3.0.15 on CentOS 7.1.

Most helpful comment

@least-olegs etcd is configured but not etcdctl. Try setting the environment variable ETCDCTL_ENDPOINTS=http://10.11.51.166:2379 for etcdctl or adding an internal client listener on 127.0.0.1 via ETCD_LISTEN_CLIENT_URLS="http://10.11.51.166:2379,http://127.0.0.1:2379" for etcd so the etcdctl defaults work.

All 3 comments

@least-olegs etcd is configured but not etcdctl. Try setting the environment variable ETCDCTL_ENDPOINTS=http://10.11.51.166:2379 for etcdctl or adding an internal client listener on 127.0.0.1 via ETCD_LISTEN_CLIENT_URLS="http://10.11.51.166:2379,http://127.0.0.1:2379" for etcd so the etcdctl defaults work.

Please try @heyitsanthony's suggestion. I am sure if it will solve this issue. Closing.

Works for me too Thanks

Was this page helpful?
0 / 5 - 0 ratings