Merge pull request #43725 from my-git9/path-15117

[zh-cn] sync configure-upgrade-etcd.md
pull/43743/head
Kubernetes Prow Robot 2023-10-30 02:28:52 +01:00 committed by GitHub
commit 4ae16ed406
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 24 additions and 11 deletions

View File

@ -495,12 +495,12 @@ etcd 支持内置快照。快照可以从使用 `etcdctl snapshot save` 命令
<!--
Below is an example for taking a snapshot of the keyspace served by
`$ENDPOINT` to the file `snapshotdb`:
`$ENDPOINT` to the file `snapshot.db`:
-->
下面是一个示例,用于获取 `$ENDPOINT` 所提供的键空间的快照到文件 `snapshotdb`
下面是一个示例,用于获取 `$ENDPOINT` 所提供的键空间的快照到文件 `snapshot.db`
```shell
ETCDCTL_API=3 etcdctl --endpoints $ENDPOINT snapshot save snapshotdb
ETCDCTL_API=3 etcdctl --endpoints $ENDPOINT snapshot save snapshot.db
```
<!--
@ -509,7 +509,7 @@ Verify the snapshot:
验证快照:
```shell
ETCDCTL_API=3 etcdctl --write-out=table snapshot status snapshotdb
ETCDCTL_API=3 etcdctl --write-out=table snapshot status snapshot.db
```
```console
@ -616,26 +616,30 @@ Here is an example:
例如:
```shell
ETCDCTL_API=3 etcdctl --endpoints 10.2.0.9:2379 snapshot restore snapshotdb
ETCDCTL_API=3 etcdctl --endpoints 10.2.0.9:2379 snapshot restore snapshot.db
```
<!--
Another example for restoring using etcdctl options:
Another example for restoring using `etcdctl` options:
-->
恢复时也可以指定操作选项,例如
恢复时使用 `etcdctl` 选项的另一个示例
```shell
ETCDCTL_API=3 etcdctl snapshot restore --data-dir <data-dir-location> snapshotdb
ETCDCTL_API=3 etcdctl snapshot restore --data-dir <data-dir-location> snapshot.db
```
<!--
Yet another example would be to first export the environment variable
where `<data-dir-location>` is a directory that will be created during the restore process.
Yet another example would be to first export the `ETCDCTL_API` environment variable
-->
另一个例子是先导出环境变量:
其中 `<data-dir-location>` 是将在恢复过程中创建的目录。
另一个例子是先导出 `ETCDCTL_API` 环境变量:
```shell
export ETCDCTL_API=3
etcdctl snapshot restore --data-dir <data-dir-location> snapshotdb
etcdctl snapshot restore --data-dir <data-dir-location> snapshot.db
```
<!--
@ -736,3 +740,12 @@ you perform defragmentation, you use a tool such as [etcd-defrag](https://github
Kubernetes 项目建议在执行碎片整理时,
使用诸如 [etcd-defrag](https://github.com/ahrtr/etcd-defrag) 之类的工具。
{{< /note >}}
<!--
You can also run the defragmentation tool as a Kubernetes CronJob, to make sure that
defragmentation happens regularly. See [`etcd-defrag-cronjob.yaml`](https://github.com/ahrtr/etcd-defrag/blob/main/doc/etcd-defrag-cronjob.yaml)
for details.
-->
你还可以将碎片整理工具作为 Kubernetes CronJob 运行,以确保定期进行碎片整理。
有关详细信息,请参阅
[`etcd-defrag-cronjob.yaml`](https://github.com/ahrtr/etcd-defrag/blob/main/doc/etcd-defrag-cronjob.yaml)。