From 0692b79c7ec32c010723b889cac0d3b8bcb8f4ce Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Wed, 18 Mar 2015 17:10:32 +0100 Subject: README.rpm-dist: Fixes for sysvinit * README.rpm-dist.template: Mainly automatize generation of the help for 'MULTIPLE POSTMASTERS' scenario. Fix other sysv/systemd nuances. * TODO: Mention some TODOs. --- README.rpm-dist.template | 135 +++++++++++++++++++++++++++++++++++++---------- TODO | 9 ++++ 2 files changed, 115 insertions(+), 29 deletions(-) diff --git a/README.rpm-dist.template b/README.rpm-dist.template index ba57706..673c125 100644 --- a/README.rpm-dist.template +++ b/README.rpm-dist.template @@ -7,11 +7,20 @@ m4_changequote(`[', `]') m4_define([PGSETUP_SERVICE], m4_ifelse([@WANT_SYSVINIT@], [1], m4_dnl [service $1 $2],m4_dnl -[systemctl $1.service $2])) +[systemctl $2 $1.service])) m4_define([PGSETUP_SERVICE_START], PGSETUP_SERVICE($1, start)) m4_define([PGSETUP_SERVICE_STOP], PGSETUP_SERVICE($1, stop)) -m4_define([PGSETUP_SERVICE_ENABLE], PGSETUP_SERVICE($1, enable)) + +m4_define([PGSETUP_SERVICE_ENABLE], +m4_ifelse([@WANT_SYSVINIT@], [1], m4_dnl +[chkconfig $1 on],m4_dnl +[systemctl enable $1.service])) + +m4_define([PGSETUP_SERVICE_DISABLE], +m4_ifelse([@WANT_SYSVINIT@], [1], m4_dnl +[chkconfig $1 off],m4_dnl +[systemctl disable $1.service])) m4_define([PGSETUP_ADMIN], [postgres]) @@ -116,56 +125,59 @@ m4_divert[]m4_dnl - In some major releases, the RPMs also support in-place upgrade from the - immediately previous major release. Currently, you can upgrade in-place - from .x to @PGMAJORVERSION@.x. This is much faster than a - dump and reload. - To do an in-place upgrade: + In some major releases, the RPMs also support faster upgrade from concrete + subset of previous releases. You can run the: + + PGSETUP_COMMAND(@NAME_BINARYBASE@ --upgrade-ids) + + to see what previous versions you are able to upgrade from. This is much + faster than a dump and reload. To do a faster upgrade: - shut down the old postmaster - PGSETUP_COMMAND(PGSETUP_SERVICE_STOP(@NAME_SERVICE@)) + shut down the old postmaster running against old data - optionally make a backup of @PGDATADIR@ (recommended!) + + optionally make a backup of data directory (recommended!) + - install the new version's RPMs (install all the ones you - had before, plus @NAME_PACKAGE@-upgrade) + install the new version's RPMs (install all the ones you had before, + plus @NAME_PACKAGE@-upgrade) - as root, run "@NAME_BINARYBASE@-setup --upgrade" + as root, run "@NAME_BINARYBASE@-setup --upgrade [[--upgrade-from ID]]" update the configuration files @PGDATADIR@/*.conf with any customizations you had before (your old configuration files are in - @POSTGRES_HOMEDIR@/data-old/) + old data directory or in @POSTGRES_HOMEDIR@/data-old/ if you've done + in-place upgrade) - as root, run - PGSETUP_SERVICE_START(@NAME_SERVICE@) + as root, run "PGSETUP_SERVICE_START(@NAME_SERVICE@)" the @NAME_PACKAGE@-upgrade package can be removed after the update is - complete, as can @POSTGRES_HOMEDIR@/data-old/ + complete, as can old data directory NOTE: The in-place upgrade process is new and relatively poorly tested, so if your data is critical it's a really good idea to make a tarball - backup of @PGDATADIR@ before running the upgrade. This will + backup of old data directory before running the upgrade. This will let you get back to where you were in case of disaster. @@ -306,6 +318,67 @@ m4_divert[]m4_dnl MULTIPLE POSTMASTERS +m4_ifelse([@WANT_SYSVINIT@], [1], m4_dnl +[ + + The @NAME_PACKAGE@-server RPM contains an "initscript" that is used to start + the postmaster. The current version of this script has logic to be able to + start multiple postmasters, with different data areas, listening on + different ports, etc. To use this functionality requires root access. + + + + As an example, let us create a secondary postmaster called, creatively + enough, 'secondary'. Here are the steps: + + + + + + create a hard link in /etc/rc.d/init.d (or equivalent location) to + '@NAME_SERVICE@' named 'secondary'. + PGSETUP_COMMAND(ln @NAME_SERVICE@ secondary) + Pick a name not already used in /etc/rc.d/init.d! + + + + + create a file in /etc/sysconfig/pgsql named secondary. This file is + a shell script -- typically you would define PGDATA, PGPORT, and PGOPTS + here. Since $PGDATA/postgresql.conf may override many of these + settings, except PGDATA, you might be surprised on startup. + + + + + create the target PGDATA + + + + + Initdb the targe PGDATA as documented in the main documentation. + Automatic initdb may or may not work for you, so a manual one is + preferred. This must be done as user 'postgres' + + + + + Edit postgresql.conf to change the port, address, tcpip settings, etc. + + + + + Start the postmaster with 'service secondary start'. + + + + + + Note that there may be problems with the standard symlink -- consider this + support experimental at this point in time. + +], m4_dnl +[ The postgresql-server package contains a systemd "unit" files @NAME_SERVICE@.service and @NAME_SERVICE@@.service. The first file is used @@ -376,6 +449,7 @@ m4_divert[]m4_dnl semanage". +]) @@ -388,11 +462,11 @@ m4_divert[]m4_dnl To run the regression tests under the RPM installation, make sure that the - PostgreSQL server has been started (if not, su to root and do "systemctl - start @NAME_SERVICE@.service"), su to postgres, cd to - @libdir@/pgsql/test/regress and execute "make check". This command will - start the regression tests and will both show the results to the screen and - store the results in the file regress.out. + PostgreSQL server has been started (if not, su to root and do + PGSETUP_COMMAND(PGSETUP_SERVICE_START(@NAME_SERVICE@)) + su to postgres, cd to @libdir@/pgsql/test/regress and execute "make check". + This command will start the regression tests and will both show the results + to the screen and store the results in the file regress.out. If any tests fail, see the file regression.diffs in that directory for @@ -414,16 +488,18 @@ m4_divert[]m4_dnl A systemd unit file for PostgreSQL is provided in the server package, as @systemdunitsdir@/@NAME_SERVICE@.service. To start the postmaster manually, as root run - PGSETUP_COMMAND(systemctl start @NAME_SERVICE@.service) + PGSETUP_COMMAND(PGSETUP_SERVICE_START(@NAME_SERVICE@)) To shut the postmaster down, - PGSETUP_COMMAND(systemctl stop @NAME_SERVICE@.service) + PGSETUP_COMMAND(PGSETUP_SERVICE_STOP(@NAME_SERVICE@)) These two commands only change the postmaster's current status. If you want the postmaster to be started automatically during future system startups, run - PGSETUP_COMMAND(systemctl enable @NAME_SERVICE@.service) + PGSETUP_COMMAND(PGSETUP_SERVICE_ENABLE(@NAME_SERVICE@)) To undo that again, - PGSETUP_COMMAND(systemctl disable @NAME_SERVICE@.service) - See "man systemctl" for other possible subcommands. + PGSETUP_COMMAND(PGSETUP_SERVICE_DISABLE(@NAME_SERVICE@)) +m4_ifelse([@WANT_SYSVINIT@], [1], m4_dnl +[See "man chkconfig" and "man service" for other possible subcommands.],m4_dnl +[See "man systemctl" for other possible subcommands.])) @@ -561,7 +637,8 @@ m4_divert[]m4_dnl Please help make this packaging better -- let us know if you find problems, or better ways of doing things. You can reach us by e-mail at - pgsql-pkg-yum@postgresql.org + pgsql-pkg-yum@postgresql.org or fail a bug against postgresql component on + bugzilla.redhat.com. diff --git a/TODO b/TODO index b0203d1..f4e16e8 100644 --- a/TODO +++ b/TODO @@ -24,3 +24,12 @@ * Allow guys from KDE upgrade the PG stack somehow. * stylesheets & html version for README.rpm-dist + +* option for admin-defined configuration file + +* old stack breakage after pg_upgrade (check whats going on?) + +* check for running postmaster! (even running postgresql92 server breaks + upgrade from postgresql to rh-postgresql94-postgresql on RHEL6) + +* SELinux advice (if selinux is not disabled) -- cgit