Thread: setting Postgres client

setting Postgres client

From
"Markova, Nina"
Date:
My message didn't get through the 1st time.

-----Original Message-----
From: Markova, Nina
Sent: September 17, 2008 17:33
To: pgsql-general@postgresql.org
Subject: Help on setting Postgres client



I have setup a Postgres server (8.2.4) on Solaris 10, for now in the
global zone, with FS :
/pg_db
/pg_log
/pg_data

Now I need to set up a client in a non-global zone on the same machine
or on anoter machine.
Not much luck so far.


What I did:
===========
- on the server in $PGDATA/pg_hub.conf I added a line for the client
host    all         all         192.XXX.XX.XXX        trust

- On the client I tried:
psql sta
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.5432"?


In my understanding:
- the data and the log file should exist on the server only.
- I should have postgres configuration file somewhere on the client to
at least specify Postgres server ip (PGHOSTTADDR and/or PGHOST), or this
should be set different way?

Questions:
==========
- where to find steps for setting up postgres client?
- what directories and files should I have on the client side?
- should I have local log file on the client?
- how to start postgres on the client - should I specify $PGDATA?
- Should $PGDATA be shared, i.e. mounted by the client, or I have choice
not to? I actually prefer not to be mounted.
- I read that for the client side I should have only 2 of the packages -
SUNWpostgr-libs and SUNWpostgr. All 24 packges for postgres are there -
should I remove the rest?
- where to specify PGHOSTTADDR and/or PGHOST?

Thanks in advance,
Nina


Any practical advices

Re: setting Postgres client

From
Bill Moran
Date:
"Markova, Nina" <nmarkova@NRCan.gc.ca> wrote:
>
> - On the client I tried:
> psql sta
> 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.5432"?

The client tries to connect to the unix domain socket by default (as
can be seen by the error message)

If your client system and server don't share the same /tmp filesystem,
then that is going to fail, which is expected.  Either specify the
IP address/hostname you want to connect to with -h or put options in
your .psqlrc file or set appropriate environment variables.  More
details here:
http://www.postgresql.org/docs/8.2/static/app-psql.html

--
Bill Moran
Collaborative Fusion Inc.

wmoran@collaborativefusion.com
Phone: 412-422-3463x4023

Re: setting Postgres client

From
"Markova, Nina"
Date:
Thanks Richard.


I specified the host IP ( I use the default 5432 port), got error:
psql: could not connect to server: Connection refused
        Is the server running on host "192.168.XX.XXX" and accepting
        TCP/IP connections on port 5432?

The only tcp lines in my postgres.conf are
#tcp_keepalives_idle = 0                # TCP_KEEPIDLE, in seconds;
                                        # 0 selects the system default
#tcp_keepalives_interval = 0            # TCP_KEEPINTVL, in seconds;
                                        # 0 selects the system default
#tcp_keepalives_count = 0               # TCP_KEEPCNT;
                                        # 0 selects the system default
Should I change something here?

Nina

-----Original Message-----
From: Richard Huxton [mailto:dev@archonet.com]
Sent: September 19, 2008 10:15
To: Markova, Nina
Subject: Re: [GENERAL] setting Postgres client

Markova, Nina wrote:
> Now I need to set up a client in a non-global zone on the same machine

> or on anoter machine.
> Not much luck so far.
>
>
> What I did:
> ===========
> - on the server in $PGDATA/pg_hub.conf I added a line for the client
> host    all         all         192.XXX.XX.XXX        trust
>
> - On the client I tried:
> psql sta
> 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.5432"?
>
>
> In my understanding:
> - the data and the log file should exist on the server only.
> - I should have postgres configuration file somewhere on the client to

> at least specify Postgres server ip (PGHOSTTADDR and/or PGHOST), or
> this should be set different way?

You can provide a hostname on the command-line too "psql -h 192.168.1.2"
, in an environment variable or in a "connection service file". Without
that, it defaults to trying to connect by unix domain sockets (on unix)
which I'm guessing doesn't work because your server is in a different
zone. Try an explicit IP address, as above.

> Questions:
> ==========
> - where to find steps for setting up postgres client?

If it runs, it's set up.

> - what directories and files should I have on the client side?

none

> - should I have local log file on the client?

No. Well, you get a .psql_history file if you have readline enabled.

> - how to start postgres on the client - should I specify $PGDATA?

No

> - Should $PGDATA be shared, i.e. mounted by the client, or I have
> choice not to? I actually prefer not to be mounted.

No

> - I read that for the client side I should have only 2 of the packages

> - SUNWpostgr-libs and SUNWpostgr. All 24 packges for postgres are
> there - should I remove the rest?

Can't help sorry.

> - where to specify PGHOSTTADDR and/or PGHOST?

You can do it in your shell profile on a per-user basis, or for the
whole machine. I tend to do it no the command-line or in an shell alias
myself  though.

--
  Richard Huxton
  Archonet Ltd

Re: setting Postgres client

