Обсуждение: Unix domain socket inconsistency

Поиск
Список
Период
Сортировка

Unix domain socket inconsistency

От
Thom Brown
Дата:
Hi all,

I'm a bit confused by my development set up.  I can connect to
PostgreSQL using unix domain sockets by not specifying any host with
psql, and the same applies to vacuumdb, createdb and dropdb.  However,
when I go to use pgbench, it seems to be looking in the wrong place
for the domain socket:

thom@swift ~/Development/postgresql $ psql postgres
psql (9.4devel)
Type "help" for help.

postgres=# \q
thom@swift ~/Development/postgresql $ createdb pgbench
thom@swift ~/Development/postgresql $ pgbench -i -s 20 pgbench
Connection to database "pgbench" 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.5488"?

The actual location is /tmp/.s.PGSQL.5488:

thom@swift ~/Development/postgresql $ pg_ctl stop
waiting for server to shut down....LOG:  received smart shutdown request
LOG:  autovacuum launcher shutting down
LOG:  shutting down
LOG:  database system is shut down
done
server stopped
thom@swift ~/Development/postgresql $ psql postgres
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5488"?

What am I missing?

--
Thom


Re: Unix domain socket inconsistency

От
Adrian Klaver
Дата:
On 12/22/2013 04:51 PM, Thom Brown wrote:

> PostgreSQL using unix domain sockets by not specifying any host with
> psql, and the same applies to vacuumdb, createdb and dropdb.  However,
> when I go to use pgbench, it seems to be looking in the wrong place
> for the domain socket:
>
> thom@swift ~/Development/postgresql $ psql postgres
> psql (9.4devel)
> Type "help" for help.
>
> postgres=# \q
> thom@swift ~/Development/postgresql $ createdb pgbench
> thom@swift ~/Development/postgresql $ pgbench -i -s 20 pgbench
> Connection to database "pgbench" 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.5488"?
>
> The actual location is /tmp/.s.PGSQL.5488:
>
> thom@swift ~/Development/postgresql $ pg_ctl stop
> waiting for server to shut down....LOG:  received smart shutdown request
> LOG:  autovacuum launcher shutting down
> LOG:  shutting down
> LOG:  database system is shut down
> done
> server stopped
> thom@swift ~/Development/postgresql $ psql postgres
> psql: could not connect to server: No such file or directory
> Is the server running locally and accepting
> connections on Unix domain socket "/tmp/.s.PGSQL.5488"?
>
> What am I missing?

Best guess pgbench is being run from a different install then rest of
your Postgres set up. Might want to check whether you have more than one
copy of pgbench and if so where they are in PATH.

>


--
Adrian Klaver
adrian.klaver@gmail.com


Re: Unix domain socket inconsistency

От
Thom Brown
Дата:
On 23 December 2013 01:13, Adrian Klaver <adrian.klaver@gmail.com> wrote:
> On 12/22/2013 04:51 PM, Thom Brown wrote:
>
>> PostgreSQL using unix domain sockets by not specifying any host with
>> psql, and the same applies to vacuumdb, createdb and dropdb.  However,
>> when I go to use pgbench, it seems to be looking in the wrong place
>> for the domain socket:
>>
>> thom@swift ~/Development/postgresql $ psql postgres
>> psql (9.4devel)
>> Type "help" for help.
>>
>> postgres=# \q
>> thom@swift ~/Development/postgresql $ createdb pgbench
>> thom@swift ~/Development/postgresql $ pgbench -i -s 20 pgbench
>> Connection to database "pgbench" 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.5488"?
>>
>> The actual location is /tmp/.s.PGSQL.5488:
>>
>> thom@swift ~/Development/postgresql $ pg_ctl stop
>> waiting for server to shut down....LOG:  received smart shutdown request
>> LOG:  autovacuum launcher shutting down
>> LOG:  shutting down
>> LOG:  database system is shut down
>> done
>> server stopped
>> thom@swift ~/Development/postgresql $ psql postgres
>> psql: could not connect to server: No such file or directory
>> Is the server running locally and accepting
>> connections on Unix domain socket "/tmp/.s.PGSQL.5488"?
>>
>> What am I missing?
>
>
> Best guess pgbench is being run from a different install then rest of your
> Postgres set up. Might want to check whether you have more than one copy of
> pgbench and if so where they are in PATH.

I should have mentioned that I've checked that:

thom@swift ~/Development $ which psql pgbench
/home/thom/Development/psql/bin//psql
/home/thom/Development/psql/bin//pgbench

--
Thom


Re: Unix domain socket inconsistency

