How can I mirror data in one container to another?

I have a docker MySQL container and I am trying to replicate data from one container to another.

if i create a database in one mysql container, the other mysql container needs to update with the changes i made.

I've tried and I haven't found a way to do this.

How to do it?

+3


source to share


2 answers


You need to set up standard replication between mysql containers.

You cannot use something like volume to share mysql data at the file level because mysql will most likely mess things up and mess up the data.



You can do replication as Master-Slave or Master-Master scheme (according to your needs).

Refer to the docs for details.

+1


source


I think @Robert is absolutely correct because you can probably start with a simple master-slave or master-master schema.



Since you mentioned Docker, I think the AutoPilot pattern is a good repository to run. They have a MySQL solution (replication, backup, failover, ...). You can find it here https://github.com/autopilotpattern/mysql

+1


source







All Articles