DEV Community

tongxi
tongxi

Posted on

openGauss Configuring Remote Connection

Before the remote connection, you need to enable the client to access the database and configure the remote connection on the server where the database primary node is deployed.

Procedure
Perform the following steps on the host where openGauss resides.

Log in as the OS user omm to the primary node of the database.

Configure the client authentication mode. For details, see Configuring Client Access Authentication.

Configure listen_addresses. listen_addresses indicates the IP address or host name of the database primary node used for remote client connection.

Run the following command to check the listen_addresses value of the primary database node:

""
gs_guc check -I all -c "listen_addresses"
Information similar to the following is displayed:

""
expected guc information: plat1: listen_addresses=NULL: [/gaussdb/data/data_cn/postgresql.conf]
gs_guc check: plat1: listen_addresses='localhost, 192.168.0.100': [/gaussdb/data/data_cn/postgresql.conf]

Total GUC values: 1. Failed GUC values: 0.
The value of parameter listen_addresses is same on all instances.
listen_addresses='localhost, 192.168.0.100'
Run the following command to append the IP addresses to be added to listen_addresses. Use commas (,) to separate multiple IP addresses. For example, add the IP address 10.11.12.13.

""
gs_guc set -I all -c "listen_addresses='localhost,192.168.0.100,10.11.12.13'"
Configure pg_hba.conf and add the IP address of the primary database node and the IP address of the client. For details about the parameters in pg_hba.conf, see Configuring Client Access Authentication.

Run the following command to add the IP address of the primary database node to pg_hba.conf. In the command, initial_user indicates the initial user name of the database, and 10.11.12.13 is the IP address of the host where the database resides.

""
gs_guc reload [-Z datanode] -N all -I all -h "host all initial_user 10.11.12.13/32 trust"
Run the following command to add the IP address of the client to pg_hba.conf. If the IP address is 10.11.12.34, the authentication mode is SHA-256.

""
gs_guc reload [-Z datanode] -N all -I all -h "host all all 10.11.12.34/32 sha256"
Run the following command to restart openGauss:

""
gs_om -t stop && gs_om -t start

Top comments (0)