The cloud migration feature of ApsaraDB RDS for PostgreSQL allows you to migrate the data of a self-managed PostgreSQL instance from an Elastic Compute Service (ECS) instance or a data center to an ApsaraDB RDS for PostgreSQL instance. This topic describes how to configure the postgresql.conf file of the self-managed PostgreSQL instance before a cloud migration to allow remote connections to the self-managed PostgreSQL instance.

Procedure

Note In this topic, the self-managed PostgreSQL instance and the ApsaraDB RDS for PostgreSQL instance run PostgreSQL 13 in the CentOS 7 operating system.
  1. Connect to the self-managed PostgreSQL instance to check whether the self-managed PostgreSQL instance listens to remote connections.
    SHOW listen_addresses;
    The following or similar command output is displayed:
     listen_addresses
    ------------------
     *
    (1 row)
  2. Stop the PostgreSQL database service.
    Note Only the postgres user can run the following command. You can run the su - postgres command to switch to the postgres user.
    /usr/pgsql-13/bin/pg_ctl stop -m fast
  3. Find the postgresql.conf file.
    Note Only the root user can run the following command.
    find / -name postgresql.conf
    The following or similar command output is displayed:
    /var/lib/pgsql/13/data/postgresql.conf
  4. Open the directory in which the postgresql.conf file is stored.
    cd /var/lib/pgsql/13/data/
  5. Run the vim postgresql.conf command to enable the edit mode. Then, change the value of the listen_addresses parameter in the postgresql.conf file to *.
    listen_addresses = '*'
    Note The listen_addresses parameter is commented out by default. After you modify the postgresql.conf file, you must delete the number sign (#) at the beginning of the line in which the parameter resides.
  6. Press ECS and enter :wq to save the postgresql.conf file and exit.
  7. Start the PostgreSQL database service.
    Note Only the postgres user can run the following command. You can run the su - postgres command to switch to the postgres user.
    /usr/pgsql-13/bin/pg_ctl start

What to do next

Create an account for cloud migration on a self-managed PostgreSQL instance