Don’t need separate binaries for each cluster;
only separate binaries for each version needed; i.e. 9.6.1, 9.6.2, etc.
To put it simply: you
cannot run different major versions of PostgreSQL with the same
binaries. 3 things need to be separate. You named 2 of them: data
directory and port. The 3rd one is separate binary locations for each
PG cluster instance running on the same host.
What I do is create a separate .profile_pgsql file for each PG cluster
instance. This file contains all the stuff necessary to distinguish
between multiple PG clusters. Here is an example for a specific Linux
distro...
export VERSION=9.6
export PGROOT=/usr/pgsql-$VERSION
export
PGBASE=/var/lib/pgsql/$VERSION
export
PATH=$PGROOT/bin:$PGROOT/share:$PATH
export PGLIB=$PGROOT/lib
export
MANPATH=$PGROOT/share/man:$MANPATH
export
LD_LIBRARY_PATH=$PGROOT/bin:$PGBASE/share:$PATH
export
PGDATA=$PGBASE/data
export PGPASSFILE=~/.pgpass
export
PGUSER=postgres
export PGDATABASE=postgres
export PGPORT=5432
Regards,
Michael Vitale