Due to the complexity and diversity of the network, the user may not be able to correctly locate the IP address of the local client which should be add in the instance whitelist. This article describes how to view the IP of a local client.
Here is an example to denote the detailed steps of the operation.
0.0.0.0/0to the whitelist of the AnalyticDB for PostgreSQL instance.
- Log on to the AnalyticDB for PostgreSQL console.
Select the region where the target instance is located.
Click the ID of the instance to go to the Basic Information page of the instance.
In the left-side navigation pane, click Security Controls.
In the Whitelist Settings page, click Modify under the default whitelist group to go to the Modify Group page.
- Delete the default address 127.0.0.1 from the whitelist and then add
0.0.0.0/0to the whitelist.Note The
0.0.0.0/0address which allows any IP to access the database involves a high security risk, and this configuration should be deleted as soon as possible.
Click OK to finish the operation.
- Connect to the AnalyticDB for PostgreSQL instance using a local client. See Connect to a HybridDB for PostgreSQL database to download and install the psql client. Issue the following statement to connect to the database:
psql -h yourgpdbaddress.gpdb.rds.aliyuncs.com -p 3432 -d postgres -U gpdbaccount
Parameter descriptions are as follows:
- -h: specifies the host address.
- -p: specifies the port number.
- -d: specifies the database (the default database is postgres).
-U: specifies the connected user.
You can view more parameters by performing
psql-- help. And in the psql prompt, you can view more supported psql commands by performing
- Run the following statement in the SQL command line window in the database to query the IP address of the local client.
select * from pg_stat_activity;
The value in the CLIENT_ADDR of the query result is the IP address of the local client.
0.0.0.0/0from the whitelist, and add the IP address in the previous step to access the database with a client.