stefalee / mysql-master-ha

Automatically exported from code.google.com/p/mysql-master-ha
0 stars 0 forks source link

Get "ERROR 1045 (28000)" when execute masterha_check_repl. #68

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
OS VERSION:Centos 6.3-64.bit
Mysql version: 5.6.14
Manger and node version: 0.55 and 0.54

What steps will reproduce the problem?
1.configure the app1.cnf
2.create a monitor user "mha_mon" and grant all privilege.
3.execute masterha_check
==========================================================
[root@mysql3 masterha]# masterha_check_repl --conf=/etc/masterha/app1.cnf
Tue Oct  8 14:52:31 2013 - [warning] Global configuration file 
/etc/masterha_default.cnf not found. Skipping.
Tue Oct  8 14:52:31 2013 - [info] Reading application default configurations 
from /etc/masterha/app1.cnf..
Tue Oct  8 14:52:31 2013 - [info] Reading server configurations from 
/etc/masterha/app1.cnf..
Tue Oct  8 14:52:31 2013 - [info] MHA::MasterMonitor version 0.55.
Tue Oct  8 14:52:31 2013 - [info] Multi-master configuration is detected. 
Current primary(writable) master is 192.168.230.103(192.168.230.103:3306)
Tue Oct  8 14:52:31 2013 - [info] Master configurations are as below: 
Master 192.168.230.103(192.168.230.103:3306), replicating from 
mysql2(192.168.230.104:3306)
Master 192.168.230.104(192.168.230.104:3306), replicating from 
mysql1(192.168.230.103:3306), read-only

Tue Oct  8 14:52:31 2013 - [info] Dead Servers:
Tue Oct  8 14:52:31 2013 - [info] Alive Servers:
Tue Oct  8 14:52:31 2013 - [info]   192.168.230.103(192.168.230.103:3306)
Tue Oct  8 14:52:31 2013 - [info]   192.168.230.104(192.168.230.104:3306)
Tue Oct  8 14:52:31 2013 - [info]   192.168.230.106(192.168.230.106:3306)
Tue Oct  8 14:52:31 2013 - [info] Alive Slaves:
Tue Oct  8 14:52:31 2013 - [info]   192.168.230.104(192.168.230.104:3306)  
Version=5.6.14-log (oldest major version between slaves) log-bin:enabled
Tue Oct  8 14:52:31 2013 - [info]     Replicating from 
mysql1(192.168.230.103:3306)
Tue Oct  8 14:52:31 2013 - [info]     Primary candidate for the new Master 
(candidate_master is set)
Tue Oct  8 14:52:31 2013 - [info]   192.168.230.106(192.168.230.106:3306)  
Version=5.6.14 (oldest major version between slaves) log-bin:disabled
Tue Oct  8 14:52:31 2013 - [info]     Replicating from 
mysql1(192.168.230.103:3306)
Tue Oct  8 14:52:31 2013 - [info]     Not candidate for the new Master 
(no_master is set)
Tue Oct  8 14:52:31 2013 - [info] Current Alive Master: 
192.168.230.103(192.168.230.103:3306)
Tue Oct  8 14:52:31 2013 - [info] Checking slave configurations..
Tue Oct  8 14:52:31 2013 - [info]  read_only=1 is not set on slave 
192.168.230.106(192.168.230.106:3306).
Tue Oct  8 14:52:31 2013 - [warning]  relay_log_purge=0 is not set on slave 
192.168.230.106(192.168.230.106:3306).
Tue Oct  8 14:52:31 2013 - [warning]  log-bin is not set on slave 
192.168.230.106(192.168.230.106:3306). This host can not be a master.
Tue Oct  8 14:52:31 2013 - [info] Checking replication filtering settings..
Tue Oct  8 14:52:31 2013 - [info]  binlog_do_db= shawn, binlog_ignore_db= 
Tue Oct  8 14:52:31 2013 - [info]  Replication filtering check ok.
Tue Oct  8 14:52:31 2013 - [info] Starting SSH connection tests..
Tue Oct  8 14:52:33 2013 - [info] All SSH connection tests passed successfully.
Tue Oct  8 14:52:33 2013 - [info] Checking MHA Node version..
Tue Oct  8 14:52:33 2013 - [info]  Version check ok.
Tue Oct  8 14:52:33 2013 - [info] Checking SSH publickey authentication 
settings on the current master..
Tue Oct  8 14:52:33 2013 - [info] HealthCheck: SSH to 192.168.230.103 is 
reachable.
Tue Oct  8 14:52:33 2013 - [info] Master MHA Node version is 0.54.
Tue Oct  8 14:52:33 2013 - [info] Checking recovery script configurations on 
the current master..
Tue Oct  8 14:52:33 2013 - [info]   Executing command: save_binary_logs 
--command=test --start_pos=4 --binlog_dir=/mydata/data/binlog/ 
--output_file=/var/tmp/save_binary_logs_test --manager_version=0.55 
--start_file=mysql-bin.000004 
Tue Oct  8 14:52:33 2013 - [info]   Connecting to 
root@192.168.230.103(192.168.230.103).. 
  Creating /var/tmp if not exists..    ok.
  Checking output directory is accessible or not..
   ok.
  Binlog found at /mydata/data/binlog/, up to mysql-bin.000004
