Migrating Postgresql DB in On-Prem-Install

Hey all,

I've been working with the local docker containers and now want to set space up on kubernetes (still on-prem).
I've got it to work, but after importing my old postgres-db, the space pods are unable to start. They crash with the following error:

Attempt to use a database from another organization or organization database is corrupted; current organization ID = 3631547044181731307, database organization ID = 5436026971207316627 

Is there any way to migrate the old db to the new setup?

 

Thanks!

0
4 comments

Till Rother, could you please double-check if all DB schemas were migrated to the new DB? Could it be the case that you migrated only the `crclt_org_<id>` schema, but not the `crclt_orgs` one?

0

Hey Pavel, I just did a

pg_dump -U space -d spacedb -f /var/lib/postgresql/data/dump.sql

in the old postgres-pod, copied the dump.sql into the persistent volume of the new postgres-pod and there then did

psql -U space -d spacedb -f /var/lib/postgresql/data/dump.sql

to import it there. It threw some errors which mostly where due to the schema existing but after looking through the logs, it looked like it just skipped everything that was already there.
I'm currently working through the old DB by hand, just doing INSERT INTO the new DB wherever I find data.

0

I was able to fix all this by recreating the datadump of the old DB using the -c option:

pg_dump -U space -d spacedb -c -f /var/lib/postgresql/data/dump.sql

This option will include commands in the dump that will drop all dumped database objects before importing them to the new DB.
This was important for me as I had the new postgresql deployment already running and being accessed by the space-deployments, which created their needed db objects which then led to the conflict.
Importing this new dump dropped everything related to space and imported the old data without any errors. After restarting all space-deployments no new errors occured. 


  

0

Please sign in to leave a comment.