Set the following information in the connection string of NpgsqlConnection, or in the data source.
Argument | Explanation |
---|---|
host1 | Specify the IP address or host name. |
port1 | Specify the port number for the connection. |
targetServer | Specify the selection sequence of the servers to which the application will connect. |
Specify the following connection string:
host1[:port1],host2[:port2];[targetServer={primary | prefer_standby }];
If the port number is omitted, the value specified for the Port keyword of the connection string will be used. Refer to "4.3.4 Connection String" for information on the Port keyword.
If the target server is omitted, the value will be primary.
When using IPV6, specify the host in the "[host]" (with square brackets) format.
[Example]
host=[2001:Db8::1234]:26500,192.168.1.1:26500;
Specify the Host property of the data source in the following format:
host1[:port1],host2[:port2]
If the port number is omitted, the value specified in the Port property will be used. Also, if the Port property is omitted, the default is 26500.
Specify the TargetServer property of the data source in the following format:
TargetServer.primary | TargetServer.prefer_standby
If the target server is omitted, the value will be primary.
Note
If using the connection parameter 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 Timeout value elapses.