postgresql broken after 14.04 despite succesful pg_upgrade

I'm running an Ubuntu VPS where i'm am upgrading to 14.04. everything has gone smoothly so far. Except the PostgreSQL migration from 9.1 to 9.3.

The server hosts a Django 1.6 site and the traceback that I get is this:

File "/srv/virtualenvs/formgiv/local/lib/python2.7/site-packages/psycopg2/__init__.py", line 164, in connect
conn = _connect(dsn, connection_factory=connection_factory, async=async)
OperationalError: 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"?

Before testing this I ran these commands basically:

service postgresql stop (stops both running server versions)
su postgres
/usr/lib/postgresql/9.3/bin/pg_upgrade -b /usr/lib/postgresql/9.1/bin -B /usr/lib/postgresql/9.3/bin -d /var/lib/postgresql/9.1/main/ -D /var/lib/postgresql/9.3/main/ -O "-c config_file=/etc/postgresql/9.3/main/postgresql.conf" -o "-c config_file=/etc/postgresql/9.1/main/postgresql.conf"
exit
service postgresql start

As far as I can tell:

  1. PostgreSQL is running and the socket-file .s.PGSQL.5432 is created just as stated in the config.
  2. Django is asking for the exact same file, but it cannot see it.
  3. This is a standard config and was working without a hitch on Ubuntu 13.10 with PostgreSQL 9.1

The error resembles these two old posts:Cannot connect to postgresql on port 5432and except I can't seem to get anything from following the suggestions that I already have found out.

I really hope someone can spot the obvious mistake this hopefully is.

8

2 Answers

I'm sure there is a better answer than this. But I had the same error in my dev environment, ran

sudo apt-get purge postgresql-9.1

and rebuilt everything in 9.3 with no issues. But I only had a couple users and small databases with migrations scripts, so you may not want to go this route.

1

Didn't find the issue, but running through TCP/IP localhost made the server run, and it is good enough for this small server.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like