Thread: Starting PostgreSQL

Starting PostgreSQL

From
admin
Date:
Sorry folks, a perennial one I'm sure ...

I have read the manual and Googled for a couple of hours but still can't
connect to PostgreSQL 8.3.4 (the PGDG RPMs running on an up to date
CentOS 5.2).

I continually get this message:

psql: could not connect to server: No such file or firectory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PDSQL.0"?

Yes, the server is running as 'ps -aux' and 'netstat -l' and 'service
postgresql status' all confirm.

service postgresql start/stop/restart works without errors
pg_ctl start/stop/restart works without errors

There is no socket file in /tmp.
I believe I have PG configured to listen on port 5432 anyway:

listen_addresses = '*'
port = 5432

Is that enough to make PG listen on a port ... the docs seem to be
saying that?




Re: Starting PostgreSQL

From
Devrim GÜNDÜZ
Date:
On Sun, 2008-10-12 at 00:03 +0930, admin wrote:
> psql: could not connect to server: No such file or firectory
> Is the server running locally and accepting
> connections on Unix domain socket "/tmp/.s.PDSQL.0"?

Socket file name is wrong -- and the port...
--
Devrim GÜNDÜZ, RHCE
devrim~gunduz.org, devrim~PostgreSQL.org, devrim.gunduz~linux.org.tr
                   http://www.gunduz.org

Attachment

Re: Starting PostgreSQL

From
Adrian Klaver
Date:
On Saturday 11 October 2008 7:33:20 am admin wrote:
> Sorry folks, a perennial one I'm sure ...
>
> I have read the manual and Googled for a couple of hours but still can't
> connect to PostgreSQL 8.3.4 (the PGDG RPMs running on an up to date
> CentOS 5.2).
>
> I continually get this message:
>
> psql: could not connect to server: No such file or firectory
> Is the server running locally and accepting
> connections on Unix domain socket "/tmp/.s.PDSQL.0"?
>
> Yes, the server is running as 'ps -aux' and 'netstat -l' and 'service
> postgresql status' all confirm.
>
> service postgresql start/stop/restart works without errors
> pg_ctl start/stop/restart works without errors
>
> There is no socket file in /tmp.
> I believe I have PG configured to listen on port 5432 anyway:
>
> listen_addresses = '*'
> port = 5432
>
> Is that enough to make PG listen on a port ... the docs seem to be
> saying that?

What is in the pg_hba.conf file?
Also are you connecting from a remote machine or the local machine?
--
Adrian Klaver
aklaver@comcast.net

Re: Starting PostgreSQL

From
Tom Lane
Date:
admin <mick@mjhall.org> writes:
> I continually get this message:

> psql: could not connect to server: No such file or firectory
> Is the server running locally and accepting
> connections on Unix domain socket "/tmp/.s.PDSQL.0"?

If it's really saying .0, and not .5432, then the problem is on the
client side --- it's got the wrong idea about the port number to
connect to.  Perhaps you have PGPORT set to something bogus in the
client environment?

            regards, tom lane

Re: Starting PostgreSQL

From
Marco Colombo
Date:
admin wrote:
> Sorry folks, a perennial one I'm sure ...
>
> I have read the manual and Googled for a couple of hours but still can't
> connect to PostgreSQL 8.3.4 (the PGDG RPMs running on an up to date
> CentOS 5.2).
>
> I continually get this message:
>
> psql: could not connect to server: No such file or firectory
> Is the server running locally and accepting
> connections on Unix domain socket "/tmp/.s.PDSQL.0"?
>
> Yes, the server is running as 'ps -aux' and 'netstat -l' and 'service
> postgresql status' all confirm.

Do you mean you have something like this in your netstan -l?
unix  2      [ ACC ]     STREAM     LISTENING     12587  /tmp/.s.PGSQL.5432

note, this is on a linux box with postgresql in standard configuration.
Just look at the port number embedded in the socket name. I don't really
think you can run a process on port 0. I think your psql is looking for
the wrong socket.

Try:
$ psql -p 5432 ...

If you don't see any unix socket for PG (I don't even think that's possible),
then you need to use IP sockets:

$ psql -p 5432 -h localhost ...

>
> service postgresql start/stop/restart works without errors
> pg_ctl start/stop/restart works without errors
>
> There is no socket file in /tmp.

Opps sorry I missed this. Well double check with netstat, but it's
possible your PG is not configured for Unix sockets... even if I
wouldn't know how to do that.

I just checked a CentOS5.2 running PG and there it is:

$ ls -l /tmp/.s.PGSQL.5432
srwxrwxrwx 1 postgres postgres 0 Oct 13 01:22 /tmp/.s.PGSQL.5432

.TM.