mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdctlv3: interactive_v3 del command update
This commit is contained in:
parent
e2d51961dd
commit
83f2fa7adc
@ -48,7 +48,7 @@ Applications can read values of keys from an etcd cluster. Queries may read a si
|
|||||||
|
|
||||||
Suppose the etcd cluster has stored the following keys:
|
Suppose the etcd cluster has stored the following keys:
|
||||||
|
|
||||||
```
|
```bash
|
||||||
foo = bar
|
foo = bar
|
||||||
foo1 = bar1
|
foo1 = bar1
|
||||||
foo3 = bar3
|
foo3 = bar3
|
||||||
@ -106,7 +106,7 @@ Since every modification to the etcd cluster key-value store increments the glob
|
|||||||
|
|
||||||
Suppose an etcd cluster already has the following keys:
|
Suppose an etcd cluster already has the following keys:
|
||||||
|
|
||||||
``` bash
|
```bash
|
||||||
foo = bar # revision = 2
|
foo = bar # revision = 2
|
||||||
foo1 = bar1 # revision = 3
|
foo1 = bar1 # revision = 3
|
||||||
foo = bar_new # revision = 4
|
foo = bar_new # revision = 4
|
||||||
@ -147,7 +147,7 @@ Applications may want to read keys which are greater than or equal to the byte v
|
|||||||
|
|
||||||
Suppose an etcd cluster already has the following keys:
|
Suppose an etcd cluster already has the following keys:
|
||||||
|
|
||||||
``` bash
|
```bash
|
||||||
a = 123
|
a = 123
|
||||||
b = 456
|
b = 456
|
||||||
z = 789
|
z = 789
|
||||||
@ -167,6 +167,20 @@ z
|
|||||||
|
|
||||||
Applications can delete a key or a range of keys from an etcd cluster.
|
Applications can delete a key or a range of keys from an etcd cluster.
|
||||||
|
|
||||||
|
Suppose an etcd cluster already has the following keys:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
foo = bar
|
||||||
|
foo1 = bar1
|
||||||
|
foo3 = bar3
|
||||||
|
zoo = val
|
||||||
|
zoo1 = val1
|
||||||
|
zoo2 = val2
|
||||||
|
a = 123
|
||||||
|
b = 456
|
||||||
|
z = 789
|
||||||
|
```
|
||||||
|
|
||||||
Here is the command to delete key `foo`:
|
Here is the command to delete key `foo`:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@ -181,6 +195,29 @@ $ etcdctl del foo foo9
|
|||||||
2 # two keys are deleted
|
2 # two keys are deleted
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Here is the command to delete key `zoo` with the deleted key value pair returned:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ etcdctl del --prev-kv zoo
|
||||||
|
1 # one key is deleted
|
||||||
|
zoo # deleted key
|
||||||
|
val # the value of the deleted key
|
||||||
|
```
|
||||||
|
|
||||||
|
Here is the command to delete keys having prefix as `zoo`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ etcdctl del --prefix zoo
|
||||||
|
2 # two keys are deleted
|
||||||
|
```
|
||||||
|
|
||||||
|
Here is the command to delete keys which are greater than or equal to the byte value of key `b` :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ etcdctl del --from-key b
|
||||||
|
2 # two keys are deleted
|
||||||
|
```
|
||||||
|
|
||||||
## Watch key changes
|
## Watch key changes
|
||||||
|
|
||||||
Applications can watch on a key or a range of keys to monitor for any updates.
|
Applications can watch on a key or a range of keys to monitor for any updates.
|
||||||
@ -212,7 +249,7 @@ Applications may want to watch for historical changes of keys in etcd. For examp
|
|||||||
|
|
||||||
Suppose we finished the following sequence of operations:
|
Suppose we finished the following sequence of operations:
|
||||||
|
|
||||||
``` bash
|
```bash
|
||||||
etcdctl put foo bar # revision = 2
|
etcdctl put foo bar # revision = 2
|
||||||
etcdctl put foo1 bar1 # revision = 3
|
etcdctl put foo1 bar1 # revision = 3
|
||||||
etcdctl put foo bar_new # revision = 4
|
etcdctl put foo bar_new # revision = 4
|
||||||
|
Loading…
x
Reference in New Issue
Block a user