MySQL backup/restore with master/master replication - mysql

I didn't find useful information in documentation that is why I decided to ask.
My environment is as this: Two MySQL servers with Master <-> Mater replication (let's call it Node1 and Node2).
All applications (99%) connects to Node1, on Node2 only one application which is doing INSERTS in a separate DB.
So - changes are propagated to both nodes because of replication. Also because of replication I have relay-bin-logs and bin-logs (on both servers).
I take backup on Node2 using mysqldump
QUESTION:
in case of restore what I need to apply to DB?
only "relay-bin-logs"?
only "bin-logs"?
both?
What is the sequence?
(link to documentation is also appreciated)
Thanks!
P.S. In case of simple MySQL server (without replication) everything is pretty simple - restore from backup and after this apply bin-logs.

Related

Connect and Sync 2 Mysql Databases

Is it possible to sync 2 MYSQL databases so if you write into one it will sync add it to the other one too and other way around? I've seen some Programs that you can use on your local pc but I need a script for example php that I can upload to my vps, it checks every minute for new data and syncs it.
Is that possible?
Are you tried Mysql Replication strategies? See MySQL Replication for High Availability.
Specially Master with Backup Master (Multiple Replication)
or Master with Active Master (Circular Replication or Ring topology)

Daily copy of AWS Aurora database to another AWS Aurora database

We have an AWS Aurora database sitting on an instance that holds all of our production data. I want to be able to perform analytics on that data without doing it in our production environment, so I want to copy the production data on a daily basis to another AWS Aurora database on a completely different instance. Within that "analytics" database, I'll build out all the needed views and stored procedures to aggregate whatever transformed data I need to store.
At first I thought of creating an Aurora replica, but of course that's read-only. I need to find a way to do this outside of the production environment and I feel it's an easy enough task to do, but I just can't find out how to do it. Maybe I haven't been able to ask the write questions, so I came here. How can I achieve this?
This is simple AWS replication.
http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Aurora.Replication.CrossRegion.html
Also if you prefer to use mysql or any other RDBMS use
http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Aurora.Overview.Replication.MySQLReplication.html
It is similar to master slave replication with little difference in sharded data mainted in Aurora.
Replication is the correct (subjective, of course) solution, but you can't use a managed Aurora replica, which is to say you can't use an Aurora replica in the cluster.
That does not, however, mean you can't create your own asynchronous Aurora replica... which would be a second Aurora cluster, an independent master that is writable, but that uses the replication stream (the binary logs, also called "binlogs,") from the master cluster to keep its data in sync.
The one caveat: you must be extremely cautious not to write to any of the tables on the asynchronous cluster that are being replicated from the production master. Do that, of course, and replication breaks. The master cluster will be completely unaffected, but the replica cluster will stop replicating once inconsistent data is detected. But you can create additonal tables, views, and stored programs without issue.
Within an Aurora cluster, there is no need for replication in the traditional sense -- the replicas use the same backing store as the master (the "cluster volume.") Here, we're just replicating from cluster to cluster, identical to the way two ordinary MySQL servers would replicate (in one direction, only, of course).
The setup is essentially identical to the setup for replicating in and out of Aurora, to or from MySQL. Since this solution uses MySQL native replication, the steps are the same.
http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Aurora.Overview.Replication.MySQLReplication.html

Setup Magento to write on multiple mysql masters

I'm completely newbie in mysql cluster. I was trying long ours to find if, when I setup magento with mysql cluster, it will write to one of the nodes or always to one node?
My second question is, when I setup mysql replication: one master and one slave, and master server die, will magento start to write on slave, or my app stop working?
Thanks a lot!
1)
Magento supports by default: 1 master and multiple read slaves.
For specific modules you can define different read/write custom connections. So, with this setup you could write data to multiple mysql master servers.
Notice: None of the large Magento hosting partners/providers (nbs, nexcess, peer1, etc) managed to have a working solution with multiple db masters.
2) No. there is no auto switch to slave.

MySQL MASTER MASTER replication, adding a new Master with out downtime

I have setup master-master mysql replication in 2 different nodes. Suppose If i am going to add one more node, i.e 3rd master , do I need to have a exactly the same copy of the database in the new server as in the node-1 and node-2 ?
These are high traffic servers and will be keep on updating the database every seconds, so we would like to do it with out downtime. Is there any way to do this, with out downtime ?
MySQL 5.1.18, it is possible to use MySQL Cluster in multi-master replication, including circular replication between a number of MySQL Clusters.
Detailed explanation is explained here:
http://dev.mysql.com/doc/refman/5.1/en/mysql-cluster-replication-multi-master.html

about mysql high-availability

I read some article about how to implement high-availability solution,the use Heartbeat to check the master mysql is broken,if it broken then switch to the backup server,
one question is when the master server broken,the backup server work on ,how the backup server get the master server 's pre-data
another question is maybe sometimes the master server is not broken,but the mysql service is broken,in this situation is Heartbeat still will switch to the backup server?
What you usually want to do is setup a master-master configuration, but generally only use one master. That was each master also acts as a slave to the other master. In theory, you can modify records in either one and they will keep in sync. In practice, I wouldn't do heavy updates on both servers at once.
My current setup is a master-master configuration, with each master also having a slave off of it. Then you can "failover" to the secondary master/slave and "fail back" when needed. I actually do this if I have database modifications that will take a while.