|
|
@@ -241,6 +241,29 @@ Let the join two more nodes to this cluster using the -C argument:
|
|
|
./etcd -c 4003 -s 7003 -C 127.0.0.1:7001 -d nod/node3
|
|
|
```
|
|
|
|
|
|
+Get the machines in the cluster
|
|
|
+
|
|
|
+```sh
|
|
|
+curl http://127.0.0.1:4001/machines
|
|
|
+```
|
|
|
+
|
|
|
+We should see there are three nodes in the cluster
|
|
|
+
|
|
|
+```
|
|
|
+0.0.0.0:7001,0.0.0.0:7002,0.0.0.0:7003
|
|
|
+```
|
|
|
+
|
|
|
+Also try to get the current leader in the cluster
|
|
|
+
|
|
|
+```
|
|
|
+curl http://127.0.0.1:4001/leader
|
|
|
+```
|
|
|
+The first server we set up should be the leader, if it has not dead during these commands.
|
|
|
+
|
|
|
+```
|
|
|
+0.0.0.0:7001
|
|
|
+```
|
|
|
+
|
|
|
Now we can do normal SET and GET operations on keys as we explored earlier.
|
|
|
|
|
|
```sh
|
|
|
@@ -259,6 +282,16 @@ Let's kill the leader of the cluster and get the value from the other machine:
|
|
|
curl http://127.0.0.1:4002/v1/keys/foo
|
|
|
```
|
|
|
|
|
|
+A new leader should have been elected.
|
|
|
+
|
|
|
+```
|
|
|
+curl http://127.0.0.1:4001/leader
|
|
|
+```
|
|
|
+
|
|
|
+```
|
|
|
+0.0.0.0:7002 or 0.0.0.0:7003
|
|
|
+```
|
|
|
+
|
|
|
You should be able to see this:
|
|
|
|
|
|
```json
|