I'm having some issues with postgresql 9.3 running on ubuntu 14.04.5
I had a django web application running using NGINX/Gunicorn, for a few weeks, then one day I went to use it and I got an OperationalError:
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
After researching, it became apparent that the postgresql server wasn't running. I then attempted to start it, and got the following error:
* No PostgreSQL clusters exist; see "man pg_createcluster"
Alarming, but my data is backed up just fine, so I did:
pg_createcluster 9.3 main --start
and then I got:
Error: cluster configuration already exists
No problem. I'll drop it and create a new one, I thought:
pg_dropcluster 9.3 main --stop
that ran fine, and so I ran:
pg_createcluster 9.3 main --start
again, and now it created the cluster apparently, but would not start:
Creating new cluster 9.3/main ...
config /etc/postgresql/9.3/main
data /var/lib/postgresql/9.3/main
locale en_US.UTF-8
port 5432
Error: cluster_port_ready: could not find psql binary
does anyone have any advice as to how to address this? I have done apt-get remove and install for postgresql, and still same results.
Thanks in advance!
UPDATE:
So, I tried the suggestion below to run the following:
/usr/lib/postgresql/9.3/bin/initdb -D /var/lib/postgresql/data -W -A md5
which returned:
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "C".
The default database encoding has accordingly been set to "SQL_ASCII".
The default text search configuration will be set to "english".
Data page checksums are disabled.
fixing permissions on existing directory /var/lib/postgresql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
creating configuration files ... ok
creating template1 database in /var/lib/postgresql/data/base/1 ... ok
initializing pg_authid ... ok
Enter new superuser password:
Enter it again:
setting password ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating collations ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
loading PL/pgSQL server-side language ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok
syncing data to disk ... ok
Success. You can now start the database server using:
/usr/lib/postgresql/9.3/bin/postgres -D /var/lib/postgresql/data
or
/usr/lib/postgresql/9.3/bin/pg_ctl -D /var/lib/postgresql/data -l logfile start
So I ran:
user$ /usr/lib/postgresql/9.3/bin/postgres -D /var/lib/postgres
ql/data
and got:
LOG: could not bind IPv6 socket: Address already in use
HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
LOG: could not bind IPv4 socket: Address already in use
HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
WARNING: could not create listen socket for "localhost"
FATAL: could not create any TCP/IP sockets