Standby Server
hot_standby
Parameter description: Specifies whether to allow connections and queries on a standby server during its recovery.
This parameter is a POSTMASTER parameter. Set it based on instructions provided in Table 1.
- If this parameter is set to on, wal_level must be set to hot_standby or higher. Otherwise, the database startup fails.
- In an HA system, hot_standby cannot be set to off, because this setting can affect other features of the HA system.
- If the hot_standby parameter was disabled and the wal_level parameter was set to a value lower than hot_standby, perform the following operations to ensure that the logs to be replayed on the standby node can be queried on the standby node before enabling the hot_standby parameter again:
- Change the wal_level value of the primary and standby nodes to hot_standby or higher, and restart the instances for the change to take effect.
- Perform the checkpoint operation on the primary node and query the pg_stat_get_wal_senders() function to ensure that the receiver_replay_location value of each standby node is the same as the sender_flush_location value of the primary node. Ensure that the value adjustment of wal_level is synchronized to standby nodes and takes effect, and standby nodes do not need to replay low-level logs.
- Set the hot_standby parameter of the primary and standby nodes to on, and restart the instances for the setting to take effect.
Value range: Boolean
- on indicates that connections and queries are allowed on the standby server during the recovery.
- off indicates that connections and queries are not allowed on the standby server during the recovery.
Default value: on
max_standby_archive_delay
Parameter description: Specifies the wait period before queries on a standby server are canceled when the queries conflict with WAL processing and archiving in hot standby mode. In the current version, the setting does not take effect and is controlled by the max_standby_streaming_delay parameter.
This is a SIGHUP parameter. Set it based on instructions provided in Table 1.
–1 indicates that the standby server waits until the conflicting queries are complete.
Value range: an integer ranging from –1 to INT_MAX. The unit is ms.
Default value: 3s (3000 ms)
max_standby_streaming_delay
Parameter description: Specifies the wait period before queries on a standby server are canceled when the queries conflict with WAL data receiving through streaming replication in hot standby mode. If this parameter is set to a large value or the service load is heavy, an error may be reported for waiting for transaction replay and flushing to disks.
This is a SIGHUP parameter. Set it based on instructions provided in Table 1.
–1 indicates that the standby server waits until the conflicting queries are complete.
Value range: an integer ranging from –1 to INT_MAX. The unit is ms.
Default value: 3s (3000 ms)
wal_receiver_status_interval
Parameter description: Specifies the maximum interval for notifying the primary server of the WAL Receiver status.
This is a SIGHUP parameter. Set it based on instructions provided in Table 1.
Value range: an integer ranging from 0 to INT_MAX. The unit is ms.
Default value: 5s (5000 ms)
If this parameter is set to 0, the standby server does not send information, such as the log receiving location, to the primary server. As a result, the transaction commit on the primary server may be blocked, and the switchover may fail. In normal service scenarios, you are not advised to set this parameter to 0.
hot_standby_feedback
Parameter description: Specifies whether a standby server is allowed to send the result of a query performed on it to the primary server, preventing a query conflict.
This is a SIGHUP parameter. Set it based on instructions provided in Table 1.
Value range: Boolean
- on indicates that the ID of the oldest transaction active on standby servers will be sent to the primary server.
- off indicates that the ID of the oldest transaction active on standby servers will not be sent to the primary server.
Default value: off
If this parameter is set to on, VACUUM on the primary server will not clean up tuples modified in transactions later than the oldest transaction active on standby servers.
Therefore, the performance of the primary server will be affected. If playback conflicts with query on the standby node and a query error is reported, you are advised to increase the value of max_standby_streaming_delay.
wal_receiver_timeout
Parameter description: Specifies the maximum wait period for a standby server to receive data from the primary server.
This is a SIGHUP parameter. Set it based on instructions provided in Table 1.
Value range: an integer ranging from 0 to INT_MAX. The unit is ms.
Default value: 6s (6000 ms)
wal_receiver_connect_timeout
Parameter description: Specifies the timeout period for a standby server to connect to the primary server.
This is a SIGHUP parameter. Set it based on instructions provided in Table 1.
Value range: an integer ranging from 0 to INT_MAX/1000. The unit is s.
Default value: 2s
wal_receiver_connect_retries
Parameter description: Specifies the maximum attempts that a standby server connects to the primary server
This is a SIGHUP parameter. Set it based on instructions provided in Table 1.
Value range: an integer ranging from 1 to INT_MAX
Default value: 1
wal_receiver_buffer_size
Parameter description: Specifies the size of the memory buffer that stores the Xlogs received by the standby and secondary nodes. Currently, primary/standby/secondary deployment is not supported by default.
This parameter is a POSTMASTER parameter. Set it based on instructions provided in Table 1.
Value range: an integer ranging from 4096 to 1047552. The unit is KB.
Default value: 64 MB (65536 KB)
primary_slotname
Parameter description: Specifies the slot name of the primary server corresponding to a standby server. This parameter is used for the mechanisms to verify the primary-standby relationship and delete WALs.
This is a SIGHUP parameter. Set it based on instructions provided in Table 1.
Value range: a string
Default value: empty
max_logical_replication_workers
Parameter description: Specifies the maximum number of apply worker threads on the subscriber side.
This parameter is a POSTMASTER parameter. Set it based on instructions provided in Table 1.
Value range: an integer ranging from 0 to 262143
Default value: 4
max_standby_base_page_size
Parameter description: Specifies the maximum storage space of base page files on the standby node after the ultimate RTO function is enabled.
This is a SIGHUP parameter. Set it based on instructions provided in Table 1.
Value range: a long integer ranging from 1048576 to 562949953421311. The unit is KB.
Default value: 268435456 (256 GB)
max_standby_lsn_info_size
Parameter description: Specifies the maximum size of LSN info files on the standby node after the ultimate RTO function is enabled.
This is a SIGHUP parameter. Set it based on instructions provided in Table 1.
Value range: a long integer ranging from 1048576 to 562949953421311. The unit is KB.
Default value: 268435456 (256 GB)
base_page_saved_interval
Parameter description: Specifies the interval for generating base pages on the standby node after the ultimate RTO function is enabled. For the same page, a base page is generated each time the value of this parameter is replayed.
This parameter is a POSTMASTER parameter. Set it based on instructions provided in Table 1.
Value range: an integer ranging from 5 to 2000.
Default value: 400
standby_force_recycle_ratio
Parameter description: Specifies the percentage of files read by the standby node to trigger forcible recycling after the ultimate RTO function is enabled. When the total size of base page files exceeds the value of max_standby_base_page_size x standby_force_recycle_ratio or the total size of LSN info files exceeds the value of max_standby_lsn_info_size x standby_force_recycle_ratio, forcible recycling is triggered and some queries are canceled. When the value of standby_force_recycle_ratio is 0, forcible recycling is not started, and the setting of max_standby_base_page_size and max_standby_lsn_info_size does not take effect.
This is a SIGHUP parameter. Set it based on instructions provided in Table 1.
Value range: a double-precision floating point number ranging from 0.0 to 1.0
Default value: 0.8
standby_recycle_interval
Parameter description: Specifies the interval for the standby node to recycle read files after the ultimate RTO function is enabled. The thread for recycling read resources on the standby node attempts to clear read files on the standby node at the interval specified by this parameter.
This is a SIGHUP parameter. Set it based on instructions provided in Table 1.
Value range: an integer ranging from 0 to 86400. The unit is s.
Default value: 10
standby_max_query_time
Parameter description: Specifies the maximum query time supported on the standby node after the ultimate RTO function is enabled. If the query time exceeds the value of this parameter, the query will be canceled. Note: The time when the query is canceled is affected by the interval parameter standby_recycle_interval of the recycling thread and the time when the snapshot is obtained. Therefore, the actual execution time of the query on the standby node must be greater than the value of this parameter.
This is a SIGHUP parameter. Set it based on instructions provided in Table 1.
Value range: an integer ranging from 0 to 86400. The unit is s.
Default value: 600
exrto_standby_read_opt
Parameter description: Specifies whether to support read optimization of the standby node with ultimate RTO. This parameter is enabled by default. This parameter is not synchronized between the primary and standby nodes.
This parameter is a POSTMASTER parameter. Set it based on instructions provided in Table 1.
Value range: Boolean. on indicates that the optimization is enabled, and off indicates that the optimization is disabled.
Default value: on
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot