Database Crash
dankyibenjamin
HOBBYOP

17 days ago

I woke up to an email saying my database has crashed, I tried restarting it but it kept crashing. So i created a new database but when I try migrating data but I keep getting "django.db.utils.OperationalError: server closed the connection unexpectedly

    This probably means the server terminated abnormally

    before or while processing the request.

server closed the connection unexpectedly

    This probably means the server terminated abnormally

    before or while processing the request."
$10 Bounty

5 Replies

Status changed to Open Railway 17 days ago


gregxsunday
PRO

17 days ago

I've had the same today. I redeployed postgres instead of restarting it and it came back online


dankyibenjamin
HOBBYOP

17 days ago

I also redeployed but Migrating data from local instance is not working


14 days ago

that migration error usually means the source DB is still dying while Django is reading from it, not that your local migration command is wrong.

I would avoid running Django migrations as the recovery method. first get a dump from the old DB with pg_dump, then restore that into a fresh empty Postgres with psql/pg_restore.

if the old DB only stays up briefly, run the dump from a temporary Railway service in the same project/network so latency is low. after restore, point Django to the new DB and only then run migrations if the schema actually needs it.


dankyibenjamin
HOBBYOP

13 days ago

Thank you. I wish I had this information before deleting the database. It was just a test website for I didn’t loose any data.


dankyibenjamin

Thank you. I wish I had this information before deleting the database. It was just a test website for I didn’t loose any data.

13 days ago

yeah hahaha. lost a bit too many nights with similar mistakes too


Status changed to Open dev 8 days ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...