MySql replication failover on Amazon Cloud - mysql

I have configured a MySql Replication with 1 Master 1 Standy and 1 Slave. Master and Standby are put on different availability zones on US East region and the Slave is on the US West region. Both Standby and Slave are replicating from the Master.
The Application layer can do the failover from Master to the Standby.For switching the replication of the Slave to the Standby when the Master dies. I have no way to assure that the Standby's data is ahead comparing to the Slave's data. If Standby's data is behind the Slave's data I need to scan the Slave's binary and relay logs to find out what is missing and transfer it the Standby. That's the THEORY.
Does anyone know any tool which can handle this ? or alternative solution for my context ?
The ultimate goal is the availability of MySql Server for application layer. I have tried MySql-Proxy but not quite happy with it. Mysql Cluster is not an option for us.
Thanks in advanced.

Kane,
Take a look at SchoonerSQL from Schooner Information Technology (my company). It is designed to have zero slave lag locally through multi-threaded synchronous replication (in current release) and automatic fail-over across regions through multi-threaded Asynchronous WAN replication (to be released in < 2 wks). http://www.schoonerinfotech.com/products/schoonersql

Related

Can I have a HA MySQL/MariaDB Slave?

Weird question I know. I have a master MySQL database which I'm not allowed to touch and need to build a slave for. I would like the slave to be as real time (as possible) of a replica of the master and would like the slave to be HA.
Does MySQL (or MariaDB) replication work when run on a cluster, say, can I make a Galera cluster and make it replicate from a master out of the box or must I use binlog-esque tools?
For the curious; this new slave cluster will be on a different network and will have many large, important queries made against it regularly - the aim of the game is to reduce load on the master and reduce network traffic.
If you are not planning on doing modifications to the downstream slave server, then you can just set up multiple slave servers. This way if one of the slaves goes down you can use another one. This will place a small load on the master for each added slave but whether this added load is even measurable depends on your setup.
Galera could work but I believe you would have to reconfigure one of the nodes to act as the slave if the current one goes down. This would place a minimal load on the master but it would require a manual intervention whenever the current "slave" node goes down.
Parallel replication should also help speed up replication for MariaDB servers.

access master table from replica

I have two mariadb servers one is configured as master and the other as a replica of this master. I have created a database named params on master and it has a table with a couple of items in it.
How can I see this table and access or modify it using the mysql shell on the replica?
Is this even possible or I have miss understood the replication altogether?
Check that replication works
If you aren't seeing the database on the slave replica, it would be good to check that the output of SHOW SLAVE STATUS doesn't return any errors. A good resource for getting started with replication is the MariaDB KB article on the subject.
When you have confirmed that replication works, you can connect to the slave replica and you should see the database there.
How replication works in MariaDB
Replication in MariaDB will propagate all changes that happen on the master server to any slave servers that are replicating from it. This allows you to read the same data from multiple places without burdening the master server. It does not allow you to seamlessly share data across multiple servers (a Galera cluster offers some of this).
The downside of master-slave replication is that when you want to make a change, you have to make it on the master in order to keep the data consistent across all servers. The benefit of it is the higher availability of your data and increased throughput of read queries. The Replication Overview article has a more detailed description of what replication is and lists some use cases for it.

Create a full duplex replication among two MySQL servers

Already configured Master-Slave Replication among two different machines. Now the problem is that it only allows the Master to enter the data and Slave to view this. the changes which made in Slave is not reflected in master.
My question is that is it possible to create a full duplex replication among two MySQL servers. ie, If i change the data either in master or in Slave both will reflected in both the machines.
References:
MySQL Master-Slave Replication
Steps to configure Master-Slave Replication
Yes, but there are risks, because replications is asynchronous. That is, both servers could insert the same row, and then when they process the replication log from the other server, they get a conflict.
You can listen to more about this problem in this free webinar: The Hazards of Multi-writing in a Dual-Master Setup
You should consider using a cluster solution with synchronous replication, like Percona XtraDB Cluster.

Master/Slave replication load balancing if master down with Galera

I'm kind of lost there, I want to setup a common MASTER/SLAVE replication on a MariaDB database. I choose MASTER/SLAVE over MASTER/MASTER to avoid complexifying things. The SLAVE will be used only if the MASTER server is down.
I've setup MariaDB 10.0.x, but when I start reading on how to achieve this replication, they introduce Galera, which, if I understand correctly, replaces MariaDB.
What do you use to tell the SLAVE server to take the relay if the MASTER server is down ? Is it handled automatically via the Galera Cluster ?
If possible, I don't want my application to be aware of the slave server : I just want to configure it with the IP of MariaDB MASTER, and if it can't be reached, to use the SLAVE instead. (But I do not want to specify this fallback in the application level)
Thanks
What you are looking for can be achieved. I just completed a setup of MariaDB 10 using asynchronous replication (not Galera). To ensure maximum uptime I setup master / master replication and used mysql-mmm to monitor the setup. This tool will manage a virtual IP and point it at one of the two masters for writing purposes. This ensures consistent writes against a single master as to avoid corruption of the data. If one master fails the virtual IP will be mapped to the other master. This provides the high availability aspect. The instructions stated below were very clear and easy to follow.
http://mysql-mmm.org/mmm2:guide
Good luck!

Redis replication config

I have a redis master setup with 2 slaves and a sentinal on each.
If the master goes down for say 2 seconds (+sdown) and comes back up (-sdown), it reads the last snapshot, and the slaves resync with the master.
The problem with this is that there may have been many writes between the last save and the +sdown. It seems like if the master goes from +sdown to -sdown and never +odown (where a failover is initiated), it should be able to sync FROM a slave. My reasoning is that the replication stream is continuous and the slaves most likely have a more accurate reflection of the masters state when +sdown happened.
Is there some config that I can do this? Am I forced to rely on the AOF or snapshots?
(Edit: adding sentinel tag)
You cannot do a partial failover, either you do it or you don't in terms of promoting the slave to master.
From Redis Sentinel:
Automatic failover. If a master is not working as expected, Sentinel can start a failover process where a slave is promoted to master, the other additional slaves are reconfigured to use the new master, and the applications using the Redis server informed about the new address to use when connecting.