From dd230ad0fd916272d67985a888d844c4bb183476 Mon Sep 17 00:00:00 2001 From: Dave Welsch <116022979+dwelsch-esi@users.noreply.github.com> Date: Thu, 28 Mar 2024 09:35:40 -0700 Subject: [PATCH] Update how-to-access-etcd (#812) - Break `how-to-access-etcd` into two files: - `writing-to-etcd` - `reading-from-etcd` - Rename pages from "How to access ..." to "Writing ..." and "Reading ..." - Added Prerequisite section - Removed animated GIF - Revised procedure to explain keywords Create reading-from-etcd.md updating v3.5 with same v3.6 content as above. Signed-off-by: Nate W --- .../docs/v3.5/tutorials/how-to-access-etcd.md | 21 ----------- .../docs/v3.5/tutorials/reading-from-etcd.md | 36 +++++++++++++++++++ .../en/docs/v3.5/tutorials/writing-to-etcd.md | 20 +++++++++++ .../docs/v3.6/tutorials/how-to-access-etcd.md | 21 ----------- .../docs/v3.6/tutorials/reading-from-etcd.md | 36 +++++++++++++++++++ .../en/docs/v3.6/tutorials/writing-to-etcd.md | 20 +++++++++++ 6 files changed, 112 insertions(+), 42 deletions(-) delete mode 100644 content/en/docs/v3.5/tutorials/how-to-access-etcd.md create mode 100644 content/en/docs/v3.5/tutorials/reading-from-etcd.md create mode 100644 content/en/docs/v3.5/tutorials/writing-to-etcd.md delete mode 100644 content/en/docs/v3.6/tutorials/how-to-access-etcd.md create mode 100644 content/en/docs/v3.6/tutorials/reading-from-etcd.md create mode 100644 content/en/docs/v3.6/tutorials/writing-to-etcd.md diff --git a/content/en/docs/v3.5/tutorials/how-to-access-etcd.md b/content/en/docs/v3.5/tutorials/how-to-access-etcd.md deleted file mode 100644 index f1ceeb2d..00000000 --- a/content/en/docs/v3.5/tutorials/how-to-access-etcd.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -title: How to access etcd -description: Guide to access an etcd cluster -weight: 200 ---- - - -![02_etcdctl_access_etcd_2016051001](https://storage.googleapis.com/etcd/demo/02_etcdctl_access_etcd_2016051001.gif) - -`put` command to write: - -```shell -etcdctl --endpoints=$ENDPOINTS put foo "Hello World!" -``` - -`get` to read from etcd: - -```shell -etcdctl --endpoints=$ENDPOINTS get foo -etcdctl --endpoints=$ENDPOINTS --write-out="json" get foo -``` diff --git a/content/en/docs/v3.5/tutorials/reading-from-etcd.md b/content/en/docs/v3.5/tutorials/reading-from-etcd.md new file mode 100644 index 00000000..f59cf485 --- /dev/null +++ b/content/en/docs/v3.5/tutorials/reading-from-etcd.md @@ -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). \ No newline at end of file diff --git a/content/en/docs/v3.5/tutorials/writing-to-etcd.md b/content/en/docs/v3.5/tutorials/writing-to-etcd.md new file mode 100644 index 00000000..917f6dee --- /dev/null +++ b/content/en/docs/v3.5/tutorials/writing-to-etcd.md @@ -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 diff --git a/content/en/docs/v3.6/tutorials/how-to-access-etcd.md b/content/en/docs/v3.6/tutorials/how-to-access-etcd.md deleted file mode 100644 index f1ceeb2d..00000000 --- a/content/en/docs/v3.6/tutorials/how-to-access-etcd.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -title: How to access etcd -description: Guide to access an etcd cluster -weight: 200 ---- - - -![02_etcdctl_access_etcd_2016051001](https://storage.googleapis.com/etcd/demo/02_etcdctl_access_etcd_2016051001.gif) - -`put` command to write: - -```shell -etcdctl --endpoints=$ENDPOINTS put foo "Hello World!" -``` - -`get` to read from etcd: - -```shell -etcdctl --endpoints=$ENDPOINTS get foo -etcdctl --endpoints=$ENDPOINTS --write-out="json" get foo -``` diff --git a/content/en/docs/v3.6/tutorials/reading-from-etcd.md b/content/en/docs/v3.6/tutorials/reading-from-etcd.md new file mode 100644 index 00000000..0c51fe37 --- /dev/null +++ b/content/en/docs/v3.6/tutorials/reading-from-etcd.md @@ -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). diff --git a/content/en/docs/v3.6/tutorials/writing-to-etcd.md b/content/en/docs/v3.6/tutorials/writing-to-etcd.md new file mode 100644 index 00000000..917f6dee --- /dev/null +++ b/content/en/docs/v3.6/tutorials/writing-to-etcd.md @@ -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