From: Tom Lane <tgl@sss.pgh.pa.us>
To: Joseph Maruca <joseph.maruca@masimo.com>
Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: Unable to execute pg_dump
Date: Mon, 15 Jun 2020 01:00:02 -0400
Message-ID: <1098936.1592197202@sss.pgh.pa.us> (raw)
In-Reply-To: <3e8a19df5ce7480bb7d5b6647e514a91@masimo.com>
References: <3e8a19df5ce7480bb7d5b6647e514a91@masimo.com>
Joseph Maruca <joseph.maruca@masimo.com> writes:
> I end up in the bash-4.1 shell. When executing the following command from within the shell: bash-4.1$ pg_dump db_name > /tmp/my_database.sql I am presented with the following error:
> pg_dump: [archiver (db)] connection to database "db_name" failed: 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"?
Ah, this is a symptom we've seen before. There is disagreement about
where the postmaster ought to put its socket file --- traditionally
PG puts it in /tmp/, but some people feel that's a security hazard and
want to put it in a bespoke directory such as /var/run/postgresql/.
It appears from these symptoms that (a) you are running a server that
puts the socket in /tmp (probably you got that server from a PGDG RPM?)
but (b) you are trying to connect to it using a Red-Hat-provided libpq
(which defaults to expecting the file to be in /var/run/postgresql/).
You have various possible workarounds:
* tell the server to create a socket file in /var/run/postgresql/ too
(see unix_socket_directories);
* tell libpq where to find the socket, e.g. with "psql -h /tmp";
* tell libpq not to use a Unix socket at all, e.g. "psql -h localhost";
* make sure to invoke psql+libpq from the PGDG distribution rather than
using ones supplied by Red Hat.
Generally speaking, mixing PGDG RPMs with vendor-supplied Postgres RPMs
is a recipe for headaches. If you can drop the Red Hat Postgres RPMs
without causing dependency problems, do that. Otherwise, the
two-socket-files solution is probably the best.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, joseph.maruca@masimo.com
Subject: Re: Unable to execute pg_dump
In-Reply-To: <1098936.1592197202@sss.pgh.pa.us>
References: <3e8a19df5ce7480bb7d5b6647e514a91@masimo.com> <1098936.1592197202@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox