使用我非常简单的设置后,etcd2 在我的 CoreOS 上失败

使用我非常简单的设置后,etcd2 在我的 CoreOS 上失败

我想设置一个 3 节点集群来运行我自己的发现服务,我正在关注这个简单的指南用于静态发现。我知道我的 3 台机器的 IP 地址,以下是我尝试在第一台机器上启动 etcd2 时的情况:

etcd2 -name infra0 -initial-advertise-peer-urls http://10.0.0.1:2380 
-listen-peer-urls http://10.0.0.1:2380 
-listen-client-urls http://10.0.0.1:2379,http://127.0.0.1:2379 
-advertise-client-urls http://10.0.0.1:2379 
-initial-cluster-token etcd-cluster-1 
-initial-cluster infra0=http://10.0.0.1:2380,infra1=http://10.0.0.2:2380,infra2=http://10.0.0.3:2380 
-initial-cluster-state new

但它失败了,只是打印出一些奇怪的输出:

2015/10/20 15:16:50 etcdmain: etcd Version: 2.1.2
2015/10/20 15:16:50 etcdmain: Git SHA: ff8d1ec
2015/10/20 15:16:50 etcdmain: Go Version: go1.4.2
2015/10/20 15:16:50 etcdmain: Go OS/Arch: linux/amd64
2015/10/20 15:16:50 etcdmain: setting maximum number of CPUs to 1, total number of available CPUs is 1
2015/10/20 15:16:50 etcdmain: no data-dir provided, using default data-dir ./infra0.etcd
2015/10/20 15:16:50 etcdmain: the server is already initialized as member before, starting as etcd member...
2015/10/20 15:16:50 etcdmain: listening for peers on http://10.0.0.1:2380
2015/10/20 15:16:50 etcdmain: listening for client requests on http://10.0.0.1:2379
2015/10/20 15:16:50 etcdmain: listening for client requests on http://127.0.0.1:2379
2015/10/20 15:16:50 etcdserver: name = infra0
2015/10/20 15:16:50 etcdserver: data dir = infra0.etcd
2015/10/20 15:16:50 etcdserver: member dir = infra0.etcd/member
2015/10/20 15:16:50 etcdserver: heartbeat = 100ms
2015/10/20 15:16:50 etcdserver: election = 1000ms
2015/10/20 15:16:50 etcdserver: snapshot count = 10000
2015/10/20 15:16:50 etcdserver: advertise client URLs = http://10.0.0.1:2379
2015/10/20 15:16:50 etcdserver: restarting member 7ebe4414520dd95e in cluster 7ef0605c00fad3ab at commit index 3
2015/10/20 15:16:50 raft: 7ebe4414520dd95e became follower at term 128
2015/10/20 15:16:50 raft: newRaft 7ebe4414520dd95e [peers: [], term: 128, commit: 3, applied: 0, lastindex: 3, lastterm: 1]
2015/10/20 15:16:50 etcdserver: starting server... [version: 2.1.2, cluster version: to_be_decided]
2015/10/20 15:16:50 etcdserver: added local member 7ebe4414520dd95e [http://10.0.0.1:2380] to cluster 7ef0605c00fad3ab
2015/10/20 15:16:50 etcdserver: added member 8c9ced5da49597eb [http://10.0.0.2:2380] to cluster 7ef0605c00fad3ab
2015/10/20 15:16:50 etcdserver: added member 992dd2c84a457838 [http://10.0.0.3:2380] to cluster 7ef0605c00fad3ab
2015/10/20 15:16:51 rafthttp: failed to dial 8c9ced5da49597eb on stream MsgApp v2 (dial tcp 10.0.0.2:2380: i/o timeout)
2015/10/20 15:16:51 rafthttp: failed to dial 8c9ced5da49597eb on stream Message (dial tcp 10.0.0.3:2380: i/o timeout)
2015/10/20 15:16:51 rafthttp: failed to dial 992dd2c84a457838 on stream MsgApp v2 (dial tcp 10.0.0.1:2380: i/o timeout)
2015/10/20 15:16:51 rafthttp: failed to dial 992dd2c84a457838 on stream Message (dial tcp 10.0.0.1:2380: i/o timeout)
2015/10/20 15:16:52 raft: 7ebe4414520dd95e is starting a new election at term 128
2015/10/20 15:16:52 raft: 7ebe4414520dd95e became candidate at term 129
2015/10/20 15:16:52 raft: 7ebe4414520dd95e received vote from 7ebe4414520dd95e at term 129
2015/10/20 15:16:52 raft: 7ebe4414520dd95e [logterm: 1, index: 3] sent vote request to 992dd2c84a457838 at term 129
2015/10/20 15:16:52 raft: 7ebe4414520dd95e [logterm: 1, index: 3] sent vote request to 8c9ced5da49597eb at term 129
2015/10/20 15:16:53 rafthttp: failed to write 992dd2c84a457838 on pipeline (dial tcp 10.0.0.1:2380: i/o timeout)
2015/10/20 15:16:53 rafthttp: failed to write 8c9ced5da49597eb on pipeline (dial tcp 10.0.0.3:2380: i/o timeout)
2015/10/20 15:16:53 raft: 7ebe4414520dd95e is starting a new election at term 129
2015/10/20 15:16:53 raft: 7ebe4414520dd95e became candidate at term 130
2015/10/20 15:16:53 raft: 7ebe4414520dd95e received vote from 7ebe4414520dd95e at term 130
2015/10/20 15:16:53 raft: 7ebe4414520dd95e [logterm: 1, index: 3] sent vote request to 8c9ced5da49597eb at term 130
2015/10/20 15:16:53 raft: 7ebe4414520dd95e [logterm: 1, index: 3] sent vote request to 992dd2c84a457838 at term 130
2015/10/20 15:16:54 raft: 7ebe4414520dd95e is starting a new election at term 130
2015/10/20 15:16:54 raft: 7ebe4414520dd95e became candidate at term 131
2015/10/20 15:16:54 raft: 7ebe4414520dd95e received vote from 7ebe4414520dd95e at term 131
2015/10/20 15:16:54 raft: 7ebe4414520dd95e [logterm: 1, index: 3] sent vote request to 8c9ced5da49597eb at term 131
2015/10/20 15:16:54 raft: 7ebe4414520dd95e [logterm: 1, index: 3] sent vote request to 992dd2c84a457838 at term 131
^C2015/10/20 15:16:54 osutil: received interrupt signal, shutting down...
2015/10/20 15:16:54 rafthttp: failed to dial 992dd2c84a457838 on stream MsgApp v2 (net/http: request canceled while waiting for connection)
2015/10/20 15:16:54 rafthttp: failed to dial 992dd2c84a457838 on stream Message (net/http: request canceled while waiting for connection)
2015/10/20 15:16:54 rafthttp: failed to dial 8c9ced5da49597eb on stream MsgApp v2 (net/http: request canceled while waiting for connection)
2015/10/20 15:16:54 rafthttp: failed to dial 8c9ced5da49597eb on stream Message (net/http: request canceled while waiting for connection)

这到底意味着什么?

答案1

该行the server is already initialized as member before, starting as etcd member...表示您之前已将此机器作为 etcd 集群的成员。它使用此状态联系先前集群的成员,尝试加入集群。

您可以删除/var/lib/etcd2/*以清除此旧集群的所有痕迹。然后重新启动 etcd2。

相关内容