etcd集群中的某个节点,重新安装系统的时候,磁盘被重新格式化,/var/lib/etcd2/下面与etcd相关的数据就没有了。在etcd起来的时候,找不到原来的集群。
尝试下面的操作:
在正常的etcd节点上执行 etcdctl member remove
将新的etcd节点加入到原来的集群: etcdctl member add
在重装的节点上添加配置文件:
ETCD_NAME="0c-c4-7a-82-c5-bc"
ETCD_INITIAL_CLUSTER="0c-c4-7a-82-c5-b8=http://0c-c4-7a-82-c5-b8:2380,00-25-90-c0-f7-80=http://00-25-90-c0-f7-80:2380,00-25-90-c0-f6-d6=http://00-25-90-c0-f6-d6:2380,0c-c4-7a-82-c5-bc=http://0c-c4-7a-82-c5-bc:2380,00-25-90-c0-f6-ee=http://00-25-90-c0-f6-ee:2380"
ETCD_INITIAL_CLUSTER_STATE="existing"
重启新的etcd
还是没有办法加入etcd集群
-- Logs begin at Wed 2016-10-19 13:22:02 CST. --
Oct 19 14:44:48 0c-c4-7a-82-c5-bc etcd2[14659]: starting member 9405402865f53913 in cluster a8736e434a73d0be
Oct 19 14:44:48 0c-c4-7a-82-c5-bc etcd2[14659]: 9405402865f53913 became follower at term 0
Oct 19 14:44:48 0c-c4-7a-82-c5-bc etcd2[14659]: newRaft 9405402865f53913 [peers: [], term: 0, commit: 0, applied: 0, lastindex: 0, lastterm: 0]
Oct 19 14:44:48 0c-c4-7a-82-c5-bc etcd2[14659]: 9405402865f53913 became follower at term 1
Oct 19 14:44:48 0c-c4-7a-82-c5-bc etcd2[14659]: starting server... [version: 2.3.2, cluster version: to_be_decided]
Oct 19 14:44:48 0c-c4-7a-82-c5-bc etcd2[14659]: the member has been permanently removed from the cluster
Oct 19 14:44:48 0c-c4-7a-82-c5-bc etcd2[14659]: the data-dir used by this member must be removed.
Oct 19 14:44:48 0c-c4-7a-82-c5-bc systemd[1]: Started etcd2.
Oct 19 14:44:48 0c-c4-7a-82-c5-bc polkitd[9036]: Unregistered Authentication Agent for unix-process:14654:497650 (system bus name :1.108, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
Oct 19 14:44:48 0c-c4-7a-82-c5-bc sudo[14653]: pam_unix(sudo:session): session closed for user root
Oct 19 14:44:58 0c-c4-7a-82-c5-bc systemd[1]: etcd2.service: Service hold-off time over, scheduling restart.
Oct 19 14:44:58 0c-c4-7a-82-c5-bc systemd[1]: Stopped etcd2.
Oct 19 14:44:58 0c-c4-7a-82-c5-bc systemd[1]: Starting etcd2...
Oct 19 14:44:58 0c-c4-7a-82-c5-bc etcd2[14708]: recognized and used environment variable ETCD_ADVERTISE_CLIENT_URLS=http://0c-c4-7a-82-c5-bc:2379
Oct 19 14:44:58 0c-c4-7a-82-c5-bc etcd2[14708]: recognized and used environment variable ETCD_DATA_DIR=/var/lib/etcd2
Oct 19 14:44:58 0c-c4-7a-82-c5-bc etcd2[14708]: recognized and used environment variable ETCD_INITIAL_ADVERTISE_PEER_URLS=http://0c-c4-7a-82-c5-bc:2380
Oct 19 14:44:58 0c-c4-7a-82-c5-bc etcd2[14708]: recognized and used environment variable ETCD_INITIAL_CLUSTER=00-25-90-c0-f7-80=http://00-25-90-c0-f7-80:2380,00-25-90-c0-f6-ee=http://00-25-90-c0-f6-ee:2380,00-25-90-c0-f6-d6=http://00-25-90-c0-f6-d6:2380,0c-c4-7a-82-c5-bc=http://0c-c4-7a-82-c5-bc:2380,0c-c4-7a-82-c5-b8=http://0c-c4-7a-82-c5-b8:2380
Oct 19 14:44:58 0c-c4-7a-82-c5-bc etcd2[14708]: recognized and used environment variable ETCD_INITIAL_CLUSTER_STATE=new
Oct 19 14:44:58 0c-c4-7a-82-c5-bc etcd2[14708]: recognized and used environment variable ETCD_INITIAL_CLUSTER_TOKEN=etcd-cluster-1
Oct 19 14:44:58 0c-c4-7a-82-c5-bc etcd2[14708]: recognized and used environment variable ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379,http://0.0.0.0:4001
Oct 19 14:44:58 0c-c4-7a-82-c5-bc etcd2[14708]: recognized and used environment variable ETCD_LISTEN_PEER_URLS=http://0c-c4-7a-82-c5-bc:2380,http://0c-c4-7a-82-c5-bc:7001
Oct 19 14:44:58 0c-c4-7a-82-c5-bc etcd2[14708]: recognized and used environment variable ETCD_NAME=0c-c4-7a-82-c5-bc
Oct 19 14:44:58 0c-c4-7a-82-c5-bc etcd2[14708]: etcd Version: 2.3.2
Oct 19 14:44:58 0c-c4-7a-82-c5-bc etcd2[14708]: Git SHA: ce63f10
Oct 19 14:44:58 0c-c4-7a-82-c5-bc etcd2[14708]: Go Version: go1.5.4
Oct 19 14:44:58 0c-c4-7a-82-c5-bc etcd2[14708]: Go OS/Arch: linux/amd64
Oct 19 14:44:58 0c-c4-7a-82-c5-bc etcd2[14708]: setting maximum number of CPUs to 48, total number of available CPUs is 48
Oct 19 14:44:58 0c-c4-7a-82-c5-bc etcd2[14708]: the server is already initialized as member before, starting as etcd member...
Oct 19 14:44:58 0c-c4-7a-82-c5-bc etcd2[14708]: listening for peers on http://0c-c4-7a-82-c5-bc:2380
Oct 19 14:44:58 0c-c4-7a-82-c5-bc etcd2[14708]: listening for peers on http://0c-c4-7a-82-c5-bc:7001
Oct 19 14:44:58 0c-c4-7a-82-c5-bc etcd2[14708]: listening for client requests on http://0.0.0.0:2379
Oct 19 14:44:58 0c-c4-7a-82-c5-bc etcd2[14708]: listening for client requests on http://0.0.0.0:4001
Oct 19 14:44:58 0c-c4-7a-82-c5-bc etcd2[14708]: name = 0c-c4-7a-82-c5-bc
Oct 19 14:44:58 0c-c4-7a-82-c5-bc etcd2[14708]: data dir = /var/lib/etcd2
Oct 19 14:44:58 0c-c4-7a-82-c5-bc etcd2[14708]: member dir = /var/lib/etcd2/member
Oct 19 14:44:58 0c-c4-7a-82-c5-bc etcd2[14708]: heartbeat = 100ms
Oct 19 14:44:58 0c-c4-7a-82-c5-bc etcd2[14708]: election = 1000ms
Oct 19 14:44:58 0c-c4-7a-82-c5-bc etcd2[14708]: snapshot count = 10000
Oct 19 14:44:58 0c-c4-7a-82-c5-bc etcd2[14708]: advertise client URLs = http://0c-c4-7a-82-c5-bc:2379
Oct 19 14:44:58 0c-c4-7a-82-c5-bc etcd2[14708]: restarting member 9405402865f53913 in cluster a8736e434a73d0be at commit index 0
Oct 19 14:44:58 0c-c4-7a-82-c5-bc etcd2[14708]: 9405402865f53913 became follower at term 0
Oct 19 14:44:58 0c-c4-7a-82-c5-bc etcd2[14708]: newRaft 9405402865f53913 [peers: [], term: 0, commit: 0, applied: 0, lastindex: 0, lastterm: 0]
Oct 19 14:44:58 0c-c4-7a-82-c5-bc etcd2[14708]: starting server... [version: 2.3.2, cluster version: to_be_decided]
Oct 19 14:44:58 0c-c4-7a-82-c5-bc systemd[1]: Started etcd2.
Oct 19 14:45:05 0c-c4-7a-82-c5-bc etcd2[14708]: publish error: etcdserver: request timed out
Oct 19 14:45:12 0c-c4-7a-82-c5-bc etcd2[14708]: publish error: etcdserver: request timed out
Oct 19 14:45:13 0c-c4-7a-82-c5-bc etcd2[14708]: got unexpected response error (etcdserver: request timed out)
Oct 19 14:45:15 0c-c4-7a-82-c5-bc etcd2[14708]: got unexpected response error (etcdserver: request timed out) [merged 1 repeated lines in 1.88s]
Oct 19 14:45:19 0c-c4-7a-82-c5-bc etcd2[14708]: publish error: etcdserver: request timed out
Oct 19 14:45:26 0c-c4-7a-82-c5-bc etcd2[14708]: publish error: etcdserver: request timed out
Oct 19 14:45:33 0c-c4-7a-82-c5-bc etcd2[14708]: publish error: etcdserver: request timed out
Oct 19 14:45:40 0c-c4-7a-82-c5-bc etcd2[14708]: publish error: etcdserver: request timed out
Oct 19 14:45:47 0c-c4-7a-82-c5-bc etcd2[14708]: publish error: etcdserver: request timed out
Oct 19 14:45:54 0c-c4-7a-82-c5-bc etcd2[14708]: publish error: etcdserver: request timed out
日志里面的etcd ID : 9405402865f53913 还是没有重装之前的ID(我重装了几次,都是这个ID)我暂时不知道这个ID是从哪里来的。