Migrate Data into CockroachDB Deployment

If you would like to migrate your data into CockroachDB deployment, the following steps may help you clear the obstacles in the migration process.

1.Export data from source instance

Connect the source instance from an authorized account and export data from the source instance by executing the command![]

  cockroach dump <database_name> --certs-dir=<certs-dir> --url=postgresql://<dbuser>:<dbpassword>@<host>:<port>/ > <backup file path>

Take the following command as an example to export your database and generate a backup file named cockroachdump-20181228.sql.

 cockroach dump testdb --certs-dir=/cockroach/cert --url=postgresql://root:passwd@cockroachdb-647.cloudclusters.net:26257/ > ./cockroachdump-20181228.sql

2. Import data into CockroachDB deployment

You can import the backup file by executing the command below.

 cockroach sql --certs-dir=<certs-dir> --url=postgresql://<dbuser>:<dbpassword>@<host>:<port>/<database_name> < <backup file path>

Please make sure to replace <certs-dir>, <dbpassword>, <host>, <port>, <database_name>, <backup file path> with your own data.

For instance:

  • This is an example command if you import your backups through Cloud Clusters web shell. Before taking the command, you need to upload the backup file to Cloud Clusters so you can get the actual backup file path. If you need guide on the topic, please refer to Transferring Data using FTPS.
cockroach sql --certs-dir=/cockroach-certs/ --url=postgresql://root:passwd@ < /data/cockroachdump-20181228.sql
  • If you import backups through outsite of Cloud Clusters platform, take the following command as an example to import your data.
cockroach sql --certs-dir=/cockroach/cert --url=postgresql://root:passwd@cockroachdb-647.cloudclusters.net:26257/testdb < /data/cockroachdump-20181228.sql
Copyright © 2021 Cloud Clusters Inc. all right reserved,powered by GitbookRevised on 06/15/2022

results matching ""

    No results matching ""