1 keepalived+虚拟ip方案
1 master配置
vim /etc/keepalived/keepalived.conf
! Configuration File for keepalived
global_defs {
router_id gpm01
}
vrrp_script chk_gp {
script"/home/gpadmin/bin/check_gp.sh"
master
interval 5
}
vrrp_instance VI_1
{
state MASTER
interface eth3
virtual_router_id 51
priority 150
advert_int 1
authentication
{
auth_type PASS
auth_pass 1111
}
virtual_ipaddress
{
10.254.21.100
}
track_script
{
chk_gp
}
}
vim /home/gpadmin/bin/check_gp.sh
#!/bin/sh
CHECK_PROCESS=ps aux|grep postgres|grep silent|wc -l
if [ $CHECK_PROCESS -eq
0 ]; then
echo “GP is stopped”
sleep 2
CHECK_PROCESS=ps aux|grep postgres|grep silent|wc -l
if [ $CHECK_PROCESS -eq
0 ]; then
service keepalived
stop
fi
fi
2 standby master 配置
vim /etc/keepalived/keepalived.conf
! Configuration File for keepalived
global_defs {
router_id gpm02
}
vrrp_instance VI_1
{
state MASTER
interface eth3
virtual_router_id 51
priority 50
advert_int 1
authentication
{
auth_type PASS
auth_pass 1111
}
virtual_ipaddress
{
10.254.21.100
}
notify /home/gpadmin/bin/keep.sh /状态切换时调用的脚本/
}
vim /home/gpadmin/bin/keep.sh
#!/bin/bash
TYPE=$1
NAME=$2
STATE=$3
case $STATE in
“MASTER”) /bin/bash /home/gpadmin/bin/runner.sh >>/home/gpadmin/LOGS/keep.data;;
“BACKUP”) echo "Executing as BACKUP date" >> /home/gpadmin/LOGS/keep.data;;
“FAULT”) echo "Executing as FAULT date" >> /home/gpadmin/LOGS/keep.data exit 0;;
*) echo "Unknown state <<<<<<<<<<<<<<<<<<< date" >> /home/gpadmin/LOGS/keep.data exit 1;;
esac
vim /home/gpadmin/bin/runner.sh
/bin/su - gpadmin -c “bash /home/gpadmin/bin/activateGPstandby.sh”
vim /home/gpadmin/bin/activateGPstandby.sh
source /usr/local/greenplum-db/greenplum_path.sh
export export MASTER_DATA_DIRECTORY=/data1/master/gpseg-1
export PGPORT=5432
echo "Activating MASTER on smdw date" >> /home/gpadmin/status
gpactivatestandby -a -d /data1/master/gpseg-1
3 配置完成后
在主备节点上启动keepalived服务:service keepalived start;
4 访问GP集群使用虚拟ip即可
注意:所添加的文件记得授予权限
chmod 777 *.sh
参考博客:
keepalived,虚拟ip(vip)实践。_Danger_Life的博客-CSDN博客_keepalived vipkeepalivedkeepalived,虚拟ip(vip)实践。keepalived介绍版本流程图搭建基础设置主机名selinux关闭防火墙(所有机器)hosts映射keepalived设置vip准备rpm包配置报错处理’keepalived_script’ for script execution does not exist.sh exited due to signal 15Unsafe permissions found配置详解可参考keepalived,虚拟ip(vip)实践。keepalihttps://blog.csdn.net/weixin_44385419/article/details/111543115keepalived实现greenplum的自动切换高可用_Danger_Life的博客-CSDN博客keepalived实现greenplum的自动切换高可用机器已经搭建了gp的高可用192.168.60.221 master节点192.168.60.222 master-standby节点192.168.60.223 segement节点segement节点数量根据需求变化机器已经搭建了keepalivedhttps://blog.csdn.net/weixin_44385419/article/details/111543115192.168.60.221 keepalivedhttps://blog.csdn.net/weixin_44385419/article/details/111550334?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522165268663516780357265128%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fall.%2522%257D&request_id=165268663516780357265128&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~first_rank_ecpm_v1~rank_v31_ecpm-1-111550334-null-null.142%5Ev9%5Epc_search_result_cache,157%5Ev4%5Econtrol&utm_term=Keepalived+greenplum+master&spm=1018.2226.3001.4187
2 双集群-双ETL方案
参考博客:
3 双集群-备份/恢复方案
备份/恢复方案,如果在并发情况下,容易造成锁表,只能在闲时运行,但是在闲时又满足不了需求,所以不推荐这个方案
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/71346.html