iagctl db migrate local-to-etcd

Migrate data from a local database to an etcd database.

The iagctl db migrate local-to-etcd command moves data from the local database at GATEWAY_APPLICATION_WORKING_DIR/gateway.db to the etcd database at GATEWAY_STORE_ETCD_HOSTS.

Before you run this command, verify that all GATEWAY_STORE_ETCD_* configuration variables are set correctly. The gateway prefixes all migrated database keys with the cluster ID set by GATEWAY_APPLICATION_CLUSTER_ID. For example, a Python script record has a key that resembles gateway/cluster_1/services/v1/python-script/my-script.

For more information, see Configure etcd database.

Syntax

$iagctl db migrate local-to-etcd [flags]

Examples

Migrate non-conflicting records

The following example moves records from the local database to etcd. If a record with the same key already exists in etcd, the gateway skips it to avoid overwriting existing data:

$iagctl db migrate local-to-etcd

Migrate all records

The following example moves all records and overwrites any existing records in etcd that have conflicting keys:

$iagctl db migrate local-to-etcd --force

Preview the migration

Use the --check flag to display a report of what the gateway would migrate without moving any data. The report shows which records the gateway would skip or replace depending on whether you include --force:

$iagctl db migrate local-to-etcd --check
$iagctl db migrate local-to-etcd --check --force

Options

$ --check Display a report of what data would migrate without making changes.
$ --force Replace conflicting records that already exist in the etcd database.
$ -h, --help Help for local-to-etcd

Options inherited from parent commands

$ --config string Path to the configuration file
$ --raw Display the result of the command in raw format
$ --verbose Enable verbose output