Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- listen_addresses = '*'
- port = 9999
- socket_dir = '/tmp'
- pcp_listen_addresses = '*'
- pcp_port = 9898
- pcp_socket_dir = '/tmp'
- listen_backlog_multiplier = 2
- backend_hostname0 = 'masterip'
- backend_port0 = 5432
- backend_weight0 = 1
- backend_data_directory0 = '/var/lib/pgsql/data'
- backend_flag0 = 'ALLOW_TO_FAILOVER'
- backend_hostname1 = 'slaveip'
- backend_port1 = 5432
- backend_weight1 = 1
- backend_data_directory1 = '/var/lib/pgsql/data'
- backend_flag1 = 'ALLOW_TO_FAILOVER'
- enable_pool_hba = off
- pool_passwd = 'pool_passwd'
- authentication_timeout = 60
- ssl = off
- num_init_children = 32
- max_pool = 4
- child_life_time = 300
- child_max_connections = 0
- connection_life_time = 0
- client_idle_limit = 0
- log_destination = 'syslog'
- log_line_prefix = '%t: pid %p: '
- log_connections = off
- log_hostname = off
- log_statement = off
- log_per_node_statement = off
- log_standby_delay = 'if_over_threshold'
- syslog_facility = 'LOCAL0'
- syslog_ident = 'pgpool'
- debug_level = 0
- pid_file_name = '/var/run/pgpool/pgpool.pid'
- logdir = '/var/log/pgpool'
- connection_cache = on
- reset_query_list = 'ABORT; DISCARD ALL'
- replication_mode = off
- replicate_select = off
- insert_lock = off
- master_slave_mode = on
- master_slave_sub_mode = 'stream'
- sr_check_period = 10
- sr_check_user = 'postgres'
- sr_check_password = 'password'
- delay_threshold = 10000000
- follow_master_command = ''
- health_check_period = 5
- health_check_timeout = 10
- health_check_user = 'postgres'
- health_check_password = 'password'
- health_check_max_retries = 10
- health_check_retry_delay = 2
- connect_timeout = 10000
- failover_command = '/etc/pgpool-II/failover.sh %d %P %H %R'
- failback_command = ''
- recovery_user = 'postgres'
- recovery_password = 'password'
- recovery_1st_stage_command = 'recovery_1st_stage.sh'
- recovery_2nd_stage_command = ''
- recovery_timeout = 90
- client_idle_limit_in_recovery = 0
- #! /bin/sh -x
- # Execute command by failover.
- # special values: %d = node id
- # %h = host name
- # %p = port number
- # %D = database cluster path
- # %m = new master node id
- # %M = old master node id
- # %H = new master node host name
- # %P = old primary node id
- # %R = new master database cluster path
- # %r = new master port number
- # %% = '%' character
- falling_node=$1 # %d
- old_primary=$2 # %P
- new_primary=$3 # %H
- pgdata=$4 # %R
- log=/var/log/pgpool/failover.log
- date >> $log
- echo "failed_node_id=$falling_node new_primary=$new_primary" >> $log
- if [ $falling_node = $old_primary ]; then
- if [ $UID -eq 0 ]
- then
- su postgres -c "ssh postgres@$new_primary /usr/bin/pg_ctl promote -D $pgdata"
- else
- ssh postgres@$new_primary /usr/bin/pg_ctl promote -D $pgdata
- fi
- exit 0;
- fi;
- #!/bin/bash -x
- # Recovery script for streaming replication.
- pgdata=$1
- remote_host=$2
- remote_pgdata=$3
- port=$4
- archivedir=/var/lib/pgsql/incrementalbackup/archivedwals
- hostname=$(hostname)
- ssh -T postgres@$remote_host
- rm -rf $remote_pgdata
- /usr/bin/pg_basebackup -h $hostname -U repuser -D $remote_pgdata -x -c fast
- rm -rf $archivedir/*
- cd $remote_pgdata
- #cp postgresql.conf postgresql.conf.bak
- #sed -e 's/#*hot_standby = off/hot_standby = on/' postgresql.conf.bak > postgresql.conf
- #rm -f postgresql.conf.bak
- cat > recovery.conf << EOT
- standby_mode = 'on'
- primary_conninfo = 'host="$hostname" port=$port user=repuser'
- restore_command = 'scp $hostname:$archivedir/%f %p'
- EOT
- "
Add Comment
Please, Sign In to add comment