6 months ago
Hi everyone,
I’d like to clone my Production PostgreSQL database into a separate Test environment on Railway so I can safely experiment with performance tuning and configuration changes.
Currently I’m doing a local pg_dump & restore but restoring into Railway is extremely slow (only ~10 MB restored after 10 minutes), likely due to network and I/O limits when streaming from my machine.
My questions:
- What is the recommended way on Railway to clone a Postgres instance into another Postgres instance? Is there a built-in workflow or a faster method than local pg_restore?
- Can Railway restore directly from one of its own backups, or from a dump stored inside the container/volume, to avoid slow remote streaming?
My goal is simply: fast + reliable production → test cloning to work on optimizations without impacting prod.
Thanks for any guidance!
2 Replies
6 months ago
Hey there! We've found the following might help you get unblocked faster:
- 🧵 :red_circle: N8N can't connect to PostgreSQL (timeout after 60s)
- 🧵 Clone existing Postgres DB
- 🧵 502 Connection Dial Timeout
If you find the answer from one of these, please let us know by solving the thread!
6 months ago
as far as im aware, I don't think you can do this (duplicating volume data directly). you can right click to duplicate the actual postgres service, and itll copy all its settings and the volume (the volume data is not duplicated, just the configuration).
you can probably achieve this via rsynchttps://www.digitalocean.com/community/tutorials/how-to-use-rsync-to-sync-local-and-remote-directories & https://www.resilio.com/blog/rsync-large-number-of-files or using cp within railway (spinning up a temp service that'll have access to both services, and you'd directly copy from source volume to target).
For your restoring data from backups, it's definitely possible. you'd need to enable backups in the postgres service, and restore it (via the backup tab) https://docs.railway.com/reference/backups
Attachments