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>@<domain name>:26257/ > <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/ > /data/cockroachdump-20181228.sql

2. Import data into CockroachDB deployment

Execute command

 cockroach sql --certs-dir=<certs-dir> --url=postgresql://<dbuser>:<dbpassword>@<domain name>:26257/<database_name> < <backup file path>

to import all data in the above backup file into CockroachDB deployment. 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 01/19/2021

results matching ""

    No results matching ""