PostgreSQL La base de donnees la plus sophistiquee au monde.

Forums PostgreSQL.fr

Le forum officiel de la communauté francophone de PostgreSQL

Vous n'êtes pas identifié(e).

#1 25/10/2016 17:48:17

parora0124
Membre

Create PGSQL.5432.lock in /tmp instead of /var/run/postgresql

Greetings,

I understand that this is a french blog but I this is the only place where I get answers so posting my question here:

I just started using PostgreSQL 9.5 and facing some problem with starting the DB service on RHEL6. I get the following error while trying to start the PostgreSQL service:

could not create lock file "/var/run/postgresql/.s.PGSQL.5432.lock": Permission denied

I am not allowed to change any permissions under /var folder, so I wanted the lock file to be created under the /tmp directory instead. So I changed my Dbstart script and in postgresql.conf file, I changed:

#unix_socket_directories = '/var/run/postgresql, /tmp'

to

unix_socket_directories = '/tmp'

after initdb. Now the PostgreSQL service starts without any error however when i try to connect to the DB and create a DB or run any query, it gives me an error: psql:
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"?

I thought I already changed the unix_socket_directories to /tmp but it is still trying to create a lock file under /var/run/postgres .
Can someone please suggest how to create the socket and the PG locks under /tmp dir and not /var/run ?

Thanks.

Hors ligne

#2 25/10/2016 18:04:15

rjuju
Administrateur

Re : Create PGSQL.5432.lock in /tmp instead of /var/run/postgresql

Hello,


You can also consider sending question on pgsql-general mailing list (https://www.postgresql.org/list/).


Anyway, your problem is that you tell your server where to put the socket file, but you don't tell your client it was moved. So without any further instruction, it just fallbacks to default location in /var.


You can run "psql -h /tmp", or put in your .bashrc file or similar a

export PGHOST="/tmp"

Regards.

Hors ligne

#3 25/10/2016 18:18:53

rjuju
Administrateur

Re : Create PGSQL.5432.lock in /tmp instead of /var/run/postgresql

BTW I forgot to mention, if you have systemd you should disable systemd-tmpfiles or systemd will randomly delete your socket file.

Hors ligne

#4 25/10/2016 19:31:24

parora0124
Membre

Re : Create PGSQL.5432.lock in /tmp instead of /var/run/postgresql

Thats why I post my questions here because I get all the answers.

Thank you so much rjuju.. Appreciate your help

Hors ligne

Pied de page des forums