Tue Oct  8 14:52:34 2013 - [info] Master setting check done.
Tue Oct  8 14:52:34 2013 - [info] Checking SSH publickey authentication and 
checking recovery script configurations on all alive slave servers..
Tue Oct  8 14:52:34 2013 - [info]   Executing command : apply_diff_relay_logs 
--command=test --slave_user='mha_mon' --slave_host=192.168.230.104 
--slave_ip=192.168.230.104 --slave_port=3306 --workdir=/var/tmp 
--target_version=5.6.14-log --manager_version=0.55 
--relay_log_info=/mydata/data/relay-log.info  --relay_dir=/mydata/data/  
--slave_pass=xxx
Tue Oct  8 14:52:34 2013 - [info]   Connecting to 
root@192.168.230.104(192.168.230.104:22).. 
  Checking slave recovery environment settings..
    Opening /mydata/data/relay-log.info ... ok.
    Relay log found at /mydata/data/relaybin, up to slave-relay-bin.000013
    Temporary relay log file is /mydata/data/relaybin/slave-relay-bin.000013
    Testing mysql connection and privileges..Warning: Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'mha_mon'@'mysql2' (using password: 
YES)
mysql command failed with rc 1:0!
 at /usr/bin/apply_diff_relay_logs line 367
        main::check() called at /usr/bin/apply_diff_relay_logs line 486
        eval {...} called at /usr/bin/apply_diff_relay_logs line 466
        main::main() called at /usr/bin/apply_diff_relay_logs line 112
Tue Oct  8 14:52:34 2013 - 
[error][/usr/share/perl5/vendor_perl/MHA/MasterMonitor.pm, ln195] Slaves 
settings check failed!
Tue Oct  8 14:52:34 2013 - 
[error][/usr/share/perl5/vendor_perl/MHA/MasterMonitor.pm, ln375] Slave 
configuration failed.
Tue Oct  8 14:52:34 2013 - 
[error][/usr/share/perl5/vendor_perl/MHA/MasterMonitor.pm, ln386] Error happend 
on checking configurations.  at /usr/bin/masterha_check_repl line 48
Tue Oct  8 14:52:34 2013 - 
[error][/usr/share/perl5/vendor_perl/MHA/MasterMonitor.pm, ln482] Error 
happened on monitoring servers.
Tue Oct  8 14:52:34 2013 - [info] Got exit code 1 (Not master dead).

MySQL Replication Health is NOT OK!

I get a "2800" error here.

Original issue reported on code.google.com by flutters...@sina.com on 8 Oct 2013 at 6:58

GoogleCodeExporter commented 9 years ago
hosts
[root@mysql3 ~]# more /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
192.168.230.103 mysql1  --master
192.168.230.104 mysql2  --master 
192.168.230.105 mysql3  --monitor
192.168.230.106 mysql4  --salve

My mha profile.
[root@mysql3 ~]# vi /etc/masterha/app1.cnf 
[server default]
manager_workdir=/etc/masterha/app1
manager_log=/etc/masterha/app1/manager.log
user=mha_mon
password='123456'
ssh_user=root
repl_user=repl
repl_password='slavei
ping_interval=1
shutdown_script=""
master_ip_online_change_script=""
report_script=""
#master_ip_failover_script="/usr/local/bin/master_ip_failover"
[server1]
hostname=192.168.230.103
master_binlog_dir=/mydata/data/binlog/
#candidate_master=1
[server2]
hostname=192.168.230.104
master_binlog_dir=/mydata/data/binlog/
candidate_master=1
#[server3]
#hostname=192.168.230.105
#master_binlog_dir=/mydata/data/binlog/
[server4]
hostname=192.168.230.106
no_master=1

I test the new user "mha_mon" connect to "192.168.230.104" on the manger 
node"mysql3",it works fine.Here "mysql2" is "192.168.230.104"

[root@mysql3 masterha]# mysql -u mha_mon -h mysql2 -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 34
Server version: 5.6.14-log MySQL Community Server (GPL)

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> select current_user();
+-------------------------+
| current_user()          |
+-------------------------+
| mha_mon@192.168.230.105 |
+-------------------------+
1 row in set (0.00 sec)

Original comment by flutters...@sina.com on 8 Oct 2013 at 7:02

