blueloveyu / mysql-master-ha

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

masterha_master_switch fails when not using port 3306 on all instances #21

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Configure two instance's both on port 3331 
2. Setup instance B to be a Slave of Instance A
3. masterha_master_switch --conf=/etc/mha.cnf --master_state=alive 
--new_master_host="hostb" --orig_master_is_new_slave

What is the expected output? What do you see instead?
masterha_master_switch --conf=/etc/mha.cnf --master_state=alive 
--new_master_host=10.30.70.54 --orig_master_is_new_slave
Wed Apr 11 11:27:26 2012 - [info] MHA::MasterRotate version 0.53.
Wed Apr 11 11:27:26 2012 - [info] Starting online master switch..
Wed Apr 11 11:27:26 2012 - [info] 
Wed Apr 11 11:27:26 2012 - [info] * Phase 1: Configuration Check Phase..
Wed Apr 11 11:27:26 2012 - [info] 
Wed Apr 11 11:27:26 2012 - [warning] Global configuration file 
/etc/masterha_default.cnf not found. Skipping.
Wed Apr 11 11:27:26 2012 - [info] Reading application default configurations 
from /etc/mha.cnf..
Wed Apr 11 11:27:26 2012 - [info] Reading server configurations from 
/etc/mha.cnf..
Wed Apr 11 11:27:26 2012 - [info] Current Alive Master: 
10.30.36.132(10.30.36.132:3331)
Wed Apr 11 11:27:26 2012 - [info] Alive Slaves:
Wed Apr 11 11:27:26 2012 - [info]   10.30.70.54(10.30.70.54:3331)  
Version=5.3.6-MariaDB-log (oldest major version between slaves) log-bin:enabled
Wed Apr 11 11:27:26 2012 - [info]     Replicating from 
10.30.36.132(10.30.36.132:3331)

It is better to execute FLUSH NO_WRITE_TO_BINLOG TABLES on the master before 
switching. Is it ok to execute on 10.30.36.132(10.30.36.132:3331)? (YES/no): 
YES    
Wed Apr 11 11:27:35 2012 - [info] Executing FLUSH NO_WRITE_TO_BINLOG TABLES. 
This may take long time..
Wed Apr 11 11:27:35 2012 - [info]  ok.
Wed Apr 11 11:27:35 2012 - [info] Checking MHA is not monitoring or doing 
failover..
Wed Apr 11 11:27:35 2012 - [info] Checking replication health on 10.30.70.54..
Wed Apr 11 11:27:35 2012 - [info]  ok.
Wed Apr 11 11:27:35 2012 - [error][/usr/share/perl5/MHA/ServerManager.pm, 
ln1145] 10.30.70.54 is not alive!
Wed Apr 11 11:27:35 2012 - [error][/usr/share/perl5/MHA/MasterRotate.pm, ln232] 
Failed to get new master!
Wed Apr 11 11:27:35 2012 - [error][/usr/share/perl5/MHA/ManagerUtil.pm, ln178] 
Got ERROR:  at /usr/bin/masterha_master_switch line 53

What version of the product are you using? On what operating system?
ii  mha4mysql-manager                   0.53                         Master 
High Availability Manager and Tools for MySQL, Manager Package
ii  mha4mysql-node                      0.53                         Master 
High Availability Manager and Tools for MySQL, Node Package

Debian 6.0.3

Please provide any additional information below.

When i reconfigure the mysql instances to port 3306 and re-configure the 
mha.conf file it all works fine.

Broken config
[server default]
# mysql user and password
user=xxxxx
password=xxxxx
repl_user=xxxx
repl_password=xxxxx

# working directory on the manager
manager_workdir=/var/log/masterha/app1

# manager log file
manager_log=/var/log/masterha/app1/app1.log

# working directory on MySQL servers
remote_workdir=/var/log/masterha/app1

[server1]
hostname=10.30.36.132
port=3331

[server2]
hostname=10.30.70.54
port=3331

Original issue reported on code.google.com by eric.har...@gmail.com on 11 Apr 2012 at 7:59

GoogleCodeExporter commented 9 years ago
You have to set --new_master_port=3331 on masterha_master_switch. Yes, this is 
a bit confusing so I consider fixing in the upcoming release.

Original comment by Yoshinor...@gmail.com on 11 Apr 2012 at 8:15

GoogleCodeExporter commented 9 years ago
Thanks that worked.

Original comment by eric.har...@gmail.com on 11 Apr 2012 at 8:27

GoogleCodeExporter commented 9 years ago
BTW, I cannot find "--new_master_port" argument in the documentation but, it 
does work.

Original comment by eric.har...@gmail.com on 13 Apr 2012 at 3:38