MHA搭建
https://metacpan.org 下载perl依赖包的网站
##################上传安装依赖包####################
mkdir /opt/soft_file
上传所有包
下面这些只需要在管理节点上安装
cd /opt/soft_file/rpm
rpm --import /etc/pki/rpm-gpg/RPM*
yum -y install glibc.i686
yum -y install libstdc++.i686
rpm -ivh perl-Log-Dispatch-2.22-7.3.noarch.rpm --force --nodeps
rpm -ivh perl-Config-Tiny-2.12-1.el5.rf.noarch.rpm --force --nodeps
rpm -ivh perl-Params-Validate-0.95-1.el5.rf.i386.rpm --force --nodeps
rpm -ivh perl-MIME-Types-1.28-2.el6.noarch.rpm --force --nodeps
rpm -ivh perl-Email-Date-Format-1.002-5.el6.noarch.rpm --force --nodeps
rpm -ivh perl-Mail-Sender-0.8.16-3.el6.noarch.rpm --force --nodeps
rpm -ivh perl-Mail-Sendmail-0.79-12.el6.noarch.rpm --force --nodeps
rpm -ivh perl-TimeDate-1.16-11.1.el6.noarch.rpm --force --nodeps
rpm -ivh perl-MailTools-2.04-4.el6.noarch.rpm --force --nodeps
rpm -ivh perl-MIME-Lite-3.027-2.el6.noarch.rpm --force --nodeps
rpm -ivh perl-Log-Dispatch-2.26-1.el5.rf.noarch.rpm --force --nodeps
rpm -ivh perl-Time-HiRes-1.9724-1.el6.rfx.x86_64.rpm --force --nodeps
cd /opt/soft_file/
tar -zxvf Log-Dispatch-2.22.tar.gz
cd Log-Dispatch-2.22
perl Makefile.PL
make && make install
tar -zxvf Parallel-ForkManager-1.11.tar.gz
cd Parallel-ForkManager-1.11
perl Makefile.PL
make && make install
##################主从复制####################
主库
use mysql
grant replication slave on *.* to 'rep'@'192.168.159.129' identified by 'rep123';
show master status\G
select user,host,password from user;
备库
CHANGE MASTER TO
MASTER_HOST='192.168.159.128',
MASTER_PORT=3306,
MASTER_USER='rep',
MASTER_PASSWORD='rep123';
CHANGE MASTER TO
MASTER_HOST='192.168.76.131',
MASTER_PORT=3306,
MASTER_LOG_FILE='binlog.000013',
MASTER_LOG_POS=1030,
MASTER_USER='rep',
MASTER_PASSWORD='rep123';
start slave;
show slave status\G
主库
delete from user where user='';
delete from user where user='root' or '';
grant all privileges on *.* to 'root'@'%' identified by 'root123' with grant option;
grant all privileges on *.* to 'root'@'localhost' identified by 'root123' with grant option;
grant all privileges on *.* to 'root'@'127.0.0.1' identified by 'root123' with grant option;
##################hosts配置####################
1.服务器
192.168.76.131 host1 #Master
192.168.76.132 host2 #Slave
192.168.76.139 host3 #MHA manager
2. 所有机器修改vim /etc/hosts
192.168.159.128 host1
192.168.159.129 host2
192.168.159.130 host3
##################SSH公钥免密码####################
3.设置SSH公钥免密码登录
#root用户操作(/root),pwd
mkdir ~/.ssh
chmod 700 ~/.ssh
cd ~/.ssh
ssh-keygen -t rsa #一直回车
ls -al
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
ls -al
chmod 600 ~/.ssh/authorized_keys
cd ..
scp -r .ssh 192.168.76.132:/root/
scp -r .ssh 192.168.76.139:/root/
ssh host1 date
ssh host2 date
ssh host3 date
##################MHA部署####################
4.下载mha4mysql-manager和mha4mysql-node
https://github.com/yoshinorim/mha4mysql-manager
https://github.com/yoshinorim/mha4mysql-node
5.在三个节点(node 和 manager)安装perl-DBD-MySQL,用光盘作yum源,#包括了3个包:Perl-DBD-MySQL,mysql-libs,perl-DBI
yum install -y perl-DBD-MySQL
yum install -y perl-DBI
yum install -y mysql-libs
6.在三个节点安装node(包括管理节点)
cd /opt/soft_file
tar -xzvf mha4mysql-node-0.56.tar.gz
cd mha4mysql-node-0.56
perl Makefile.PL
make && make install
7.在管理节点安装manager
cd /opt/soft_file
tar -xzvf mha4mysql-manager-0.56.tar.gz
cd mha4mysql-manager-0.56
perl Makefile.PL
make && make install
#################配置文件###################
mkdir -p /u01/mha/etc
mkdir -p /u01/mha/log
mkdir -p /u01/mha/etc/app
vim /u01/mha/etc/app.cnf
[server default]
user = root
password = root123
ssh_user = root
repl_user = rep
repl_password = rep123
ping_interval = 1
ping_type = SELECT
manager_workdir=/u01/mha/etc/app
manager_log=/u01/mha/log/manager.log
remote_workdir=/u01/mha/etc/app
master_binlog_dir="/u01/svr/log/my3306/binlog"
master_ip_failover_script="/u01/mha/etc/master_ip_failover"
master_ip_online_change_script="/u01/mha/etc/master_ip_failover"
shutdown_script=""
report_script=""
#check_repl_delay=0
[server1]
hostname=host1
port=3306
master_binlog_dir="/u01/svr/log/my3306/binlog"
candidate_master=1
ignore_fail=1
[server2]
hostname=host2
port=3307
master_binlog_dir="/u01/svr/log/my3307/binlog"
candidate_master=1
ignore_fail=1
MHA测试
/usr/local/bin/masterha_check_ssh --conf=/u01/mha/etc/app.cnf
####################切换脚本###############
vim /u01/mha/etc/master_ip_failover
chmod 777 master_ip_failover
#!/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.76.140/24'; # Virtual IP
my $key = "1";
my $int = "eth0";
my $ssh_start_vip = "/sbin/ifconfig $int:$key $vip";
my $ssh_stop_vip = "/sbin/ifconfig $int:$key down";
my $arp_effect = "/sbin/arping -Uq -s192.168.76.140 -I $int 192.168.76.1 -c 3"; # Virtual IP and gateway
#my $test = "echo successfull >/tmp/test.txt";
$ssh_user = "root";
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" ) {
# $orig_master_host, $orig_master_ip, $orig_master_port are passed.
# If you manage master ip address at global catalog database,
# invalidate orig_master_ip here.
my $exit_code = 1;
eval {
print "Disabling the VIP on old master: $orig_master_host \n";
&stop_vip();
$exit_code = 0;
};
if ($@) {
warn "Got Error: $@\n";
exit $exit_code;
}
exit $exit_code;
}
elsif ( $command eq "start" ) {
# all arguments are passed.
# If you manage master ip address at global catalog database,
# activate new_master_ip here.
# You can also grant write access (create user, set read_only=0, etc) here.
my $exit_code = 10;
eval {
print "Enabling the VIP - $vip on the new master - $new_master_host \n";
&start_vip();
$exit_code = 0;
};
if ($@) {
warn $@;
exit $exit_code;
}
exit $exit_code;
}
elsif ( $command eq "status" ) {
print "Checking the Status of the script.. OK \n";
`ssh $ssh_user\@host1 \" $ssh_start_vip \"`;
&status();
exit 0;
}
else {
&usage();
exit 1;
}
}
# A simple system call that enable the VIP on the new master
sub start_vip() {
`ssh $ssh_user\@$new_master_host \" $ssh_start_vip \"`;
`ssh $ssh_user\@$new_master_host \" $arp_effect \"`;
# `ssh $ssh_user\@$new_master_host \" $test \"`;
}
# A simple system call that disable the VIP on the old_master
sub stop_vip() {
`ssh $ssh_user\@$orig_master_host \" $ssh_stop_vip \"`;
}
sub status() {
print `ssh $ssh_user\@$orig_master_host \" ip add show $int \"`;
}
sub usage {
print
"Usage: master_ip_failover --command=start|stop|stopssh|status --orig_master_host=host --orig_maste
r_ip=ip --orig_master_port=port --new_master_host=host --new_master_ip=ip --new_master_port=port\n";
}
####################常用命令###############
检测SSH
/usr/local/bin/masterha_check_ssh --conf=/u01/mha/etc/app.cnf
查看复制是否建立好
a、读取配置文件
b、检测配置文件中列出的mysql服务器(识别主从)
c、检测从库配置信息
read_only参数
relay_log_purge参数
复制过滤规则
d、ssh等效性验证
e、检测主库保存binlog脚本(save_binary_logs) ,主要是用于在master死掉后从binlog读取日志
f、检测各从库能否apply差量binlog(apply_diff_relay_logs)
g、检测IP切换,如果有部署脚本
/usr/local/bin/masterha_check_repl --conf=/u01/mha/etc/app.cnf
检查启动的状态
/u01/mha/etc/masterha_check_status --conf=/u01/mha/etc/app.cnf
启动mha
/usr/local/bin/masterha_manager --conf=/u01/mha/etc/app.cnf &
停止mha
/usr/local/bin/masterha_stop --conf=/u01/mha/etc/app.cnf
7.启动管理节点
/usr/local/bin/masterha_manager --conf=/u01/mha/etc/app.cnf &
/usr/local/bin/masterha_manager --conf=/u01/mha/etc/app.cnf --remove_dead_master_conf --ignore_last_failover &
masterha_check_repl --conf=/u01/mha/etc/app.cnf
检测是否正常
###################切换######################
一、failover故障切换
1.模拟主库宕机
[root@mydb3~]# ssh mydb1 "killall -r mysqld"
2.查看管理节点日志,可以看到VIP已经漂移
[root@mydb3 ~]# cat /u01/mha/log/manager.log |grep -i vip
3. 验证VIP是否位于节点mydb2
[root@mydb3 ~]# ssh mydb2 "ifconfig |grep 56.201 -B1"
4. 查看管理节点MHA切换日志
[root@mydb3 ~]# tail /u01/mha/log/manager.log
5. new master(old slave)
show master status\G
6. new slave(old:master)
(1)打开MySQL
mysqld_safe --defaults-file=/u01/my3306/my.cnf &
(2)检查数据库
show master status\G
show slave status\G
(3)在管理节点日志中查主库的日志文件和位置
cat /u01/mha/log/manager.log |grep -i change
(4)在slave连接master
CHANGE MASTER TO
MASTER_HOST='192.168.76.132',
MASTER_PORT=3307,
MASTER_LOG_FILE='binlog.000006',
MASTER_LOG_POS=7073229,
MASTER_USER='rep',
MASTER_PASSWORD='rep123';
7.启动管理节点
/usr/local/bin/masterha_manager --conf=/u01/mha/etc/app.cnf &
/usr/local/bin/masterha_manager --conf=/u01/mha/etc/app.cnf --ignore_last_failover &
二、switchover线上切换
1.master:关闭event_scheduler(即192.168.56.21 host1)
set global event_scheduler=off;
2.manager:关闭管理进程 (即192.168.56.23 manager node)
/usr/local/bin/masterha_stop --conf=/u01/mha/etc/app.cnf
3.manager:检查配置文件
/u01/mha/etc/app.cnf 有没有被修改破坏。如果破坏需要重新编辑正确配置文件:/u01/mha/etc/app.cnf
cp /u01/mha/etc/app.cnf.bak /u01/mha/etc/app.cnf
4.开始切换:
/u01/mha/etc/masterha_master_switch --master_state=alive --conf=/u01/mha/etc/app.cnf
5.new master(old slave)
mysql> show master status\G
*************************** 1. row ***************************
File: binlog.000021
Position: 299
Binlog_Do_DB:
Binlog_Ignore_DB:
Executed_Gtid_Set:
1 row in set (0.00 sec)
6.new slave(old master)
CHANGE MASTER TO
MASTER_HOST='192.168.56.22',
MASTER_PORT=3306,
MASTER_LOG_FILE='binlog.000021',
MASTER_LOG_POS=299,
MASTER_USER='rep',
MASTER_PASSWORD='rep123';
mysql> start slave;
Query OK, 0 rows affected (0.01 sec)
mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.56.12
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: binlog.000017
Read_Master_Log_Pos: 299
Relay_Log_File: relaylog.000002
Relay_Log_Pos: 280
Relay_Master_Log_File: binlog.000017
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
7.启动管理节点
/u01/mha/etc/masterha_manager --conf=/u01/mha/etc/app.cnf &
/u01/mha/etc/masterha_manager --conf=/u01/mha/etc/app.cnf --remove_dead_master_conf --ignore_last_failover &
启动参数介绍:
--remove_dead_master_conf 该参数代表当发生主从切换后,老的主库的ip将会从配置文件中移除。
--manger_log 日志存放位置
--ignore_last_failover 在缺省情况下,如果MHA检测到连续发生宕机,且两次宕机间隔不足8小时的话,则不会进行Failover,之所以这样限制是为了避免ping-pong效应。该参数代表忽略上次MHA触发切换产生的文件,默认情况下,MHA发生切换后会在日志目录,也就是上面我设置的/data产生app1.failover.complete文件,下次再次切换的时候如果发现该目录下存在该文件将不允许触发切换,除非在第一次切换后收到删除该文件,为了方便,这里设置为--ignore_last_failover。
============================================================================
masterha_check_repl报错汇总
[root@DBMysql ~]#masterha_check_repl --conf=/etc/masterha/app1.cnf
导致如下报错的原因主要有两类:
1.mysql的安装时用源码安装,导致mysql的目录与MHA默认的目录不一致。解决办法用ln -s做相关软连接。注:我的mysql数据库是用mysql用户安装的,MHA是用root用户安装的,如果在同一个用户下安装不知是否可以避免此类问题
2.candidate_master对应的用户权限不足导致。
以下内容摘自网络
报错记录1:
[root@data01 ~]# masterha_check_repl--conf=/etc/masterha/app1.cnf
Tue Apr 7 22:31:06 2015 - [warning] Global configuration file/etc/masterha_default.cnf not found. Skipping.
Tue Apr 7 22:31:07 2015 - [info] Reading application default configuration from/etc/masterha/app1.cnf..
Tue Apr 7 22:31:07 2015 - [info] Reading server configuration from/etc/masterha/app1.cnf..
Tue Apr 7 22:31:07 2015 - [info] MHA::MasterMonitor version 0.56.
Tue Apr 7 22:31:07 2015 - [error][/usr/local/share/perl5/MHA/Server.pm,ln303] Getting relay log directory orcurrent relay logfile from replication table failed on192.168.52.130(192.168.52.130:3306)!
Tue Apr 7 22:31:07 2015 - [error][/usr/local/share/perl5/MHA/MasterMonitor.pm,ln424] Error happened on checking configurations. at /usr/local/share/perl5/MHA/ServerManager.pmline 315
Tue Apr 7 22:31:07 2015 - [error][/usr/local/share/perl5/MHA/MasterMonitor.pm,ln523] Error happened on monitoring servers.
Tue Apr 7 22:31:07 2015 - [info] Got exit code 1 (Not master dead).
MySQL Replication Health is NOT OK!
[root@data01 ~]#
解决办法:在192.168.52.130上面,vim /etc/my.cnf,在里面添加
relay-log=/home/data/mysql/binlog/mysql-relay-bin
然后重启mysql,再去重新设置slave连接。
STOP SLAVE;
RESET SLAVE;
CHANGE MASTER TOMASTER_HOST='192.168.52.129',MASTER_USER='repl',MASTER_PASSWORD='repl_1234',MASTER_LOG_FILE='mysql-bin.000178',MASTER_LOG_POS=459;
START SLAVE;
Ok,搞定了。
报错记录2:
[root@data01 perl]# masterha_check_repl--conf=/etc/masterha/app1.cnf
Thu Apr 9 00:54:32 2015 - [warning] Global configuration file/etc/masterha_default.cnf not found. Skipping.
Thu Apr 9 00:54:32 2015 - [info] Reading application default configuration from/etc/masterha/app1.cnf..
Thu Apr 9 00:54:32 2015 - [info] Reading server configuration from/etc/masterha/app1.cnf..
Thu Apr 9 00:54:32 2015 - [info] MHA::MasterMonitor version 0.56.
Thu Apr 9 00:54:32 2015 - [error][/usr/local/share/perl5/MHA/Server.pm,ln306] Getting relay log directory orcurrent relay logfile from replication table failed on 192.168.52.130(192.168.52.130:3306)!
Thu Apr 9 00:54:32 2015 - [error][/usr/local/share/perl5/MHA/MasterMonitor.pm,ln424] Error happened on checking configurations. at/usr/local/share/perl5/MHA/ServerManager.pm line 315
Thu Apr 9 00:54:32 2015 - [error][/usr/local/share/perl5/MHA/MasterMonitor.pm,ln523] Error happened on monitoring servers.
Thu Apr 9 00:54:32 2015 - [info] Got exit code 1 (Not master dead).
MySQL Replication Health is NOT OK!
[root@data01 perl]#
解决方法:
/etc/masterha/app1.cnf文件里面的参数配置,user和repl_user都是mysql账号,需要创建好,这里是只创建了repl_user而没有创建好user账号:
user=manager
password=manager_1234
repl_user=repl
repl_password=repl_1234
在mysql节点上,建立允许manager 访问数据库的“ manager manager ”账户,主要用于SHOW SLAVESTATUS,RESET SLAVE; 所以需要执行如下命令:
GRANT SUPER,RELOAD,REPLICATIONCLIENT,SELECT ON *.* TO manager@'192.168.52.%' IDENTIFIED BY 'manager_1234';
错误记录3:
[root@oraclem1 ~]# masterha_check_repl--conf=/etc/masterha/app1.cnf
Thu Apr 9 23:09:05 2015 - [warning] Global configuration file/etc/masterha_default.cnf not found. Skipping.
Thu Apr 9 23:09:05 2015 - [info] Reading application default configuration from/etc/masterha/app1.cnf..
Thu Apr 9 23:09:05 2015 - [info] Reading server configuration from/etc/masterha/app1.cnf..
Thu Apr 9 23:09:05 2015 - [info] MHA::MasterMonitor version 0.56.
Thu Apr 9 23:09:05 2015 - [error][/usr/local/share/perl5/MHA/ServerManager.pm,ln781] Multi-master configuration is detected, but two or more masters areeither writable (read-only is not set) or dead! Check configurations fordetails. Master configurations are as below:
Master 192.168.52.130(192.168.52.130:3306),replicating from 192.168.52.129(192.168.52.129:3306)
Master 192.168.52.129(192.168.52.129:3306),replicating from 192.168.52.130(192.168.52.130:3306)
Thu Apr 9 23:09:05 2015 - [error][/usr/local/share/perl5/MHA/MasterMonitor.pm,ln424] Error happened on checking configurations. at/usr/local/share/perl5/MHA/MasterMonitor.pm line 326
Thu Apr 9 23:09:05 2015 - [error][/usr/local/share/perl5/MHA/MasterMonitor.pm,ln523] Error happened on monitoring servers.
Thu Apr 9 23:09:05 2015 - [info] Got exit code 1 (Not master dead).
MySQL Replication Health is NOT OK!
[root@oraclem1 ~]#
解决办法:
mysql> set global read_only=1;
Query OK, 0 rows affected (0.00 sec)
mysql>
报错记录4:
Thu Apr 9 23:54:32 2015 - [info] Checking SSH publickey authentication andchecking recovery script configurations on all alive slave servers..
Thu Apr 9 23:54:32 2015 - [info] Executing command : apply_diff_relay_logs --command=test--slave_user='manager' --slave_host=192.168.52.130 --slave_ip=192.168.52.130--slave_port=3306 --workdir=/var/tmp --target_version=5.6.12-log--manager_version=0.56 --relay_dir=/home/data/mysql/data--current_relay_log=mysqld-relay-bin.000011 --slave_pass=xxx
Thu Apr 9 23:54:32 2015 - [info] Connecting to root@192.168.52.130(192.168.52.130:22)..
Can't exec "mysqlbinlog": No suchfile or directory at /usr/local/share/perl5/MHA/BinlogManager.pm line 106.
mysqlbinlog version command failed with rc1:0, please verify PATH, LD_LIBRARY_PATH, and client options
at/usr/local/bin/apply_diff_relay_logs line 493
Thu Apr 9 23:54:32 2015 - [error][/usr/local/share/perl5/MHA/MasterMonitor.pm,ln205] Slaves settings check failed!
Thu Apr 9 23:54:32 2015 - [error][/usr/local/share/perl5/MHA/MasterMonitor.pm,ln413] Slave configuration failed.
Thu Apr 9 23:54:32 2015 - [error][/usr/local/share/perl5/MHA/MasterMonitor.pm,ln424] Error happened on checking configurations. at /usr/local/bin/masterha_check_repl line 48
Thu Apr 9 23:54:32 2015 - [error][/usr/local/share/perl5/MHA/MasterMonitor.pm,ln523] Error happened on monitoring servers.
Thu Apr 9 23:54:32 2015 - [info] Got exit code 1 (Not master dead).
MySQL Replication Health is NOT OK!
[root@oraclem1 ~]#
解决办法(所有节点都执行一遍):
[root@data02 ~]# type mysqlbinlog
mysqlbinlog is/usr/local/mysql/bin/mysqlbinlog
[root@data02 ~]#
[root@data02 ~]# ln -s/usr/local/mysql/bin/mysqlbinlog /usr/bin/mysqlbinlog
报错记录5:
Thu Apr 9 23:57:24 2015 - [info] Connecting to root@192.168.52.130(192.168.52.130:22)..
Checking slave recovery environment settings..
Relay log found at /home/data/mysql/data, up to mysqld-relay-bin.000013
Temporary relay log file is /home/data/mysql/data/mysqld-relay-bin.000013
Testing mysql connection and privileges..sh: mysql: command not found
mysql command failed with rc 127:0!
at/usr/local/bin/apply_diff_relay_logs line 375
main::check()called at /usr/local/bin/apply_diff_relay_logs line 497
eval{...} called at /usr/local/bin/apply_diff_relay_logs line 475
main::main()called at /usr/local/bin/apply_diff_relay_logs line 120
Thu Apr 9 23:57:24 2015 - [error][/usr/local/share/perl5/MHA/MasterMonitor.pm,ln205] Slaves settings check failed!
Thu Apr 9 23:57:24 2015 - [error][/usr/local/share/perl5/MHA/MasterMonitor.pm,ln413] Slave configuration failed.
Thu Apr 9 23:57:24 2015 - [error][/usr/local/share/perl5/MHA/MasterMonitor.pm,ln424] Error happened on checking configurations. at /usr/local/bin/masterha_check_repl line 48
Thu Apr 9 23:57:24 2015 - [error][/usr/local/share/perl5/MHA/MasterMonitor.pm,ln523] Error happened on monitoring servers.
Thu Apr 9 23:57:24 2015 - [info] Got exit code 1 (Not master dead).
MySQL Replication Health is NOT OK!
解决办法(所有节点都执行一遍):
ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql
报错记录6(所切换机器用户权限不匹配):
Fri Apr 10 00:58:36 2015 - [info] Executing command : apply_diff_relay_logs--command=test --slave_user='manager' --slave_host=192.168.52.130--slave_ip=192.168.52.130 --slave_port=3306 --workdir=/var/tmp--target_version=5.6.12-log --manager_version=0.56--relay_dir=/home/data/mysql/data--current_relay_log=mysqld-relay-bin.000011 --slave_pass=xxx
Fri Apr 10 00:58:36 2015 - [info] Connecting to root@192.168.52.130(192.168.52.130:22)..
Checking slave recovery environment settings..
Relay log found at /home/data/mysql/data, up to mysqld-relay-bin.000013
Temporary relay log file is/home/data/mysql/data/mysqld-relay-bin.000013
Testing mysql connection and privileges..Warning: Using a password onthe command line interface can be insecure.
ERROR 1142 (42000) at line 1: CREATEcommand denied to user 'manager'@'192.168.52.130' for table'apply_diff_relay_logs_test'
mysql command failed with rc 1:0!
at/usr/local/bin/apply_diff_relay_logs line 375
main::check()called at /usr/local/bin/apply_diff_relay_logs line 497
eval{...} called at /usr/local/bin/apply_diff_relay_logs line 475
main::main()called at /usr/local/bin/apply_diff_relay_logs line 120
Fri Apr 10 00:58:37 2015 -[error][/usr/local/share/perl5/MHA/MasterMonitor.pm, ln205] Slaves settingscheck failed!
Fri Apr 10 00:58:37 2015 -[error][/usr/local/share/perl5/MHA/MasterMonitor.pm, ln413] Slave configurationfailed.
Fri Apr 10 00:58:37 2015 -[error][/usr/local/share/perl5/MHA/MasterMonitor.pm, ln424] Error happened onchecking configurations. at/usr/local/bin/masterha_check_repl line 48
Fri Apr 10 00:58:37 2015 -[error][/usr/local/share/perl5/MHA/MasterMonitor.pm, ln523] Error happened onmonitoring servers.
Fri Apr 10 00:58:37 2015 - [info] Got exitcode 1 (Not master dead).
MySQL Replication Health is NOT OK!
解决办法:
执行如下授权语句sql:
GRANT CREATE,INSERT,UPDATE,DELETE,DROP ON*.* TO manager@'192.168.52.%';
MHA搭建的更多相关文章
- mysql高可用架构MHA搭建(centos7+mysql5.7.28)
无论是传统行业,还是互联网行业,数据可用性都是至关重要的,虽然现在已经步入大数据时代,nosql比较流行,但是作为数据持久化及事务性的关系型数据库依然是项目首选,比如mysql. 现在几乎所有的公司项 ...
- MySQL MHA 搭建&测试
一:背景介绍 MHA(Master HA)是一款开源的MySQL的高可用工具,能在MySQL主从复制的基础上,实现自动化主服务器故障转移.虽然MHA试图从宕机的主服务器上保存二进制日志,但并不是总是可 ...
- MySQL MHA 搭建&测试(环境:CentOS7 + MySQL5.7.23)
MySQL MHA架构介绍: MHA(Master High Availability)目前在MySQL高可用方面是一个相对成熟的解决方案,它由日本DeNA公司youshimaton(现就职于Face ...
- MySQL MHA搭建
MHA算是业内比较成熟的MySQL高可用解决方案,在MySQL故障切换过程中,MHA能做到自动完成数据库的故障切换操作,并且在进行故障切换的过程中,MHA能在最大程度上保证数据的一致性,以达到真正意义 ...
- 8.3 MHA 搭建
操作步骤 1.配置主从 1.1 master /etc/my.cnf server-id log-bin skip-name-resolve 1.2 master 建立repl用户 grant rep ...
- MySQL高可用之MHA搭建
测试环境 节点1 172.16.200.231 6666 master 节点2 172.16.200.27 6666 slave1 ...
- MHA搭建及故障维护
MHA是一种方便简单可靠的MySQL高可用架构,具体的介绍我在这里就不多说了,下面是我在网上找的一个教程,我在此基础上进行了一些修改: 大致步骤 (一).环境介绍 (二).用ssh-keygen实现四 ...
- MySQL 有关MHA搭建与切换的几个错误log
1:masterha_check_repl 副本集方面报错 replicates is not defined in the configuration file! 具体信息如下: # /usr/l ...
- MHA快速搭建
很早之前写过MHA的文章,但是常常在技术群看到有同学问MHA搭建的问题,不是权限问题就是配置问题,我在这里就再次一写下配置过程以及快速的搭建.如果想知道更多的细节与原理,请参考:MySQL高可用架构之 ...
随机推荐
- AcWing:112. 雷达设备(贪心 + 笛卡尔坐标系化区间)
假设海岸是一条无限长的直线,陆地位于海岸的一侧,海洋位于另外一侧. 每个小岛都位于海洋一侧的某个点上. 雷达装置均位于海岸线上,且雷达的监测范围为d,当小岛与某雷达的距离不超过d时,该小岛可以被雷达覆 ...
- PTA 二叉树路径
二叉树的路径 (25 分) 二叉树是一种普通的数据结构.给出一棵无限的二叉树,节点被标识为一对整数,构造如下: (1)树根被标识为整数对(1,1). (2)如果一个节点被标识为(a,b ...
- IP输出 之 ip_local_out
概述 将要从本地发出的数据包,会在构造了ip头之后,调用ip_local_out函数,该函数设置数据包的总长度和校验和,然后经过netfilter的LOCAL_OUT钩子点进行检查过滤,如果通过,则调 ...
- 自定义ViewPager+RadioGroup联动效果的实现
package com.loaderman.myviewpager; import android.os.Bundle; import android.support.v7.app.AppCompat ...
- Python3 matplotlib.pyplot 中文乱码 多个直线图 添加图例
#import之后 font = { 'family' : 'SimHei' } matplotlib.rc('font', **font) # -*- coding:utf-8 -*- import ...
- 数据分析 - numpy 模块
numpy 概述 ▨ Numerical Python. 补充了python所欠缺的数值计算能力 ▨ Numpy是其他数据分析及机器学习库的底层库 ▨ Numpy完全标准C语言实现,运行效率充分 ...
- [idea]创建一个控制台程序
新建项目时,选择JBoss即可.
- 八十三:redis之redis的字符串、过期时间、列表操作
字符串操作 设置值 set key value 设置有空格的值,加引号 set username 'hello world' 获取值 get key 删除值:del key 清除所有内容:flusha ...
- 七十四:flask信号之flask的内置信号
flask所有的内置信号 1.template_rendered:模板渲染完成后的信号2.before_render_template:模板渲染之前的信号3.request_started:模板开始渲 ...
- pyqt5在QMainWindow中布局的问题
在pyqt5中使用了父类为QMainWindow的话,在里面使用布局类,QGridLayout, QHBoxLayout ,QVBoxLayout 时,发现不好用. 解决: 如果是在以QWidget为 ...