Skip to content

Commit

Permalink
Update how-to-access-etcd (#812)
Browse files Browse the repository at this point in the history
- 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 <natew@cncf.io>
  • Loading branch information
dwelsch-esi committed Mar 28, 2024
1 parent f84d66c commit dd230ad
Show file tree
Hide file tree
Showing 6 changed files with 112 additions and 42 deletions.
21 changes: 0 additions & 21 deletions content/en/docs/v3.5/tutorials/how-to-access-etcd.md

This file was deleted.

36 changes: 36 additions & 0 deletions 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).
20 changes: 20 additions & 0 deletions 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
21 changes: 0 additions & 21 deletions content/en/docs/v3.6/tutorials/how-to-access-etcd.md

This file was deleted.

36 changes: 36 additions & 0 deletions 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).
20 changes: 20 additions & 0 deletions 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

0 comments on commit dd230ad

Please sign in to comment.