Skip to content

Commit 0b800f9

Browse files
committed
fix: Fix v2store and v3store
Signed-off-by: Wendy Ha <[email protected]>
1 parent d2bd6c9 commit 0b800f9

File tree

1 file changed

+23
-19
lines changed

1 file changed

+23
-19
lines changed

content/en/docs/v3.4/how-to-migrate.md

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
11
---
2-
title: How to migrate etcd from v2 store to v3
2+
title: How to migrate etcd from v2store to v3store
33
description: etcd v2 to v3 migration guide
44
weight: 1200
55
---
66

7-
`migrate` to transform etcd v2 to v3 data.
7+
`migrate` to transform etcd v2store to v3store.
88

99
{{% alert color="warning" %}}
1010
⚠️ **Deprecated functionality:**
1111

12-
The `etcdctl migrate` command was removed in etcd v3.5.0 ([pull/12971](https://github.com/etcd-io/etcd/pull/12971)). If your etcd cluster is already running v3.5 or higher, you can no longer migrate v2 data to v3 using this method.
12+
The `etcdctl migrate` command was removed in etcd v3.5.0 ([pull/12971](https://github.com/etcd-io/etcd/pull/12971)). If your etcd cluster is already running v3.5 or higher, you can no longer migrate v2store to v3store using this method.
1313

1414
You **must use etcdctl v3.4 or earlier** to perform the migration (View note from [CHANGELOG-3.5](https://github.com/ahrtr/etcd/blob/main/CHANGELOG/CHANGELOG-3.5.md#etcdctl-v3-3)). However please take appropriate precautions when using it, as it is no longer officially supported or tested in recent releases.
1515
{{% /alert %}}
1616

1717
## Pre-requisites
1818

19-
Before migrating from etcd v2 to v3, ensure the following:
19+
Before migrating from etcd v2store to v3store, make sure you have:
2020

21-
- A currently running etcd v2 cluster.
22-
- The `etcdctl` CLI tool version <= v3.4.
21+
- An etcd cluster that still contains v2store data.
22+
- The `etcdctl` CLI version 3.4 or earlier.
2323
- Access to each etcd node and their data directories.
2424
- A working backup of your etcd data before performing the migration.
2525

2626
## Migrate a cluster
2727

28-
The following steps show how to migrate your etcd data from v2 to v3 using `etcdctl migrate`.
28+
The following steps show how to migrate your etcd data stored from v2store to v3store using `etcdctl migrate`.
2929

3030
### Variables and Flags Used
3131

3232
- `--endpoints`: Specifies the etcd cluster endpoint(s).
3333
- `--output`: Output format (e.g., `"json"`).
3434
- `--data-dir`: Path to the data directory (default: `default.etcd`). View more at [etcd flags](https://etcd.io/docs/v3.6/op-guide/configuration/#member).
35-
- `--wal-dir`: The write-ahead log directory inside `data-dir` (default: `default.etcd/member/wal`). View more at [etcd flags](https://etcd.io/docs/v3.6/op-guide/configuration/#member).
36-
- `set`: Command to set a key-value pair in etcd v2 (View [READMEv2](https://github.com/etcd-io/etcd/blob/main/etcdctl/READMEv2.md#setting-key-values) for more details. In etcd v3, the equivalent command is `put` instead of `set`, see the [READMEv3](https://github.com/etcd-io/etcd/tree/main/etcdctl#key-value-commands)) for reference.
35+
- `--wal-dir`: The write-ahead log (WAL) directory inside `data-dir` (default: `default.etcd/member/wal`). View more at [etcd flags](https://etcd.io/docs/v3.6/op-guide/configuration/#member).
36+
- `set`: Command to set a key-value pair in etcd v2store (View [READMEv2](https://github.com/etcd-io/etcd/blob/main/etcdctl/READMEv2.md#setting-key-values) for more details. In etcd v3, the equivalent command is `put` instead of `set`, see the [READMEv3](https://github.com/etcd-io/etcd/tree/main/etcdctl#key-value-commands)) for reference.
3737
- `get`: Command to retrieve a key-value pair (View [Read keys](https://etcd.io/docs/v3.6/dev-guide/interacting_v3/#read-keys)).
3838

3939
### Migration Process
4040

41-
- Step 1: Set up test key using v2 API
41+
- Step 1: Write a test key into the v2store and confirm that key exists
4242

4343
```sh
4444
export ETCDCTL_API=2
@@ -50,9 +50,9 @@ etcdctl --endpoints=http://$ENDPOINT --output="json" get foo
5050

5151
Before running the migration, stop your etcd node to ensure data consistency.
5252

53-
- Step 3: Run the migration tool
53+
- Step 3: Run the migration tool to convert v2store to v3store
5454

55-
Switch to API v3 and use `etcdctl migrate` command to transform the v2 store. Please review the deprecation alert on top of the page, you must use etcdctl v3.4 or earlier to be able to perform this command.
55+
Switch to v3 API and use `etcdctl migrate` command to transform the v2store data into v3store. Please review the deprecation alert on top of the page, you must use etcdctl v3.4 or earlier to be able to perform this command.
5656

5757
```sh
5858
export ETCDCTL_API=3
@@ -65,31 +65,35 @@ etcdctl --endpoints=http://$ENDPOINT migrate \
6565

6666
Repeat steps 2–4 for each etcd node one at a time in your cluster.
6767

68-
- Step 5: Confirm the data is accessible via v3 API
68+
- Step 5: Confirm the key is now stored in v3store
69+
70+
Use the v3 API to check:
6971

7072
```sh
7173
etcdctl --endpoints=$ENDPOINTS get /foo
7274
```
7375

76+
If the migration succeeded, you should see the value previously stored in v2store.
77+
7478
Summary full process:
7579

7680
```shell
77-
# write key in etcd version 2 store
81+
# Write key in etcd version 2store
7882
export ETCDCTL_API=2
7983
etcdctl --endpoints=http://$ENDPOINT set foo bar
8084

81-
# read key in etcd v2
85+
# Confirm key exists in v2store
8286
etcdctl --endpoints=$ENDPOINTS --output="json" get foo
8387

84-
# stop etcd node to migrate, one by one
88+
# Stop etcd node to migrate, one by one
8589

86-
# migrate v2 data
90+
# Migrate v2store to v3store
8791
export ETCDCTL_API=3
8892
etcdctl --endpoints=$ENDPOINT migrate --data-dir="default.etcd" --wal-dir="default.etcd/member/wal"
8993

90-
# restart etcd node after migrate, one by one
94+
# Restart etcd node after migrate, one by one and repeat the previous process for each node.
9195

92-
# confirm that the key got migrated
96+
# Confirm the key was migrated into v3store
9397
etcdctl --endpoints=$ENDPOINTS get /foo
9498
```
9599

0 commit comments

Comments
 (0)