瀏覽代碼

Merge pull request #1956 from coreos/member-migration-example

doc: update node migration guide
Xiang Li 11 年之前
父節點
當前提交
a000e97eea
共有 1 個文件被更改,包括 63 次插入0 次删除
  1. 63 0
      Documentation/0.5/admin_guide.md

+ 63 - 0
Documentation/0.5/admin_guide.md

@@ -43,6 +43,69 @@ The data directory contains all the data to recover a member to its point-in-tim
 * Update the peer URLs for that member to reflect the new machine according to the [member api] [change peer url]
 * Start etcd on the new machine, using the same configuration and the copy of the data directory
 
+This example will walk you through the process of migrating the infra1 member to a new machine:
+
+|Name|Peer URL|
+|------|--------------|
+|infra0|10.0.1.10:2380|
+|infra1|10.0.1.11:2380|
+|infra2|10.0.1.12:2380|
+
+```
+$ export ETCDCTL_PEERS=http://10.0.1.10:2379,http://10.0.1.11:2379,http://10.0.1.12:2379
+```
+
+```
+$ etcdctl member list
+84194f7c5edd8b37: name=infra0 peerURLs=http://10.0.1.10:2380 clientURLs=http://127.0.0.1:2379,http://10.0.1.10:2379
+b4db3bf5e495e255: name=infra1 peerURLs=http://10.0.1.11:2380 clientURLs=http://127.0.0.1:2379,http://10.0.1.11:2379
+bc1083c870280d44: name=infra2 peerURLs=http://10.0.1.12:2380 clientURLs=http://127.0.0.1:2379,http://10.0.1.12:2379
+```
+
+#### Stop the member etcd process
+
+```
+$ ssh core@10.0.1.11
+```
+
+```
+$ sudo systemctl stop etcd
+```
+
+#### Copy the data directory of the now-idle member to the new machine
+
+```
+$ tar -cvzf node1.etcd.tar.gz /var/lib/etcd/node1.etcd 
+```
+
+```
+$ scp node1.etcd.tar.gz core@10.0.1.13:~/
+```
+
+#### Update the peer URLs for that member to reflect the new machine
+
+```
+$ curl http://10.0.1.10:2379/v2/members/b4db3bf5e495e255 -XPUT \
+-H "Content-Type: application/json" -d '{"peerURLs":["http://10.0.1.13:2380"]}'
+```
+
+#### Start etcd on the new machine, using the same configuration and the copy of the data directory
+
+```
+$ ssh core@10.0.1.13
+```
+
+```
+$ tar -xzvf node1.etcd.tar.gz -C /var/lib/etcd
+```
+
+```
+etcd -name node1 \
+-listen-peer-urls http://10.0.1.13:2380 \
+-listen-client-urls http://10.0.1.13:2379,http://127.0.0.1:2379 \
+-advertise-client-urls http://10.0.1.13:2379,http://127.0.0.1:2379
+```
+
 [change peer url]: https://github.com/coreos/etcd/blob/master/Documentation/0.5/other_apis.md#change-the-peer-urls-of-a-member 
 
 ### Disaster Recovery