Skip Navigation Links
Exit Print View
| Oracle Solaris Cluster Data Service for PostgreSQL Guide Oracle Solaris Cluster 4.1

Search Scope:

- This Document
- Entire Library

## Installing and Configuring PostgreSQL

This section explains only the special requirements for installing PostgreSQL for use with HA for PostgreSQL. For complete information about installing and configuring PostgreSQL, see http://www.postgresql.org. For complete information about installing and configuring an Oracle Solaris non-global zone, see Oracle Solaris 11.1 Administration: Oracle Solaris Zones, Oracle Solaris 10 Zones, and Resource Management.

Determine if the Oracle-supplied PostgreSQL software is already installed and if the installed version fulfills your requirements. To do this you need to check whether the following minimum packages are installed on your system.

`database/postgres-84`
`database/postgres-84/contrib`
`database/postgres-84/library`
`database/postgres-84/tests`
`database/postgres-common`
`service/database/postgres-84`

To determine which PostgreSQL version is installed, submit the following commands.

    # su - non-root-user
    $ postmaster --version

If the minimum set of packages is not installed, you must decide whether to install PostgreSQL from the Oracle Solaris media or to build PostgreSQL on your own. If the version does not fulfill your needs, you must 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 HA for PostgreSQL to run in the global zone or in an HA for Solaris Zones configuration.

- The global zone procedure is applicable if you install PostgreSQL in the global zone or in a zone cluster.

- The HA for Solaris Zones procedure is applicable if you install PostgreSQL in a non-global zone that is configured with HA for Solaris Zones.

To install and configure PostgreSQL in the global zone, complete the following tasks:

- How to Enable a PostgreSQL Database to Run in the Global Zone

- How to Install and Configure PostgreSQL in the Global Zone

To install and configure PostgreSQL in an HA for Solaris Zones configuration, complete the following tasks:

- How to Enable a Non-Global Zone to Run PostgreSQL in an HA for Solaris Zones Configuration

- How to Install and Configure PostgreSQL in an HA for Solaris Zones Configuration

## How to Enable a PostgreSQL Database to Run in the Global Zone

For a complete example of deploying in the global zone, see Appendix B, Deployment Example: Installing PostgreSQL in the Global Zone or a Zone Cluster.

1. As superuser, register the `SUNW.HAStoragePlus` and `SUNW.gds` resource types.

       # clresourcetype register SUNW.HAStoragePlus SUNW.gds

2. Create a failover resource group.

       # clresourcegroup create PostgreSQL-resource-group

3. Create a resource for PostgreSQL's disk storage.

       # clresource create -t SUNW.HAStoragePlus \
       -p FileSystemMountPoints=PostgreSQL-instance-mount-points \
       PostgreSQL-has-resource