GoogleCodeExporter commented 9 years ago
I also try to remove '' from the mha profile,it`s also failed.
[server default]
manager_workdir=/etc/masterha/app1
manager_log=/etc/masterha/app1/manager.log
user=mha_mon
password=123456
ssh_user=root
repl_user=repl
repl_password=slave
ping_interval=1
shutdown_script=""
master_ip_online_change_script=""
report_script=""
#master_ip_failover_script="/usr/local/bin/master_ip_failover"
[server1]
hostname=192.168.230.103
master_binlog_dir=/mydata/data/binlog/
#candidate_master=1
[server2]
hostname=192.168.230.104
master_binlog_dir=/mydata/data/binlog/
candidate_master=1
#[server3]
#hostname=192.168.230.105
#master_binlog_dir=/mydata/data/binlog/
[server4]
hostname=192.168.230.106
no_master=1

Original comment by flutters...@sina.com on 8 Oct 2013 at 7:08

GoogleCodeExporter commented 9 years ago
Please check you can connect to MySQL instance on mysql2 from the same host 
(mysql2), with same username and password.

Original comment by Yoshinor...@gmail.com on 8 Oct 2013 at 7:12

GoogleCodeExporter commented 9 years ago
I check the user on the mysql2 instance,it had been configure as a specifc 
hosts.
===========================================================
mysql>   select * from user where user='mha_mon'\G;
*************************** 1. row ***************************
                  Host: 192.168.230.105
                  User: mha_mon

I change the hosts to "192.168.230.10%',it works fine.
[root@mysql3 masterha]# masterha_check_repl --conf=/etc/masterha/app1.cnf
Tue Oct  8 15:24:47 2013 - [warning] Global configuration file 
/etc/masterha_default.cnf not found. Skipping.
Tue Oct  8 15:24:47 2013 - [info] Reading application default configurations 
from /etc/masterha/app1.cnf..
Tue Oct  8 15:24:47 2013 - [info] Reading server configurations from 
/etc/masterha/app1.cnf..
Tue Oct  8 15:24:47 2013 - [info] MHA::MasterMonitor version 0.55.
Tue Oct  8 15:24:48 2013 - [info] Multi-master configuration is detected. 
Current primary(writable) master is 192.168.230.103(192.168.230.103:3306)
Tue Oct  8 15:24:48 2013 - [info] Master configurations are as below: 
Master 192.168.230.103(192.168.230.103:3306), replicating from 
mysql2(192.168.230.104:3306)
Master 192.168.230.104(192.168.230.104:3306), replicating from 
mysql1(192.168.230.103:3306), read-only

Tue Oct  8 15:24:48 2013 - [info] Dead Servers:
Tue Oct  8 15:24:48 2013 - [info] Alive Servers:
Tue Oct  8 15:24:48 2013 - [info]   192.168.230.103(192.168.230.103:3306)
Tue Oct  8 15:24:48 2013 - [info]   192.168.230.104(192.168.230.104:3306)
Tue Oct  8 15:24:48 2013 - [info]   192.168.230.106(192.168.230.106:3306)
Tue Oct  8 15:24:48 2013 - [info] Alive Slaves:
Tue Oct  8 15:24:48 2013 - [info]   192.168.230.104(192.168.230.104:3306)  
Version=5.6.14-log (oldest major version between slaves) log-bin:enabled
Tue Oct  8 15:24:48 2013 - [info]     Replicating from 
mysql1(192.168.230.103:3306)
Tue Oct  8 15:24:48 2013 - [info]     Primary candidate for the new Master 
(candidate_master is set)
Tue Oct  8 15:24:48 2013 - [info]   192.168.230.106(192.168.230.106:3306)  
Version=5.6.14 (oldest major version between slaves) log-bin:disabled
Tue Oct  8 15:24:48 2013 - [info]     Replicating from 
mysql1(192.168.230.103:3306)
Tue Oct  8 15:24:48 2013 - [info]     Not candidate for the new Master 
(no_master is set)
Tue Oct  8 15:24:48 2013 - [info] Current Alive Master: 
192.168.230.103(192.168.230.103:3306)
Tue Oct  8 15:24:48 2013 - [info] Checking slave configurations..
Tue Oct  8 15:24:48 2013 - [info]  read_only=1 is not set on slave 
192.168.230.106(192.168.230.106:3306).
Tue Oct  8 15:24:48 2013 - [warning]  relay_log_purge=0 is not set on slave 
192.168.230.106(192.168.230.106:3306).
Tue Oct  8 15:24:48 2013 - [warning]  log-bin is not set on slave 
192.168.230.106(192.168.230.106:3306). This host can not be a master.
Tue Oct  8 15:24:48 2013 - [info] Checking replication filtering settings..
Tue Oct  8 15:24:48 2013 - [info]  binlog_do_db= shawn, binlog_ignore_db= 
Tue Oct  8 15:24:48 2013 - [info]  Replication filtering check ok.
Tue Oct  8 15:24:48 2013 - [info] Starting SSH connection tests..
Tue Oct  8 15:24:49 2013 - [info] All SSH connection tests passed successfully.
Tue Oct  8 15:24:49 2013 - [info] Checking MHA Node version..
Tue Oct  8 15:24:50 2013 - [info]  Version check ok.
Tue Oct  8 15:24:50 2013 - [info] Checking SSH publickey authentication 
settings on the current master..
Tue Oct  8 15:24:50 2013 - [info] HealthCheck: SSH to 192.168.230.103 is 
reachable.
Tue Oct  8 15:24:50 2013 - [info] Master MHA Node version is 0.54.
Tue Oct  8 15:24:50 2013 - [info] Checking recovery script configurations on 
the current master..
Tue Oct  8 15:24:50 2013 - [info]   Executing command: save_binary_logs 
--command=test --start_pos=4 --binlog_dir=/mydata/data/binlog/ 
--output_file=/var/tmp/save_binary_logs_test --manager_version=0.55 
--start_file=mysql-bin.000004 
Tue Oct  8 15:24:50 2013 - [info]   Connecting to 
root@192.168.230.103(192.168.230.103).. 
  Creating /var/tmp if not exists..    ok.
  Checking output directory is accessible or not..
   ok.
  Binlog found at /mydata/data/binlog/, up to mysql-bin.000004
Tue Oct  8 15:24:50 2013 - [info] Master setting check done.
Tue Oct  8 15:24:50 2013 - [info] Checking SSH publickey authentication and 
checking recovery script configurations on all alive slave servers..
Tue Oct  8 15:24:50 2013 - [info]   Executing command : apply_diff_relay_logs 
--command=test --slave_user='mha_mon' --slave_host=192.168.230.104 
--slave_ip=192.168.230.104 --slave_port=3306 --workdir=/var/tmp 
--target_version=5.6.14-log --manager_version=0.55 
--relay_log_info=/mydata/data/relay-log.info  --relay_dir=/mydata/data/  
--slave_pass=xxx
Tue Oct  8 15:24:50 2013 - [info]   Connecting to 
root@192.168.230.104(192.168.230.104:22).. 
  Checking slave recovery environment settings..
    Opening /mydata/data/relay-log.info ... ok.
    Relay log found at /mydata/data/relaybin, up to slave-relay-bin.000017
    Temporary relay log file is /mydata/data/relaybin/slave-relay-bin.000017
    Testing mysql connection and privileges..Warning: Using a password on the command line interface can be insecure.
 done.
    Testing mysqlbinlog output.. done.
    Cleaning up test file(s).. done.
Tue Oct  8 15:24:51 2013 - [info]   Executing command : apply_diff_relay_logs 
--command=test --slave_user='mha_mon' --slave_host=192.168.230.106 
--slave_ip=192.168.230.106 --slave_port=3306 --workdir=/var/tmp 
--target_version=5.6.14 --manager_version=0.55 
--relay_log_info=/mydata/data/relay-log.info  --relay_dir=/mydata/data/  
--slave_pass=xxx
Tue Oct  8 15:24:51 2013 - [info]   Connecting to 
root@192.168.230.106(192.168.230.106:22).. 
  Checking slave recovery environment settings..
    Opening /mydata/data/relay-log.info ... ok.
    Relay log found at /mydata/data/relaybin, up to slave-relay-bin.000005
    Temporary relay log file is /mydata/data/relaybin/slave-relay-bin.000005
    Testing mysql connection and privileges..Warning: Using a password on the command line interface can be insecure.
 done.
    Testing mysqlbinlog output.. done.
    Cleaning up test file(s).. done.
Tue Oct  8 15:24:51 2013 - [info] Slaves settings check done.
Tue Oct  8 15:24:51 2013 - [info] 
192.168.230.103 (current master)
 +--192.168.230.104
 +--192.168.230.106

Tue Oct  8 15:24:51 2013 - [info] Checking replication health on 
192.168.230.104..
Tue Oct  8 15:24:51 2013 - [info]  ok.
Tue Oct  8 15:24:51 2013 - [info] Checking replication health on 
192.168.230.106..
Tue Oct  8 15:24:51 2013 - [info]  ok.
Tue Oct  8 15:24:51 2013 - [warning] master_ip_failover_script is not defined.
Tue Oct  8 15:24:51 2013 - [warning] shutdown_script is not defined.
Tue Oct  8 15:24:51 2013 - [info] Got exit code 0 (Not master dead).

MySQL Replication Health is OK.

Original comment by flutters...@sina.com on 8 Oct 2013 at 7:46