Skip to content

Commit

Permalink
Sync from etcd-io/website@dd230ad by PCIT
Browse files Browse the repository at this point in the history
  • Loading branch information
khs1994 committed Mar 29, 2024
1 parent 555ce65 commit 192891c
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 22 deletions.
3 changes: 2 additions & 1 deletion SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
* [PR Management](triage/PRs.md)
- Tutorials
* [Tutorials](tutorials/_index.md)
* [How To Access Etcd](tutorials/how-to-access-etcd.md)
* [How To Check Cluster Status](tutorials/how-to-check-cluster-status.md)
* [How To Conduct Leader Election In Etcd Cluster](tutorials/how-to-conduct-elections.md)
* [How To Create Lease](tutorials/how-to-create-lease.md)
Expand All @@ -77,6 +76,8 @@
* [How To Set Up A Demo Etcd Cluster](tutorials/how-to-setup-cluster.md)
* [How To Make Multiple Writes In A Transaction](tutorials/how-to-transactional-write.md)
* [How To Watch Keys](tutorials/how-to-watch-keys.md)
* [Reading From Etcd](tutorials/reading-from-etcd.md)
* [Writing To Etcd](tutorials/writing-to-etcd.md)
- Upgrades
* [Upgrading](upgrades/_index.md)
* [Upgrade etcd from 2.3 to 3.0](upgrades/upgrade_3_0.md)
Expand Down
21 changes: 0 additions & 21 deletions tutorials/how-to-access-etcd.md

This file was deleted.

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

0 comments on commit 192891c

Please sign in to comment.