My trac server recently started having issues. It was running a very outdated version of Ubuntu, and I was unable to properly use apt-get
to correct the issues I was having. So instead I backed up the machine and did a clean install of Ubuntu 12.04.
Now I have a new server with Postgres 9.1 properly installed and running. I want to get my old Postgres 8.4 database from the backup copied over and setup on the new install. How do I go about doing this?
What I have done so far is to copy the old Postgres 8.4 data and bin directories from the backup (/var/lib/postgresql/8.4/main
and /usr/lib/postgresql/8.4/bin
) to /tmp/postgres.old
and /tmp/postgres-bin.old
on the new install. I stopped Postgres 9.1 using service postgres stop
and ran the command:
sudo -u postgres /usr/lib/postgresql/9.1/bin/pg_upgrade \
--old-datadir=/tmp/postgres.old/main/ \
--new-datadir=/var/lib/postgresql/9.1/main/ \
--old-bindir=/tmp/postgres-bin.old/postgresql/8.4/bin \
--new-bindir=/usr/lib/postgresql/9.1/bin
As described in the Postgres documentation. This seemed like it would work great, except I received the error:
Performing Consistency Checks
-----------------------------
Checking current, bin, and data directories ok
Checking cluster versions ok
connection to database failed: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
unable to connect to old postmaster started with the command: "/tmp/postgres-bin.old/postgresql/8.4/bin/pg_ctl" -w -l "/dev/null" -D "/tmp/postgres.old/main" -o "-p 5432 -c autovacuum=off -c autovacuum_freeze_max_age=2000000000" start >> "/dev/null" 2>&1
Failure, exiting
The issue seems to be that it's trying to start the old server, and that doesn't work because it's so very old and not installed properly. Trying to start it manually reveals the problem:
root@mission:/tmp# sudo -u postgres /tmp/postgres-bin.old/postgresql/8.4/bin/postgres
/tmp/postgres-bin.old/postgresql/8.4/bin/postgres: error while loading shared libraries: libssl.so.0.9.8: cannot open shared object file: No such file or directory
So, How can I restore old Postgres 8.4 databases into a new Postgres 9.1 install, and update them?