4. (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

5. Enable the failover resource group.

       # clresourcegroup online -M PostgreSQL-resource-group

6. Create a directory for the HA for PostgreSQL parameter file.

       # mkdir PostgreSQL-instance-mount-points/parameter-dir

## How to Install and Configure PostgreSQL in the Global Zone

Note - For complete information about installing PostgreSQL, go to http://www.postgresql.org.

For a complete example of deployment in the global zone, see Appendix B, Deployment Example: Installing PostgreSQL in the Global Zone or a Zone Cluster.

Before You Begin

Determine the following requirements for the deployment of PostgreSQL with Oracle Solaris Cluster software:

- See whether the PostgreSQL version that you need is already installed on each cluster node by searching the most probable root paths to find `bin/postmaster`:

  `/usr` | Root path for PostgreSQL shipped with Oracle Solaris software.
  `/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.

1. As superuser create the home directory for the PostgreSQL user on one node.

       # mkdir /global/postgres

2. Add a group for PostgreSQL on every node.

       # groupadd -g 1000 postgres

3. 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

4. Switch to the PostgreSQL user.

       # su - postgres

5. Set your `PATH` variable.

       $ PATH=$PATH:/usr/local/bin:/usr/sfw/bin:/usr/ccs/bin
       $ export PATH

6. Set your `LD_LIBRARY_PATH` variable.

       $ LD_LIBRARY_PATH=/usr/sfw/lib:/usr/local/lib:/usr/lib:
       $ export LD_LIBRARY_PATH

7. Switch to your build directory.

       $ cd /tmp/postgres/version

8. Configure the PostgreSQL build.

       $ ./configure --prefix=/global/postgres/version

9. Complete, verify and install the build.

       $ gmake
       $ gmake check
       $ gmake install

## How to Enable a Non-Global Zone to Run PostgreSQL in an HA for Solaris Zones Configuration

For a complete example of deploying in an HA for Solaris Zones configuration, see Appendix C, Deployment Example: Installing PostgreSQL in a Non-Global Zone With HA for Solaris Zones.

1. As superuser, register the `SUNW.HAStoragePlus` and `SUNW.gds` resource types.

       # clresourcetype register SUNW.HAStoragePlus SUNW.gds

2. Create a failover resource group.

       # clresourcegroup create PostgreSQL-resource-group

3. Create a resource for the PostgreSQL zone's disk storage.

       # clresource create -t SUNW.HAStoragePlus \
       -p FileSystemMountPoints=PostgreSQL-instance-mount-points \
       PostgreSQL-has-resource

4. (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

5. Place the resource group in the managed state.

       # clresourcegroup online -M PostgreSQL-resource-group

6. Install the non-global zone.

   Install the zone according to the Oracle Solaris Cluster HA for Solaris Zones agent documentation, assuming that the resource name is pgsql-zone-rs and that the zone name is pgsql-zone.

7. Verify the zone's installation.

       # zoneadm -z pgsql-zone boot
       # zoneadm -z pgsql-zone halt

8. Register the zone's boot component.
   1. Copy the zone resource boot component configuration file.

          # cp /opt/SUNWsczone/sczbt/util/sczbt_config zones-target-configuration-file

   2. 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=

   3. Create the parameter directory for your zone's resource.

          # mkdir pgsql-zone-parameter-directory

   4. Execute the Oracle Solaris Cluster HA for Solaris Zones's registration script.

          # /opt/SUNWsczone/sczbt/util/sczbt_register -f zones-target-configuration-file

   5. Enable the HA for Solaris Zones resource.

          # clresource enable pgsql-zone-rs

9. Enable the resource group.

       # clresourcegroup online PostgreSQL-resource-group

## How to Install and Configure PostgreSQL in an HA for Solaris Zones Configuration

Note - For complete information about installing PostgreSQL, go to http://www.postgresql.org.

Before You Begin

Determine the following requirements for the deployment of PostgreSQL with Oracle Solaris Cluster software:

- See whether 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 the Oracle Solaris software.
  `/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.

1. Log in to the non-global zone.

       # zlogin postgres-zone

2. Add a group for PostgreSQL.

       # groupadd -g 1000 postgres

3. Add a user who owns the PostgreSQL installation on every node.

       # useradd -u 1000 -g postgres -d /postgres -m -s /usr/bin/ksh postgres

4. Switch to the PostgreSQL user.

       # su - postgres

5. Set your `PATH` variable.

       $ PATH=$PATH:/usr/local/bin:/usr/sfw/bin:/usr/ccs/bin
       $ export PATH

6. Set your `LD_LIBRARY_PATH` variable.

       $ LD_LIBRARY_PATH=/usr/sfw/lib:/usr/local/lib:/usr/lib:
       $ export LD_LIBRARY_PATH

7. Switch to your build directory.

       $ cd /tmp/postgres/version

8. Configure the PostgreSQL build.

       $ ./configure --prefix=/postgres/version

9. Complete, verify, and install the build.

       $ gmake
       $ gmake check
       $ gmake install

Copyright © 2000, 2013, Oracle and/or its affiliates. All rights reserved. Legal Notices |