Move a database from Railway
Copy a database from Railway into a 5050cloud database service with one pipe through 5050 connect.
Before you start
- In Railway, turn on the database's public network access and copy its public URL (
DATABASE_PUBLIC_URLand the like). - In 5050cloud, create the same database type (or import the project) and link your directory:
5050 link -s Postgres. - Install the client tools locally (
pg_dumpandpsql,mysqldumpandmysql,redis-cli,mongodumpandmongorestore). - Stop writes to the Railway database, or plan a short final sync.
Postgres
pg_dump "$RAILWAY_URL" --no-owner --no-acl | 5050 connect Postgres -- psqlMySQL
mysqldump --single-transaction --routines "$RAILWAY_DB" -h "$HOST" -P "$PORT" -u "$USER" -p"$PASSWORD" | 5050 connect MySQL -- mysqlRedis
redis-cli -u "$RAILWAY_REDIS_URL" --rdb dump.rdbThen load dump.rdb into the new service's volume: 5050 connect Redis --tunnel-only gives you a local URL for tools that replay keys, or copy the file in with 5050 ssh and restart.
MongoDB
mongodump --uri "$RAILWAY_MONGO_URL" --archive --gzip | 5050 connect MongoDB -- mongorestore --archive --gzipCheck and switch
- Compare row or key counts.
- Point services at the new database with
${{Postgres.DATABASE_URL}}(imports already do). - Deploy, then turn off public access on the Railway database.