New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Data-loss Handling of Mysql with Apache Helix Cluster management #5
Comments
Hi Kuntal, Short answer, you can achieve what the goals you want but it requires some more work :-). There are couple of ways to approach this but first is to have a way to detect that master and slave are out of sync. This can be done by looking at the gtid's of master and slave. If there is discrepancy, then there are multiple options. This node can first set up replication with current master, catch up with the slave after which you will have to make this node the master. When this node becomes the master, other slaves will setup replication and the missing data will be propagated to the slaves. This is one of the solution. I will write a detailed answer tomorrow. |
Hi Kishore, Thanks for providing some guidance. I will look into the MasterSlaveRebalancer code too meet our requirement for customize leader election. |
Hi Kishore, After going through your suggestion,here is what we are implementing HELIX for MySQL.
//Add semi sync replication
// Update this information to the dashboard inside onCallback() method of MasterSlaveRebalancer
//Updated part of MasterSlaveRebalancer class setAppPermissions() method:if ( instanceType.equals("slave") )
|
Once the ideal master become Slave, we are calling rebalance cluster and Are you referring to admin.rebalance? Why do you need to call rebalance semi-sync is a good idea to avoid data loss. On Thu, Apr 9, 2015 at 5:49 AM, Kuntal Ganguly notifications@github.com
|
Yeah i'm using admin.rebalance for rebalancing the cluster. |
MasterSlaveRebalancer is where you need to make appropriate changes. ( This code is invoked every time any node starts/stops in the cluster. See Which node is MASTER/SLAVE is controlled via IdealState. There are two So if you have 6 nodes (N1...N6) and say replication factor as 2. It will P0 This is done only one time when the cluster is initially created. MasterSlaveRebalancer will always maintain this mapping but only updates Lets say that N1 goes down and N2 is alive, MasterSlaveRebalancer will Now lets say the N1 comes back up, MasterSlaveRebalancer will not update You want MasterSlaveRebalancer to be invoked when ever there is change in So, what you can do here is wait for N1: to become SLAVE for a partition. That should solve your problem Hope this helps. thanks, On Thu, Apr 9, 2015 at 11:06 PM, Kuntal Ganguly notifications@github.com
|
Thank you very much Kishore. 👍 Its really helpful for us. Also this will help us automate the master re-Election process. |
We are trying to manage our MySql cluster with Apache Helix. We will be running 1 Mysql master and 2 Slaves in each Helix Cluster. We are using Mysql Helix Fullmatrix for this purpose
I have the following queries:
All write goes to master and replicated to slave. Now suppose write occur in master and it is not replicated in slave yet,and on that time the master goes down. Now Helix will choose one of the slave as master.But say when the previous master comes up and become slave,is there a way that transaction that were there in this previous master will sync with current master and other slaves?? Is there a way to ensure that there is No data-loss in this type of scenario??
Also if my requirement is such that i always want that when my previous master comes up,it should become the master,not slave.Because we are planning to use high configuration machine for master. So how to do it using Helix?? Or we should keep master and slave with same configuration machine? What is the best approach?
I have seen that there might a way to do it using Customize/user defined Rebalancing algorithm.But Not able to find proper piece of code for getting started with this kind of scenario.
Any help or expert opinion for the above queries will be very helpfull.
The text was updated successfully, but these errors were encountered: