This section explains only the special requirements for installing PostgreSQL for use with Sun Cluster HA for PostgreSQL. For complete information about installing and configuring PostgreSQL, see http://www.postgresql.org. For complete information about installing and configuring a Solaris Container, see System Administration Guide: Solaris Containers-Resource Management and Solaris Zones.
Determine if the sun supplied PostgreSQL is already installed and if the installed version fulfills your requirements. To do this you need to check if at least the three following packages are installed on your system.
SUNWpostgr |
SUNWpostgr-libs |
SUNWpostgr-server-data |
To determine which PostgreSQL version is installed, submit the following commands.
# su - non-root-user $ postmaster --version |
If they are not installed, you need to decide wether you want to install PostgreSQL from the Solaris Media or if you want to build PostgreSQL on your own. If the version does not fulfill your needs, you have to build PostgreSQL on your own.
For each PostgreSQL database that you are installing and configuring choose the following tasks according to your zone type.
Determine whether you have to configure Sun Cluster HA for PostgreSQL to run in a global zone, in a zone or in an HA container configuration. The global zone configuration procedure is applicable if you install PostgreSQL on Solaris 9, or in the global zone of Solaris 10. The HA container configuration procedure is applicable if you install PostgreSQL in an HA container.
To install and configure PostgreSQL in a global zone configuration, complete the following tasks:
To install and configure PostgreSQL in a zone configuration, complete the following tasks:
To install and configure PostgreSQL in an HA container configuration, complete the following tasks:
For a complete example of deploying in a global zone, see Deployment Example: Installing PostgreSQL in the Global Zone.
As superuser register the SUNW.HAStoragePlus and the SUNW.gds resource types.
# clresourcetype register SUNW.HAStoragePlus SUNW.gds |
Create a failover resource group.
# clresourcegroup create PostgreSQL-resource-group |
Create a resource for PostgreSQL`s disk storage.
# clresource create -t SUNW.HAStoragePlus \ -p FileSystemMountPoints=PostgreSQL-instance-mount-points \ PostgreSQL-has-resource |
(Optional) If you plan to access the database from a logical host, choose the following tasks according to your zone type.
# clreslogicalhostname create -g PostgreSQL-resource-group \ PostgreSQL-logical-hostname-resource-name |
Enable the failover resource group.
# clresourcegroup online -M PostgreSQL-resource-group |
Create a directory for the Sun Cluster HA for PostgreSQL parameter file.
# mkdir PostgreSQL-instance-mount-points/parameter-dir |
For complete information about installing PostgreSQL, go to http://www.postgresql.org.
For a complete example of deployment in a global zone, see Deployment Example: Installing PostgreSQL in the Global Zone.
Determine the following requirements for the deployment of PostgreSQL with Sun Cluster:
See if the PostgreSQL version that you need is already installed on each cluster node. by searching the most probable root paths where you find bin/postmaster:
/usr |
Root path for PostgreSQL shipped with Solaris OS. |
/usr/local/psql |
Root path for the PostgreSQL build without a prefix. |
/your-path |
Fully customized root path for PostgreSQL. This is where to place the binaries on the shared storage. A known convention is /path/postgresql-x.y.z. |
Determine the number of PostgreSQL resources to deploy.
Determine which cluster file systems will be used by each PostgreSQL resource.
Make sure, that a C compiler, make, and the readline package are installed. These packages are needed to build PostgreSQL from the source code downloads from http://www.postgresql.org .
The following assumptions are made:
The compiler gcc and the gmake package are installed in /usr/sfw.
The readline package is installed under /usr/local.
The PostgreSQL database software will be installed on the shared storage in the directory version in the failover file system /global/postgres.
The PostgreSQL database cluster will be installed in the same file system as the database software, in the directory /global/postgres/data.
The home directory of the postgres user is /global/postgres.
The PostgreSQL build directory is in /tmp/postgres/version, and the software is already downloaded and extracted in this place.
As superuser create the home directory for the PostgreSQL user on one node.
# mkdir /global/postgres |
Add a group for PostgreSQL on every node.
# groupadd -g 1000 postgres |
Add a user who owns the PostgreSQL installation on every node.
# useradd -u 1000 -g postgres -d /global/postgres -s /usr/bin/ksh postgres # chown -R postgres:postgres /global/postgres |
Switch to the PostgreSQL user.
# su - postgres |
Set your PATH variable.
$ PATH=$PATH:/usr/local/bin:/usr/sfw/bin:/usr/ccs/bin $ export PATH |
Set your LD_LIBRARY_PATH variable.
$ LD_LIBRARY_PATH=/usr/sfw/lib:/usr/local/lib:/usr/lib: $ export LD_LIBRARY_PATH |
Switch to your build directory.
$ cd /tmp/postgres/version |
Configure the PostgreSQL build.
$ ./configure --prefix=/global/postgres/version |
Complete, verify and install the build.
$ gmake $ gmake check $ gmake install |
For a complete example of deploying in a zone, see Deployment Example: Installing PostgreSQL in a Non-Global Zone.
As superuser register the SUNW.HAStoragePlus and the SUNW.gds resource types.
# clresourcetype register SUNW.HAStoragePlus SUNW.gds |
Install and boot the zone pgs-zone on all the nodes to host Sun Cluster HA for PostgreSQL.
Create a failover resource group.
# clresourcegroup create -n node-1:pgs-zone,node-2:pgs-zone PostgreSQL-resource-group |
Create a resource for the PostgreSQL zone`s disk storage.
# clresource create -t SUNW.HAStoragePlus \ -p FileSystemMountPoints=PostgreSQL-instance-mount-points \ PostgreSQL-has-resource |
(Optional) Create a resource for the PostgreSQL`s logical hostname.
# clreslogicalhostname create -g PostgreSQL-resource-group \ PostgreSQL-logical-hostname-resource-name |
# clresourcegroup online -M PostgreSQL-resource-group |
For complete information about installing PostgreSQL, go to http://www.postgresql.org.
For a complete example of deploying in an HA container, see Deployment Example: Installing PostgreSQL in a Non-Global HA Container.
Determine the following requirements for the deployment of PostgreSQL with Sun Cluster:
See if the PostgreSQL version that you need is already installed on each cluster node. by searching the most probable root paths where you find bin/postmaster:
/usr |
Root path for PostgreSQL shipped with Solaris OS. |
/usr/local/psql |
Root path for the PostgreSQL build without a prefix. |
/your-path |
Fully customized root path for PostgreSQL. This is where to place the binaries on the shared storage. A known convention is /path/postgresql-x.y.z. |
Determine the number of PostgreSQL resources to deploy.
Determine which cluster file systems will be used by each PostgreSQL resource.
Make sure that a C compiler, make, and the readline package are installed. These packages are needed to build PostgreSQL from the source code downloads from http://www.postgresql.org .
The following assumptions are made:
The zone postgres-zone is installed and configured on every node.
The compiler gcc and the gmake package are installed in /usr/sfw.
The readline package is installed under /usr/local.
The PostgreSQL database software will be installed on the shared storage, in the directory version in the failover file system /postgres.
The PostgreSQL database cluster will be installed in the same file system as the database software, in the directory /postgres/data.
The home directory of the postgres user is /postgres.
The PostgreSQL build directory is in /tmp/postgres/version, and the software is already downloaded and extracted in this place.
As superuser log in to the zone.
# zlogin pgsql-zone |
Add a group for PostgreSQL.
# groupadd -g 1000 postgres |
Add a user who owns the PostgreSQL installation on every node.
# useradd -u 1000 -g postgres -d /postgres -m -s /usr/bin/ksh postgres |
Switch to the PostgreSQL user.
# su - postgres |
Set your PATH variable.
$ PATH=$PATH:/usr/local/bin:/usr/sfw/bin:/usr/ccs/bin $ export PATH |
Set your LD_LIBRARY_PATH variable.
$ LD_LIBRARY_PATH=/usr/sfw/lib:/usr/local/lib:/usr/lib: $ export LD_LIBRARY_PATH |
Switch to your build directory.
$ cd /tmp/postgres/version |
Configure the PostgreSQL build.
$ ./configure --prefix=/postgres/version |
Complete, verify, and install the build.
$ gmake $ gmake check $ gmake install |
For a complete example of deploying in an HA container, see Deployment Example: Installing PostgreSQL in a Non-Global HA Container.
As superuser register the SUNW.HAStoragePlus and the SUNW.gds resource types.
# clresourcetype register SUNW.HAStoragePlus SUNW.gds |
Create a failover resource group.
# clresourcegroup create PostgreSQL-resource-group |
Create a resource for the PostgreSQL zone`s disk storage.
# clresource create -t SUNW.HAStoragePlus \ -p FileSystemMountPoints=PostgreSQL-instance-mount-points \ PostgreSQL-has-resource |
(Optional) If you want the protection against a total adapter failure for your public network, create a resource for the PostgreSQL`s logical hostname.
# clreslogicalhostname create -g PostgreSQL-resource-group \ PostgreSQL-logical-hostname-resource-name |
Place the resource group in the managed state.
# clresourcegroup online -M PostgreSQL-resource-group |
Install the zone.
Install the zone according to the Sun Cluster HA for Solaris Containers agent documentation, assuming that the resource name is pgsql-zone-rs and that the zone name is pgsql-zone.
Verify the zone's installation.
# zoneadm -z pgsql-zone boot # zoneadm -z pgsql-zone halt |
Register the zone's boot component.
Copy the container resource boot component configuration file.
# cp /opt/SUNWsczone/sczbt/util/sczbt_config zones-target-configuration-file |
Use a plain text editor to set the following variables:
RS=pgsql-zone-rs RG=PostgreSQL-resource-group PARAMETERDIR=pgsql-zone-parameter-directory SC_NETWORK=true|false SC_LH=PostgreSQL-logical-hostname-resource-name FAILOVER=true|false HAS_RS=PostgreSQL-has-resource Zonename=pgsql-zone Zonebootopt=zone-boot-options Milestone=zone-boot-milestone Mounts=
Create the parameter directory for your zone's resource.
# mkdir pgsql-zone-parameter-directory |
Execute the Sun Cluster HA for Solaris Container's registration script.
# /opt/SUNWsczone/sczbt/util/sczbt_register -f zones-target-configuration-file |
Enable the Solaris Container resource.
# clresource enable pgsql-zone-rs |
# clresourcegroup online PostgreSQL-resource-group |
For complete information about installing PostgreSQL, go to http://www.postgresql.org.
For a complete example of deploying in an HA container, see Deployment Example: Installing PostgreSQL in a Non-Global HA Container.
Determine the following requirements for the deployment of PostgreSQL with Sun Cluster:
See if the PostgreSQL version that you need is already installed on each cluster node by searching the most probable root paths where you find bin/postmaster:
/usr |
Root path for PostgreSQL shipped with Solaris OS. |
/usr/local/psql |
Root path for the PostgreSQL build without a prefix. |
/your-path |
Fully customized root path for PostgreSQL. This is where to place the binaries on the shared storage. A known convention is /path/postgresql-x.y.z. |
Determine the number of PostgreSQL resources to deploy.
Determine which cluster file systems will be used by each PostgreSQL resource.
Make sure that a C compiler, make, and the readline package are installed. These packages are needed to build PostgreSQL from the source code downloads from http://www.postgresql.org .
The following assumptions are made:
The zone postgres-zone is installed and configured on every node.
The compiler gcc and the gmake package are installed in /usr/sfw.
The readline package is installed under /usr/local.
The PostgreSQL database software will be installed on the shared storage, in the directory version in the failover file system /postgres.
The PostgreSQL database cluster will be installed in the same file system as the database software, in the directory /postgres/data.
The home directory of the postgres user is /postgres.
The PostgreSQL build directory is in /tmp/postgres/version, and the software is already downloaded and extracted in this place.
Log in to the zone.
# zlogin postgres-zone |
Add a group for PostgreSQL.
# groupadd -g 1000 postgres |
Add a user who owns the PostgreSQL installation on every node.
# useradd -u 1000 -g postgres -d /postgres -m -s /usr/bin/ksh postgres |
Switch to the PostgreSQL user.
# su - postgres |
Set your PATH variable.
$ PATH=$PATH:/usr/local/bin:/usr/sfw/bin:/usr/ccs/bin $ export PATH |
Set your LD_LIBRARY_PATH variable.
$ LD_LIBRARY_PATH=/usr/sfw/lib:/usr/local/lib:/usr/lib: $ export LD_LIBRARY_PATH |
Switch to your build directory.
$ cd /tmp/postgres/version |
Configure the PostgreSQL build.
$ ./configure --prefix=/postgres/version |
Complete, verify, and install the build.
$ gmake $ gmake check $ gmake install |