cancel
Showing results for 
Search instead for 
Did you mean: 

Moving a Database from a CDS Free Trial Console to a CDS Paid/Production Console

Moving a Database from a CDS Free Trial Console to a CDS Paid/Production Console

 

How exciting it must be to create a database cluster under a CDS Free Trial offer and really experience EDB's Cloud Database Service, or to do a POC and be fully confident your database is working well with an application!

 

As you may be aware, any cluster created under CDS Free Trial offer will be live for 48 hrs from the time it spins up. However, if you would like to retain your data or would like to move your database to a more permanent state (CDS Paid Console), how could you possibly do that?

 

Below is a solution that will guide you in moving data from a CDS Free Trial console to your CDS Paid Console using logical backup(pg_dump) and restore(pg_restore) command. It's an offline method and may require downtime to migrate the data.

Note:

  • For the ability to create a cluster on the CDS Paid Console, please update the Billing section located under the Accounts tab which grants you access to the CDS Paid Console available on additional regions.
  • Once you create a cluster on the CDS Paid Console, you can then migrate the existing data from the CDS Free Trial cluster to the desired cluster.

 

Environment/Setup Details

 

Source Database [Cloud (Public/Private) Or on-prem Instance ]

Postgres V11 on Centos 7

IP: 3.86.118.158

In order to test, I created 5 tables and inserted sample data.

 

Screen Shot 2019-02-12 at 4.59.55 PM.png

Target Database [CDS Instance on Paid/Production Console]

Postgres V11 on CentOS 7

IP: 34.231.11.192

 

Migration Steps From CDS Free Trial to CDS Paid Console

 

Step 1: Spin up an EC2 instance in cloud or provision a machine in your own data center. I have used CentOS 7 for my testing in AWS.

 

Step 2: Connect to the machine and install Postgres client (you don't have to create a database).

 

Step 3: Configure a YUM Repository.

Please configure the PostgreSQL repository in your system by using below command for CentOS 7:

rpm -Uvh https://yum.postgresql.org/11/redhat/rhel-7-x86_64/pgdg-centos11-11-2.noarch.rpm

 

Step 4: Install PostgreSQL 11 on CentOS

After enabling PostgreSQL YUM repository in your system, use the following command to install PostgreSQL 11 on your system with YUM Package Manager.

yum install postgresql11-server

 

Step 5: Switch to Postgres user "sudo su - postgres"

 

Step 6: Performing Backup

Execute below command to take a logical backup of the Source Database (Postgres V11)

./pg_dump -h <Host> -p <Port> -d <Database> -U <DBUser> -Fc -f <Filename>

./pg_dump -h 3.86.118.158 -p 9999 -d postgres -U postgres -Fc -f /tmp/backup_source.dmp

 

Step 7: Performing Restore

Execute the below command to restore the logical backup reference in the previous step to the target Database (Postgres V11).

./pg_restore -h <Host> -p <Port> -d <Database> -U <DBUser>  <Filename>

./pg_restore -h 3.95.89.192 -p 9999 -d postgres -U postgres /tmp/backup_source.dmp

 

Step 8: Data Validation:

This is necessary so we can we can verify that the number of rows in the table is the same as the source.

 

Screen Shot 2019-02-12 at 5.00.09 PM.png

 

I hope this is helpful. If you have any question regarding migration or the related solution, please feel free to comment or send an email to

cds-help@enterprisedb.com

 

Version history
Revision #:
10 of 10
Last update:
‎02-12-2019 05:15 PM
Updated by:
 
Labels (1)
Contributors