pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedpostgres operational
5+ messages / 4 participants
[nested] [flat]
* postgres operational
@ 2019-01-09 17:58 Steve Clark <steve.clark@netwolves.com>
0 siblings, 2 replies; 5+ messages in thread
From: Steve Clark @ 2019-01-09 17:58 UTC (permalink / raw)
To: pgsql-general
Hi List,
Is there a sure fire way to tell if postgres server is up an operational. I was testing to see if the
socket at /tmp/.s.PGSQL.5432 existed - but I ran into a recent problem on CentOS 7.5, postgresql 9.2.24, where the
socket was there but my script couldn't read from my database yet.
Thanks,
Steve
--
^ permalink raw reply [nested|flat] 5+ messages in thread
* RE: postgres operational
@ 2019-01-09 18:02 Scot Kreienkamp <Scot.Kreienkamp@la-z-boy.com>
parent: Steve Clark <steve.clark@netwolves.com>
1 sibling, 0 replies; 5+ messages in thread
From: Scot Kreienkamp @ 2019-01-09 18:02 UTC (permalink / raw)
To: Steve Clark <steve.clark@netwolves.com>; pgsql-general
The best way I came up with for older versions is: If timeout -s 9 10 psql -d DBNAME -c "select 1" >/dev/null ; then ....
And on newer versions, use the pg_isready command.
Scot Kreienkamp |Senior Systems Engineer | La-Z-Boy Corporate
One La-Z-Boy Drive| Monroe, Michigan 48162 | Office: 734-384-6403 | | Mobile: 7349151444 | Email: Scot.Kreienkamp@la-z-boy.com
> -----Original Message-----
> From: Steve Clark [mailto:steve.clark@netwolves.com]
> Sent: Wednesday, January 9, 2019 12:59 PM
> To: pgsql <pgsql-general@postgresql.org>
> Subject: postgres operational
>
> Hi List,
>
> Is there a sure fire way to tell if postgres server is up an operational. I was
> testing to see if the
> socket at /tmp/.s.PGSQL.5432 existed - but I ran into a recent problem on
> CentOS 7.5, postgresql 9.2.24, where the
> socket was there but my script couldn't read from my database yet.
>
> Thanks,
> Steve
> --
>
This message is intended only for the individual or entity to which it is addressed. It may contain privileged, confidential information which is exempt from disclosure under applicable laws. If you are not the intended recipient, you are strictly prohibited from disseminating or distributing this information (other than to the intended recipient) or copying this information. If you have received this communication in error, please notify us immediately by e-mail or by telephone at the above number. Thank you.
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: postgres operational
@ 2019-01-09 18:19 Martín Marqués <martin@2ndquadrant.com>
parent: Steve Clark <steve.clark@netwolves.com>
1 sibling, 1 reply; 5+ messages in thread
From: Martín Marqués @ 2019-01-09 18:19 UTC (permalink / raw)
To: Steve Clark <steve.clark@netwolves.com>; pgsql-general
El 9/1/19 a las 14:58, Steve Clark escribió:
> Hi List,
>
> Is there a sure fire way to tell if postgres server is up an operational. I was testing to see if the
> socket at /tmp/.s.PGSQL.5432 existed - but I ran into a recent problem on CentOS 7.5, postgresql 9.2.24, where the
> socket was there but my script couldn't read from my database yet.
Use `check_postgres`
--
Martín Marqués http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: postgres operational
@ 2019-01-09 20:38 Ron <ronljohnsonjr@gmail.com>
parent: Martín Marqués <martin@2ndquadrant.com>
0 siblings, 1 reply; 5+ messages in thread
From: Ron @ 2019-01-09 20:38 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
On 1/9/19 12:19 PM, Martín Marqués wrote:
> El 9/1/19 a las 14:58, Steve Clark escribió:
>> Hi List,
>>
>> Is there a sure fire way to tell if postgres server is up an operational. I was testing to see if the
>> socket at /tmp/.s.PGSQL.5432 existed - but I ran into a recent problem on CentOS 7.5, postgresql 9.2.24, where the
>> socket was there but my script couldn't read from my database yet.
> Use `check_postgres`
Isn't "pg_ctl status" the canonical method?
--
Angular momentum makes the world go 'round.
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: postgres operational
@ 2019-01-09 23:43 Martín Marqués <martin@2ndquadrant.com>
parent: Ron <ronljohnsonjr@gmail.com>
0 siblings, 0 replies; 5+ messages in thread
From: Martín Marqués @ 2019-01-09 23:43 UTC (permalink / raw)
To: Ron <ronljohnsonjr@gmail.com>; pgsql-general@lists.postgresql.org
El 9/1/19 a las 17:38, Ron escribió:
> On 1/9/19 12:19 PM, Martín Marqués wrote:
>> El 9/1/19 a las 14:58, Steve Clark escribió:
>>> Hi List,
>>>
>>> Is there a sure fire way to tell if postgres server is up an
>>> operational. I was testing to see if the
>>> socket at /tmp/.s.PGSQL.5432 existed - but I ran into a recent
>>> problem on CentOS 7.5, postgresql 9.2.24, where the
>>> socket was there but my script couldn't read from my database yet.
>> Use `check_postgres`
>
> Isn't "pg_ctl status" the canonical method?
Depends on what you are expecting.
`check_postgres` has many different checks, one which will actually try
to connect and run `SELECT 1` to make sure postgres can actually run a
query.
pg_ctl status might return ok, yet you can't connect for other reasons.
--
Martín Marqués http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2019-01-09 23:43 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-01-09 17:58 postgres operational Steve Clark <steve.clark@netwolves.com>
2019-01-09 18:02 ` Scot Kreienkamp <Scot.Kreienkamp@la-z-boy.com>
2019-01-09 18:19 ` Martín Marqués <martin@2ndquadrant.com>
2019-01-09 20:38 ` Ron <ronljohnsonjr@gmail.com>
2019-01-09 23:43 ` Martín Marqués <martin@2ndquadrant.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox