Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jkhE6-0003KY-Ip for pgsql-general@arkaria.postgresql.org; Mon, 15 Jun 2020 05:00:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jkhE5-0002k7-HW for pgsql-general@arkaria.postgresql.org; Mon, 15 Jun 2020 05:00:05 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jkhE5-0002k0-9e for pgsql-general@lists.postgresql.org; Mon, 15 Jun 2020 05:00:05 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jkhE3-00067t-9X for pgsql-general@lists.postgresql.org; Mon, 15 Jun 2020 05:00:04 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 05F502UC1098937; Mon, 15 Jun 2020 01:00:02 -0400 From: Tom Lane To: Joseph Maruca cc: "pgsql-general@lists.postgresql.org" Subject: Re: Unable to execute pg_dump In-reply-to: <3e8a19df5ce7480bb7d5b6647e514a91@masimo.com> References: <3e8a19df5ce7480bb7d5b6647e514a91@masimo.com> Comments: In-reply-to Joseph Maruca message dated "Mon, 15 Jun 2020 04:38:22 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1098935.1592197202.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 15 Jun 2020 01:00:02 -0400 Message-ID: <1098936.1592197202@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Joseph Maruca writes: > I end up in the bash-4.1 shell. When executing the following command fro= m 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 loc= ally 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