简体   繁体   中英

Is the server running locally and accepting connections on Unix domain socket “/var/run/postgresql/.s.PGSQL.5432”? in Odoo

After some time the Postgres database stopped working of my live server. I'm working on this server from last 8 months. Now suddenly it's stopped working.

when I try to enter the command, psql produces 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"?

enter image description here

I'm using odoo8.

First, you need to make sure the socket file is located in /var/run/postgresql/.s.PGSQL.5432 . To check that

$ cat /var/run/postgresql/.s.PGSQL.5432

if result shows something, then the problem is anything else. But, if file is not there you need to check /tmp dir (specially for OSX Homebrew users)

$ cd /tmp
$ l

total 16
drwxrwxrwt  7 root   wheel   224B Mar 11 08:03 .
drwxr-xr-x  6 root   wheel   192B Jan 23 18:35 ..
-rw-r--r--  1 root   wheel    65B Nov  7 22:59 .BBE72B41371180178E084EEAF106AED4F350939DB95D3516864A1CC62E7AE82F
srwxrwxrwx  1 shiva  wheel     0B Mar 11 08:03 .s.PGSQL.5432
-rw-------  1 shiva  wheel    57B Mar 11 08:03 .s.PGSQL.5432.lock
drwx------  3 shiva  wheel    96B Mar 10 17:11 com.apple.launchd.C1tUB2MvF8
drwxr-xr-x  2 root   wheel    64B Mar 10 17:10 powerlog

Now, there are two ways you can solve the error

Solution One

You can change the application configuration to see for sockets at /tmp/.s.PGSQL.5432

For Rails Users

# config/database.yml

default: &default
  adapter: postgresql
  pool: 5
  # port: 
  timeout: 5000
  encoding: utf8
  # min_messages: warning
  socket: /tmp/.s.PGSQL.5432

Solution Two

You can create symlinks to the expected location

$ sudo mkdir /var/pgsql_socket
$ sudo ln /tmp/.s.PGSQL.5432 /var/pgsql_socket/

Then the error should go.

Hope this helps.


Note: Your default socket directory may not be /tmp

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

Related Question Is the server running locally and accepting connections on Unix domain socket “/var/run/postgresql/.s.PGSQL.5432” Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"? Is the server running locally and accepting connections on Unix domain socket “/var/run/postgresql/.s.PGSQL.5432” error with postgresql datababse : Is the server running locally and accepting connections on Unix domain socket “/var/run/postgresql/.s.PGSQL.5432”? No such file or directory Is the server running locally and accepting connections on Unix domain socket “/var/run/postgresql/.s.PGSQL.5432” Error in Django,docker,PostGIS: Is the server running locally and accepting connections on Unix domain socket “/var/run/postgresql/.s.PGSQL.5432”? Adminer: Is the server running locally and accepting connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"? No such file or directory Is the server running locally and accepting connections on Unix domain socket “/tmp/.s.PGSQL.5432”? BlueHost - No such file or directory Is the server running locally and accepting connections on Unix domain socket “/tmp/.s.PGSQL.5432” No such file or directory Is the server running locally and accepting connections on Unix domain socket “/tmp/.s.PGSQL.5432”? at docker
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM