5.4. Backend Settings

5.4.1. Backend Connection Settings

backend_hostname (string)

backend_hostname specifies the PostgreSQL backend to be connected to. It is used by Pgpool-II to communicate with the server.

For TCP/IP communication, this parameter can take a hostname or an IP address. If this begins with a slash(/), it specifies Unix-domain communication rather than TCP/IP; the value is the name of the directory in which the socket file is stored. The default behavior when backend_hostname is empty ('') is to connect to a Unix-domain socket in /tmp.

Multiple backends can be specified by adding a number at the end of the parameter name (e.g.backend_hostname0). This number is referred to as "DB node ID", and it starts from 0. The backend which was given the DB node ID of 0 will be called "main node". When multiple backends are defined, the service can be continued even if the main node is down (not true in some modes). In this case, the youngest DB node ID alive will be the new main node.

Please note that the DB node which has id 0 has no special meaning if operated in streaming replication mode. Rather, you should care about if the DB node is the "primary node" or not. See Section 5.7, Section 5.9, Section 5.11 for more details.

If you plan to use only one PostgreSQL server, specify it by backend_hostname0.

New nodes can be added by adding parameter rows and reloading a configuration file. However, the existing values cannot be updated, so you must restart Pgpool-II in that case.

backend_port (integer)

backend_port specifies the port number of the backends. Multiple backends can be specified by adding a number at the end of the parameter name (e.g. backend_port0). If you plan to use only one PostgreSQL server, specify it by backend_port0.

New backend ports can be added by adding parameter rows and reloading a configuration file. However, the existing values cannot be updated, so you must restart Pgpool-II in that case.

backend_weight (floating point)

backend_weight specifies the load balance ratio of the backends. It may be set to any integer or floating point value greater than or equal to zero. Multiple backends can be specified by adding a number at the end of the parameter name (e.g. backend_weight0). If you plan to use only one PostgreSQL server, specify it by backend_weight0.

New backend_weight can be added in this parameter by reloading a configuration file. However, this will take effect only for new established client sessions. Pgpool-II V2.2.6, V2.3 or later allows updating the values by reloading a configuration file. This is useful if you want to prevent any query sent to standbys to perform some administrative work in streaming replication mode, logical replication mode and slony mode.

5.4.2. Backend Data Settings

backend_data_directory (string)

backend_data_directory specifies the database cluster directory of the backend. Multiple backends can be specified by adding a number at the end of the parameter name (e.g. backend_data_directory0). If you plan to use only one PostgreSQL server, specify it by backend_data_directory0. This parameter is used by online recovery. If you do not use online recovery, you do not need to set it.

New backend data_directory can be added by adding parameter rows and reloading a configuration file. However, the existing values cannot be updated, so you must restart Pgpool-II in that case.

backend_flag (string)

backend_flag controls various backend behavior. Multiple backends can be specified by adding a number at the end of the parameter name (e.g. backend_flag0). If you plan to use only one PostgreSQL server, specify it by backend_flag0.

New backend flags can be added by adding parameter rows and reloading a configuration file. Currently followings are allowed. Multiple flags can be specified by using "|".

Table 5-2. Backend flags

FlagDescription
ALLOW_TO_FAILOVERAllow to failover or detaching backend. This is the default. You cannot specify with DISALLOW_TO_FAILOVER at a same time.
DISALLOW_TO_FAILOVERDisallow to failover or detaching backend This is useful when you protect backend by using HA (High Availability) softwares such as Heartbeat or Pacemaker. You cannot specify with ALLOW_TO_FAILOVER at a same time.
ALWAYS_PRIMARYThis is only useful in streaming replication mode. See Section 3.3.2 about streaming replication mode. If this flag is set to one of backends, Pgpool-II will not find the primary node by inspecting backend. Instead, always regard the node which the flag is set as the primary node. This is useful for systems including Amazon Aurora for PostgreSQL Compatibility which has fixed primary server name. See Section 8.4 for an example settings.

This parameter can be changed by reloading the Pgpool-II configurations.

backend_application_name (string)

backend_application_name specifies the application name of walreceiver, which receives WAL log from primary node. Thus in other than streaming replication mode, this parameter does not need to be set. Also this parameter is required to if you want to show "replication_state" and "replication_sync_state" column in SHOW POOL NODES and pcp_node_info commands.

For example, suppose the primary node is backend0 (its host name is "host0"), the standby node in question is backend1 and the backend_application_name for backend1 is "server1", then primary_conninfo parameter of postgresql.conf should like like:

primary_conninfo = 'host=host0 port=5432 user=postgres application_name='server1''
      

The recovery_1st_stage_command should generate the parameter. See Section 8.2.6.8 for a complete example of the command.

This parameter can be changed by reloading the Pgpool-II configurations.