[Pkg-postgresql-private] Replacing cluster_ports by something better

Martin Pitt mpitt@debian.org
Mon, 24 Jan 2005 00:56:04 +0100


--YiEDa0DAkWCtVeE4
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi!

Oliver Elphick [2005-01-23 23:19 +0000]:
> The point is to support ISPs and such who want to run multiple instances
> under different ownerships.=20

Okay, then I will modify my unofficial branch to support several
clusters (this should be easy).

So what should package installation do with multiple clusters? My
current idea would be to install a default cluster ("main") if there
is not already any cluster for the respective major version. If there
is, the postinst would not do anything.

> > 2. cluster_ports is currently a configuration file, and as such we
> >    must be _very_ careful in automatically modifying it at e. g.
> >    package installation.
>=20
> Yes; but that's life.

But if we can make it easier, more flexible and more robust, why
shouldn't we do so?

> > 3. cluster_ports contains a lot of redundancy, which should be
> >    avoided:
> >=20
> >    CLUSTER: not necessary _if_ we only support one instance (see 1.)
> >    STATUS: this is okay
> >    OWNER: should always be postgres
> >    VERSION: already in CLUSTERPATH/PG_VERSION
> >    PORT: already in CLUSTERPATH/postmaster.conf
> >          (=3D=3D /etc/postgresql/VERSION/postmaster.conf)
> >    CLUSTERPATH: this seems okay to me, too
>=20
> But the configuration can also be used to set up the databases.  Also,
> the data needs to be available to clients who don't have privilege to
> access $PG_DATA, since they have to know what port to connect to for
> which database.  If we were only talking about the server side you would
> be right.

This is no problem for PORT, since the configuration file lives in
/etc/postgresql/$CLUSTER/postmaster.conf, where it is world-readable.
CLUSTER is also implicitly present as the last path directory
component. I would not like to add a VERSION file to
/etc/postgresql/$CLUSTER/, though. I think having
/etc/postgresql/$VERSION/$CLUSTER is easier to iterate and handle.

If we have this structure, then we don't need to mess with a central
conffile, clusters can be added and removed without needing to care
for the conffile, and the system is less prone against inconsistency.

> > Proposal:
> > ---------
> >=20
> > If we support just one cluster per major version, we rely on the
> > existence of /etc/postgresql/$MAJOR_VERSION/, in the case of several
> > clusters we rely on /etc/postgresql/$CLUSTERNAME/. This directory
> > contains all configuration files.

So this should be modified to:

For cluster $CLUSTER we rely on the existance of
/etc/postgresql/$VERSION/$CLUSTER, which contains the following files:

 pg_hba.conf, pg_ident.conf postgresql.conf
 status
 pgdata (symlink to e. g. /var/lib/postgresql/$VERSION/$CLUSTER)

> > cluster_ports will be dropped entirely; instead, the relevant data
> > (STATUS and CLUSTERPATH) is put into a new conffile
> > /etc/postgresql/$CLUSTER/status and a symlink
> > /etc/postgresql/$CLUSTER/pgdata which points to the actual data
> > directory.

I would still like to do this.

> As I point out above, this doesn't handle the problem of client access
> and I also wish to support multiple independent postmasters for
> different users.  If that is really impracticable, it will have to be
> dropped, but at the moment I don't see that it is.

I think it is doable, and in fact I think that the decentral approach
would make this even more useful: because the central conffile does
not need to be writeable by every database admin, but the system admin
can set the permissions of the various /etc/ directories in a way that
each db admin can administer only their own db directories.

Martin

--=20
Martin Pitt                       http://www.piware.de
Ubuntu Developer            http://www.ubuntulinux.org
Debian GNU/Linux Developer       http://www.debian.org

--YiEDa0DAkWCtVeE4
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFB9DmUDecnbV4Fd/IRAtFjAKCI1cZUU8lsWssArjAoLXWJZDZ6ZACeNH82
SDeaklNOe3rqryQ9xlZMsI8=
=ZXbs
-----END PGP SIGNATURE-----

--YiEDa0DAkWCtVeE4--