I have 3 docker MySQL container running and I am trying to replicate the data in one container to another.
if I create a database in one mysql-container the other mysql-container should get updated with the the changes I made.
I tried and I did not find a way to do that.
How to make this happen ?
You need to setup an standard replication between mysql containers.
You cannot use something like volume to share mysql data at file level because the mysql's will mess the things up and corrupt data for sure.
You can make a replication as Master-Slave scheme or Master-Master (according to your needs).
Refer to the docs to have detailed information.
I think @Robert is absolutely right in that 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 start. They have a solution for MySQL (replication, backups, failover, ...). Here is where you can find it https://github.com/autopilotpattern/mysql
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With