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 statusG
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 statusG
主库
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 "
IN SCRIPT TEST====$ssh_stop_vip==$ssh_start_vip===
";
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
";
&stop_vip();
$exit_code = 0;
};
if ($@) {
warn "Got Error: $@
";
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
";
&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
";
`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
";
}
####################常用命令###############
检测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 statusG
6. new slave(old:master)
(1)打开MySQL
mysqld_safe --defaults-file=/u01/my3306/my.cnf &
(2)检查数据库
show master statusG
show slave statusG
(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 statusG
*************************** 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 statusG
*************************** 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.%';