pgpool-II 4.1.4 Documentation
Prev | Up | Chapter 5. Server Configuration | Next

# 5.11. Streaming Replication Check

Pgpool-II can work with PostgreSQL native Streaming Replication, that is available since PostgreSQL 9.0. To configure Pgpool-II with streaming replication, enable master_slave_mode and set master_slave_sub_mode to `'stream'`.

Pgpool-II assumes that Streaming Replication is configured with Hot Standby on PostgreSQL, which means that the standby database can handle read-only queries.

`sr_check_period` (`integer`)

  Specifies the time interval in seconds to check the streaming replication delay. Default is 0, which means the check is disabled.

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

`sr_check_user` (`string`)

  Specifies the PostgreSQL user name to perform streaming replication check. The user must have LOGIN privilege and exist on all the PostgreSQL backends.

  > Note: sr_check_user and sr_check_password are used even when sr_check_period is set to 0 (disabled) for the identification of the primary server.

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

`sr_check_password` (`string`)

  Specifies the password of the sr_check_user PostgreSQL user to perform the streaming replication checks. Use `''` (empty string) if the user does not requires a password.

  If `sr_check_password` is left blank Pgpool-II will first try to get the password for sr_check_user from pool_passwd file before using the empty password.

  Pgpool-II accepts following forms of password in either `sr_check_password` or pool_passwd file:

  AES256-CBC encrypted password

    Most secure and recommended way to store password. The password string must be prefixed with `AES`. You can use pg_enc utility to create the correctly formatted `AES` encrypted password strings. Pgpool-II will require a valid decryption key at the startup to use the encrypted passwords. see Section 6.4.2 for more details on providing the decryption key to Pgpool-II

  MD5 hashed password

    Not so secure as AES256, but still better than clear text password. The password string must be prefixed with `MD5`. Note that the backend must set up MD5 authentication as well. You can use pg_md5 utility to create the correctly formatted `MD5` hashed password strings.

  Plain text password

    Not encrypted, clear text password. You should avoid to use this if possible. The password string must be prefixed with `TEXT`. For example if you want to set `mypass` as a password, you should specify `TEXTmypass` in the password field. In the absence of a valid prefix, Pgpool-II will considered the string as a plain text password.

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

`sr_check_database` (`string`)

  Specifies the database to perform streaming replication delay checks. The default is `"postgres"`.

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

`delay_threshold` (`integer`)

  Specifies the maximum tolerance level of replication delay in WAL bytes on the standby server against the primary server. If the delay exceeds this configured level, Pgpool-II stops sending the SELECT queries to the standby server and starts routing everything to the primary server even if load_balance_mode is enabled, until the standby catches-up with the primary. Setting this parameter to 0 disables the delay checking. This delay threshold check is performed every sr_check_period. Default is 0.

  This parameter can be changed by reloading the Pgpool-IIconfigurations.

`log_standby_delay` (`string`)

  Specifies when to log the replication delay. Below table contains the list of all valid values for the parameter.

  Table 5-9. Log standby delay options

  Value | Description
  --- | ---
  `'none'` | Never log the standby delay
  `'always'` | Log the standby delay, every time the replication delay is checked
  `'if_over_threshold'` | Only log the standby delay, when it exceeds delay_threshold value

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

Prev | Home | Next
Online Recovery | Up | In Memory Query Cache