От
Thom Brown
Дата:
On 23 December 2013 01:15, Thom Brown <thom@linux.com> wrote:
> On 23 December 2013 01:13, Adrian Klaver <adrian.klaver@gmail.com> wrote:
>> On 12/22/2013 04:51 PM, Thom Brown wrote:
>>
>>> PostgreSQL using unix domain sockets by not specifying any host with
>>> psql, and the same applies to vacuumdb, createdb and dropdb.  However,
>>> when I go to use pgbench, it seems to be looking in the wrong place
>>> for the domain socket:
>>>
>>> thom@swift ~/Development/postgresql $ psql postgres
>>> psql (9.4devel)
>>> Type "help" for help.
>>>
>>> postgres=# \q
>>> thom@swift ~/Development/postgresql $ createdb pgbench
>>> thom@swift ~/Development/postgresql $ pgbench -i -s 20 pgbench
>>> Connection to database "pgbench" 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.5488"?
>>>
>>> The actual location is /tmp/.s.PGSQL.5488:
>>>
>>> thom@swift ~/Development/postgresql $ pg_ctl stop
>>> waiting for server to shut down....LOG:  received smart shutdown request
>>> LOG:  autovacuum launcher shutting down
>>> LOG:  shutting down
>>> LOG:  database system is shut down
>>> done
>>> server stopped
>>> thom@swift ~/Development/postgresql $ psql postgres
>>> psql: could not connect to server: No such file or directory
>>> Is the server running locally and accepting
>>> connections on Unix domain socket "/tmp/.s.PGSQL.5488"?
>>>
>>> What am I missing?
>>
>>
>> Best guess pgbench is being run from a different install then rest of your
>> Postgres set up. Might want to check whether you have more than one copy of
>> pgbench and if so where they are in PATH.
>
> I should have mentioned that I've checked that:
>
> thom@swift ~/Development $ which psql pgbench
> /home/thom/Development/psql/bin//psql
> /home/thom/Development/psql/bin//pgbench

Hmm... now this is odd.  I went to correct the PATH information in my
.bashrc script file (to remove the superfluous trailing
forward-slash), and when running both psql and pgbench in a new
terminal, all is fine:

thom@swift ~/Development $ which psql pgbench
/home/thom/Development/psql/bin/psql
/home/thom/Development/psql/bin/pgbench
thom@swift ~/Development $ psql postgres
psql (9.4devel)
Type "help" for help.

postgres=# \q
thom@swift ~/Development $ pgbench -i -s 20 pgbench
NOTICE:  table "pgbench_history" does not exist, skipping
NOTICE:  table "pgbench_tellers" does not exist, skipping
NOTICE:  table "pgbench_accounts" does not exist, skipping
NOTICE:  table "pgbench_branches" does not exist, skipping
creating tables...
100000 of 2000000 tuples (5%) done (elapsed 0.10 s, remaining 1.86 s).
200000 of 2000000 tuples (10%) done (elapsed 0.19 s, remaining 1.72 s).
...

So it's all working now, but I don't know why.  I don't think that
change would be the thing that fixed it.  Perhaps it's something to do
with me attempting to run pgbench before building the development
contrib module of it, so it picks up the OS package-installed version,
and when I go to build the local dev version, it has cached the
location for the domain socket from the previous attempt.  *shrug*

--
Thom


Re: Unix domain socket inconsistency

От
Adrian Klaver
Дата:
On 12/22/2013 05:21 PM, Thom Brown wrote:
> On 23 December 2013 01:15, Thom Brown <thom@linux.com> wrote:
>> On 23 December 2013 01:13, Adrian Klaver <adrian.klaver@gmail.com> wrote:
>>> On 12/22/2013 04:51 PM, Thom Brown wrote:

>> I should have mentioned that I've checked that:
>>
>> thom@swift ~/Development $ which psql pgbench
>> /home/thom/Development/psql/bin//psql
>> /home/thom/Development/psql/bin//pgbench
>
> Hmm... now this is odd.  I went to correct the PATH information in my
> .bashrc script file (to remove the superfluous trailing
> forward-slash), and when running both psql and pgbench in a new
> terminal, all is fine:
>
> thom@swift ~/Development $ which psql pgbench
> /home/thom/Development/psql/bin/psql
> /home/thom/Development/psql/bin/pgbench
> thom@swift ~/Development $ psql postgres
> psql (9.4devel)
> Type "help" for help.
>
> postgres=# \q
> thom@swift ~/Development $ pgbench -i -s 20 pgbench
> NOTICE:  table "pgbench_history" does not exist, skipping
> NOTICE:  table "pgbench_tellers" does not exist, skipping
> NOTICE:  table "pgbench_accounts" does not exist, skipping
> NOTICE:  table "pgbench_branches" does not exist, skipping
> creating tables...
> 100000 of 2000000 tuples (5%) done (elapsed 0.10 s, remaining 1.86 s).
> 200000 of 2000000 tuples (10%) done (elapsed 0.19 s, remaining 1.72 s).
> ...
>
> So it's all working now, but I don't know why.  I don't think that
> change would be the thing that fixed it.  Perhaps it's something to do
> with me attempting to run pgbench before building the development
> contrib module of it, so it picks up the OS package-installed version,
> and when I go to build the local dev version, it has cached the
> location for the domain socket from the previous attempt.  *shrug*

That's what I like, problems that fix themselves:)

>


--
Adrian Klaver
adrian.klaver@gmail.com


Re: Unix domain socket inconsistency

От
John R Pierce
Дата:
On 12/22/2013 5:21 PM, Thom Brown wrote:
> Hmm... now this is odd.  I went to correct the PATH information in my
> .bashrc script file (to remove the superfluous trailing
> forward-slash), and when running both psql and pgbench in a new
> terminal, all is fine:

fyi, I was going to suggest ther'es more than one libpq.so on your
system, and for whatever reason the failing program was loading the
wrong one.

this VERY frequently happens on mac OSX systems, as OSX provides a
libpq.so which doesn't use the same socket path as most of the OSX
postgres server distributions.



--
john r pierce                                      37N 122W
somewhere on the middle of the left coast