My question is: Show Am I able to have one database server as slave to more than one master servers with different databases. So for example:
If I'm able, can you tell me how to achieve this with MySQL 5.7? asked Mar 29, 2019 at 8:27
In MySQL jargon that is called "multi-source replication" and that is a supported configuration in MySQL 5.7. The MySQL manual comes with a complete tutorial:
etc.
answered Mar 29, 2019 at 8:39
HBruijnHBruijn 72.7k21 gold badges127 silver badges193 bronze badges Multi-Master replication stands for the ability to write to any node in the cluster, and not to worry that eventually it will get out-of-sync situation, as it regularly happens with regular MySQL replication if you imprudently write to the wrong server. This is a long-waited feature and there has been growing demand for it for the last two years, or even more. With Percona XtraDB Cluster you can write to any node, and the Cluster guarantees consistency of writes. That is, the write is either committed on all the nodes or not committed at all. For the simplicity, this diagram shows the use of the two-node example, but the same logic is applied with the N nodes: All queries are executed locally on the node, and there is a special handling only on COMMIT. When the COMMIT is issued, the transaction has to pass certification on all the nodes. If it does not pass, you will receive ERROR as a response on that query. After that, transaction is applied on the local node. Response time of COMMIT consists of several parts:
Please note that applying the transaction on remote nodes does not affect the response time of COMMIT, as it happens in the background after the response on certification. The two important consequences of this architecture:
The described behavior of COMMIT also has the second serious implication. If you run write transactions to two different nodes, the cluster will use an optimistic locking model. That means a transaction will not check on possible locking conflicts during the individual queries, but rather on the COMMIT stage, and you may get ERROR response on COMMIT. This is mentioned because it is one of the incompatibilities with regular InnoDB that you might experience. In InnoDB usually DEADLOCK and LOCK TIMEOUT errors happen in response on particular query, but not on COMMIT. It’s good practice to check the error codes after COMMIT query, but there are still many applications that do not do that. If you plan to use Multi-Master capabilities of XtraDB Cluster and run write transactions on several nodes, you may need to make sure you handle response on COMMIT query. Does MySQL support master master replication?MySQL Master Master replication is a development of master-slave replication that addresses its major flaws. This method of replication requires two or more master nodes that can handle both read and write requests. Additionally, each of your masters can have several slave nodes.
Does MySQL support multi master?Multi-master replication for MySQL is easy to setup, is similar to master-slave replication and provides a host of features and options not available with the regular master-slave setup.
What type of replication does MySQL support?Replication in MySQL features support for one-way, asynchronous replication, in which one server acts as the source, while one or more other servers act as replicas.
Is MySQL good for replication?Advantages of replication in MySQL include: Scale-out solutions - spreading the load among multiple replicas to improve performance. In this environment, all writes and updates must take place on the source server. Reads, however, may take place on one or more replicas.
|