It is recommended that you use a connection service file. Refer to "11.2.4 Using a Connection Service File" for details.
If a connection service file will not be used, specify the following information in the psql command option/environment variable.
Option (environment variable) | Explanation |
---|---|
-h/--host(PGHOST/PGHOSTADDR) | Specify IP address 1 and IP address 2, or the host name, using a comma as the delimiter. |
-p/--port(PGPORT) | Specify the connection destination port numbers, using a comma as the delimiter. Specify the port number corresponding to the IP address specified for the nth -h option as the nth -p option. The port number can be omitted. If omitted, the default is 26500. If n -h options are specified, the (n+1)th and later -p options will be ignored. |
(PGXTARGETSERVER) | Specify the selection sequence of the servers to which the application will connect. |
(PGSSLMODE) | Specify this to encrypt communications. By default, this is disabled. disable: Connect without SSL allow: Connect without SSL, and if it fails, connect with SSL prefer: Connect with SSL, and if it fails, connect without SSL require: Connect always with SSL verify-ca: Connect with SSL, using a certificate issued by a trusted CA (*1) verify-full: Connect with SSL, using a certificate issued by a trusted CA to verify if the server host name matches the certificate (*1) |
(PGXSSLSERVERCERTCN) | This environment variable is enabled only to perform SSL authentication (PGSSLMODE=verify-full). Specify the server certificate CN. If this is omitted, the value will be null, and the server certificate CN will be authenticated using the host name specified in host. |
*1: If specifying either "verify-ca" or "verify-full", use the system environment variable PGSSLROOTCERT (connection parameter sslrootcert) of your operating system to specify the CA certificate file as shown below.
Example)
Variable name: PGSSLROOTCERT
Variable value: cACertificateFile
Note
If using the connection parameter connect_timeout, this value is applied for connections to each of the specified hosts. If both multiplexed database servers have failed, the connection will time out when a time equal to double the connect_timeout value elapses.
Information
Use the same method as for psql commands to specify connection destination server information for other client commands used to specify connection destinations.