Before using the cloud migration feature to migrate data from a self-managed PostgreSQL instance to ApsaraDB RDS for PostgreSQL, open the PostgreSQL port on the server firewall so that the migration service can connect to the source database.
The steps in this topic apply to CentOS. For other operating systems, refer to the official documentation for that OS.
Prerequisites
Before you begin, ensure that you have:
Access to the server on which the self-managed PostgreSQL instance runs
Root or sudo privileges on the server
Open the PostgreSQL port
The default PostgreSQL port is 5432. If your instance uses a different port, replace 5432 with the actual port number in the commands below.
CentOS 7
Connect to the server.
Check which ports are currently open:
firewall-cmd --list-portsOpen TCP port 5432 to allow inbound connections from the migration service:
firewall-cmd --zone=public --add-port=5432/tcp --permanentReload the firewall to apply the change:
firewall-cmd --reloadConfirm the port is now listed as open:
firewall-cmd --list-portsThe output should include
5432/tcp.
CentOS 6 or earlier
Connect to the server.
Check which ports are currently open:
/etc/init.d/iptables statusOpen port 5432 to allow inbound TCP connections:
/sbin/iptables -I INPUT -p tcp --dport 85432 -j ACCEPTRestart the firewall to apply the change:
service iptables restart
Alternative: disable the firewall
If opening a specific port is not practical, you can disable the firewall before the migration.
Disabling the firewall exposes the server to all inbound traffic. Re-enable it after the migration is complete.
CentOS 7:
systemctl stop firewalld.serviceCentOS 6 or earlier:
service iptables stop