Quick Start

Connect with psql to your PostgreSQL

To connect to your DB instance with psql, you need to retrieve your credentials:

exo dbaas -z de-fra-1 show test-pg --uri

postgres://avnadmin:xxxxx@test-pg-exoscale-980a712f-5c76-4ec4-a3bc-4e4e442deef2.aivencloud.com:21699/defaultdb?sslmode=require

The status of your DB instance should have changed from rebuilding after the create command to running. To check:

exo dbaas show test-pg -z de-fra-1

┼───────────────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼
│   DATABASE SERVICE    │                                                                                                                                │
┼───────────────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼
│ Zone                  │ de-fra-1                                                                                                                       │
│ Name                  │ test-pg                                                                                                                        │
│ Type                  │ pg                                                                                                                             │
│ Plan                  │ hobbyist-2                                                                                                                     │
│ Disk Size             │ 8.0 GiB                                                                                                                        │
│ State                 │ rebuilding                                                                                                                     │
│ Creation Date         │ 2022-06-09 08:26:13 +0000 UTC                                                                                                  │
│ Update Date           │ 2022-06-09 08:27:25 +0000 UTC                                                                                                  │
│ Nodes                 │ 1│ Node CPUs             │ 2│ Node Memory           │ 2.0 GiB                                                                                                                        │
│ Termination Protected │ true│ Maintenance           │ sunday (11:52:43)│ Version               │ 14│ Backup Schedule       │ 08:19                                                                                                                          │
│ URI                   │ postgres://avnadmin:xxxxx@test-pg-exoscale-980a712f-5c76-4ec4-a3bc-4e4e442deef2.aivencloud.com:21699/defaultdb?sslmode=require │
│ IP Filter             │ 1.2.3.4/32                                                                                                                     │
│ Components            │                                                                                                                                │
│                       │   pg          test-pg-exoscale-980a712f-5c76-4ec4-a3bc-4e4e442deef2.aivencloud.com:21699   route:dynamic   usage:primary       │
│                       │   pgbouncer   test-pg-exoscale-980a712f-5c76-4ec4-a3bc-4e4e442deef2.aivencloud.com:21700   route:dynamic   usage:primary       │
│                       │                                                                                                                                │
│ Users                 │ n/a                                                                                                                            │
┼───────────────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼

You can now connect to the database engine:

psql postgres://avnadmin:xxxxx@test-pg-exoscale-980a712f-5c76-4ec4-a3bc-4e4e442deef2.aivencloud.com:21699/defaultdb?sslmode=require

psql (9.2.24, server 14.3)
WARNING: psql version 9.2, server version 14.0.
         Some psql features might not work.
SSL connection (cipher: ECDHE-RSA-AES256-GCM-SHA384, bits: 256)
Type "help" for help.

defaultdb=> \l
                                  List of databases
   Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
 _aiven    | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =T/postgres          +
           |          |          |             |             | postgres=CTc/postgres
 defaultdb | avnadmin | UTF8     | en_US.UTF-8 | en_US.UTF-8 |
 template0 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
 template1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
(4 rows)

defaultdb=>

Performing data migration

To perform the migration, you can either use the portal or the Exoscale CLI, depends on when the action it’s performed and if the service receiving the migration already exists or not.

Run the following command to create a new service and start the migration immediately:

exo dbaas create pg business-4 target-postgresql-service-name --pg-ip-filter 0.0.0.0/0 --pg-migration-host x.x.x.x --pg-migration-port 5432 --pg-migration-username xxxxx --pg-migration-password xxxxx --pg-migration-method replication --pg-migration-ssl false --pg-migration-dbname xxxxx
  • target-PostgreSQL-service-name : Target DBaaS Service Name
  • –pg-migration-host : the IP address of your source PostgreSQL server
  • –pg-migration-port : the port on which your source PostgreSQL server is reachable
  • –pg-migration-username : username on your source PostgreSQL server
  • –pg-migration-password : password on your source PostgreSQL server
  • –pg-migration-method : the chosen method for migration, which could be replication or dump method.

In case the PostgreSQL service is already created, you can run the command below:

exo dbaas update --pg-migration-host x.x.x.x --pg-migration-port 5432 --pg-migration-username xxxxx --pg-migration-password xxxxx --pg-migration-method dump target-postgresql-service-name

To check status of our migration we can run command:

exo dbaas migration status target-postgresql-service-name

And if we want to stop the running migration:

exo dbaas migration stop target-postgresql-service-name

NOTE - Ensure you are using at least version 1.53.0 of the Exoscale CLI.