2 months ago
Hey
I am currently running a MySQL container built from the Railway MySQL template.
I want offsite backups (in addition to the baked in Railway Volume backup service)
But, running a mysqldump on this PROD database is far from ideal (can cause slow down etc)
So, my plan is to create a MySQL Replica and then run the mysql dump against that.
But, I don't think this is possible with my primary being built from Railway MySQL template (mainly because log_bin is OFF and it needs to be ON for replication... and I can't turn it on, right?)
So, my questions:
- Can I run a replica off the Railway MySQL template
1b) Can I turn ON log_bin on this container
or
Is the only practical solution to move away from the Railway MySQL template for my primary/PROD database, and instead build my own MySQL server from a custom Dockerfile, with all the config I require?
And then set up a replica service which replicates from this new server?
Thanks
2 Replies
2 months ago
The MySQL template deploys the official mysql Docker image, and you have full control over its configuration. You can enable binary logging by setting a custom start command in your service settings, for example adding --log-bin and --server-id=1 flags, or by switching to a custom Dockerfile that includes a my.cnf with your replication settings. You don't need to move away from the template - but if you want full control over the config file, a custom Dockerfile based on the same mysql image is a clean approach. Our Build a Database Service guide covers setting up volumes, networking, and persistence for custom database services.
Status changed to Awaiting User Response Railway • 2 months ago
sam-a
The MySQL template deploys the official [mysql Docker image](https://hub.docker.com/_/mysql), and you have full control over its configuration. You can enable binary logging by setting a custom start command in your service settings, for example adding `--log-bin` and `--server-id=1` flags, or by switching to a custom Dockerfile that includes a `my.cnf` with your replication settings. You don't need to move away from the template - but if you want full control over the config file, a custom Dockerfile based on the same `mysql` image is a clean approach. Our [Build a Database Service](https://docs.railway.com/databases/build-a-database-service) guide covers setting up volumes, networking, and persistence for custom database services.
2 months ago
Thanks!
Status changed to Awaiting Railway Response Railway • 2 months ago
Status changed to Solved sam-a • 2 months ago
