etcdctl: update the examples for endpoint hashkv command in readme

Signed-off-by: Benjamin Wang <wachao@vmware.com>
dependabot/go_modules/go.uber.org/atomic-1.10.0
Benjamin Wang 2022-11-22 06:10:00 +08:00
parent cd15507c65
commit f2d765d247
1 changed files with 57 additions and 12 deletions

View File

@ -837,28 +837,73 @@ Prints a line of JSON encoding each endpoint URL and KV history hash.
Get the hash for the default endpoint: Get the hash for the default endpoint:
```bash ```bash
./etcdctl endpoint hashkv ./etcdctl endpoint hashkv --cluster
# 127.0.0.1:2379, 1084519789 http://127.0.0.1:2379, 2064120424, 13
http://127.0.0.1:22379, 2064120424, 13
http://127.0.0.1:32379, 2064120424, 13
``` ```
Get the status for the default endpoint as JSON: Get the status for the default endpoint as JSON:
```bash ```bash
./etcdctl -w json endpoint hashkv ./etcdctl endpoint hash --cluster -w json | jq
# [{"Endpoint":"127.0.0.1:2379","Hash":{"header":{"cluster_id":14841639068965178418,"member_id":10276657743932975437,"revision":1,"raft_term":3},"hash":1084519789,"compact_revision":-1}}] [
{
"Endpoint": "http://127.0.0.1:2379",
"HashKV": {
"header": {
"cluster_id": 17237436991929494000,
"member_id": 9372538179322590000,
"revision": 13,
"raft_term": 2
},
"hash": 2064120424,
"compact_revision": -1,
"hash_revision": 13
}
},
{
"Endpoint": "http://127.0.0.1:22379",
"HashKV": {
"header": {
"cluster_id": 17237436991929494000,
"member_id": 10501334649042878000,
"revision": 13,
"raft_term": 2
},
"hash": 2064120424,
"compact_revision": -1,
"hash_revision": 13
}
},
{
"Endpoint": "http://127.0.0.1:32379",
"HashKV": {
"header": {
"cluster_id": 17237436991929494000,
"member_id": 18249187646912140000,
"revision": 13,
"raft_term": 2
},
"hash": 2064120424,
"compact_revision": -1,
"hash_revision": 13
}
}
]
``` ```
Get the status for all endpoints in the cluster associated with the default endpoint: Get the status for all endpoints in the cluster associated with the default endpoint:
```bash ```bash
./etcdctl -w table endpoint --cluster hashkv $ ./etcdctl endpoint hash --cluster -w table
+------------------------+------------+ +------------------------+------------+----------+
| ENDPOINT | HASH | | ENDPOINT | HASH | REVISION |
+------------------------+------------+ +------------------------+------------+----------+
| http://127.0.0.1:2379 | 1084519789 | | http://127.0.0.1:2379 | 2064120424 | 13 |
| http://127.0.0.1:22379 | 1084519789 | | http://127.0.0.1:22379 | 2064120424 | 13 |
| http://127.0.0.1:32379 | 1084519789 | | http://127.0.0.1:32379 | 2064120424 | 13 |
+------------------------+------------+ +------------------------+------------+----------+
``` ```
### ALARM \<subcommand\> ### ALARM \<subcommand\>