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.


  1. Add to the whitelist of the AnalyticDB for PostgreSQL instance.
    1. Log on to the AnalyticDB for PostgreSQL console.
    2. Select the region where the target instance is located.

    3. Click the ID of the instance to go to the Basic Information page of the instance.

    4. In the left-side navigation pane, click Security Controls.

    5. In the Whitelist Settings page, click Modify under the default whitelist group to go to the Modify Group page.

    6. Delete the default address from the whitelist and then add to the whitelist.
      Note The address which allows any IP to access the database involves a high security risk, and this configuration should be deleted as soon as possible.
    7. Click OK to finish the operation.

  2. 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 -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 \?.

  3. 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.

  4. Remove from the whitelist, and add the IP address in the previous step to access the database with a client.