etcd 集群管理
https://segmentfault.com/a/1190000003852735 etcd集群3
https://segmentfault.com/a/1190000003976539 etcd集群4
就当记事本了
etcd 干掉损坏节点
root@a02:/opt/etcd# ./etcdctl member list
6b37185aa393dfc1: name=etcd01 peerURLs=http://etcd01:2380 clientURLs=http://etcd01:2379 isLeader=false
9f47628f4e1f4eba: name=etcd02 peerURLs=http://etcd02:2380 clientURLs=http://etcd02:2379 isLeader=false
a66781ca848d9396: name=etcd03 peerURLs=http://etcd03:2380 clientURLs=http://etcd03:2379 isLeader=true
删掉损坏的etcd02节点
./etcdctl member remove 9f47628f4e1f4eba
新增节点
etcdctl member add etcd02 http://etcd02:2380
在etcd02的机器中启动
#!/bin/bash
nohup etcd -name etcd02 -initial-advertise-peer-urls http://etcd02:2380 \
-listen-peer-urls http://0.0.0.0:2380 \
-listen-client-urls http://0.0.0.0:2379 \
-advertise-client-urls http://etcd02:2379 \
-initial-cluster-token etcd-cluster-1 \
-initial-cluster etcd01=http://etcd01:2380,etcd02=http://etcd02:2380,etcd03=http://etcd03:2380 \
-initial-cluster-state new -data-dir /opt/etcd/etc > /var/log/etcd.log 2>&1 &
root@a02:/opt/etcd# ./etcdctl member list
6b37185aa393dfc1: name=etcd01 peerURLs=http://etcd01:2380 clientURLs=http://etcd01:2379 isLeader=false
9f47628f4e1f4eba: name=etcd02 peerURLs=http://etcd02:2380 clientURLs=http://etcd02:2379 isLeader=false
a66781ca848d9396: name=etcd03 peerURLs=http://etcd03:2380 clientURLs=http://etcd03:2379 isLeader=true
删掉损坏的etcd02节点
./etcdctl member remove 9f47628f4e1f4eba
新增节点
etcdctl member add etcd02 http://etcd02:2380
在etcd02的机器中启动
#!/bin/bash
nohup etcd -name etcd02 -initial-advertise-peer-urls http://etcd02:2380 \
-listen-peer-urls http://0.0.0.0:2380 \
-listen-client-urls http://0.0.0.0:2379 \
-advertise-client-urls http://etcd02:2379 \
-initial-cluster-token etcd-cluster-1 \
-initial-cluster etcd01=http://etcd01:2380,etcd02=http://etcd02:2380,etcd03=http://etcd03:2380 \
-initial-cluster-state new -data-dir /opt/etcd/etc > /var/log/etcd.log 2>&1 &
本文出自 小Q,转载时请注明出处及相应链接。
本文永久链接: http://www.linuxqq.com/archives/1682.html