pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedDoes PG have a database
4+ messages / 4 participants
[nested] [flat]
* Does PG have a database
@ 2006-05-22 16:28 Mark Fenbers <Mark.Fenbers@noaa.gov>
2006-05-22 17:52 ` Re: Does PG have a database Markus Schaber <schabi@logix-tt.com>
2006-05-22 17:59 ` Re: Does PG have a database Manlio Perillo <manlio_perillo@libero.it>
2006-05-23 05:39 ` Re: Does PG have a database Achilleus Mantzios <achill@matrix.gatewaynet.com>
0 siblings, 3 replies; 4+ messages in thread
From: Mark Fenbers @ 2006-05-22 16:28 UTC (permalink / raw)
To: pgsql-sql
I have working PostgreSQL databases on 3 of my ~30 Linux boxes. I want
my software to be able to determine which of my 30 boxes have functional
databases on them. Since Pg is part of the baseline distro, merely
checking for the existence of an executable doesn't solve my problem.
I tried looping through my list of hosts and running the command:
psql -h $host --list
but this fails on a box with a database with the same error code as on a
box that doesn't have a database, if my PGUSER isn't set and my login ID
is not the username of the database. The PGUSER setting might differ
for each host, so specifying this in the software is not practical.
Bottom line: What trick can I use to determine whether a box has a
living, breathing Pg database if I don't know the DB owner?
Mark
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Does PG have a database
2006-05-22 16:28 Does PG have a database Mark Fenbers <Mark.Fenbers@noaa.gov>
@ 2006-05-22 17:52 ` Markus Schaber <schabi@logix-tt.com>
2 siblings, 0 replies; 4+ messages in thread
From: Markus Schaber @ 2006-05-22 17:52 UTC (permalink / raw)
To: pgsql-sql
Hi, Mark,
Mark Fenbers schrieb:
> Bottom line: What trick can I use to determine whether a box has a
> living, breathing Pg database if I don't know the DB owner?
If all your Postmasters run on the default port, use nmap on the port,
so you see that postmasters are running there. When they run, then there
must be a cluster with databases, at least the template ones.
If your "baseline distro" is debian, ssh into the machines, and do
pg_lsclusters.
HTH,
Markus
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Does PG have a database
2006-05-22 16:28 Does PG have a database Mark Fenbers <Mark.Fenbers@noaa.gov>
@ 2006-05-22 17:59 ` Manlio Perillo <manlio_perillo@libero.it>
2 siblings, 0 replies; 4+ messages in thread
From: Manlio Perillo @ 2006-05-22 17:59 UTC (permalink / raw)
To: pgsql-sql
Mark Fenbers ha scritto:
> I have working PostgreSQL databases on 3 of my ~30 Linux boxes. I want
> my software to be able to determine which of my 30 boxes have functional
> databases on them. Since Pg is part of the baseline distro, merely
> checking for the existence of an executable doesn't solve my problem.
>
> I tried looping through my list of hosts and running the command:
> psql -h $host --list
> but this fails on a box with a database with the same error code as on a
> box that doesn't have a database, if my PGUSER isn't set and my login ID
> is not the username of the database. The PGUSER setting might differ
> for each host, so specifying this in the software is not practical.
>
> Bottom line: What trick can I use to determine whether a box has a
> living, breathing Pg database if I don't know the DB owner?
> Mark
>
Just write a custom client that connects to the given host, on some
standard ports.
If the connection is accepted, there is a possibility that on the other
side there is a PostgreSQL server.
To make sure send a StartupMessage
http://www.postgresql.org/docs/8.1/static/protocol-message-formats.html
You can reuse some code of a library I have written: pglib.
http://developer.berlios.de/projects/pglib/
It is released under the MIT license, and it is written in Python and
Twisted (a framework for writing asynchronous applications).
By the way: pglib aims to be a complete replacement for libpq.
Regards Manlio Perillo
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Does PG have a database
2006-05-22 16:28 Does PG have a database Mark Fenbers <Mark.Fenbers@noaa.gov>
@ 2006-05-23 05:39 ` Achilleus Mantzios <achill@matrix.gatewaynet.com>
2 siblings, 0 replies; 4+ messages in thread
From: Achilleus Mantzios @ 2006-05-23 05:39 UTC (permalink / raw)
To: Mark Fenbers <Mark.Fenbers@noaa.gov>; +Cc: pgsql-sql
O Mark Fenbers Ýãñáøå óôéò May 22, 2006 :
> I have working PostgreSQL databases on 3 of my ~30 Linux boxes. I want
> my software to be able to determine which of my 30 boxes have functional
> databases on them. Since Pg is part of the baseline distro, merely
> checking for the existence of an executable doesn't solve my problem.
>
> I tried looping through my list of hosts and running the command:
> psql -h $host --list
> but this fails on a box with a database with the same error code as on a
> box that doesn't have a database, if my PGUSER isn't set and my login ID
> is not the username of the database. The PGUSER setting might differ
> for each host, so specifying this in the software is not practical.
>
> Bottom line: What trick can I use to determine whether a box has a
> living, breathing Pg database if I don't know the DB owner?
Use a net mgmt tool (like opennms).
netcat, telnet to 5432, etc...
>
> Mark
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
>
--
-Achilleus
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2006-05-23 05:39 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-05-22 16:28 Does PG have a database Mark Fenbers <Mark.Fenbers@noaa.gov>
2006-05-22 17:52 ` Markus Schaber <schabi@logix-tt.com>
2006-05-22 17:59 ` Manlio Perillo <manlio_perillo@libero.it>
2006-05-23 05:39 ` Achilleus Mantzios <achill@matrix.gatewaynet.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