mha切换脚本可用的
- #!/usr/bin/env perl
- use strict;
- use warnings FATAL => 'all';
- use Getopt::Long;
- my (
- $command, $ssh_user, $orig_master_host, $orig_master_ip,
- $orig_master_port, $new_master_host, $new_master_ip, $new_master_port
- );
- my $vip = '192.168.237.120/24';
- my $key = '2';
- my $ssh_start_vip = "/sbin/ifconfig eno16777736:$key $vip";
- my $ssh_stop_vip = "/sbin/ifconfig eno16777736:$key down";
- GetOptions(
- 'command=s' => \$command,
- 'ssh_user=s' => \$ssh_user,
- 'orig_master_host=s' => \$orig_master_host,
- 'orig_master_ip=s' => \$orig_master_ip,
- 'orig_master_port=i' => \$orig_master_port,
- 'new_master_host=s' => \$new_master_host,
- 'new_master_ip=s' => \$new_master_ip,
- 'new_master_port=i' => \$new_master_port,
- );
- exit &main();
- sub main {
- print "\n\nIN SCRIPT TEST====$ssh_stop_vip==$ssh_start_vip===\n\n";
- if ( $command eq "stop" || $command eq "stopssh" ) {
- my $exit_code = ;
- eval {
- print "Disabling the VIP on old master: $orig_master_host \n";
- &stop_vip();
- $exit_code = ;
- };
- if ($@) {
- warn "Got Error: $@\n";
- exit $exit_code;
- }
- exit $exit_code;
- }
- elsif ( $command eq "start" ) {
- my $exit_code = ;
- eval {
- print "Enabling the VIP - $vip on the new master - $new_master_host \n";
- &start_vip();
- $exit_code = ;
- };
- if ($@) {
- warn $@;
- exit $exit_code;
- }
- exit $exit_code;
- }
- elsif ( $command eq "status" ) {
- print "Checking the Status of the script.. OK \n";
- exit ;
- }
- else {
- &usage();
- exit ;
- }
- }
- sub start_vip() {
- `ssh $ssh_user\@$new_master_host \" $ssh_start_vip \"`;
- }
- sub stop_vip() {
- return 0 unless ($ssh_user);
- `ssh $ssh_user\@$orig_master_host \" $ssh_stop_vip \"`;
- }
- sub usage {
- "Usage: master_ip_failover --command=start|stop|stopssh|status --orig_master_host=host --orig_master_ip=ip --orig_master_port=port --new_master_host=host --new_master_ip=ip --new_master_port=port\n";
- }
mha切换脚本可用的的更多相关文章
- MySQL/MariaDB数据库的MHA实现高可用实战
MySQL/MariaDB数据库的MHA实现高可用实战 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.MySQL高可用常见的解决方案 1>.Multi-Master ...
- Redis主从配置及通过Keepalived实现Redis自动切换高可用
Redis主从配置及通过Keepalived实现Redis自动切换高可用 [日期:2014-07-23] 来源:Linux社区 作者:fuquanjun [字体:大 中 小] 一:环境介绍: M ...
- MySQL数据库主从切换脚本自动化
MySQL数据库主从切换脚本自动化 本文转载自:https://blog.csdn.net/weixin_36135773/article/details/79514507 在一些实际环境中,如何实现 ...
- MySQL--19 MHA切换日志分析
MHA切换检测日志分析 GTID模式 [root@db03 ~]# tail -f /etc/mha/manager.log #在MySQL select ping:2006上出错(MySQL服务器已 ...
- [转]IP动态切换脚本
因为公司办公室要设置固定IP才行,而家里的IP段和公司是不一样的,家里采用了DHCP机制,这样每次就得改IP设置,很是不方便,就写了这个脚本来动态切换,很流畅的说!WINXP,WIN7测试通过~嘿嘿~ ...
- mysql+keepalived主从切换脚本 转
Keepalived MySQL故障自动切换脚本 MySQL架构为master-slave(主从),master故障自动切换到slave上.当然也可以设置为双master,但这里有个弊端:就是当主 ...
- IP切换脚本
1. 新建bat文件: 2. 将下面内容拷贝进bat文件: 3. 运行bat文件: @echo off color 00title IP切换脚本:start @echo --------------- ...
- mysql mha 主从自动切换 高可用
mha(Master High Availability)目前在MySQL多服务器(超过二台),高可用方面是一个相对成熟的解决方案. 一,什么是mha,有什么特性 1. 主服务器的自动监控和故障转移 ...
- MySQL高可用之MHA切换测试(switchover & failover)
Preface I've installed MasterHA yesterday,Now let's test the master-slave switch and failove ...
随机推荐
- C++ smart pointer智能指针
在C++中,程序员可以直接操作内存,给编程增加了不少的灵活性.但是灵活性是有代价的,程序员必须负责自己负责释放自己申请的内存,否则就会出现内存泄露.智能指针就是为了解决这个问题而存在的.它和其他指 ...
- kafka 配置文件注释
文章转载自:http://liyonghui160com.iteye.com/blog/2163899 server.properties配置: server.properties中所有配置参数说明( ...
- MySQL 5.6学习笔记(数据表基本操作)
1. 创建数据表 1.1 最基本的语法 CREATE TABLE tbl_name (col_name column_definition,...) [table_options] -column_d ...
- Atitit opencv 模板匹配
Atitit opencv 模板匹配 1.1. 图片1 1.2. Atitit opencv 模板匹配 6中匹配算法貌似效果区别不大1 1.3. 对模板缩放的影响 一般的缩放可以,太大了就歇菜了.. ...
- Oracle Time Model Statistics(时间模型统计)
Oracle数据库从10g開始,启用以时间模型统计为主.命中率为辅等性能度量指标.基于时间模型统计,主要是基于操作类型測量在数据库中花费的时间的统计信息.最重要的时间模型统计是数据库时间.或DB时间. ...
- mongoose查询不到数据表中的数据的问题
在做分类管理的时候,在数据库中创建了一张category表,但使用下面这行代码始终查不到表里的数据,也没有任何报错. var Category = mongoose.model('Category', ...
- Flink SQL与 SQL Parser ,calcite
http://vinoyang.com/2017/06/12/flink-table-sql-source/ Flink Table&Sql 如何结合Apache Calcite http:/ ...
- tensorflow笔记1:基础函数、embedding_lookup
函数一:tf.nn.embedding_lookup() ERROR: I get this error: TypeError: Tensors in list passed to 'values' ...
- (转)C++头文件顺序
转自:http://blog.csdn.net/clever101/article/details/7269058关键总结:先包含的头文件的函数会覆盖后包含的头文件的同名函数.建议采用Google C ...
- vue实现点击区域外部的区域,关闭该区域
var _this = this; document.addEventListener('click',function(e){ console.log(_this.$refs.configforms ...