yoshinorim / mha4mysql-manager

Development tree of Master High Availability Manager and tools for MySQL (MHA), Manager part
http://code.google.com/p/mysql-master-ha/
GNU General Public License v2.0
1.46k stars 501 forks source link

Specify replication server #62

Open denismatveev opened 8 years ago

denismatveev commented 8 years ago

I have two MySQL servers : Master and slave. The first one has address 172.16.5.90 and the second has 172.16.5.70. But replication works through another network interfaces with addresses from another subnet: 192.168.5.90 and 192.168.5.70.

My config of mha:

$ cat /etc/mha/app1.cnf 
[server default]
# mysql user and password
user=root
password=qq
# 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=192.168.5.70
ssh_host=flexo
repl_password=qq
repl_user=replication

[server2]
hostname=192.168.5.90
ssh_host=bender
repl_password=qq
repl_user=replication

When I'm trying to change server's role using command:

masterha_master_switch --master_state=alive  --conf=/etc/mha/app1.cnf  --orig_master_is_new_slave --interactive=1

I got an error:

[error][/usr/share/perl5/MHA/ServerManager.pm, ln188] There is no alive server. We can't do failover

I have done a lot of tests And I think it is due to interfaces 192.168.5.90 and 192.168.5.70 that are not available from 172.16.0.0/24 where manager is located. These interfaces take part for checks connection(alive or dead) and used in SQL ' change master to' statement. And if MHA does not check availability of 192.168.5.90 and 192.168.5.70 fails. What is the best way to make this scheme? What for the 'ssh_host' parameter? OK, if I specify a hostname that available from manager ip address(172.16.5.90 and 172.16.5.70), how can I specify a host to use for replication?