1.1 主从节点故障切换
登录pgpool所在的数据库主节点
su - root
cd /opt/pgsql932/bin
上传failover_stream.sh文件
chmod 755 failover_stream.sh
启动主 PostgreSQL 节点和备 PostgreSQL 节点来初始化基于双机热备。如果主节点失效,备节点将自动切换为主节点。
注: failover_stream.sh内容需要修改的内容:
#! /bin/sh
# Failover command for streamingreplication.
# This script assumes that DB node 0 isprimary, and 1 is standby.
#
# If standby goes down, do nothing. Ifprimary goes down, create a
# trigger file so that standby takes overprimary node.
#
# Arguments: $1: failed node id. $2: newmaster hostname. $3: path to
# trigger file.
host1=172.16.0.195 (根据实际主从节点IP进行配置)
host2=172.1