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.47k stars 500 forks source link

Feature Request: Supporting multi-master configuration #5

Closed yoshinorim closed 13 years ago

yoshinorim commented 13 years ago

Some users want MHA to work with multi-master configuration, which current MHA (v 0.50) does not support.

Here are some design considerations.

seattlegaucho commented 13 years ago

Consider the following scenario:

(I apologize, but GitHub is not friendly to ASCII code)

Active master would be A, and B would be the stand-by. The manager would be monitoring A, B & C. If A fails, B would have to be promoted to active master and C would now replicate of it.

It would be nice to be able to include D in the configuration file and MHA Manager not fail at start up if the 3rd tier slaves replicate off the stand-by master. This way, when the MHA Manager gets restarted after the fail over, D would be included as a fail-over candidate.

I would also consider making sure that only the masters have 'candidate_master=1' set.

My $.02 Gerry

yoshinorim commented 13 years ago

It would be nice to be able to include D in the configuration file and MHA Manager not fail at start up if the 3rd tier slaves replicate off the stand-by master. This way, when the MHA Manager gets restarted after the fail over, D would be included as a fail-over candidate.

This makes sense. How about adding a new application-scope parameter like "multi_tier_slave"? By default, MHA Manager aborts if it detects any slave NOT replicating from the current primary master. But if multi_tier_slave=1 is set, MHA Manager handles these slaves as "not managed", and starts running.

Regards, Yoshinori

yoshinorim commented 13 years ago

Multi-master is implemented and published at a separated "multimaster" branch. http://yoshinorimatsunobu.blogspot.com/2011/08/mysql-mha-support-for-multi-master.html

I verified it works by many test cases, but I'd like to take some time for people to evaluate, and will decide whether I'll merge it to the main branch.

seattlegaucho commented 13 years ago

Hi there,

I followed your instructions to get the source for the multimaster version after removing all the old software and I keep getting the following error:

on Aug 29 16:58:40 2011 - [error][/usr/lib/perl5/site_perl/5.8.8/MHA/MasterMonitor.pm, ln316] Error happend on checking configurations. Parameter name multi-tier-slave is invalid! at /usr/lib/perl5/site_perl/5.8.8/MHA/MasterMonitor.pm line 190

I checked that the MasterMonitor.pm file is the same I got from the git repository. Here's my new configuration file:

[server default] manager_workdir=/var/log/masterha/test manager_log=/var/log/masterha/test.log multi-tier-slave=1

[server1] hostname=CentOS-OM candidate_master=1

[server2] hostname=CentOS-OM-02 candidate_master=1

[server3] hostname=CentOS-OM-03

[server4] hostname=CentOS-OM-04

"server4" is replicating from "server3".

I grepped for 'multi_tier_slave' (and shorter combinations just in case) and didn't find it on any of the .pm files.

Can you help? Thx.

Gerry

yoshinorim commented 13 years ago

Please try multi_tier_slave, not multi-tier-slave. Keyword multi_tier_slave should be in Config.pm and ServerManager.pm if you have switched to multimaster branch correctly.

yoshinorim commented 13 years ago

Gerry,

Sorry, the original blog entry was not correct. Would you please try to switch branch as below? git checkout -b multimaster origin/multimaster

seattlegaucho commented 13 years ago

Thank you very much, although I had the typo in the configuration file, the git checkout needed correction. I got the checks to run properly. Thank you very much.

yoshinorim commented 13 years ago

Pushed to the main branch.