Greenplum——Master自动fail-over高可用方案

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

Greenplum Mater自动切换方案_windtalkerwy的博客-CSDN博客使用Keepalived集群软件实现Master节点的自动切换一、方案描述Keepalived的作用是检测服务器的状态,当GPDB的master服务器出现重启或者无法访问的情况下,或者GPDB主进程已经不再运行的情况下,会自动触发GPDBmaster-standby的自动切换动作。并且自动将虚拟IP地址接管至standbymater通过这种方式可以保证GPDB mater服务的高可用。...https://blog.csdn.net/windtalkerwy/article/details/95190001?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522165275604316782184616142%2522%252C%2522scm%2522%253A%252220140713.130102334..%2522%257D&request_id=165275604316782184616142&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduend~default-1-95190001-null-null.142%5Ev10%5Epc_search_result_control_group,157%5Ev4%5Econtrol&utm_term=Keepalived+greenplum+master&spm=1018.2226.3001.4187

2 双集群-双ETL方案

参考官方文档:Greenplum数据库最佳实践 - 高可用性 - 《Greenplum数据库 v6.0 中文文档》 - 书栈网 · BookStack高可用性磁盘存储最佳实践Master镜像最佳实践Segment镜像最佳实践双集群最佳实践备份和恢复最佳实践检测故障的master和segment实例最佳实践附加信息Segment镜像配置Group MirroringSpread MirroringBlock Mirroring实现Block Mirroring GreenPlum是基于数据库分布式架构的开源大数据平台;采用无共享(no sharehttps://www.bookstack.cn/read/greenplum-admin_guide-6.0-zh/47bfcbeb07195f4b.md#6tsq38

参考博客:

10. Greenplum高可用架构_Murkey学习之旅的博客-CSDN博客_greenplum高可用架构10. Greenplum高可用架构与数据持久化论述Greenplum数据库系统的高可用可以通过提供容错硬件平台实现,可以通过启用Greenplum数据库高可用特性实现,也可以通过执行定期监控和运维作业来确保整个系统所有组件保持健康来实现。硬件平台的最终故障,可能因为常见的持久运行故障或非预期的运行环境。异常断电会导致组件临时不可用。系统可以通过为可能故障的节点配置冗余备份节点来保...https://blog.csdn.net/murkey/article/details/105884695?ops_request_misc=&request_id=&biz_id=102&utm_term=GreenPlum%2520%25E5%258F%258C%25E9%259B%2586%25E7%25BE%25A4%2520%25E5%258F%258CETL&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduweb~default-2-105884695.142%5Ev10%5Econtrol,157%5Ev4%5Econtrol&spm=1018.2226.3001.4187

3 双集群-备份/恢复方案

备份/恢复方案,如果在并发情况下,容易造成锁表,只能在闲时运行,但是在闲时又满足不了需求,所以不推荐这个方案

你可能感兴趣的:(大数据,GP,Greenplum,fail-over,Keepalived)