Mysql – How to create a multiple thesql replication

master-slave-replicationMySQL

My question is about to create a mysql replication server.

Here i have multiple slaves and i want replicate all respective database into multiple master server .

Que is that how could i set multiple master in a single server.

details: i have 4 clients ,and I want to setup a master-server machine where I want database replication from my all 4 clients(slave), but here it require 4 master-server. and i want to do do it ina single hardware machine.

Best Answer

The question is a bit confusing ("into"? master; "master-server"?; "client" vs "slave"?; etc); I'll answer some possibly related things.

You can have multiple MySQL 'instances' (master or slave) on a single server (piece of hardware). They must have separate data trees and my.cnf. The implementation could be:

  • Separate Ports (not all 3306)
  • Separate VMs
  • Separate Docker instances

Those choices may involve separate or the same copy of the MySQL binary.

If by "client" you mean "web server", then you need to figure out how the "users" will hit the same or different web servers in order to get to different mysql instances.

Once you have multiple instances running, they can connect Master and Slave in the standard way -- namely that you need to know th host and port. Ditto for Master-Master.

Are you talking about 4 "customers"? Or 4 Slaves? Either way, I have mostly covered both.

Setting up "Master-Master" (alias "multi-Master" replication) on a single server does not make much sense. It does not give you much performance, HA, or any other reason to have M-M.