1 # ----------------------------
2 # pgPool-II configuration file
3 # ----------------------------
5 # This file consists of lines of the form:
9 # Whitespace may be used. Comments are introduced with "#" anywhere on a line.
10 # The complete list of parameter names and allowed values can be found in the
11 # pgPool-II documentation.
13 # This file is read on server startup and when the server receives a SIGHUP
14 # signal. If you edit the file on a running system, you have to SIGHUP the
15 # server for the changes to take effect, or use "pgpool reload". Some
16 # parameters, which are marked below, require a server shutdown and restart to
21 #------------------------------------------------------------------------------
23 #------------------------------------------------------------------------------
25 # - pgpool Connection Settings -
27 listen_addresses = 'localhost'
28 # Host name or IP address to listen on:
29 # '*' for all, '' for no TCP/IP connections
30 # (change requires restart)
33 # (change requires restart)
35 # Unix domain socket path
36 # The Debian package defaults to
38 # (change requires restart)
39 listen_backlog_multiplier = 2
40 # Set the backlog parameter of listen(2) to
41 # num_init_children * listen_backlog_multiplier.
42 # (change requires restart)
43 serialize_accept = off
44 # whether to serialize accept() call to avoid thundering herd problem
45 # (change requires restart)
46 reserved_connections = 0
47 # Number of reserved connections.
48 # Pgpool-II does not accept connections if over
49 # num_init_chidlren - reserved_connections.
51 # - pgpool Communication Manager Connection Settings -
53 pcp_listen_addresses = '*'
54 # Host name or IP address for pcp process to listen on:
55 # '*' for all, '' for no TCP/IP connections
56 # (change requires restart)
59 # (change requires restart)
60 pcp_socket_dir = '/tmp'
61 # Unix domain socket path for pcp
62 # The Debian package defaults to
64 # (change requires restart)
66 # - Backend Connection Settings -
68 backend_hostname0 = 'localhost'
69 # Host name or IP address to connect to for backend 0
71 # Port number for backend 0
73 # Weight for backend 0 (only in load balancing mode)
74 backend_data_directory0 = '/var/lib/pgsql/data'
75 # Data directory for backend 0
76 backend_flag0 = 'ALLOW_TO_FAILOVER'
77 # Controls various backend behavior
78 # ALLOW_TO_FAILOVER, DISALLOW_TO_FAILOVER
80 backend_application_name0 = 'server0'
81 # walsender's application_name, used for "show pool_nodes" command
82 #backend_hostname1 = 'host2'
85 #backend_data_directory1 = '/data1'
86 #backend_flag1 = 'ALLOW_TO_FAILOVER'
87 #backend_application_name1 = 'server1'
92 # Use pool_hba.conf for client authentication
94 # File name of pool_passwd for md5 authentication.
95 # "" disables pool_passwd.
96 # (change requires restart)
97 authentication_timeout = 60
98 # Delay in seconds to complete client authentication
101 allow_clear_text_frontend_auth = off
102 # Allow Pgpool-II to use clear text password authentication
103 # with clients, when pool_passwd does not
104 # contain the user password
107 # - SSL Connections -
111 # (change requires restart)
112 #ssl_key = './server.key'
113 # Path to the SSL private key file
114 # (change requires restart)
115 #ssl_cert = './server.cert'
116 # Path to the SSL public certificate file
117 # (change requires restart)
119 # Path to a single PEM format file
120 # containing CA root certificate(s)
121 # (change requires restart)
122 #ssl_ca_cert_dir = ''
123 # Directory containing CA root certificate(s)
124 # (change requires restart)
126 ssl_ciphers = 'HIGH:MEDIUM:+3DES:!aNULL'
127 # Allowed SSL ciphers
128 # (change requires restart)
129 ssl_prefer_server_ciphers = off
130 # Use server's SSL cipher preferences,
131 # rather than the client's
132 # (change requires restart)
133 ssl_ecdh_curve = 'prime256v1'
134 # Name of the curve to use in ECDH key exchange
135 ssl_dh_params_file = ''
136 # Name of the file containing Diffie-Hellman parameters used
137 # for so-called ephemeral DH family of SSL cipher.
139 #------------------------------------------------------------------------------
141 #------------------------------------------------------------------------------
143 # - Concurrent session and pool size -
145 num_init_children = 32
146 # Number of concurrent sessions allowed
147 # (change requires restart)
149 # Number of connection pool caches per connection
150 # (change requires restart)
154 child_life_time = 300
155 # Pool exits after being idle for this many seconds
156 child_max_connections = 0
157 # Pool exits after receiving that many connections
159 connection_life_time = 0
160 # Connection to backend closes after being idle for this many seconds
162 client_idle_limit = 0
163 # Client is disconnected after being idle for that many seconds
164 # (even inside an explicit transactions!)
165 # 0 means no disconnection
168 #------------------------------------------------------------------------------
170 #------------------------------------------------------------------------------
174 log_destination = 'stderr'
176 # Valid values are combinations of stderr,
177 # and syslog. Default to stderr.
181 log_line_prefix = '%t: pid %p: ' # printf-style string to output at beginning of each log line.
183 log_connections = off
186 # Hostname will be shown in ps status
187 # and in logs if connections are logged
190 log_per_node_statement = off
192 # with node and backend informations
193 log_client_messages = off
194 # Log any client messages
195 log_standby_delay = 'none'
197 # Valid values are combinations of always,
198 # if_over_threshold, none
200 # - Syslog specific -
202 syslog_facility = 'LOCAL0'
203 # Syslog local facility. Default to LOCAL0
204 syslog_ident = 'pgpool'
205 # Syslog program identification string
206 # Default to 'pgpool'
210 #log_error_verbosity = default # terse, default, or verbose messages
212 #client_min_messages = notice # values in order of decreasing detail:
223 #log_min_messages = warning # values in order of decreasing detail:
237 #------------------------------------------------------------------------------
239 #------------------------------------------------------------------------------
241 pid_file_name = '/var/postgres/pgpool-II/pgpool.pid'
243 # Can be specified as relative to the"
244 # location of pgpool.conf file or
245 # as an absolute path
246 # (change requires restart)
247 logdir = '/var/postgres/pgpool-II'
248 # Directory of pgPool status file
249 # (change requires restart)
252 #------------------------------------------------------------------------------
254 #------------------------------------------------------------------------------
256 connection_cache = on
257 # Activate connection pools
258 # (change requires restart)
260 # Semicolon separated list of queries
261 # to be issued at the end of a session
262 # The default is for 8.3 and later
263 reset_query_list = 'ABORT; DISCARD ALL'
264 # The following one is for 8.2 and before
265 #reset_query_list = 'ABORT; RESET ALL; SET SESSION AUTHORIZATION DEFAULT'
268 #------------------------------------------------------------------------------
270 #------------------------------------------------------------------------------
272 replication_mode = off
273 # Activate replication mode
274 # (change requires restart)
275 replicate_select = off
276 # Replicate SELECT statements
277 # when in replication mode
278 # replicate_select is higher priority than
282 # Automatically locks a dummy row or a table
283 # with INSERT statements to keep SERIAL data
285 # Without SERIAL, no lock will be issued
287 # When rewriting lo_creat command in
288 # replication mode, specify table name to
291 # - Degenerate handling -
293 replication_stop_on_mismatch = off
294 # On disagreement with the packet kind
295 # sent from backend, degenerate the node
296 # which is most likely "minority"
297 # If off, just force to exit this session
299 failover_if_affected_tuples_mismatch = off
300 # On disagreement with the number of affected
301 # tuples in UPDATE/DELETE queries, then
302 # degenerate the node which is most likely
304 # If off, just abort the transaction to
305 # keep the consistency
308 #------------------------------------------------------------------------------
309 # LOAD BALANCING MODE
310 #------------------------------------------------------------------------------
312 load_balance_mode = off
313 # Activate load balancing mode
314 # (change requires restart)
315 ignore_leading_white_space = on
316 # Ignore leading white spaces of each query
317 white_function_list = ''
318 # Comma separated list of function names
319 # that don't write to database
320 # Regexp are accepted
321 black_function_list = 'currval,lastval,nextval,setval'
322 # Comma separated list of function names
323 # that write to database
324 # Regexp are accepted
326 black_query_pattern_list = ''
327 # Semicolon separated list of query patterns
328 # that should be sent to primary node
329 # Regexp are accepted
330 # valid for streaming replicaton mode only.
332 database_redirect_preference_list = ''
333 # comma separated list of pairs of database and node id.
334 # example: postgres:primary,mydb[0-4]:1,mydb[5-9]:2'
335 # valid for streaming replicaton mode only.
336 app_name_redirect_preference_list = ''
337 # comma separated list of pairs of app name and node id.
338 # example: 'psql:primary,myapp[0-4]:1,myapp[5-9]:standby'
339 # valid for streaming replicaton mode only.
340 allow_sql_comments = off
341 # if on, ignore SQL comments when judging if load balance or
342 # query cache is possible.
343 # If off, SQL comments effectively prevent the judgment
344 # (pre 3.4 behavior).
346 disable_load_balance_on_write = 'transaction'
347 # Load balance behavior when write query is issued
348 # in an explicit transaction.
349 # Note that any query not in an explicit transaction
350 # is not affected by the parameter.
351 # 'transaction' (the default): if a write query is issued,
352 # subsequent read queries will not be load balanced
353 # until the transaction ends.
354 # 'trans_transaction': if a write query is issued,
355 # subsequent read queries in an explicit transaction
356 # will not be load balanced until the session ends.
357 # 'always': if a write query is issued, read queries will
358 # not be load balanced until the session ends.
360 statement_level_load_balance = off
361 # Enables statement level load balancing
363 #------------------------------------------------------------------------------
365 #------------------------------------------------------------------------------
367 master_slave_mode = off
368 # Activate master/slave mode
369 # (change requires restart)
370 master_slave_sub_mode = 'stream'
371 # Master/slave sub mode
372 # Valid values are combinations stream, slony
373 # or logical. Default is stream.
374 # (change requires restart)
379 # Streaming replication check period
380 # Disabled (0) by default
381 sr_check_user = 'nobody'
382 # Streaming replication check user
383 # This is necessary even if you disable
384 # streaming replication delay check with
385 # sr_check_period = 0
387 sr_check_password = ''
388 # Password for streaming replication check user.
389 # Leaving it empty will make Pgpool-II to first look for the
390 # Password in pool_passwd file before using the empty password
392 sr_check_database = 'postgres'
393 # Database name for streaming replication check
395 # Threshold before not dispatching query to standby node
397 # Disabled (0) by default
399 # - Special commands -
401 follow_master_command = ''
402 # Executes this command after master failover
404 # %d = failed node id
405 # %h = failed node host name
406 # %p = failed node port number
407 # %D = failed node database cluster path
408 # %m = new master node id
409 # %H = new master node hostname
410 # %M = old master node id
411 # %P = old primary node id
412 # %r = new master port number
413 # %R = new master database cluster path
414 # %N = old primary node hostname
415 # %S = old primary node port number
418 #------------------------------------------------------------------------------
419 # HEALTH CHECK GLOBAL PARAMETERS
420 #------------------------------------------------------------------------------
422 health_check_period = 0
423 # Health check period
424 # Disabled (0) by default
425 health_check_timeout = 20
426 # Health check timeout
428 health_check_user = 'nobody'
430 health_check_password = ''
431 # Password for health check user
432 # Leaving it empty will make Pgpool-II to first look for the
433 # Password in pool_passwd file before using the empty password
435 health_check_database = ''
436 # Database name for health check. If '', tries 'postgres' frist, then 'template1'
438 health_check_max_retries = 0
439 # Maximum number of times to retry a failed health check before giving up.
440 health_check_retry_delay = 1
441 # Amount of time to wait (in seconds) between retries.
442 connect_timeout = 10000
443 # Timeout value in milliseconds before giving up to connect to backend.
444 # Default is 10000 ms (10 second). Flaky network user may want to increase
445 # the value. 0 means no timeout.
446 # Note that this value is not only used for health check,
447 # but also for ordinary conection to backend.
449 #------------------------------------------------------------------------------
450 # HEALTH CHECK PER NODE PARAMETERS (OPTIONAL)
451 #------------------------------------------------------------------------------
452 #health_check_period0 = 0
453 #health_check_timeout0 = 20
454 #health_check_user0 = 'nobody'
455 #health_check_password0 = ''
456 #health_check_database0 = ''
457 #health_check_max_retries0 = 0
458 #health_check_retry_delay0 = 1
459 #connect_timeout0 = 10000
461 #------------------------------------------------------------------------------
462 # FAILOVER AND FAILBACK
463 #------------------------------------------------------------------------------
465 failover_command = ''
466 # Executes this command at failover
468 # %d = failed node id
469 # %h = failed node host name
470 # %p = failed node port number
471 # %D = failed node database cluster path
472 # %m = new master node id
473 # %H = new master node hostname
474 # %M = old master node id
475 # %P = old primary node id
476 # %r = new master port number
477 # %R = new master database cluster path
478 # %N = old primary node hostname
479 # %S = old primary node port number
481 failback_command = ''
482 # Executes this command at failback.
484 # %d = failed node id
485 # %h = failed node host name
486 # %p = failed node port number
487 # %D = failed node database cluster path
488 # %m = new master node id
489 # %H = new master node hostname
490 # %M = old master node id
491 # %P = old primary node id
492 # %r = new master port number
493 # %R = new master database cluster path
494 # %N = old primary node hostname
495 # %S = old primary node port number
498 failover_on_backend_error = on
499 # Initiates failover when reading/writing to the
500 # backend communication socket fails
501 # If set to off, pgpool will report an
502 # error and disconnect the session.
504 detach_false_primary = off
505 # Detach false primary if on. Only
506 # valid in streaming replicaton
507 # mode and with PostgreSQL 9.6 or
510 search_primary_node_timeout = 300
511 # Timeout in seconds to search for the
512 # primary node when a failover occurs.
513 # 0 means no timeout, keep searching
514 # for a primary node forever.
517 # Dettached backend node reattach automatically
518 # if replication_state is 'streaming'.
519 auto_failback_interval = 60
520 # Min interval of executing auto_failback in
523 #------------------------------------------------------------------------------
525 #------------------------------------------------------------------------------
527 recovery_user = 'nobody'
528 # Online recovery user
529 recovery_password = ''
530 # Online recovery password
531 # Leaving it empty will make Pgpool-II to first look for the
532 # Password in pool_passwd file before using the empty password
534 recovery_1st_stage_command = ''
535 # Executes a command in first stage
536 recovery_2nd_stage_command = ''
537 # Executes a command in second stage
538 recovery_timeout = 90
539 # Timeout in seconds to wait for the
540 # recovering node's postmaster to start up
542 client_idle_limit_in_recovery = 0
543 # Client is disconnected after being idle
544 # for that many seconds in the second stage
546 # 0 means no disconnection
547 # -1 means immediate disconnection
550 #------------------------------------------------------------------------------
552 #------------------------------------------------------------------------------
558 # (change requires restart)
560 # -Connection to up stream servers -
563 # trusted server list which are used
564 # to confirm network connection
565 # (hostA,hostB,hostC,...)
566 # (change requires restart)
569 # (change requires restart)
571 # - Watchdog communication Settings -
574 # Host name or IP address of this watchdog
575 # (change requires restart)
577 # port number for watchdog service
578 # (change requires restart)
580 # priority of this watchdog in leader election
581 # (change requires restart)
584 # Authentication key for watchdog communication
585 # (change requires restart)
587 wd_ipc_socket_dir = '/tmp'
588 # Unix domain socket path for watchdog IPC socket
589 # The Debian package defaults to
590 # /var/run/postgresql
591 # (change requires restart)
594 # - Virtual IP control Setting -
597 # delegate IP address
598 # If this is empty, virtual IP never bring up.
599 # (change requires restart)
600 if_cmd_path = '/sbin'
601 # path to the directory where if_up/down_cmd exists
602 # If if_up/down_cmd starts with "/", if_cmd_path will be ignored.
603 # (change requires restart)
604 if_up_cmd = '/usr/bin/sudo /sbin/ip addr add $_IP_$/24 dev eth0 label eth0:0'
605 # startup delegate IP command
606 # (change requires restart)
607 if_down_cmd = '/usr/bin/sudo /sbin/ip addr del $_IP_$/24 dev eth0'
608 # shutdown delegate IP command
609 # (change requires restart)
610 arping_path = '/usr/sbin'
611 # arping command path
612 # If arping_cmd starts with "/", if_cmd_path will be ignored.
613 # (change requires restart)
614 arping_cmd = '/usr/bin/sudo /usr/sbin/arping -U $_IP_$ -w 1 -I eth0'
616 # (change requires restart)
618 # - Behaivor on escalation Setting -
620 clear_memqcache_on_escalation = on
621 # Clear all the query cache on shared memory
622 # when standby pgpool escalate to active pgpool
623 # (= virtual IP holder).
624 # This should be off if client connects to pgpool
625 # not using virtual IP.
626 # (change requires restart)
627 wd_escalation_command = ''
628 # Executes this command at escalation on new active pgpool.
629 # (change requires restart)
630 wd_de_escalation_command = ''
631 # Executes this command when master pgpool resigns from being master.
632 # (change requires restart)
634 # - Watchdog consensus settings for failover -
636 failover_when_quorum_exists = on
637 # Only perform backend node failover
638 # when the watchdog cluster holds the quorum
639 # (change requires restart)
641 failover_require_consensus = on
642 # Perform failover when majority of Pgpool-II nodes
643 # aggrees on the backend node status change
644 # (change requires restart)
646 allow_multiple_failover_requests_from_node = off
647 # A Pgpool-II node can cast multiple votes
648 # for building the consensus on failover
649 # (change requires restart)
651 enable_consensus_with_half_votes = off
652 # apply majority rule for consensus and quorum computation
653 # at 50% of votes in a cluster with even number of nodes.
654 # when enabled the existence of quorum and consensus
655 # on failover is resolved after receiving half of the
656 # total votes in the cluster, otherwise both these
657 # decisions require at least one more vote than
658 # half of the total votes.
659 # (change requires restart)
661 # - Lifecheck Setting -
665 wd_monitoring_interfaces_list = '' # Comma separated list of interfaces names to monitor.
666 # if any interface from the list is active the watchdog will
667 # consider the network is fine
668 # 'any' to enable monitoring on all interfaces except loopback
669 # '' to disable monitoring
670 # (change requires restart)
673 wd_lifecheck_method = 'heartbeat'
674 # Method of watchdog lifecheck ('heartbeat' or 'query' or 'external')
675 # (change requires restart)
677 # lifecheck interval (sec) > 0
678 # (change requires restart)
680 # -- heartbeat mode --
682 wd_heartbeat_port = 9694
683 # Port number for receiving heartbeat signal
684 # (change requires restart)
685 wd_heartbeat_keepalive = 2
686 # Interval time of sending heartbeat signal (sec)
687 # (change requires restart)
688 wd_heartbeat_deadtime = 30
689 # Deadtime interval for heartbeat signal (sec)
690 # (change requires restart)
691 heartbeat_destination0 = 'host0_ip1'
692 # Host name or IP address of destination 0
693 # for sending heartbeat signal.
694 # (change requires restart)
695 heartbeat_destination_port0 = 9694
696 # Port number of destination 0 for sending
697 # heartbeat signal. Usually this is the
698 # same as wd_heartbeat_port.
699 # (change requires restart)
700 heartbeat_device0 = ''
701 # Name of NIC device (such like 'eth0')
702 # used for sending/receiving heartbeat
703 # signal to/from destination 0.
704 # This works only when this is not empty
705 # and pgpool has root privilege.
706 # (change requires restart)
708 #heartbeat_destination1 = 'host0_ip2'
709 #heartbeat_destination_port1 = 9694
710 #heartbeat_device1 = ''
715 # lifecheck retry times
716 # (change requires restart)
717 wd_lifecheck_query = 'SELECT 1'
718 # lifecheck query to pgpool from watchdog
719 # (change requires restart)
720 wd_lifecheck_dbname = 'template1'
721 # Database name connected for lifecheck
722 # (change requires restart)
723 wd_lifecheck_user = 'nobody'
724 # watchdog user monitoring pgpools in lifecheck
725 # (change requires restart)
726 wd_lifecheck_password = ''
727 # Password for watchdog user in lifecheck
728 # Leaving it empty will make Pgpool-II to first look for the
729 # Password in pool_passwd file before using the empty password
730 # (change requires restart)
732 # - Other pgpool Connection Settings -
734 #other_pgpool_hostname0 = 'host0'
735 # Host name or IP address to connect to for other pgpool 0
736 # (change requires restart)
737 #other_pgpool_port0 = 5432
738 # Port number for other pgpool 0
739 # (change requires restart)
740 #other_wd_port0 = 9000
741 # Port number for other watchdog 0
742 # (change requires restart)
743 #other_pgpool_hostname1 = 'host1'
744 #other_pgpool_port1 = 5432
745 #other_wd_port1 = 9000
748 #------------------------------------------------------------------------------
750 #------------------------------------------------------------------------------
752 # Life time of relation cache in seconds.
753 # 0 means no cache expiration(the default).
754 # The relation cache is used for cache the
755 # query result against PostgreSQL system
756 # catalog to obtain various information
757 # including table structures or if it's a
758 # temporary table or not. The cache is
759 # maintained in a pgpool child local memory
760 # and being kept as long as it survives.
761 # If someone modify the table by using
762 # ALTER TABLE or some such, the relcache is
763 # not consistent anymore.
764 # For this purpose, cache_expiration
765 # controls the life time of the cache.
768 # Number of relation cache
769 # entry. If you see frequently:
770 # "pool_search_relcache: cache replacement happend"
771 # in the pgpool log, you might want to increate this number.
773 check_temp_table = catalog
774 # Temporary table check method. catalog, trace or none.
775 # Default is catalog.
777 check_unlogged_table = on
778 # If on, enable unlogged table check in SELECT statements.
779 # This initiates queries against system catalog of primary/master
780 # thus increases load of master.
781 # If you are absolutely sure that your system never uses unlogged tables
782 # and you want to save access to primary/master, you could turn this off.
784 enable_shared_relcache = on
785 # If on, relation cache stored in memory cache,
786 # the cache is shared among child process.
788 # (change requires restart)
790 relcache_query_target = master # Target node to send relcache queries. Default is master (primary) node.
791 # If load_balance_node is specified, queries will be sent to load balance node.
792 #------------------------------------------------------------------------------
793 # IN MEMORY QUERY MEMORY CACHE
794 #------------------------------------------------------------------------------
795 memory_cache_enabled = off
796 # If on, use the memory cache functionality, off by default
797 # (change requires restart)
798 memqcache_method = 'shmem'
799 # Cache storage method. either 'shmem'(shared memory) or
800 # 'memcached'. 'shmem' by default
801 # (change requires restart)
802 memqcache_memcached_host = 'localhost'
803 # Memcached host name or IP address. Mandatory if
804 # memqcache_method = 'memcached'.
805 # Defaults to localhost.
806 # (change requires restart)
807 memqcache_memcached_port = 11211
808 # Memcached port number. Mondatory if memqcache_method = 'memcached'.
810 # (change requires restart)
811 memqcache_total_size = 67108864
812 # Total memory size in bytes for storing memory cache.
813 # Mandatory if memqcache_method = 'shmem'.
815 # (change requires restart)
816 memqcache_max_num_cache = 1000000
817 # Total number of cache entries. Mandatory
818 # if memqcache_method = 'shmem'.
819 # Each cache entry consumes 48 bytes on shared memory.
820 # Defaults to 1,000,000(45.8MB).
821 # (change requires restart)
823 # Memory cache entry life time specified in seconds.
824 # 0 means infinite life time. 0 by default.
825 # (change requires restart)
826 memqcache_auto_cache_invalidation = on
827 # If on, invalidation of query cache is triggered by corresponding
828 # DDL/DML/DCL(and memqcache_expire). If off, it is only triggered
829 # by memqcache_expire. on by default.
830 # (change requires restart)
831 memqcache_maxcache = 409600
832 # Maximum SELECT result size in bytes.
833 # Must be smaller than memqcache_cache_block_size. Defaults to 400KB.
834 # (change requires restart)
835 memqcache_cache_block_size = 1048576
836 # Cache block size in bytes. Mandatory if memqcache_method = 'shmem'.
838 # (change requires restart)
839 memqcache_oiddir = '/var/postgres/pgpool-II/oiddir'
840 # Temporary work directory to record table oids
841 # (change requires restart)
842 white_memqcache_table_list = ''
843 # Comma separated list of table names to memcache
844 # that don't write to database
845 # Regexp are accepted
846 black_memqcache_table_list = ''
847 # Comma separated list of table names not to memcache
848 # that don't write to database
849 # Regexp are accepted