Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated instructions for acessing (reading and writing) an etcd KV pair #812

Merged
merged 1 commit into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
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).
20 changes: 20 additions & 0 deletions content/en/docs/v3.5/tutorials/writing-to-etcd.md
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
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
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).
20 changes: 20 additions & 0 deletions content/en/docs/v3.6/tutorials/writing-to-etcd.md
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