Running fresh 2.0.0. On centos7 with selinux disabled and firewalling disabled. (yuck)
Within Vagrant, I have 4 servers: master1, master2, master3 and client1. masters1-3 are running etcd and seem to be communicating just fine. Started with the following command:
./etcd -name master1 -initial-advertise-peer-urls
http://10.0.3.21:2380 \
-listen-peer-urls
http://10.0.3.21:2380 \
-initial-cluster-token etcd-vagrant-1 \
-initial-cluster master1=
http://10.0.3.21:2380,master2=
http://10.0.3.22:2380,master3=
http://10.0.3.23:2380 \
-initial-cluster-state new -listen-client-urls
http://10.0.3.21:4001The other masters increment the master numbers and their local IP addresses.
On client1 however, when I try to run etcdctl commands, I'm stuck. Here are several examples:
1) Set single peer on CLI:
$ ./etcdctl --peers
http://10.0.3.21:4001 --debug set foo 42
Cluster-Endpoints:
http://localhost:2379,
http://localhost:2379,
http://localhost:2379,
http://localhost:4001,
http://localhost:4001,
http://localhost:4001Curl-Example: curl -X PUT
http://localhost:2379/v2/keys/foo -d value=42
Curl-Example: curl -X PUT
http://localhost:2379/v2/keys/foo -d value=42
Curl-Example: curl -X PUT
http://localhost:2379/v2/keys/foo -d value=42
Curl-Example: curl -X PUT
http://localhost:2379/v2/keys/foo -d value=42
Curl-Example: curl -X PUT
http://localhost:4001/v2/keys/foo -d value=42
Curl-Example: curl -X PUT
http://localhost:4001/v2/keys/foo -d value=42
Curl-Example: curl -X PUT
http://localhost:4001/v2/keys/foo -d value=42
Curl-Example: curl -X PUT
http://localhost:2379/v2/keys/foo -d value=42
Curl-Example: curl -X PUT
http://localhost:2379/v2/keys/foo -d value=42
Curl-Example: curl -X PUT
http://localhost:2379/v2/keys/foo -d value=42
Curl-Example: curl -X PUT
http://localhost:4001/v2/keys/foo -d value=42
Error: 501: All the given peers are not reachable (Tried to connect to each peer twice and failed) [0]
2) Set multiple peers on the CLI:
$ ./etcdctl --peers
http://10.0.3.21:4001,
http://10.0.3.22:4001,
http://10.0.3.23:4001 --debug set foo 42
Cluster-Endpoints:
http://localhost:2379,
http://localhost:2379,
http://localhost:2379,
http://localhost:4001,
http://localhost:4001,
http://localhost:4001Curl-Example: curl -X PUT
http://localhost:2379/v2/keys/foo -d value=42
Curl-Example: curl -X PUT
http://localhost:2379/v2/keys/foo -d value=42
Curl-Example: curl -X PUT
http://localhost:2379/v2/keys/foo -d value=42
Curl-Example: curl -X PUT
http://localhost:2379/v2/keys/foo -d value=42
Curl-Example: curl -X PUT
http://localhost:4001/v2/keys/foo -d value=42
Curl-Example: curl -X PUT
http://localhost:4001/v2/keys/foo -d value=42
Curl-Example: curl -X PUT
http://localhost:4001/v2/keys/foo -d value=42
Curl-Example: curl -X PUT
http://localhost:2379/v2/keys/foo -d value=42
Curl-Example: curl -X PUT
http://localhost:2379/v2/keys/foo -d value=42
Curl-Example: curl -X PUT
http://localhost:2379/v2/keys/foo -d value=42
Curl-Example: curl -X PUT
http://localhost:4001/v2/keys/foo -d value=42
Error: 501: All the given peers are not reachable (Tried to connect to each peer twice and failed) [0]
3) use env var to set peers:
$ ETCDCTL_PEERS="
http://10.0.3.21:4001,
http://10.0.3.22:4001,
http://10.0.3.23:4001"
$ export ETCDCTL_PEERS
$ ./etcdctl --debug set foo 42Cluster-Endpoints:
http://localhost:2379,
http://localhost:2379,
http://localhost:2379,
http://localhost:4001,
http://localhost:4001,
http://localhost:4001Curl-Example: curl -X PUT
http://localhost:2379/v2/keys/foo -d value=42
Curl-Example: curl -X PUT
http://localhost:2379/v2/keys/foo -d value=42
Curl-Example: curl -X PUT
http://localhost:2379/v2/keys/foo -d value=42
Curl-Example: curl -X PUT
http://localhost:2379/v2/keys/foo -d value=42
Curl-Example: curl -X PUT
http://localhost:4001/v2/keys/foo -d value=42
Curl-Example: curl -X PUT
http://localhost:4001/v2/keys/foo -d value=42
Curl-Example: curl -X PUT
http://localhost:4001/v2/keys/foo -d value=42
Curl-Example: curl -X PUT
http://localhost:2379/v2/keys/foo -d value=42
Curl-Example: curl -X PUT
http://localhost:2379/v2/keys/foo -d value=42
Curl-Example: curl -X PUT
http://localhost:2379/v2/keys/foo -d value=42
Curl-Example: curl -X PUT
http://localhost:4001/v2/keys/foo -d value=42
Error: 501: All the given peers are not reachable (Tried to connect to each peer twice and failed) [0]
4) Remove http from --peers command:
$ ./etcdctl --peers
10.0.3.21:4001,
10.0.3.22:4001,
10.0.3.23:4001 --debug set foo 42
Cluster-Endpoints:
http://localhost:2379,
http://localhost:2379,
http://localhost:2379,
http://localhost:4001,
http://localhost:4001,
http://localhost:4001Curl-Example: curl -X PUT
http://localhost:2379/v2/keys/foo -d value=42
Curl-Example: curl -X PUT
http://localhost:2379/v2/keys/foo -d value=42
Curl-Example: curl -X PUT
http://localhost:2379/v2/keys/foo -d value=42
Curl-Example: curl -X PUT
http://localhost:2379/v2/keys/foo -d value=42
Curl-Example: curl -X PUT
http://localhost:4001/v2/keys/foo -d value=42
Curl-Example: curl -X PUT
http://localhost:4001/v2/keys/foo -d value=42
Curl-Example: curl -X PUT
http://localhost:4001/v2/keys/foo -d value=42
Curl-Example: curl -X PUT
http://localhost:2379/v2/keys/foo -d value=42
Curl-Example: curl -X PUT
http://localhost:2379/v2/keys/foo -d value=42
Curl-Example: curl -X PUT
http://localhost:2379/v2/keys/foo -d value=42
Curl-Example: curl -X PUT
http://localhost:4001/v2/keys/foo -d value=42
Error: 501: All the given peers are not reachable (Tried to connect to each peer twice and failed) [0]
5) Override localhost to be actually a remote host in /etc/hosts (TERRIBLE HACK! DO NOT USE)
$ ./etcdctl --debug set foo 42
Cluster-Endpoints:
http://localhost:2379,
http://localhost:2379,
http://localhost:2379,
http://localhost:4001,
http://localhost:4001,
http://localhost:4001Curl-Example: curl -X PUT
http://localhost:2379/v2/keys/foo -d value=42
Curl-Example: curl -X PUT
http://localhost:2379/v2/keys/foo -d value=42
Curl-Example: curl -X PUT
http://localhost:2379/v2/keys/foo -d value=42
Curl-Example: curl -X PUT
http://localhost:2379/v2/keys/foo -d value=42
Curl-Example: curl -X PUT
http://localhost:4001/v2/keys/foo -d value=42
42
What the heck am I doing wrong?