如何使用pgpool failover_stream.sh自己控制选择指定的master节点
集群架构:
h236:master
h237:standby sync
h238:standby sync
h239:stadnby async
h240:standby async
h241:standby async
pool.conf
failover_command = '/etc/kingbasecluster/failover_stream.sh %H %P %d'
failover_stream.sh
#!/bin/sh
h238=172.19.33.238
h239=172.19.33.239
h240=172.19.33.240
h241=172.19.33.241
h236=172.19.33.236
h237=172.19.33.237
trigger_command="pg_ctl promote -D /data/pgdata"
fix_rec="sed -i 's/172\.19\.33\.236\./172.19.33.237/' /data/pgdata/recovery.conf;\
pg_ctl -D /data/pgdata/ stop -m fast;pg_ctl -D /data/pgdata/ start"
#primary down
#236(node 0) , 237(node1)
if [$2 -eq $3 ];then
#node 236 down
if [ $2 -eq 0 ];then
/usr/bin/ssh -T $h237 $trigger_command
fi
#node 237 down #236手动修复称为standby之后
if [ $2 -eq 1 ];then
$fix_rec="sed -i 's/172\.19\.33\.237\./172.19.33.236/' /data/pgdata/recovery.conf;\
pg_ctl -D /data/pgdata/ stop -m fast;pg_ctl -D /data/pgdata/ start"
/usr/bin/ssh -T $h236 $trigger_command
fi
#238-241 follow new primary
/usr/bin/ssh -T $h238 $fix_rec &
/usr/bin/ssh -T $h239 $fix_rec &
/usr/bin/ssh -T $h240 $fix_rec &
/usr/bin/ssh -T $h241 $fix_rec &
#do nothing for other standby down
fi
exit 0;
==============================================================================
failover命令中的参数使用描述
- failover_command
-
This parameter specifies a command to run when a node is detached. pgpool-II replaces the following special characters with backend specific information.
Special character Description %d Backend ID of a detached node. %h Hostname of a detached node. %p Port number of a detached node. %D Database cluster directory of a detached node. %M Old master node ID. %m New master node ID. %H Hostname of the new master node. %P Old primary node ID. %% '%' character You need to reload pgpool.conf if you change failover_command.
When a failover is performed, pgpool kills all its child processes, which will in turn terminate all active sessions to pgpool. Then pgpool invokes the failover_command and waits for its completion. After this, pgpool starts new child processes and is ready again to accept connections from clients.
- failback_command
-
This parameter specifies a command to run when a node is attached. pgpool-II replaces special the following characters with backend specific information.
Special character Description %d Backend ID of an attached node. %h Hostname of an attached node. %p Port number of an attached node. %D Database cluster path of an attached node. %M Old master node %m New master node %H Hostname of the new master node. %P Old primary node ID. %% '%' character You need to reload pgpool.conf if you change failback_command.
如何使用pgpool failover_stream.sh自己控制选择指定的master节点的更多相关文章
- Oracle 函数 “数据控制,指定某些人只能查看他权限范围内的信息”
create or replace function work_plan_mask (p_schema VARCHAR2,p_table VARCHAR2) return Varchar2 AS -- ...
- jquery选择指定元素之外的所有元素
最近的项目中有这么一个需求,点击一排图片中的任意一张后底部弹出一个对话框,要求点击任意地方隐藏对话框 这个时候用not()显然是不现实的,用closest()可以实现差不多的功能 <!DOCTY ...
- 选择指定的MySQL数据库
<?php /******************************** *** 功能:选择指定的MySQL数据库 *********************************/ ? ...
- 黑马程序员——C语言基础 流程控制 选择结构和循环结构
---恢复内容开始--- Java培训.Android培训.iOS培训..Net培训.期待与您交流! (以下内容是对黑马苹果入学视频的个人知识点总结) (一)流程控制 1> 顺序结构:默认的流程 ...
- WdatePicker 控制选择范围
1. 跨无限级框架显示 无论你把日期控件放在哪里,你都不需要担心会被外层的iframe所遮挡进而影响客户体验,因为My97日期控件是可以跨无限级框架显示的 示例2-7 跨无限级框架演示 可无限跨越框架 ...
- ElementUI DatePicker 日期选择器控制选择时间范围
选择今天以及今天之后的日期 <el-date-picker v-model="value1" type="date" placeholder=" ...
- UGUI 用手柄或者键盘控制选择Scroll View中的游戏对象时,滚动条跟着移动
原预制体以及脚本的下载地址:https://download.csdn.net/download/qq_15017279/10404010 1.新建一个Scroll View,删掉横向的滚动条,并且把 ...
- input accept属性控制选择文件类型
<form> <input type="file" name="pic" id="pic" accept="im ...
- 打印机设置(PrintDialog)、页面设置(PageSetupDialog) 及 RDLC报表如何选择指定打印机
如果一台电脑同时连接多个打印机,而且每个打印机使用的纸张大小各不相同(比如:票据打印钱用的小票专用张,办公打印机用的是A4标准纸),在处理打印类的需求时,如果不用代码干预,用户必须每次打印时,都必须在 ...
随机推荐
- Kafka学习笔记(1)----Kafka的简介和Linux下单机安装
1. Kafka简介 Kafka is a distributed,partitioned,replicated commit logservice.它提供了类似于JMS的特性,但是在设计实现上完全不 ...
- 06 Django组件-cookie与session
一.会话跟踪技术 1.什么是会话跟踪技术 我们需要先了解一下什么是会话!可以把会话理解为客户端与服务器之间的一次会晤,在一次会晤中可能会包含多次请求和响应.例如你给10086打个电话,你就是客户端,而 ...
- Connection refused (SQL: select * from information_s chema.tables where table_schema = apidemo and table_name = migrations)
LARAVEL 执行: $ php artisan migrate 报错 ,把 .env文件里的 DB_CONNECTION=mysqlDB_HOST=127.0.0.1DB_PORT=3306 换成 ...
- HDU2149 - Public Sale【巴什博弈】
虽然不想,但是现实总归是现实,Lele始终没有逃过退学的命运,因为他没有拿到奖学金.现在等待他的,就是像FarmJohn一样的农田生涯. 要种田得有田才行,Lele听说街上正在举行一场别开生面的拍卖 ...
- ansible自动化部署
ansible通过模块实现批量管理及部署服务器,功能有模块实现 ansible无需在被控端安装agent/client,因为ansible是通过ssh分发ad-hoc(单条指令)或者palybook( ...
- LVM实践
[root@ftp:/root] > fdisk -l Disk /dev/sda: 53.7 GB, 53687091200 bytes, 104857600 sectors Units = ...
- vue v-for下图片src显示失败,404错误
- python第一周:python初识、流程控制
编译性语言:在将源代码编译完毕生成一个可执行文件后才能运行 解释性语言:在代码的运行期间进行编译 动态类型语言:在运行期间才去做数据检查的语言,也就是说在使用动态类型语言时不用指定数据类型 静态类型语 ...
- [Design]Ppt处理大段文字
可以用标签类的东西 时间轴
- hdu 1542 线段树之扫描线之面积并
点击打开链接 题意:给你n个矩形,求它们的面积,反复的不反复计算 思路:用线段树的扫描线完毕.将X坐标离散化后,从下到上扫描矩形,进行各种处理,看代码凝视把 #include <stdio.h& ...