You cannot find the IP address of your computer or add it to an IP address whitelist of your AnalyticDB for PostgreSQL instance.
- Follow these steps to add
0.0.0.0/0to an IP address whitelist of your AnalyticDB for PostgreSQL instance:
- Log on to the AnalyticDB for PostgreSQL console.
- In the top navigation bar, select the region where the target instance resides.
- Find the target instance and click its ID. The Basic Information page appears.
In the left-side navigation pane, click Security Controls. The Security Controls page appears.
- On the Whitelist Settings tab, find the IP address whitelist labeled default and click Modify to its right. The Modify Group dialog box appears.
- In the White List field, delete the IP address 127.0.0.1 and enter
0.0.0.0/0indicates that all entities are allowed to access the instance. However, this is risky, so we recommend that you delete it after you no longer need it.
- Click OK.
- Install the psql CLI client. For more information, see Connect to an AnalyticDB for PostgreSQL instance. Then, run the following command to connect your computer to a database on the instance:
psql -h yourgpdbaddress.gpdb.rds.aliyuncs.com -p 3432 -d postgres -U gpdbaccount
- -h: the host address used to connect to the database.
- -p: the port used to connect to the database.
- -d: the name of the database. The default database is postgres.
- -U: the account used to connect to the database.
- You can run the
psql --helpcommand to view more options. You can also run the
\?command to view more commands supported by the psql CLI client.
- After you connect to the database, run the following command in the SQL window to
query the IP address of your computer:
select * from pg_stat_activity;The value of the CLIENT_ADDR field is the IP address of your computer.
- In the AnalyticDB for PostgreSQL console, delete
0.0.0.0/0from the default IP address whitelist and enter the IP address of your computer.