其他分享
首页 > 其他分享> > etcd集群移除节点

etcd集群移除节点

作者:互联网

查看当前集群信息

# etcdctl member list --write-out=table
+------------------+---------+--------------------+--------------------------------+-----------------------------------------------------+------------+
|        ID        | STATUS  |        NAME        |           PEER ADDRS           |                    CLIENT ADDRS                     | IS LEARNER |
+------------------+---------+--------------------+--------------------------------+-----------------------------------------------------+------------+
| 44d8bc3300880bcd | started | sht-sgmhadoopdn-01 | http://sht-sgmhadoopdn-01:2380 | http://10.0.0.1:2379,http://sht-sgmhadoopdn-01:2379 |      false |
| 7796493c3943f891 | started | sht-sgmhadoopdn-04 | http://sht-sgmhadoopdn-04:2380 | http://10.0.0.1:2379,http://sht-sgmhadoopdn-01:2379 |      false |
| d446fbe3296eb85a | started | sht-sgmhadoopdn-03 | http://sht-sgmhadoopdn-03:2380 | http://10.0.0.1:2379,http://sht-sgmhadoopdn-02:2379 |      false |
| e9136c1ad1754783 | started | sht-sgmhadoopdn-02 | http://sht-sgmhadoopdn-02:2380 | http://10.0.0.1:2379,http://sht-sgmhadoopdn-02:2379 |      false |
+------------------+---------+--------------------+--------------------------------+-----------------------------------------------------+------------+

# etcdctl endpoint status --endpoints=http://sht-sgmhadoopdn-01:2379,http://sht-sgmhadoopdn-02:2379,http://sht-sgmhadoopdn-03:2379,http://sht-sgmhadoopdn-04:2379 --write-out=table
+--------------------------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+
|            ENDPOINT            |        ID        | VERSION | DB SIZE | IS LEADER | IS LEARNER | RAFT TERM | RAFT INDEX | RAFT APPLIED INDEX | ERRORS |
+--------------------------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+
| http://sht-sgmhadoopdn-01:2379 | 44d8bc3300880bcd |   3.4.1 |   16 kB |     false |      false |        17 |         38 |                 38 |        |
| http://sht-sgmhadoopdn-02:2379 | e9136c1ad1754783 |   3.4.1 |   16 kB |     false |      false |        17 |         38 |                 38 |        |
| http://sht-sgmhadoopdn-03:2379 | d446fbe3296eb85a |   3.4.1 |   16 kB |     false |      false |        17 |         38 |                 38 |        |
| http://sht-sgmhadoopdn-04:2379 | 7796493c3943f891 |   3.4.1 |   20 kB |      true |      false |        17 |         38 |                 38 |        |
+--------------------------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+

# etcdctl endpoint health --endpoints=http://sht-sgmhadoopdn-01:2379,http://sht-sgmhadoopdn-02:2379,http://sht-sgmhadoopdn-03:2379,http://sht-sgmhadoopdn-04:2379 --write-out=table
+--------------------------------+--------+------------+-------+
|            ENDPOINT            | HEALTH |    TOOK    | ERROR |
+--------------------------------+--------+------------+-------+
| http://sht-sgmhadoopdn-04:2379 |   true | 5.329583ms |       |
| http://sht-sgmhadoopdn-02:2379 |   true | 5.943424ms |       |
| http://sht-sgmhadoopdn-03:2379 |   true | 4.715634ms |       |
| http://sht-sgmhadoopdn-01:2379 |   true | 6.611197ms |       |
+--------------------------------+--------+------------+-------+

将节点sht-sgmhadoopdn-04移除

# etcdctl member remove 7796493c3943f891
Member 7796493c3943f891 removed from cluster 69bef0b9ccf44365
# etcdctl member list --write-out=table
+------------------+---------+--------------------+--------------------------------+-----------------------------------------------------+------------+
|        ID        | STATUS  |        NAME        |           PEER ADDRS           |                    CLIENT ADDRS                     | IS LEARNER |
+------------------+---------+--------------------+--------------------------------+-----------------------------------------------------+------------+
| 44d8bc3300880bcd | started | sht-sgmhadoopdn-01 | http://sht-sgmhadoopdn-01:2380 | http://10.0.0.1:2379,http://sht-sgmhadoopdn-01:2379 |      false |
| d446fbe3296eb85a | started | sht-sgmhadoopdn-03 | http://sht-sgmhadoopdn-03:2380 | http://10.0.0.1:2379,http://sht-sgmhadoopdn-02:2379 |      false |
| e9136c1ad1754783 | started | sht-sgmhadoopdn-02 | http://sht-sgmhadoopdn-02:2380 | http://10.0.0.1:2379,http://sht-sgmhadoopdn-02:2379 |      false |
+------------------+---------+--------------------+--------------------------------+-----------------------------------------------------+------------+

修改配置文件etcd.conf,修改参数ETCD_INITIAL_CLUSTER并移除节点信息,重启etcd服务

 

标签:02,http,sgmhadoopdn,2379,etcd,移除,sht,false,节点
来源: https://www.cnblogs.com/ilifeilong/p/11625677.html