1---
2layout: "docs"
3page_title: "operator migrate - Command"
4sidebar_title: "<code>migrate</code>"
5sidebar_current: "docs-commands-operator-migrate"
6description: |-
7  The "operator migrate" command copies data between storage backends to facilitate
8  migrating Vault between configurations. It operates directly at the storage
9  level, with no decryption involved.
10---
11
12# operator migrate
13
14The `operator migrate` command copies data between storage backends to facilitate
15migrating Vault between configurations. It operates directly at the storage
16level, with no decryption involved. Keys in the destination storage backend will
17be overwritten, and the destination should _not_ be initialized prior to the
18migrate operation. The source data is not modified, with the exception of a small lock
19key added during migration.
20
21This is intended to be an offline operation to ensure data consistency, and Vault
22will not allow starting the server if a migration is in progress.
23
24## Examples
25
26Migrate all keys:
27
28```text
29$ vault operator migrate -config migrate.hcl
30
312018-09-20T14:23:23.656-0700 [INFO ] copied key: data/core/seal-config
322018-09-20T14:23:23.657-0700 [INFO ] copied key: data/core/wrapping/jwtkey
332018-09-20T14:23:23.658-0700 [INFO ] copied key: data/logical/fd1bed89-ffc4-d631-00dd-0696c9f930c6/31c8e6d9-2a17-d98f-bdf1-aa868afa1291/archive/metadata
342018-09-20T14:23:23.660-0700 [INFO ] copied key: data/logical/fd1bed89-ffc4-d631-00dd-0696c9f930c6/31c8e6d9-2a17-d98f-bdf1-aa868afa1291/metadata/5kKFZ4YnzgNfy9UcWOzxxzOMpqlp61rYuq6laqpLQDnB3RawKpqi7yBTrawj1P
35...
36```
37
38Migration is done in a consistent, sorted order. If the migration is halted or
39exits before completion (e.g. due to a connection error with a storage backend),
40it may be resumed from an arbitrary key prefix:
41
42```text
43$ vault operator migrate -config migrate.hcl -start "data/logical/fd"
44```
45
46## Configuration
47
48The `operator migrate` command uses a dedicated configuration file to specify the source
49and destination storage backends. The format of the storage stanzas is identical
50to that used to [configure Vault](/docs/configuration/storage/index.html),
51with the only difference being that two stanzas are required: `storage_source` and `storage_destination`.
52
53```hcl
54storage_source "mysql" {
55  username = "user1234"
56  password = "secret123!"
57  database = "vault"
58}
59
60storage_destination "consul" {
61  address = "127.0.0.1:8500"
62  path    = "vault"
63}
64```
65
66## Usage
67
68The following flags are available for the `operator migrate` command.
69
70- `-config` `(string: <required>)` - Path to the migration configuration file.
71
72- `-start` `(string: "")` - Migration starting key prefix. Only keys at or after this value will be copied.
73
74- `-reset` - Reset the migration lock. A lock file is added during migration to prevent
75  starting the Vault server or another migration. The `-reset` option can be used to
76  remove a stale lock file if present.
77