Обсуждение: [GENERAL] psql - looking in wrong place for socket

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

[GENERAL] psql - looking in wrong place for socket

От
Steve Clark
Дата:
Hi List,

I am running postgresql 8.4.20 on CentOS 6. Things have been running fine for a long time
then I rebooted. Postgres came up but when I tried to connect with psql on the local machine
I got

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"?

The socket is actually being created (and always has been) in /tmp

I worked around the problem temporarily by
ln -s /tmp/.s.PGSQL.5432 /var/run/postgresql/.s.PGSQL.5432

What controls where psql looks for the socket?

Thanks,
Steve




Re: [GENERAL] psql - looking in wrong place for socket

От
Adrian Klaver
Дата:
On 03/17/2017 06:42 AM, Steve Clark wrote:
> Hi List,
>
> I am running postgresql 8.4.20 on CentOS 6. Things have been running fine for a long time
> then I rebooted. Postgres came up but when I tried to connect with psql on the local machine
> I got
>
> 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"?
>
> The socket is actually being created (and always has been) in /tmp

So you built Postgres from source?

>
> I worked around the problem temporarily by
> ln -s /tmp/.s.PGSQL.5432 /var/run/postgresql/.s.PGSQL.5432
>
> What controls where psql looks for the socket?

https://www.postgresql.org/message-id/23876.1488949292%40sss.pgh.pa.us

"With the default configure options you used, the postmaster would have
put its Unix socket file into /tmp, not /var/run.  I wonder whether your
problem is that you're trying to connect to it with distro-supplied
psql+libpq that expects to find the Unix socket in /var/run."



>
> Thanks,
> Steve
>
>
>
>


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: [GENERAL] psql - looking in wrong place for socket

От
Steve Clark
Дата:
On 03/17/2017 09:49 AM, Adrian Klaver wrote:
On 03/17/2017 06:42 AM, Steve Clark wrote:
Hi List,

I am running postgresql 8.4.20 on CentOS 6. Things have been running fine for a long time
then I rebooted. Postgres came up but when I tried to connect with psql on the local machine
I got

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"?

The socket is actually being created (and always has been) in /tmp
So you built Postgres from source?
No - it is installed using yum.

It looks like the problem is someone loaded postgresql-9.5 and psql was using:
psql    14971 postgres  mem    REG                8,4   193296   950807 /usr/pgsql-9.5/lib/libpq.so.5.8

the libpq from 9.5.

By removing the ln and using

# rm /var/run/postgresql/.s.PGSQL.5432
rm: remove symbolic link `/var/run/postgresql/.s.PGSQL.5432'? y

$ psql
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"?

$ LD_LIBRARY_PATH=/usr/lib64 psql
psql (8.4.20)
Type "help" for help.

postgres=#

It works OK again.

So now I know what caused the problem.

Thanks,
Steve
I worked around the problem temporarily by
ln -s /tmp/.s.PGSQL.5432 /var/run/postgresql/.s.PGSQL.5432

What controls where psql looks for the socket?
https://www.postgresql.org/message-id/23876.1488949292%40sss.pgh.pa.us

"With the default configure options you used, the postmaster would have 
put its Unix socket file into /tmp, not /var/run.  I wonder whether your
problem is that you're trying to connect to it with distro-supplied
psql+libpq that expects to find the Unix socket in /var/run."



Thanks,
Steve







--
Stephen Clark
NetWolves Managed Services, LLC.
Director of Technology
Phone: 813-579-3200
Fax: 813-882-0209
Email: steve.clark@netwolves.com
http://www.netwolves.com

Re: [GENERAL] psql - looking in wrong place for socket

От
Adrian Klaver
Дата:
On 03/17/2017 06:58 AM, Steve Clark wrote:
> On 03/17/2017 09:49 AM, Adrian Klaver wrote:
>> On 03/17/2017 06:42 AM, Steve Clark wrote:
>>> Hi List,
>>>
>>> I am running postgresql 8.4.20 on CentOS 6. Things have been running fine for a long time
>>> then I rebooted. Postgres came up but when I tried to connect with psql on the local machine
>>> I got
>>>
>>> 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"?
>>>
>>> The socket is actually being created (and always has been) in /tmp
>> So you built Postgres from source?
> No - it is installed using yum.
>
> It looks like the problem is someone loaded postgresql-9.5 and psql was
> using:
> psql    14971 postgres  mem    REG                8,4   193296   950807
> /usr/pgsql-9.5/lib/libpq.so.5.8
>
> the libpq from 9.5.
>
> By removing the ln and using
>
> # rm /var/run/postgresql/.s.PGSQL.5432
> rm: remove symbolic link `/var/run/postgresql/.s.PGSQL.5432'? y
>
> $ psql
> 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"?
>
> $ LD_LIBRARY_PATH=/usr/lib64 psql
> psql (8.4.20)

You probably already know, but 8.4 is ~2 1/2 past EOL. Also the last
release in that series was 8.4.22.

> Type "help" for help.
>
> postgres=#
>
> It works OK again.
>
> So now I know what caused the problem.
>
> Thanks,
> Steve
>>> I worked around the problem temporarily by
>>> ln -s /tmp/.s.PGSQL.5432 /var/run/postgresql/.s.PGSQL.5432
>>>
>>> What controls where psql looks for the socket?
>> https://www.postgresql.org/message-id/23876.1488949292%40sss.pgh.pa.us
>>
>> "With the default configure options you used, the postmaster would have
>> put its Unix socket file into /tmp, not /var/run.  I wonder whether your
>> problem is that you're trying to connect to it with distro-supplied
>> psql+libpq that expects to find the Unix socket in /var/run."
>>
>>
>>
>>> Thanks,
>>> Steve
>>>
>>>
>>>
>>>
>>
>
>
> --
> Stephen Clark
> *NetWolves Managed Services, LLC.*
> Director of Technology
> Phone: 813-579-3200
> Fax: 813-882-0209
> Email: steve.clark@netwolves.com
> http://www.netwolves.com


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: [GENERAL] psql - looking in wrong place for socket

