Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ tmp/
# IDEs
.idea
*.iml
package.json
62 changes: 31 additions & 31 deletions content/en/docs/v3.1/upgrades/upgrade_3_3.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ title: Upgrade etcd from 3.2 to 3.3
---

In the general case, upgrading from etcd 3.2 to 3.3 can be a zero-downtime, rolling upgrade:
- one by one, stop the etcd v3.2 processes and replace them with etcd v3.3 processes
- after running all v3.3 processes, new features in v3.3 are available to the cluster

- one by one, stop the etcd v3.2 processes and replace them with etcd v3.3 processes
- after running all v3.3 processes, new features in v3.3 are available to the cluster

Before [starting an upgrade](#upgrade-procedure), read through the rest of this guide to prepare.

Expand All @@ -24,23 +25,23 @@ Before and after (e.g. [k8s.io/kubernetes/test/e2e_node/services/etcd.go](https:
import "github.com/coreos/etcd/etcdserver"

type EtcdServer struct {
*etcdserver.EtcdServer
- config *etcdserver.ServerConfig
+ config etcdserver.ServerConfig
*etcdserver.EtcdServer
- config *etcdserver.ServerConfig
+ config etcdserver.ServerConfig
}

func NewEtcd(dataDir string) *EtcdServer {
- config := &etcdserver.ServerConfig{
+ config := etcdserver.ServerConfig{
DataDir: dataDir,
- config := &etcdserver.ServerConfig{
+ config := etcdserver.ServerConfig{
DataDir: dataDir,
...
}
return &EtcdServer{config: config}
}
return &EtcdServer{config: config}
}

func (e *EtcdServer) Start() error {
var err error
e.EtcdServer, err = etcdserver.NewServer(e.config)
var err error
e.EtcdServer, err = etcdserver.NewServer(e.config)
...
```

Expand All @@ -52,15 +53,15 @@ Field `LogOutput` is added to `embed.Config`:
package embed

type Config struct {
Debug bool `json:"debug"`
LogPkgLevels string `json:"log-package-levels"`
+ LogOutput string `json:"log-output"`
...
Debug bool `json:"debug"`
LogPkgLevels string `json:"log-package-levels"`
+ LogOutput string `json:"log-output"`
...
```

Before gRPC server warnings were logged in etcdserver.

```
```bash
WARNING: 2017/11/02 11:35:51 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: Error while dialing dial tcp: operation was canceled"; Reconnecting to {localhost:2379 <nil>}
WARNING: 2017/11/02 11:35:51 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: Error while dialing dial tcp: operation was canceled"; Reconnecting to {localhost:2379 <nil>}
```
Expand Down Expand Up @@ -93,14 +94,14 @@ Before

```bash
curl -L http://localhost:2379/v3alpha/kv/put \
-X POST -d '{"key": "Zm9v", "value": "YmFy"}'
-X POST -d '{"key": "Zm9v", "value": "YmFy"}'
```

After

```bash
curl -L http://localhost:2379/v3beta/kv/put \
-X POST -d '{"key": "Zm9v", "value": "YmFy"}'
-X POST -d '{"key": "Zm9v", "value": "YmFy"}'
```

Requests to `/v3alpha` endpoints will redirect to `/v3beta`, and `/v3alpha` will be removed in 3.4 release.
Expand Down Expand Up @@ -253,7 +254,6 @@ Previously, `lease timetolive LEASE_ID` command on expired lease prints `-1s` fo

Before


```bash
lease 2d8257079fa1bc0c granted with TTL(0s), remaining(-1s)
```
Expand Down Expand Up @@ -320,7 +320,7 @@ _, err := clientv3.New(clientv3.Config{
DialTimeout: 2 * time.Second
})
if err == grpc.ErrClientConnTimeout {
// handle errors
// handle errors
}
```

Expand All @@ -332,7 +332,7 @@ _, err := clientv3.New(clientv3.Config{
DialTimeout: 2 * time.Second
})
if err == context.DeadlineExceeded {
// handle errors
// handle errors
}
```

Expand Down Expand Up @@ -392,7 +392,7 @@ This example shows how to upgrade a 3-member v3.2 etcd cluster running on a loca

Is the cluster healthy and running v3.2.x?

```
```bash
$ ETCDCTL_API=3 etcdctl endpoint health --endpoints=localhost:2379,localhost:22379,localhost:32379
localhost:2379 is healthy: successfully committed proposal: took = 6.600684ms
localhost:22379 is healthy: successfully committed proposal: took = 8.540064ms
Expand All @@ -406,7 +406,7 @@ $ curl http://localhost:2379/version

When each etcd process is stopped, expected errors will be logged by other cluster members. This is normal since a cluster member connection has been (temporarily) broken:

```
```console
14:13:31.491746 I | raft: c89feb932daef420 [term 3] received MsgTimeoutNow from 6d4f535bae3ab960 and starts an election to get leadership.
14:13:31.491769 I | raft: c89feb932daef420 became candidate at term 4
14:13:31.491788 I | raft: c89feb932daef420 received MsgVoteResp from c89feb932daef420 at term 4
Expand All @@ -426,21 +426,21 @@ When each etcd process is stopped, expected errors will be logged by other clust

It's a good idea at this point to [backup the etcd data](../../op-guide/maintenance/#snapshot-backup) to provide a downgrade path should any problems occur:

```
$ etcdctl snapshot save backup.db
```bash
etcdctl snapshot save backup.db
```

#### 3. Drop-in etcd v3.3 binary and start the new etcd process

The new v3.3 etcd will publish its information to the cluster:

```
```console
14:14:25.363225 I | etcdserver: published {Name:s1 ClientURLs:[http://localhost:2379]} to cluster a9ededbffcb1b1f1
```

Verify that each member, and then the entire cluster, becomes healthy with the new v3.3 etcd binary:

```
```console
$ ETCDCTL_API=3 /etcdctl endpoint health --endpoints=localhost:2379,localhost:22379,localhost:32379
localhost:22379 is healthy: successfully committed proposal: took = 5.540129ms
localhost:32379 is healthy: successfully committed proposal: took = 7.321771ms
Expand All @@ -449,7 +449,7 @@ localhost:2379 is healthy: successfully committed proposal: took = 10.629901ms

Upgraded members will log warnings like the following until the entire cluster is upgraded. This is expected and will cease after all etcd cluster members are upgraded to v3.3:

```
```console
14:15:17.071804 W | etcdserver: member c89feb932daef420 has a higher version 3.3.0
14:15:21.073110 W | etcdserver: the local etcd version 3.2.7 is not up-to-date
14:15:21.073142 W | etcdserver: member 6d4f535bae3ab960 has a higher version 3.3.0
Expand All @@ -463,12 +463,12 @@ Upgraded members will log warnings like the following until the entire cluster i

When all members are upgraded, the cluster will report upgrading to 3.3 successfully:

```
```console
14:15:54.536901 N | etcdserver/membership: updated the cluster version from 3.2 to 3.3
14:15:54.537035 I | etcdserver/api: enabled capabilities for version 3.3
```

```
```console
$ ETCDCTL_API=3 /etcdctl endpoint health --endpoints=localhost:2379,localhost:22379,localhost:32379
localhost:2379 is healthy: successfully committed proposal: took = 2.312897ms
localhost:22379 is healthy: successfully committed proposal: took = 2.553476ms
Expand Down
9 changes: 9 additions & 0 deletions content/en/docs/v3.5/dev-guide/golang_embed_pkg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: Embedding etcd in a Go Application
weight: 3562
description: Use the Go embed package to run an etcd server within your application
---

The `embed` package from Go provides a simple way to embed an etcd server directly into your application.

For more details, see the [embed package documentation](https://pkg.go.dev/go.etcd.io/etcd/server/v3/embed).
145 changes: 103 additions & 42 deletions content/en/docs/v3.5/quickstart.md
Original file line number Diff line number Diff line change
@@ -1,61 +1,122 @@
---
title: Quickstart
weight: 900
description: Get etcd up and running in less than 5 minutes!
description: Run etcd Locally Under 5 minutes!
---

Follow these instructions to locally install, run, and test a single-member
cluster of etcd:
This guide walks through installing and running a single-node etcd cluster locally using pre-built binaries - no containers or cloud set up required.

1. Install etcd from pre-built binaries or from source. For details, see
[Install][].
## Requirements

{{% alert color="warning" %}}**Important**: Ensure that you perform the last
step of the installation instructions to verify that `etcd` is in your path.
{{% /alert %}}
Make sure you're on a supported platform before getting started:

2. Launch `etcd`:
- Operating System: Ubuntu 22.04+ or macOS 11+. Windows users can use WSL2.
- [Supported platforms architecture](/docs/v3.5/op-guide/)
- Tools installed:
- `curl` and `tar`
- Internet connection to download the latest etcd [release](https://github.com/etcd-io/etcd/releases/).
- `sudo` access to install binaries.

```console
$ etcd
{"level":"info","ts":"2021-09-17T09:19:32.783-0400","caller":"etcdmain/etcd.go:72","msg":... }
```
## Steps

{{% alert color="info" %}}**Note**: The output produced by `etcd` are
[logs](../op-guide/configuration/#logging) &mdash; info-level logs can
be ignored. {{% /alert %}}
### 1. Installation

3. From **another terminal**, use `etcdctl` to set a key:
Install `etcd` from pre-built binaries using cURL.

```console
$ etcdctl put greeting "Hello, etcd"
OK
```
```bash
# Download and extract the latest release using cURL
curl -L https://github.com/etcd-io/etcd/releases/download/v3.5.21/etcd-v3.5.21-linux-arm64.tar.gz \
-o etcd.tar.gz
tar -xvf etcd.tar.gz
cd etcd-v3.5.21-linux-arm64

4. From the same terminal, retrieve the key:
```

```console
$ etcdctl get greeting
greeting
Hello, etcd
```
Move binaries to `/usr/local/bin`:

```bash
sudo mv etcd etcdctl etcdutl /usr/local/bin
```

Confirm installation:

```bash
etcd --version
etcdctl version
```

Output:

```bash
etcd Version: 3.5.21
Git SHA: a17edfd
Go Version: go1.23.7
Go OS/Arch: linux/arm64


etcdctl version: 3.5.21
API version: 3.5

```

### 2. Start `etcd`

In a new terminal window, start etcd with the default configuration:

```bash
etcd
```

You should see logs indicating etcd has started and is listening on `localhost:2379`.

### 3. From another terminal, use `etcdctl` to set a key

```bash
etcdctl put greeting "Hello, etcd"
```

where:

- `put`: Puts the given key into the store

Ouput:

```bash
OK
```

### 4. From the same terminal, retrieve the key

```bash
etcdctl get greeting
```

where:

- `get`: gets the key or range of keys.

Output:

```bash
greeting
Hello, etcd
```

### 5. Shut down `etcd`

To stop etcd, press `Ctrl+C` in the terminal where it is running.

## What's next?

Learn about more ways to configure and use etcd from the following pages:

- Explore the gRPC [API][].
- Set up a [multi-machine cluster][clustering].
- Learn how to [configure][] etcd.
- Find [language bindings and tools][integrations].
- Use TLS to [secure an etcd cluster][security].
- [Tune etcd][tuning].

[api]: /docs/{{< param version >}}/learning/api
[clustering]: /docs/{{< param version >}}/op-guide/clustering
[configure]: /docs/{{< param version >}}/op-guide/configuration
[integrations]: /docs/{{< param version >}}/integrations
[security]: /docs/{{< param version >}}/op-guide/security
[tuning]: /docs/{{< param version >}}/tuning
[Install]: ../install/
- If you are a developer:
- Explore the gRPC [API](/docs/v3.5/learning/api).
- Set up a [multi-machine cluster](/docs/v3.5/op-guide/clustering).

If you are an operator or admin:

- Learn how to [configure](/docs/v3.5/op-guide/configuration) etcd.
- Find language [bindings and tools](/docs/v3.5/integrations).
- Use TLS to [secure](/docs/v3.5/op-guide/security) an etcd cluster.
- [Tune etcd](/docs/v3.5/tuning).
Loading