# not using virtual IP. # (change requires restart) wd_escalation_command = ''
# Executes this command at escalation on new active pgpool. # (change requires restart)
# - Lifecheck Setting -
# -- common --
wd_lifecheck_method = 'heartbeat'
wd_interval = 10
# -- heartbeat mode --
wd_heartbeat_port = 9694
wd_heartbeat_keepalive = 2
wd_heartbeat_deadtime = 30
heartbeat_destination0 = 'host0_ip1'
heartbeat_destination_port0 = 9694
heartbeat_device0 = ''
#heartbeat_destination1 = 'host0_ip2' #heartbeat_destination_port1 = 9694 #heartbeat_device1 = ''
# -- query mode --
# Method of watchdog lifecheck ('heartbeat' or 'query') # (change requires restart) # lifecheck interval (sec) > 0 # (change requires restart) # Port number for receiving heartbeat signal # (change requires restart) # Interval time of sending heartbeat signal (sec) # (change requires restart) # Deadtime interval for heartbeat signal (sec) # (change requires restart) # Host name or IP address of destination 0 # for sending heartbeat signal. # (change requires restart) # Port number of destination 0 for sending # heartbeat signal. Usually this is the # same as wd_heartbeat_port. # (change requires restart) # Name of NIC device (such like 'eth0') # used for sending/receiving heartbeat # signal to/from destination 0.
# This works only when this is not empty # and pgpool has root privilege. # (change requires restart)
wd_life_point = 3
# lifecheck retry times # (change requires restart) wd_lifecheck_query = 'SELECT 1'
# lifecheck query to pgpool from watchdog # (change requires restart) wd_lifecheck_dbname = 'template1'
# Database name connected for lifecheck # (change requires restart) wd_lifecheck_user = 'nobody'
# watchdog user monitoring pgpools in lifecheck # (change requires restart) wd_lifecheck_password = ''
# Password for watchdog user in lifecheck # (change requires restart)
# - Other pgpool Connection Settings -
#other_pgpool_hostname0 = 'host0'
# Host name or IP address to connect to for other pgpool 0 # (change requires restart) #other_pgpool_port0 = 5432
# Port number for othet pgpool 0 # (change requires restart) #other_wd_port0 = 9000
# Port number for othet watchdog 0 # (change requires restart) #other_pgpool_hostname1 = 'host1' #other_pgpool_port1 = 5432 #other_wd_port1 = 9000
#------------------------------------------------------------------------------ # OTHERS
#------------------------------------------------------------------------------ relcache_expire = 0
# Life time of relation cache in seconds. # 0 means no cache expiration(the default). # The relation cache is used for cache the # query result against PostgreSQL system # catalog to obtain various information # including table structures or if it's a # temporary table or not. The cache is # maintained in a pgpool child local memory # and being kept as long as it survives. # If someone modify the table by using # ALTER TABLE or some such, the relcache is # not consistent anymore.
# For this purpose, cache_expiration
# controls the life time of the cache. relcache_size = 256
# Number of relation cache # entry. If you see frequently:
check_temp_table = on
# If on, enable temporary table check in SELECT statements. # This initiates queries against system catalog of primary/master
check_unlogged_table = on
# If on, enable unlogged table check in SELECT statements. # This initiates queries against system catalog of primary/master # thus increases load of master.
# If you are absolutely sure that your system never uses unlogged tables # and you want to save access to primary/master, you could turn this off. # Default is on.
#------------------------------------------------------------------------------ # IN MEMORY QUERY MEMORY CACHE
#------------------------------------------------------------------------------ memory_cache_enabled = off
# If on, use the memory cache functionality, off by default
# thus increases load of master.
# If you are absolutely sure that your system never uses temporary tables # and you want to save access to primary/master, you could turn this off. # Default is on.
# \ # in the pgpool log, you might want to increate this number.
memqcache_method = 'shmem'
# Cache storage method. either 'shmem'(shared memory) or # 'memcached'. 'shmem' by default
# (change requires restart) memqcache_memcached_host = 'localhost'
# Memcached host name or IP address. Mandatory if # memqcache_method = 'memcached'. # Defaults to localhost.
# (change requires restart) memqcache_memcached_port = 11211
# Memcached port number. Mondatory if memqcache_method = 'memcached'. # Defaults to 11211.
# (change requires restart) memqcache_total_size = 67108864
# Total memory size in bytes for storing memory cache. # Mandatory if memqcache_method = 'shmem'. # Defaults to 64MB.
# (change requires restart) memqcache_max_num_cache = 1000000
# Total number of cache entries. Mandatory # if memqcache_method = 'shmem'.
# Each cache entry consumes 48 bytes on shared memory.
# Defaults to 1,000,000(45.8MB).
# (change requires restart) memqcache_expire = 0
# Memory cache entry life time specified in seconds. # 0 means infinite life time. 0 by default.
# (change requires restart) memqcache_auto_cache_invalidation = on
# If on, invalidation of query cache is triggered by corresponding # DDL/DML/DCL(and memqcache_expire). If off, it is only triggered # by memqcache_expire. on by default.
# (change requires restart) memqcache_maxcache = 409600
# Maximum SELECT result size in bytes.
# Must be smaller than memqcache_cache_block_size. Defaults to 400KB.
# (change requires restart) memqcache_cache_block_size = 1048576
# Cache block size in bytes. Mandatory if memqcache_method = 'shmem'. # Defaults to 1MB.
# (change requires restart) memqcache_oiddir = '/usr/local/pgpool/oiddir'
# Temporary work directory to record table oids
# (change requires restart) white_memqcache_table_list = ''
# Comma separated list of table names to memcache # that don't write to database # Regexp are accepted black_memqcache_table_list = ''
# Comma separated list of table names not to memcache # that don't write to database # Regexp are accepted backend_hostname0 = '172.16.144.145' backend_port0 = 5432 backend_weight0 = 1
backend_data_directory0 = '/usr/local/pgsql/data' backend_flag0 = 'ALLOW_TO_FAILOVER' backend_hostname1 = '172.16.144.146' backend_port1 = 5432 backend_weight1 = 2
backend_data_directory1 = '/usr/local/pgsql/data' backend_flag1= 'ALLOW_TO_FAILOVER' backend_hostname2 = '172.16.144.147' backend_port2 = 5432 backend_weight2 = 2
backend_data_directory2 = '/usr/local/pgsql/data' backend_flag2= 'ALLOW_TO_FAILOVER'
在主库的主机上/home/postgres/scripts下新建文件failover_stream.sh
#! /bin/sh