От
Steve Clark
Дата:
On 03/17/2017 10:14 AM, Adrian Klaver wrote:
On 03/17/2017 06:58 AM, Steve Clark wrote:
On 03/17/2017 09:49 AM, Adrian Klaver wrote:
On 03/17/2017 06:42 AM, Steve Clark wrote:
Hi List,

I am running postgresql 8.4.20 on CentOS 6. Things have been running fine for a long time
then I rebooted. Postgres came up but when I tried to connect with psql on the local machine
I got

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"?

The socket is actually being created (and always has been) in /tmp
So you built Postgres from source?
No - it is installed using yum.

It looks like the problem is someone loaded postgresql-9.5 and psql was
using:
psql    14971 postgres  mem    REG                8,4   193296   950807
/usr/pgsql-9.5/lib/libpq.so.5.8

the libpq from 9.5.

By removing the ln and using

# rm /var/run/postgresql/.s.PGSQL.5432
rm: remove symbolic link `/var/run/postgresql/.s.PGSQL.5432'? y

$ psql
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"?

$ LD_LIBRARY_PATH=/usr/lib64 psql
psql (8.4.20)
You probably already know, but 8.4 is ~2 1/2 past EOL. Also the last 
release in that series was 8.4.22.


Hmm... maybe you missed the fact I am running CentOS 6. It appears 8.20 is the latest official release.

$ rpm -qa|grep postgres
postgresql-server-8.4.20-6.el6.x86_64

$ sudo yum update postgresql-server
Loaded plugins: fastestmirror, refresh-packagekit
Setting up Update Process
Loading mirror speeds from cached hostfile
 * atomic: www6.atomicorp.com
 * base: repo1.dal.innoscale.net
 * elrepo: iad.mirror.rackspace.com
 * epel: mirror.nodesdirect.com
 * extras: mirror.sjc02.svwh.net
 * updates: mirror.millry.co
No Packages marked for Update



Re: [GENERAL] psql - looking in wrong place for socket

От
Adrian Klaver
Дата:
On 03/17/2017 07:31 AM, Steve Clark wrote:
> On 03/17/2017 10:14 AM, Adrian Klaver wrote:
>> On 03/17/2017 06:58 AM, Steve Clark wrote:
>>> On 03/17/2017 09:49 AM, Adrian Klaver wrote:
>>>> On 03/17/2017 06:42 AM, Steve Clark wrote:
>>>>> Hi List,
>>>>>
>>>>> I am running postgresql 8.4.20 on CentOS 6. Things have been running fine for a long time
>>>>> then I rebooted. Postgres came up but when I tried to connect with psql on the local machine
>>>>> I got
>>>>>
>>>>> 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"?
>>>>>
>>>>> The socket is actually being created (and always has been) in /tmp
>>>> So you built Postgres from source?
>>> No - it is installed using yum.
>>>
>>> It looks like the problem is someone loaded postgresql-9.5 and psql was
>>> using:
>>> psql    14971 postgres  mem    REG                8,4   193296   950807
>>> /usr/pgsql-9.5/lib/libpq.so.5.8
>>>
>>> the libpq from 9.5.
>>>
>>> By removing the ln and using
>>>
>>> # rm /var/run/postgresql/.s.PGSQL.5432
>>> rm: remove symbolic link `/var/run/postgresql/.s.PGSQL.5432'? y
>>>
>>> $ psql
>>> 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"?
>>>
>>> $ LD_LIBRARY_PATH=/usr/lib64 psql
>>> psql (8.4.20)
>> You probably already know, but 8.4 is ~2 1/2 past EOL. Also the last
>> release in that series was 8.4.22.
>>
>>
> Hmm... maybe you missed the fact I am running CentOS 6. It appears 8.20
> is the latest official release.

Yeah, that would be the CentOS repo's.

The Postgres community repo's are more current:

https://yum.postgresql.org/repopackages.php

My guess, that is where the 9.5 version you found came from.

>
> $ rpm -qa|grep postgres
> postgresql-server-8.4.20-6.el6.x86_64
>
> $ sudo yum update postgresql-server
> Loaded plugins: fastestmirror, refresh-packagekit
> Setting up Update Process
> Loading mirror speeds from cached hostfile
>  * atomic: www6.atomicorp.com
>  * base: repo1.dal.innoscale.net
>  * elrepo: iad.mirror.rackspace.com
>  * epel: mirror.nodesdirect.com
>  * extras: mirror.sjc02.svwh.net
>  * updates: mirror.millry.co
> No Packages marked for Update
>
>
>


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: [GENERAL] psql - looking in wrong place for socket

От
George Neuner
Дата:
On Fri, 17 Mar 2017 10:31:16 -0400, Steve Clark
<steve.clark@netwolves.com> wrote:


>Hmm... maybe you missed the fact I am running CentOS 6. It appears
>8.20 is the latest official release.


I'm running 9.5.5 on Centos 6.8 - no problems at all.


Go into /etc/yum.repos.d/CentOS-Base.repo, and add the line

  exclude=postgresql*

to both the [base] and [updates] section.  This will prevent yum from
looking at the Centos repositories for anything postgresql.


Then grab a repo file for a more recent version from
https://yum.postgresql.org/ and place the file in /etc/yum.repos.d.

From that point, yum will see the new version.


I don't know what issues you may face in upgrading from 8.2 - I have
never tried leaping so many [major] versions at once.

George