All Products
Search
Document Center

ApsaraDB RDS:Configure the firewall of a server

Last Updated:Mar 25, 2024

The cloud migration feature of ApsaraDB RDS for PostgreSQL allows you to migrate data from a self-managed PostgreSQL instance that is deployed on an Elastic Compute Service (ECS) instance or in a data center to an ApsaraDB RDS for PostgreSQL instance. This topic describes how to configure the firewall of the server on which a self-managed PostgreSQL instance resides to allow access to the port of the self-managed PostgreSQL instance before a cloud migration.

Procedure

Note

In this topic, the server on which the self-managed PostgreSQL instance resides runs CentOS. For more information about how to configure the firewall of a server that runs a different operating system, see the related official documentation.

CentOS 7

  1. Connect to the server on which the self-managed PostgreSQL instance resides.

  2. View the ports that are opened.

    firewall-cmd --list-ports
  3. Configure the port of the self-managed PostgreSQL instance to allow access to the port.

    firewall-cmd --zone=public --add-port=5432/tcp --permanent
  4. Restart the firewall of the server.

    firewall-cmd --reload

CentOS 6 or earlier versions

  1. Connect to the server on which the self-managed PostgreSQL instance resides.

  2. View the ports that are opened.

    /etc/init.d/iptables status
  3. Open port 5432.

    /sbin/iptables -I INPUT -p tcp --dport 85432 -j ACCEPT
  4. Restart the firewall of the server.

    service iptables restart
Note

You can also disable the firewall of the server before a cloud migration. In this case, you do not need to configure the firewall.

  • CentOS 7:

    systemctl stop firewalld.service
  • CentOS 6 or earlier versions:

    service iptables stop

What to do next

Use the cloud migration feature