mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #10401 from markmc/doc-drop-etcdctl-v3-flag
Eliminate some ETCDCTL_API=3 usage
This commit is contained in:
@@ -2,7 +2,9 @@
|
||||
|
||||
Users mostly interact with etcd by putting or getting the value of a key. This section describes how to do that by using etcdctl, a command line tool for interacting with etcd server. The concepts described here should apply to the gRPC APIs or client library APIs.
|
||||
|
||||
By default, etcdctl talks to the etcd server with the v2 API for backward compatibility. For etcdctl to speak to etcd using the v3 API, the API version must be set to version 3 via the `ETCDCTL_API` environment variable. However note that any key that was created using the v2 API will not be able to be queried via the v3 API. A v3 API ```etcdctl get``` of a v2 key will exit with 0 and no key data, this is the expected behaviour.
|
||||
The API version used by etcdctl to speak to etcd may be set to version `2` or `3` via the `ETCDCTL_API` environment variable. By default, etcdctl on master (3.4) uses the v3 API and earlier versions (3.3 and earlier) default to the v2 API.
|
||||
|
||||
Note that any key that was created using the v2 API will not be able to be queried via the v2 API. A v3 API ```etcdctl get``` of a v2 key will exit with 0 and no key data, this is the expected behaviour.
|
||||
|
||||
|
||||
```bash
|
||||
|
||||
@@ -21,14 +21,7 @@ The running etcd member listens on `localhost:2379` for client requests.
|
||||
|
||||
Use `etcdctl` to interact with the running cluster:
|
||||
|
||||
1. Configure the environment to have `ETCDCTL_API=3` so `etcdctl` uses the etcd API version 3 instead of defaulting to version 2.
|
||||
|
||||
```
|
||||
# use API version 3
|
||||
$ export ETCDCTL_API=3
|
||||
```
|
||||
|
||||
2. Store an example key-value pair in the cluster:
|
||||
1. Store an example key-value pair in the cluster:
|
||||
|
||||
```
|
||||
$ ./etcdctl put foo bar
|
||||
@@ -37,7 +30,7 @@ Use `etcdctl` to interact with the running cluster:
|
||||
|
||||
If OK is printed, storing key-value pair is successful.
|
||||
|
||||
3. Retrieve the value of `foo`:
|
||||
2. Retrieve the value of `foo`:
|
||||
|
||||
```
|
||||
$ ./etcdctl get foo
|
||||
@@ -70,14 +63,7 @@ A `Procfile` at the base of the etcd git repository is provided to easily config
|
||||
|
||||
Use `etcdctl` to interact with the running cluster:
|
||||
|
||||
1. Configure the environment to have `ETCDCTL_API=3` so `etcdctl` uses the etcd API version 3 instead of defaulting to version 2.
|
||||
|
||||
```
|
||||
# use API version 3
|
||||
$ export ETCDCTL_API=3
|
||||
```
|
||||
|
||||
2. Print the list of members:
|
||||
1. Print the list of members:
|
||||
|
||||
```
|
||||
$ etcdctl --write-out=table --endpoints=localhost:2379 member list
|
||||
@@ -94,7 +80,7 @@ Use `etcdctl` to interact with the running cluster:
|
||||
+------------------+---------+--------+------------------------+------------------------+
|
||||
```
|
||||
|
||||
3. Store an example key-value pair in the cluster:
|
||||
2. Store an example key-value pair in the cluster:
|
||||
|
||||
```
|
||||
$ etcdctl put foo bar
|
||||
|
||||
@@ -52,11 +52,11 @@ $ $GOPATH/bin/etcd
|
||||
Run the following:
|
||||
|
||||
```sh
|
||||
$ ETCDCTL_API=3 ./bin/etcdctl put foo bar
|
||||
$ ./bin/etcdctl put foo bar
|
||||
OK
|
||||
```
|
||||
|
||||
(or `ETCDCTL_API=3 $GOPATH/bin/etcdctl put foo bar` if etcdctl was installed with `go get`)
|
||||
(or `$GOPATH/bin/etcdctl put foo bar` if etcdctl was installed with `go get`)
|
||||
|
||||
If OK is printed, then etcd is working!
|
||||
|
||||
|
||||
Reference in New Issue
Block a user