backup/backup

Could not connect to server: No such file or directory (pg_dump)

illustrarium opened this issue · 9 comments

What went wrong?

After installing and launching I have an error

pg_dump: [archiver (db)] connection to database "s_production" failed: could not connect to server: No such file or directory
[2017/08/29 09:07:44][error]   	Is the server running locally and accepting
[2017/08/29 09:07:44][error]   	connections on Unix domain socket "/tmp/pg.sock/.s.PGSQL.5432"?

The command below doesn't works

PGPASSWORD=mypass /usr/local/bin/pg_dump --username=myname --host='localhost' --port='5432' s_production

After it I have the same trace

pg_dump: [archiver (db)] connection to database "s_production" failed: could not connect to server: No such file or directory

But this one, works fine:

PGPASSWORD=mypass pg_dump --username=myname --host='localhost' --port='5432' s_production

  • Operating system: Ubuntu 16.04 x64
  • Backup version: 5.0.0.beta.2
  • Ruby version: 2.4
  • Tools or services used by backup: PostgreSQL 9.5.7

This issue doesn't helps

Hello Aleksey,

What does this command give you?

which pg_dump

I have

/usr/bin/pg_dump

OK. That means that you probably have two copies of PostgreSQL - a copy from the Ubuntu package, and another copy that was installed a different way (which put files in /usr/local/ directories). If that is not what you would expect, I would suggest removing the other copy of PostgreSQL.

I have no any packages into usr/local/bin, it is empty. All packages in usr/bin

In that case, I am sorry, but I don't quite understand why you tried /usr/local/bin/pg_dump as the dump program...

Anyway, the error message says that Backup is trying to connect to PostgreSQL through a UNIX socket, but on the command-line you are connecting with networking. The actual problem is likely to be your configuration. If you can post the model as a gist and link to it, I can have a look and be more specific.

Sorry but I'm newer in UNIX :) If I understand right 'backup gem' use /usr/local/bin/pg_dump for dump, where I can configure other path?

You should be able to configure it as a utility. More on that here: http://backup.github.io/backup/v4/utilities/

Thanks, a lot. I think it will be help.

Problem solved. Problem was in incorrect path to socket. Backup tried to connect with /tmp/pg.sock/.s.PGSQL.5432, but in my case socket file was /var/run/postgresql/.s.PGSQL.5432

I edited row in postgresql.conf and restart server (sudo servise postgresql restart). There is the row:

unix_socket_directory = '/var/run/postgresql/'