MasterFailover.pm

1473 $ret =
1474 $_server_manager->change_master_and_start_slave( $target, $latest_slave,
1475 undef, undef, $log );

===========================

vim ServerManager.pm

-------------------------

sub change_master_and_start_slave {
my ( $self, $target, $master, $master_log_file, $master_log_pos, $log ) = @_;
$log = $self->{logger} unless ($log);
return if ( $target->{id} eq $master->{id} );
my $dbhelper = $target->{dbhelper};
$log->info(
sprintf(
" Resetting slave %s and starting replication from the new master %s..",
$target->get_hostinfo(),
$master->get_hostinfo()
)
);
$target->stop_slave($log) unless ( $target->{not_slave} );
$dbhelper->reset_slave() unless ( $target->{not_slave} );
my $addr =
$target->{use_ip_for_change_master}
? $master->{ip}
: $master->{hostname};

if ( $self->is_gtid_auto_pos_enabled() && !$target->{is_mariadb} ) {
$dbhelper->change_master_gtid( $addr, $master->{port},
$master->{repl_user}, $master->{repl_password} );
}
else {
$dbhelper->change_master( $addr,
$master->{port}, $master_log_file, $master_log_pos, $master->{repl_user},
$master->{repl_password} );
}
$log->info(" Executed CHANGE MASTER.");

# After executing CHANGE MASTER, relay_log_purge is automatically disabled.
# If the original value is 0, we should turn to 0 explicitly.
if ( !$target->{has_gtid} ) {
unless ( $target->{relay_purge} ) {
$target->disable_relay_log_purge();
}
}
my $ret = $target->start_slave($log);
unless ($ret) {
$log->info(" Slave started.");
}
return $ret;
}

mha error的更多相关文章

  1. Got error on conf /etc/mha/app1.cnf: Parameter name master_ip_failover_scrip is invalid!

    问题: [root@db03-53 ~]# masterha_check_repl --conf=/etc/mha/app1.cnf Tue Apr 2 20:24:58 2019 - [warnin ...

  2. mha安装报错 [error][/usr/share/perl5/vendor_perl/MHA/MasterMonitor.pm, ln361] None of slaves can be master. Check failover configuration file or log-bin settings in my.cnf

    查找资料 参考 http://blog.51cto.com/16769017/1878451 解决方法: 在两个从库上开启二进制日志即可(花了 一天时间,找不到解决方法,最后还是靠自己的理解及测试解决 ...

  3. MYSQL MHA

    MYSQL MHA 简介: MHA(Master High Availability)目前在MySQL高可用方面是一个相对成熟的解决方案,它由日本DeNA公司youshimaton(现就职于 Face ...

  4. MySQL高可用架构之MHA

    简介: MHA(Master High Availability)目前在MySQL高可用方面是一个相对成熟的解决方案,它由日本DeNA公司youshimaton(现就职于Facebook公司)开发,是 ...

  5. MySQL MHA 搭建&测试

    一:背景介绍 MHA(Master HA)是一款开源的MySQL的高可用工具,能在MySQL主从复制的基础上,实现自动化主服务器故障转移.虽然MHA试图从宕机的主服务器上保存二进制日志,但并不是总是可 ...

  6. mha安装使用手册

    mha安装使用手册 注:目前mha最新的版本代码已经不放到google code网站了,而是放在github上,最新的版本为0.57,github链接如下: mha manager:https://g ...

  7. mha配置参数详解

    mha配置参数详解: 参数名字 是否必须 参数作用域 默认值 示例 hostname Yes Local Only - hostname=mysql_server1, hostname=192.168 ...

  8. MHA故障切换和在线手工切换原理

    一.故障切换的过程 当master_manager监控到主库mysqld服务停止后,首先对主库进行SSH登录检查(save_binary_logs -command=test),然后对mysqld服务 ...

  9. MHA+Atlas+mysql一主一从开启gtid安装配置与实验

    各节点架构 (说明:生产环境有两个节点可以组成一套完整集群,我是测试环境,因此对于manager以及atlas和binlog server都是单点,如果生产环境,相应的将manager以及atlas和 ...

随机推荐

  1. SQL server 存储过程学习

    一.定义变量--简单赋值 declare @a intset @a=5 print @a --使用select语句赋值 declare @user1 nvarchar(50) select @user ...

  2. 解决vi编辑器不能使用方向键和退格键

    1.使用vi命令时,不能正常编辑文件,使用方向键时老是出现很多字母 这个问题主要是新系统直装了vi,没有装vim.因为vi是不能直接按退格键删除字符的,所以当你使用退格键删除字符,只有在按下esc时, ...

  3. ORACLE函数、连接查询、约束

    *ORDER BY 子句在SELECT语句的结尾. 使用外连接可以查询不满足连接条件的数据 with字句 字符函数lower upper initcap concat substr length in ...

  4. A + B 问题

    要求: 问题:给出两个整数a和b, 求他们的和, 但不能使用 + 等数学运算符. 示例: 如果 a=1 并且 b=2,返回3 代码: package main import ( "fmt&q ...

  5. Android ADT 工具下载地址

    /********************************************************************************* * Android ADT 工具下 ...

  6. 【linux基础】如何查看Linux系统是64位还是32位

    如何查看Linux系统是64位还是32位 $getconf LONG_BIT or $file /bin/ls or #查看linux版本 $lsb_release -a or $uname -a 参 ...

  7. Java中的数组初探

    1.数组的类型? Java中的数组为引用类型. 2.数组的三种初始化方式 1. int[] arr1=new int[] {1,2,3,4,}; 2. int[] arr2= {1,2,3,4,}; ...

  8. tf.contrib.rnn.core_rnn_cell.BasicLSTMCell should be replaced by tf.contrib.rnn.BasicLSTMCell.

    For Tensorflow 1.2 and Keras 2.0, the line tf.contrib.rnn.core_rnn_cell.BasicLSTMCell should be repl ...

  9. PAT-1084(外观数列 ) && PAT-1085 (PAT单位排行)

    1084  利用字符串string的可加性 #include <bits/stdc++.h> using namespace std; int main () { int x,n; cin ...

  10. P3084 [USACO13OPEN]照片Photo (dp+单调队列优化)

    题目链接:传送门 题目: 题目描述 Farmer John has decided to assemble a panoramic photo of a lineup of his N cows ( ...