-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sync from etcd-io/website@dd230ad by PCIT
- Loading branch information
Showing
4 changed files
with
58 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
title: Reading from etcd | ||
description: Reading a value in an etcd cluster | ||
weight: 200 | ||
--- | ||
|
||
## Prerequisites | ||
|
||
- Install `etcdctl` | ||
|
||
|
||
## Procedure | ||
|
||
Use the `get` subcommand to read from etcd: | ||
|
||
```shell | ||
$ etcdctl --endpoints=$ENDPOINTS get foo | ||
foo | ||
Hello World! | ||
$ | ||
``` | ||
|
||
where: | ||
- `foo` is the requested key | ||
- `Hello World!` is the retrieved value | ||
|
||
Or, for formatted output: | ||
|
||
``` | ||
$ etcdctl --endpoints=$ENDPOINTS --write-out="json" get foo | ||
{"header":{"cluster_id":289318470931837780,"member_id":14947050114012957595,"revision":3,"raft_term":4, | ||
"kvs":[{"key":"Zm9v","create_revision":2,"mod_revision":3,"version":2,"value":"SGVsbG8gV29ybGQh"}]}} | ||
$ | ||
``` | ||
|
||
where `write-out="json"` causes the value to be output in JSON format (note that the key is not returned). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
title: Writing to etcd | ||
description: Adding a KV pair to an etcd cluster | ||
weight: 200 | ||
--- | ||
|
||
## Prerequisites | ||
|
||
- Install `etcdctl` | ||
|
||
## Procedure | ||
|
||
Use the `put` subcommand to write a key-value pair: | ||
|
||
```shell | ||
etcdctl --endpoints=$ENDPOINTS put foo "Hello World!" | ||
``` | ||
where: | ||
- `foo` is the key name | ||
- `"Hello World!"` is the quote-delimited value |