From
Steve Clark
Date:
Markova, Nina wrote:
>
> Thanks Richard.
>
>
> I specified the host IP ( I use the default 5432 port), got error:
> psql: could not connect to server: Connection refused
>         Is the server running on host "192.168.XX.XXX" and accepting
>         TCP/IP connections on port 5432?
>
> The only tcp lines in my postgres.conf are
> #tcp_keepalives_idle = 0                # TCP_KEEPIDLE, in seconds;
>                                         # 0 selects the system default
> #tcp_keepalives_interval = 0            # TCP_KEEPINTVL, in seconds;
>                                         # 0 selects the system default
> #tcp_keepalives_count = 0               # TCP_KEEPCNT;
>                                         # 0 selects the system default
> Should I change something here?
>
> Nina
>
> -----Original Message-----
> From: Richard Huxton [mailto:dev@archonet.com]
> Sent: September 19, 2008 10:15
> To: Markova, Nina
> Subject: Re: [GENERAL] setting Postgres client
>
> Markova, Nina wrote:
>
>>Now I need to set up a client in a non-global zone on the same machine
>
>
>>or on anoter machine.
>>Not much luck so far.
>>
>>
>>What I did:
>>===========
>>- on the server in $PGDATA/pg_hub.conf I added a line for the client
>>host    all         all         192.XXX.XX.XXX        trust
>>
>>- On the client I tried:
>>psql sta
>>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.5432"?
>>
>>
>>In my understanding:
>>- the data and the log file should exist on the server only.
>>- I should have postgres configuration file somewhere on the client to
>
>
>>at least specify Postgres server ip (PGHOSTTADDR and/or PGHOST), or
>>this should be set different way?
>
>
> You can provide a hostname on the command-line too "psql -h 192.168.1.2"
> , in an environment variable or in a "connection service file". Without
> that, it defaults to trying to connect by unix domain sockets (on unix)
> which I'm guessing doesn't work because your server is in a different
> zone. Try an explicit IP address, as above.
>
>
>>Questions:
>>==========
>>- where to find steps for setting up postgres client?
>
>
> If it runs, it's set up.
>
>
>>- what directories and files should I have on the client side?
>
>
> none
>
>
>>- should I have local log file on the client?
>
>
> No. Well, you get a .psql_history file if you have readline enabled.
>
>
>>- how to start postgres on the client - should I specify $PGDATA?
>
>
> No
>
>
>>- Should $PGDATA be shared, i.e. mounted by the client, or I have
>>choice not to? I actually prefer not to be mounted.
>
>
> No
>
>
>>- I read that for the client side I should have only 2 of the packages
>
>
>>- SUNWpostgr-libs and SUNWpostgr. All 24 packges for postgres are
>>there - should I remove the rest?
>
>
> Can't help sorry.
>
>
>>- where to specify PGHOSTTADDR and/or PGHOST?
>
>
> You can do it in your shell profile on a per-user basis, or for the
> whole machine. I tend to do it no the command-line or in an shell alias
> myself  though.
>
> --
>   Richard Huxton
>   Archonport = 5432 et Ltd
>

port = 5432

Re: setting Postgres client

From
Richard Huxton
Date:
Markova, Nina wrote:
>
> Thanks Richard.
>
>
> I specified the host IP ( I use the default 5432 port), got error:
> psql: could not connect to server: Connection refused
>         Is the server running on host "192.168.XX.XXX" and accepting
>         TCP/IP connections on port 5432?
>
> The only tcp lines in my postgres.conf are
> #tcp_keepalives_idle = 0                # TCP_KEEPIDLE, in seconds;
>                                         # 0 selects the system default
> #tcp_keepalives_interval = 0            # TCP_KEEPINTVL, in seconds;
>                                         # 0 selects the system default
> #tcp_keepalives_count = 0               # TCP_KEEPCNT;
>                                         # 0 selects the system default
> Should I change something here?

Check "listen_addresses" and "port" look OK. You're probably only
listening to localhost.

You can test by telnet-ing to port 5432 or using lsof / netstat to see
what connections you have open in that zone.

--
  Richard Huxton
  Archonet Ltd

Re: setting Postgres client

From
"Markova, Nina"
Date:
 YES! Done - my listen addresses was the default.

Thanks Richard!

Nina
-----Original Message-----
From: Richard Huxton [mailto:dev@archonet.com]
Sent: September 19, 2008 11:57
To: Markova, Nina
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] setting Postgres client

Markova, Nina wrote:
>
> Thanks Richard.
>
>
> I specified the host IP ( I use the default 5432 port), got error:
> psql: could not connect to server: Connection refused
>         Is the server running on host "192.168.XX.XXX" and accepting
>         TCP/IP connections on port 5432?
>
> The only tcp lines in my postgres.conf are
> #tcp_keepalives_idle = 0                # TCP_KEEPIDLE, in seconds;
>                                         # 0 selects the system default
> #tcp_keepalives_interval = 0            # TCP_KEEPINTVL, in seconds;
>                                         # 0 selects the system default
> #tcp_keepalives_count = 0               # TCP_KEEPCNT;
>                                         # 0 selects the system default

> Should I change something here?

Check "listen_addresses" and "port" look OK. You're probably only
listening to localhost.

You can test by telnet-ing to port 5432 or using lsof / netstat to see
what connections you have open in that zone.

--
  Richard Huxton
  Archonet Ltd