# Die Datenbank sichern

> Anleitung zum Erstellen eines Snapshots der etcd-Datenbank

---

LLMS-Index: [llms.txt](/de/llms.txt)

---

## Voraussetzungen {#pre-requisites}

* [etcdctl und etcdutl installieren](/de/docs/etcd/install/)
* [Einen lokalen Cluster einrichten](/de/docs/etcd/dev-guide/local_cluster/)

## Einen Snapshot der Datenbank erstellen {#snapshot-a-database}

`snapshot` zum Speichern eines Snapshots der etcd-Datenbank zu einem bestimmten Zeitpunkt:

```bash
etcdctl --endpoints=$ENDPOINT snapshot save DB_NAME
```

### Globale Optionen {#global-options}

#### etcdctl {#etcdctl}

```bash
--endpoints=[127.0.0.1:2379], gRPC endpoints
```

Ein Snapshot kann nur von einem einzelnen etcd-Knoten angefordert werden. Daher sollte die Option `--endpoints` nur einen Endpunkt enthalten.

#### etcdutl {#etcdutl}

```bash
-w, --write-out string   set the output format (fields, json, protobuf, simple, table) (default "simple")
```

### Beispiel {#example}

![11_etcdctl_snapshot_2016051001](/docs/etcd/tasks/img/save-database.gif)

```shell
ENDPOINTS=$HOST_1:2379
etcdctl --endpoints=$ENDPOINTS snapshot save my.db

Snapshot saved at my.db
```

```shell
etcdutl --write-out=table snapshot status my.db

+---------+----------+------------+------------+
|  HASH   | REVISION | TOTAL KEYS | TOTAL SIZE |
+---------+----------+------------+------------+
| c55e8b8 |        9 |         13 | 25 kB      |
+---------+----------+------------+------------+
```
