Sun Cluster Data Service for PostgreSQL Guide for Solaris OS

offbeatlossData Management

Nov 22, 2012 (4 years and 10 months ago)

686 views

SunCluster DataServicefor
PostgreSQLGuidefor Solaris OS
SunMicrosystems,Inc.
4150 Network Circle
Santa Clara,CA95054
U.S.A.
Part No:819–5578–10
December 2006,RevisionA
Copyright 2006 SunMicrosystems,Inc.4150 Network Circle,Santa Clara,CA95054 U.S.A.All rights reserved.
SunMicrosystems,Inc.has intellectual property rights relating to technology embodied inthe product that is described inthis document.Inparticular,and without
limitation,these intellectual property rights may include one or more U.S.patents or pending patent applications inthe U.S.and inother countries.
U.S.Government Rights – Commercial software.Government users are subject to the SunMicrosystems,Inc.standard license agreement and applicable provisions
of the FARand its supplements.
This distributionmay include materials developed by third parties.
Parts of the product may be derived fromBerkeley BSDsystems,licensed fromthe University of California.UNIXis a registered trademark inthe U.S.and other
countries,exclusively licensed through X/OpenCompany,Ltd.
Sun,SunMicrosystems,the Sunlogo,the Solaris logo,the Java Coffee Cup logo,docs.sun.com,Java,and Solaris are trademarks or registered trademarks of Sun
Microsystems,Inc.inthe U.S.and other countries.All SPARCtrademarks are used under license and are trademarks or registered trademarks of SPARC
International,Inc.inthe U.S.and other countries.Products bearing SPARCtrademarks are based uponanarchitecture developed by SunMicrosystems,Inc.
The OPENLOOKand SunGraphical User Interface was developed by SunMicrosystems,Inc.for its users and licensees.Sunacknowledges the pioneering efforts of
Xerox inresearching and developing the concept of visual or graphical user interfaces for the computer industry.Sunholds a non-exclusive license fromXerox to the
Xerox Graphical User Interface,which license also covers Sun’s licensees who implement OPENLOOKGUIs and otherwise comply with Sun’s writtenlicense
agreements.
Products covered by and informationcontained inthis publicationare controlled by U.S.Export Control laws and may be subject to the export or import laws in
other countries.Nuclear,missile,chemical or biological weapons or nuclear maritime end uses or end users,whether direct or indirect,are strictly prohibited.Export
or reexport to countries subject to U.S.embargo or to entities identified onU.S.export exclusionlists,including,but not limited to,the denied persons and specially
designated nationals lists is strictly prohibited.
DOCUMENTATIONIS PROVIDED“AS IS” ANDALLEXPRESS ORIMPLIEDCONDITIONS,REPRESENTATIONSANDWARRANTIES,INCLUDINGANY
IMPLIEDWARRANTYOF MERCHANTABILITY,FITNESS FORAPARTICULARPURPOSEORNON-INFRINGEMENT,AREDISCLAIMED,EXCEPTTO
THEEXTENTTHATSUCHDISCLAIMERSAREHELDTOBELEGALLYINVALID.
Copyright 2006 SunMicrosystems,Inc.4150 Network Circle,Santa Clara,CA95054 U.S.A.Tous droits réservés.
SunMicrosystems,Inc.détient les droits de propriété intellectuelle relatifs à la technologie incorporée dans le produit qui est décrit dans ce document.Enparticulier,
et ce sans limitation,ces droits de propriété intellectuelle peuvent inclure unou plusieurs brevets américains ou des applications de brevet enattente aux Etats-Unis et
dans d’autres pays.
Cette distributionpeut comprendre des composants développés par des tierces personnes.
Certaines composants de ce produit peuvent être dérivées du logiciel Berkeley BSD,licenciés par l’Université de Californie.UNIXest une marque déposée aux
Etats-Unis et dans d’autres pays;elle est licenciée exclusivement par X/OpenCompany,Ltd.
Sun,SunMicrosystems,le logo Sun,le logo Solaris,le logo Java Coffee Cup,docs.sun.com,Java et Solaris sont des marques de fabrique ou des marques déposées de
SunMicrosystems,Inc.aux Etats-Unis et dans d’autres pays.Toutes les marques SPARCsont utilisées sous licence et sont des marques de fabrique ou des marques
déposées de SPARCInternational,Inc.aux Etats-Unis et dans d’autres pays.Les produits portant les marques SPARCsont basés sur une architecture développée par
SunMicrosystems,Inc.
L’interface d’utilisationgraphique OPENLOOKet Suna été développée par SunMicrosystems,Inc.pour ses utilisateurs et licenciés.Sunreconnaît les efforts de
pionniers de Xerox pour la recherche et le développement du concept des interfaces d’utilisationvisuelle ou graphique pour l’industrie de l’informatique.Sundétient
une licence nonexclusive de Xerox sur l’interface d’utilisationgraphique Xerox,cette licence couvrant également les licenciés de Sunqui mettent enplace l’interface
d’utilisationgraphique OPENLOOKet qui,enoutre,se conforment aux licences écrites de Sun.
Les produits qui font l’objet de cette publicationet les informations qu’il contient sont régis par la legislationaméricaine enmatière de contrôle des exportations et
peuvent être soumis au droit d’autres pays dans le domaine des exportations et importations.Les utilisations finales,ou utilisateurs finaux,pour des armes nucléaires,
des missiles,des armes chimiques ou biologiques ou pour le nucléaire maritime,directement ou indirectement,sont strictement interdites.Les exportations ou
réexportations vers des pays sous embargo des Etats-Unis,ou vers des entités figurant sur les listes d’exclusiond’exportationaméricaines,y compris,mais de manière
nonexclusive,la liste de personnes qui font objet d’unordre de ne pas participer,d’une façondirecte ou indirecte,aux exportations des produits ou des services qui
sont régis par la legislationaméricaine enmatière de contrôle des exportations et la liste de ressortissants spécifiquement designés,sont rigoureusement interdites.
LADOCUMENTATIONESTFOURNIE"ENL’ETAT"ETTOUTESAUTRES CONDITIONS,DECLARATIONS ETGARANTIES EXPRESSES OUTACITES
SONTFORMELLEMENTEXCLUES,DANS LAMESUREAUTORISEEPARLALOI APPLICABLE,YCOMPRIS NOTAMMENTTOUTEGARANTIE
IMPLICITERELATIVEALAQUALITEMARCHANDE,AL’APTITUDEAUNEUTILISATIONPARTICULIEREOUAL’ABSENCEDECONTREFACON.
061017@15490
Contents
Preface.............................................................................................................................................................7
Installing andConfiguring SunCluster HAfor PostgreSQL.................................................................11
SunCluster HAfor PostgreSQLOverview................................................................................................11
Overviewof Installing and Configuring SunCluster HAfor PostgreSQL.............................................12
Planning the SunCluster HAfor PostgreSQLInstallationand Configuration.....................................12
PostgreSQLand Solaris Containers....................................................................................................12
ConfigurationRestrictions..................................................................................................................13
ConfigurationRequirements..............................................................................................................14
Installing and Configuring PostgreSQL.....................................................................................................15
▼Howto Enable a PostgreSQLDatabase to Runina Global Zone Configuration..........................16
▼ Howto Install and Configure PostgreSQLina Global Zone..........................................................16
▼Howto Enable a Zone to RunPostgreSQLina Zone Configuration.............................................18
▼ Howto Install and Configure PostgreSQLina Zone.......................................................................19
▼Howto Enable a Zone to RunPostgreSQLina Failover Zone Configuration..............................20
▼ Howto Install and Configure PostgreSQLina Failover Zone........................................................22
Verifying the Installationand Configurationof PostgreSQL..................................................................23
▼Howto Verify the Installationand Configurationof PostgreSQL..................................................24
Installing the SunCluster HAfor PostgreSQLPackages.........................................................................25
▼Howto Install the SunCluster HAfor PostgreSQLPackages.........................................................25
Registering and Configuring SunCluster HAfor PostgreSQL...............................................................26
Specifying ConfigurationParameters for the PostgreSQLResource..............................................27
Prepare Your PostgreSQLInstallationfor Cluster Control..............................................................33
▼Howto Prepare Your PostgreSQLfor SunCluster Registrationina Global Zone
Configuration................................................................................................................................33
▼Howto Prepare Your PostgreSQLfor SunCluster Registrationina Failover Zone
Configuration................................................................................................................................34
Creating and Enabling Resources for PostgreSQL............................................................................35
▼Howto Create and Enable Resources for PostgreSQL.............................................................35
3
▼Howto Modify Parameters inthe SunCluster HAfor PostgreSQLManifest.......................36
▼Howto Remove a SunCluster HAfor PostgreSQLResource Froma Failover Zone...........36
Verifying the SunCluster HAfor PostgreSQLInstallationand Configuration....................................37
▼Howto Verify the SunCluster HAfor PostgreSQLInstallationand Configuration....................37
Tuning the SunCluster HAfor PostgreSQLFault Monitor.....................................................................38
Operationof the SunCluster HAfor PostgreSQLParameter File..................................................39
Operationof the Fault Monitor for SunCluster HAfor PostgreSQL.............................................40
Debugging SunCluster HAfor PostgreSQL..............................................................................................40
▼HowtoActivate Debugging for SunCluster HAfor PostgreSQL...................................................40
A File for Configuring SunCluster HAfor Solaris PostgreSQL Resources..............................................43
Listing of pgs_config..................................................................................................................................43
B Deployment Example:Installing PostgreSQL inthe Global Zone......................................................47
Target Cluster Configuration......................................................................................................................47
Software Configuration................................................................................................................................47
Assumptions.................................................................................................................................................48
Installing and Configuring PostgreSQLonShared Storage inthe Global Zone...................................48
▼Example:Preparing the Cluster for PostgreSQL...............................................................................48
▼Example:Configuring Cluster Resources for PostgreSQL...............................................................49
▼Example:Modifying the PostgreSQLConfigurationFile................................................................49
▼Example:Building and Installing the PostgreSQLSoftware onShared Storage............................50
▼Example:Enabling the PostgreSQLSoftware to Runinthe Cluster...............................................51
Installing the PostgreSQLBinaries inthe Default Directory (Alternative Installation)......................52
▼Example:Building and Installing the PostgreSQLSoftware inthe Default Directory inthe Global
Zone........................................................................................................................................................53
C Deployment Example:Installing PostgreSQL ina Non-Global Failover Zone..................................55
Target Cluster Configuration......................................................................................................................55
Software Configuration................................................................................................................................55
Assumptions.................................................................................................................................................56
Installing and Configuring PostgreSQLonShared Storage ina Non-Global Failover Zone..............56
▼Example:Preparing the Cluster for PostgreSQL...............................................................................56
▼Example:Configuring Cluster Resources for PostgreSQL...............................................................57
▼Example:Configuring the Failover Zone...........................................................................................57
▼Example:Modifying the PostgreSQLConfigurationFile................................................................59
Contents
SunCluster Data Service for PostgreSQLGuide for Solaris OS • December 2006,RevisionA4
▼Example:Building and Installing the PostgreSQLSoftware onShared Storage ina Failover
Zone........................................................................................................................................................60
▼Example:Enabling the PostgreSQLSoftware to Runinthe Cluster...............................................61
Installing the PostgreSQLBinaries inthe Default Directory ina Failover Zone (Alternative
Installation)...................................................................................................................................................62
▼Example:Building and Installing the PostgreSQLSoftware inthe Default Directory ina Failover
Zone........................................................................................................................................................63
D Deployment Example:Installing PostgreSQL ina Non-Global Zone..................................................65
Target Cluster Configuration......................................................................................................................65
Software Configuration................................................................................................................................65
Assumptions.................................................................................................................................................66
Installing and Configuring PostgreSQLonShared Storage ina Non-Global Zone..............................66
▼Example:Preparing the Cluster for PostgreSQL...............................................................................66
▼Example:Configuring the Zone..........................................................................................................67
▼Example:Configuring Cluster Resources for PostgreSQL...............................................................68
▼Example:Modifying the PostgreSQLConfigurationFile................................................................68
▼Example:Building and Installing the PostgreSQLSoftware onShared Storage ina Zone...........70
▼Example:Enabling the PostgreSQLSoftware to Runinthe Cluster...............................................71
Installing the PostgreSQLBinaries inthe Default Directory ina Zone (Alternative Installation).....72
▼Example:Building and Installing the PostgreSQLSoftware inthe Default Directory ina
Zone........................................................................................................................................................72
Index..............................................................................................................................................................75
Contents
5
6
Preface
Sun Cluster Data Service for PostgreSQLGuide for Solaris OS explains howto install and configure
Sun
TM
Cluster HAfor PostgreSQLonboth SPARC® based systems and x86 based systems.
Note –
This SunCluster release supports systems that use the SPARCandx86 families of processor
architectures:UltraSPARC,SPARC64,andAMD64.Inthis document,the label x86 refers to systems
that use the AMD64 family of processor architectures.
This document is intended for systemadministrators with extensive knowledge of Sunsoftware and
hardware.Do not use this document as a planning or presales guide.Before reading this document,
you should have already determined your systemrequirements and purchased the appropriate
equipment and software.
The instructions inthis book assume knowledge of the Solaris
TM
Operating System(Solaris OS) and
expertise with the volume-manager software that is used with SunCluster software.
Note –
SunCluster software runs ontwo platforms,SPARCandx86.The informationinthis
document pertains to both platforms unless otherwise specified ina special chapter,section,note,
bulleted item,figure,table,or example.
UsingUNIXCommands
This document contains informationabout commands that are specific to installing and configuring
SunCluster data services.The document does not containcomprehensive informationabout basic
UNIX® commands and procedures,such as shutting downthe system,booting the system,and
configuring devices.Informationabout basic UNIXcommands and procedures is available fromthe
following sources:

Online documentationfor the Solaris Operating System

Solaris Operating Systemmanpages

Other software documentationthat you received with your system
7
Typographic Conventions
The following table describes the typographic conventions that are used inthis book.
TABLE P–1
TypographicConventions
Typeface Meaning Example
AaBbCc123 The names of commands,files,and directories,
and onscreencomputer output
Edit your.login file.
Use ls -a to list all files.
machine_name% you have mail.
AaBbCc123 What you type,contrasted with onscreen
computer output
machine_name% su
Password:
aabbcc123 Placeholder:replace with a real name or value The command to remove a file is rm
filename.
AaBbCc123 Book titles,newterms,and terms to be
emphasized
Read Chapter 6 inthe User’s Guide.
Acache is a copy that is stored
locally.
Do not save the file.
Note:Some emphasized items
appear bold online.
Shell Prompts inCommandExamples
The following table shows the default UNIXsystemprompt and superuser prompt for the Cshell,
Bourne shell,and Kornshell.
TABLE P–2
Shell Prompts
Shell Prompt
Cshell machine_name%
Cshell for superuser machine_name#
Bourne shell and Kornshell $
Bourne shell and Kornshell for superuser#
Preface
SunCluster Data Service for PostgreSQLGuide for Solaris OS • December 2006,RevisionA8
RelatedDocumentation
Informationabout related SunCluster topics is available inthe documentationthat is listed inthe
following table.All SunCluster documentationis available at http://docs.sun.com.
Topic Documentation
Data service
administration
Sun Cluster Data Services Planning and Administration Guide for Solaris OS
Individual data service guides
Concepts Sun Cluster Concepts Guide for Solaris OS
Overview Sun Cluster Overviewfor Solaris OS
Software installation Sun Cluster Software Installation Guide for Solaris OS
Systemadministration Sun Cluster SystemAdministration Guide for Solaris OS
Hardware administration Sun Cluster 3.1 - 3.2 Hardware Administration Manual for Solaris OS
Individual hardware administrationguides
Data service development Sun Cluster Data Services Developer’s Guide for Solaris OS
Error messages Sun Cluster Error Messages Guide for Solaris OS
Command and function
reference
Sun Cluster Reference Manual for Solaris OS
For a complete list of SunCluster documentation,see the release notes for your release of SunCluster
at http://docs.sun.com.
RelatedThird-PartyWebSiteReferences
Third-party URLs that are referenced inthis document provide additional related information.
Note –
Sunis not responsible for the availability of third-party web sites mentionedinthis document.
Sundoes not endorse and is not responsible or liable for any content,advertising,products,or other
materials that are available onor through such sites or resources.Sunwill not be responsible or liable
for any actual or alleged damage or loss caused or alleged to be caused by or inconnectionwith use of
or reliance onany such content,goods,or services that are available onor through such sites or
resources.
Preface
9
Documentation,Support,andTraining
The Sunweb site provides informationabout the following additional resources:

Documentation(http://www.sun.com/documentation/)

Support (http://www.sun.com/support/)

Training (http://www.sun.com/training/)
GettingHelp
If you have problems installing or using SunCluster,contact your service provider and provide the
following information:

Your name and email address (if available)

Your company name,address,and phone number

The model number and serial number of your systems

The release number of the Solaris Operating System(for example,Solaris 10)

The release number of SunCluster (for example,SunCluster 3.2)
Use the following commands to gather informationabout each node onyour systemfor your service
provider.
Command Function
prtconf -v Displays the size of the systemmemory and reports
informationabout peripheral devices
psrinfo -v Displays informationabout processors
showrev –p Reports which patches are installed
SPARCprtdiag -v Displays systemdiagnostic information
/usr/cluster/bin/clnode show-rev Displays SunCluster release and package version
information
Also have available the contents of the/var/adm/messages file.
Preface
SunCluster Data Service for PostgreSQLGuide for Solaris OS • December 2006,RevisionA10
InstallingandConfiguringSunCluster HAfor
PostgreSQL
This chapter explains howto install and configure SunCluster HAfor PostgreSQLand contains the
following sections:

“SunCluster HAfor PostgreSQLOverview” onpage 11

“Overviewof Installing and Configuring SunCluster HAfor PostgreSQL” onpage 12

“Planning the SunCluster HAfor PostgreSQLInstallationand Configuration” onpage 12

“Installing and Configuring PostgreSQL” onpage 15

“Verifying the Installationand Configurationof PostgreSQL” onpage 23

“Installing the SunCluster HAfor PostgreSQLPackages” onpage 25

“Registering and Configuring SunCluster HAfor PostgreSQL” onpage 26

“Verifying the SunCluster HAfor PostgreSQLInstallationand Configuration” onpage 37

“Tuning the SunCluster HAfor PostgreSQLFault Monitor” onpage 38

“Debugging SunCluster HAfor PostgreSQL” onpage 40
SunCluster HAfor PostgreSQLOverview
SunCluster HAfor PostgreSQLenables the SunCluster software to manage PostgreSQLby
providing components to performthe orderly startup,shutdown,and fault monitoring of
PostgreSQL.
You canconfigure SunCluster HAfor PostgreSQLas a failover service.You cannot configure Sun
Cluster HAfor PostgreSQLas a multiple-masters service or as a scalable service.
Whena PostgreSQLdatabase cluster is managed by the SunCluster HAfor PostgreSQLdata service,
the PostgreSQLinstance becomes a failover PostgreSQLresource across the SunCluster nodes.The
failover is managed by the SunCluster HAfor PostgreSQLdata service,which runs withinthe global
zone and failover zones.
For conceptual informationabout failover data services,multiple-masters data services,and scalable
data services,see Sun Cluster Concepts Guide for Solaris OS.
11
Overviewof InstallingandConfiguringSunCluster HAfor
PostgreSQL
The following table summarizes the tasks for installing and configuring SunCluster HAfor
PostgreSQLand provides cross-references to detailed instructions for performing these tasks.
Performthe tasks inthe order that they are listed inthe table.
TABLE 1
Tasks for Installing andConfiguring SunCluster HAfor PostgreSQL
Task Instructions
Planthe installation “Planning the SunCluster HAfor PostgreSQLInstallationand
Configuration” onpage 12
Install and configure the PostgreSQL
software
“Installing and Configuring PostgreSQL” onpage 15
Verify the installationand configuration “Howto Verify the Installationand Configurationof
PostgreSQL” onpage 24
Install SunCluster HAfor PostgreSQL
packages
“Installing the SunCluster HAfor PostgreSQLPackages”
onpage 25
Register and configure SunCluster HAfor
PostgreSQLresources
“Registering and Configuring SunCluster HAfor PostgreSQL”
onpage 26
Verify the SunCluster HAfor PostgreSQL
installationand configuration
“Verifying the SunCluster HAfor PostgreSQLInstallationand
Configuration” onpage 37
Tune the SunCluster HAfor PostgreSQL
fault monitor
“Tuning the SunCluster HAfor PostgreSQLFault Monitor”
onpage 38
Debug SunCluster HAfor PostgreSQL “Debugging SunCluster HAfor PostgreSQL” onpage 40
PlanningtheSunCluster HAfor PostgreSQLInstallationand
Configuration
This sectioncontains the informationyou need to planyour SunCluster HAfor PostgreSQL
installationand configuration.
PostgreSQLandSolaris Containers
SunCluster HAfor PostgreSQLis supported inSolaris Containers,SunCluster is offering two
concepts for Solaris Containers.
Overviewof InstallingandConfiguringSunCluster HAfor PostgreSQL
SunCluster Data Service for PostgreSQLGuide for Solaris OS • December 2006,RevisionA12

Zones are containers which are running after a reboot of the node.These containers,combined
with resource groups having the nodename nodename:zonename as valid “nodename” inthe
resource groups nodename list.

Failover Zone containers are managed by the Solaris Container agent,and are represented by a
resource of a resource group.
ConfigurationRestrictions
The configurationrestrictions inthe subsections that followapply only to SunCluster HAfor
PostgreSQL.
Caution –
Your data service configurationmight not be supportedif youdo not observe these
restrictions.
Restrictionfor theLocationof theDatabaseCluster
The PostgreSQLdatabase cluster is where the database files and the configurationfiles are stored.
The database cluster,represented by the configurationvariable PGDATA,needs to be placed onthe
shared storage.
Restrictionfor theListeningPolicyof thePostgreSQLDatabaseServer
SunCluster HAfor PostgreSQLrequires that the PostgreSQLlistens at the localhost.Otherwise the
monitoring of your data service will not work.For more information,see “Prepare Your PostgreSQL
Installationfor Cluster Control” onpage 33.
Restrictionfor thePostgreSQLpostgresql.confFile
The postgresql.conf file is one of the central configurationfiles for a specific PostgreSQLdatabase
cluster.
The postgresql.conf file must be stored inthe PGDATA path.You cannot register SunCluster HAfor
PostgreSQLif the file postgresql.conf is not inthe directory referenced inthe PGDATA variable.The
other configurationfiles canbe kept elsewhere.For more informationabout registration,see
“Registering and Configuring SunCluster HAfor PostgreSQL” onpage 26.
Restrictionfor thePasswordPolicyfor theSunCluster HAfor
PostgreSQLMonitoringDatabase
SunCluster HAfor PostgreSQLrequires a database to which it canconnect and where it can
manipulate a table for monitoring purposes.The password policy of this database for access fromthe
localhost must be either trust or password.All other password policies canbe whatever is
applicable.For more informationabout setting the password policy,see “Registering and
Configuring SunCluster HAfor PostgreSQL” onpage 26.For more informationabout the
password policy,go to http://www.postgresql.org.
Planningthe SunCluster HAfor PostgreSQLInstallationandConfiguration
InstallingandConfiguringSunCluster HAfor PostgreSQL 13
Restrictionfor thePostgreSQLsmfServiceNameinaFailover Zone
The PostgreSQLconfigurationina failover zone uses the smf component of SunCluster HAfor
Solaris Containers.The registrationof the SunCluster HAfor PostgreSQLdata service ina failover
zone defines ansmf service to control the PostgreSQLdatabase.The name of this smf service is
generated inthis naming scheme:svc:/application/sczone-agents:resource-name.No other smf
service with exactly this name canexist.
The associated smf manifest is automatically created during the registrationprocess inthis location
and naming scheme:/var/svc/manifest/application/sczone-agents/resource-name.xml.No
other manifest cancoexist with this name.
ConfigurationRequirements
The configurationrequirements inthis sectionapply only to SunCluster HAfor PostgreSQL.
Caution –
If your data service configurationdoes not conformto these requirements,the data service
configurationmight not be supported.
Dependencies BetweenSunCluster HAfor PostgreSQLComponents
The dependencies betweenthe SunCluster HAfor PostgreSQLcomponents are described inthe
following table.
TABLE 2
Dependencies BetweenSunCluster HAfor PostgreSQLComponents
Component Dependency
PostgreSQLresource ina
Solaris 10 global zone,zone
or inSolaris 9
SUNW.HAStoragePlus This dependency is required only if the configuration
uses a failover file system,of file systems ina zone.
SUNW.LogicalHostName
PostgreSQLresource ina
Solaris 10 failover zone.
SunCluster HAfor the Solaris Container boot resource.
SUNW.HAStoragePlus
SUNW.LogicalHostName —This dependency is required only if the zones boot
resource does not manage the zone’s IPaddress.
You set these dependencies,whenyou register and configure SunCluster HAfor PostgreSQL.For
more information,see “Registering and Configuring SunCluster HAfor PostgreSQL” onpage 26.
If more elaborate dependencies are required,see the r_properties(5) and rg_properties(5) man
pages for further dependencies and affinities settings.
Planningthe SunCluster HAfor PostgreSQLInstallationandConfiguration
SunCluster Data Service for PostgreSQLGuide for Solaris OS • December 2006,RevisionA14
Parameter Filefor SunCluster HAfor PostgreSQL
SunCluster HAfor PostgreSQLrequires a parameter file to pass configurationinformationto the
data service.You must create a directory for this file.Because the directory must be available oneach
node that is to host the PostgreSQLdatabase,place the directory onthe shared storage.If SunCluster
HAfor PostgreSQLis configured for a failover zone,this file must be available inthis zone.The
parameter file is created automatically whenthe resource is registered.
InstallingandConfiguringPostgreSQL
This sectionexplains only the special requirements for installing PostgreSQLfor use with Sun
Cluster HAfor PostgreSQL.For complete informationabout installing and configuring PostgreSQL,
see http://www.postgresql.org.For complete informationabout installing and configuring a
Solaris Container,see SystemAdministration Guide:Solaris Containers-Resource Management and
Solaris Zones.
Determine if the sunsupplied PostgreSQLis already installed and if the installed versionwill fulfill
your requirements.To do this you need to check if at least the three following packages are installed
onyour system.
SUNWpostgr
SUNWpostgr-libs
SUNWpostgr-server-data
To determine which PostgreSQLversionis installed,submit the following commands.
#su - non-root-user
$ postmaster --version
If they are not installed,you need to decide wether you wanto install PostgreSQLfromthe Solaris
Media or if you want to build PostgreSQLonyour own.If the versiondoes not fulfill your needs,you
have to build PostgreSQLonyour own.
For each PostgreSQLdatabase that you are installing and configuring choose the following tasks
according to your zone type.
Determine whether you have to configure SunCluster HAfor PostgreSQLto runina global zone,in
a zone or ina failover zone configuration.The global zone configurationprocedure is applicable if
you install PostgreSQLonSolaris 9,or inthe global zone of Solaris 10.The failover zone
configurationprocedure is applicable if you install PostgreSQLina failover zone.
To install and configure PostgreSQLina global zone configuration,complete the following tasks:

“Howto Enable a PostgreSQLDatabase to Runina Global Zone Configuration” onpage 16

“ Howto Install and Configure PostgreSQLina Global Zone” onpage 16
To install and configure PostgreSQLina zone configuration,complete the following tasks:
InstallingandConfiguringPostgreSQL
InstallingandConfiguringSunCluster HAfor PostgreSQL 15

“Howto Enable a Zone to RunPostgreSQLina Zone Configuration” onpage 18

“ Howto Install and Configure PostgreSQLina Zone” onpage 19
To install and configure PostgreSQLina failover zone configuration,complete the following tasks:

“Howto Enable a Zone to RunPostgreSQLina Failover Zone Configuration” onpage 20

“ Howto Install and Configure PostgreSQLina Failover Zone” onpage 22

HowtoEnableaPostgreSQLDatabasetoRunina
Global ZoneConfiguration
For a complete example of deploying ina global zone,see Appendix B.
As superuser register theSUNW.HAStoragePlus andtheSUNW.gdsresourcetypes.
#clresourcetype register SUNW.HAStoragePlus SUNW.gds
Createafailover resourcegroup.
#clresourcegroup create PostgreSQL-resource-group
Createaresourcefor thePostgreSQL‘s diskstorage.
#clresource create -t SUNW.HAStoragePlus\
-p FileSystemMountPoints=PostgreSQL-instance-mount-points\
PostgreSQL-has-resource
(Optional) If youplantoaccess thedatabasefromalogical host,choosethefollowingtasks
accordingtoyour zonetype.
#clreslogicalhostname create -g PostgreSQL-resource-group\
PostgreSQL-logical-hostname-resource-name
Enablethefailover resourcegroup.
#clresourcegroup online -M PostgreSQL-resource-group
Createadirectoryfor theSunCluster HAfor PostgreSQLparameter file.
#mkdir PostgreSQL-instance-mount-points/parameter-dir

HowtoInstall andConfigurePostgreSQLinaGlobal
Zone
Note –
For complete informationabout installing PostgreSQL,go to http://www.postgresql.org.
For a complete example of deployment ina global zone,see Appendix B.
1
2
3
4
5
6
InstallingandConfiguringPostgreSQL
SunCluster Data Service for PostgreSQLGuide for Solaris OS • December 2006,RevisionA16
Determine the following requirements for the deployment of PostgreSQLwith SunCluster:

See if the PostgreSQLversionthat you need is already installed oneach cluster node.by searching
the most probable root paths where you find bin/postmaster:
/usr Root path for PostgreSQLshipped with Solaris OS.
/usr/local/psql Root path for the PostgreSQLbuild without a prefix.
/your-path Fully customized root path for PostgreSQL.This is where to place the binaries
onthe shared storage.Aknownconventionis/path/postgresql-x.y.z.

Determine the number of PostgreSQLresources to deploy.

Determine which cluster file systems will be used by each PostgreSQLresource.

Make sure,that a Ccompiler,make,and the readline package are installed.These packages are
needed to build PostgreSQLfromthe 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 PostgreSQLdatabase software will be installed onthe shared storage inthe directory version
inthe failover file system/global/postgres.

The PostgreSQLdatabase cluster will be installed inthe same file systemas the database software,
inthe directory/global/postgres/data.

The home directory of the postgres user is/global/postgres.

The PostgreSQLbuild directory is in/tmp/postgres/version,and the software is already
downloaded and extracted inthis place.
As superuser createthehomedirectoryfor thePostgreSQLuser ononenode.
#mkdir/global/postgres
Addagroupfor PostgreSQLoneverynode.
#groupadd -g 1000 postgres
Addauser whoowns thePostgreSQLinstallationoneverynode.
#useradd -u 1000 -g postgres -d/global/postgres -s/usr/bin/ksh postgres
#chown -R postgres:postgres/global/postgres
SwitchtothePostgreSQLuser.
#su - postgres
BeforeYouBegin
1
2
3
4
InstallingandConfiguringPostgreSQL
InstallingandConfiguringSunCluster HAfor PostgreSQL 17
Set your PATHvariable.
$ 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
Switchtoyour builddirectory.
$ cd/tmp/postgres/version
ConfigurethePostgreSQLbuild.
$./configure --prefix=/global/postgres/version
Complete,verifyandinstall thebuild.
$ gmake
$ gmake check
$ gmake install

HowtoEnableaZonetoRunPostgreSQLinaZone
Configuration
For a complete example of deploying ina zone,see Appendix D.
As superuser register theSUNW.HAStoragePlus andtheSUNW.gdsresourcetypes.
#clresourcetype register SUNW.HAStoragePlus SUNW.gds
Install andboot thezonepgs-zone onall thenodes tohost SunCluster HAfor PostgreSQL.
Createafailover resourcegroup.
#clresourcegroup create -n node-1:pgs-zone,node-2:pgs-zone PostgreSQL-resource-group
Createaresourcefor thePostgreSQLzone‘s diskstorage.
#clresource create -t SUNW.HAStoragePlus\
-p FileSystemMountPoints=PostgreSQL-instance-mount-points\
PostgreSQL-has-resource
(Optional) Createaresourcefor thePostgreSQL‘s logical hostname.
#clreslogicalhostname create -g PostgreSQL-resource-group\
PostgreSQL-logical-hostname-resource-name
5
6
7
8
9
1
2
3
4
5
InstallingandConfiguringPostgreSQL
SunCluster Data Service for PostgreSQLGuide for Solaris OS • December 2006,RevisionA18
Enabletheresourcegroup.
#clresourcegroup online -M PostgreSQL-resource-group

HowtoInstall andConfigurePostgreSQLinaZone
Note –
For complete informationabout installing PostgreSQL,go to http://www.postgresql.org.
For a complete example of deploying ina failover zone,see Appendix D.
Determine the following requirements for the deployment of PostgreSQLwith SunCluster:

See if the PostgreSQLversionthat you need is already installed oneach cluster node.by searching
the most probable root paths where you find bin/postmaster:
/usr Root path for PostgreSQLshipped with Solaris OS.
/usr/local/psql Root path for the PostgreSQLbuild without a prefix.
/your-path Fully customized root path for PostgreSQL.This is where to place the binaries
onthe shared storage.Aknownconventionis/path/postgresql-x.y.z.

Determine the number of PostgreSQLresources to deploy.

Determine which cluster file systems will be used by each PostgreSQLresource.

Make sure that a Ccompiler,make,and the readline package are installed.These packages are
needed to build PostgreSQLfromthe source code downloads from
http://www.postgresql.org.
The following assumptions are made:

The zone postgres-zone is installed and configured onevery node.

The compiler gcc and the gmake package are installed in/usr/sfw.

The readline package is installed under/usr/local.

The PostgreSQLdatabase software will be installed onthe shared storage,inthe directory version
inthe failover file system/postgres.

The PostgreSQLdatabase cluster will be installed inthe same file systemas the database software,
inthe directory/postgres/data.

The home directory of the postgres user is/postgres.

The PostgreSQLbuild directory is in/tmp/postgres/version,and the software is already
downloaded and extracted inthis place.
As superuser logintothezone.
#zlogin postgres-zone
6
BeforeYouBegin
1
InstallingandConfiguringPostgreSQL
InstallingandConfiguringSunCluster HAfor PostgreSQL 19
Addagroupfor PostgreSQL.
#groupadd -g 1000 postgres
Addauser whoowns thePostgreSQLinstallationoneverynode.
#useradd -u 1000 -g postgres -d/postgres -m -s/usr/bin/ksh postgres
SwitchtothePostgreSQLuser.
#su - postgres
Set your PATHvariable.
$ 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
Switchtoyour builddirectory.
$ cd/tmp/postgres/version
ConfigurethePostgreSQLbuild.
$./configure --prefix=/postgres/version
Complete,verify,andinstall thebuild.
$ gmake
$ gmake check
$ gmake install

HowtoEnableaZonetoRunPostgreSQLinaFailover
ZoneConfiguration
For a complete example of deploying ina failover zone,see Appendix D.
As superuser register theSUNW.HAStoragePlus andtheSUNW.gdsresourcetypes.
#clresourcetype register SUNW.HAStoragePlus SUNW.gds
Createafailover resourcegroup.
#clresourcegroup create PostgreSQL-resource-group
2
3
4
5
6
7
8
9
1
2
InstallingandConfiguringPostgreSQL
SunCluster Data Service for PostgreSQLGuide for Solaris OS • December 2006,RevisionA20
Createaresourcefor thePostgreSQLzone‘s diskstorage.
#clresource create -t SUNW.HAStoragePlus\
-p FileSystemMountPoints=PostgreSQL-instance-mount-points\
PostgreSQL-has-resource
(Optional) If youwant theprotectionagainst atotal adapter failurefor your public network,createa
resourcefor thePostgreSQL‘s logical hostname.
#clreslogicalhostname create -g PostgreSQL-resource-group\
PostgreSQL-logical-hostname-resource-name
Placetheresourcegroupinthemanagedstate.
#clresourcegroup online -M PostgreSQL-resource-group
Install thezone.
Install the zone according to the SunCluster HAfor Solaris Containers agent documentation,
assuming that the resource name is pgsql-zone-rs and that the zone name is pgsql-zone.
Verifythezone’s installation.
#zoneadm -z pgsql-zone boot
#zoneadm -z pgsql-zone halt
Register thezone’s boot component.
a.Copythecontainer resourceboot component configurationfile.
#cp/opt/SUNWsczone/sczbt/util/sczbt_config zones-target-configuration-file
b.Useaplaintext editor toset thefollowingvariables:
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=
c.Createtheparameter directoryfor your zone’s resource.
#mkdir pgsql-zone-parameter-directory
d.ExecutetheSunCluster HAfor Solaris Container’s registrationscript.
#/opt/SUNWsczone/sczbt/util/sczbt_register -f zones-target-configuration-file
3
4
5
6
7
8
InstallingandConfiguringPostgreSQL
InstallingandConfiguringSunCluster HAfor PostgreSQL 21
e.EnabletheSolaris Container resource
#clresource enable pgsql-zone-rs
Enabletheresourcegroup.
#clresourcegroup online PostgreSQL-resource-group

HowtoInstall andConfigurePostgreSQLinaFailover
Zone
Note –
For complete informationabout installing PostgreSQL,go to http://www.postgresql.org.
For a complete example of deploying ina failover zone,see Appendix D.
Determine the following requirements for the deployment of PostgreSQLwith SunCluster:

See if the PostgreSQLversionthat you need is already installed oneach cluster node.by searching
the most probable root paths where you find bin/postmaster:
/usr Root path for PostgreSQLshipped with Solaris OS.
/usr/local/psql Root path for the PostgreSQLbuild without a prefix.
/your-path Fully customized root path for PostgreSQL.This is where to place the binaries
onthe shared storage.Aknownconventionis/path/postgresql-x.y.z.

Determine the number of PostgreSQLresources to deploy.

Determine which cluster file systems will be used by each PostgreSQLresource.

Make sure that a Ccompiler,make,and the readline package are installed.These packages are
needed to build PostgreSQLfromthe source code downloads from
http://www.postgresql.org.
The following assumptions are made:

The zone postgres-zone is installed and configured onevery node.

The compiler gcc and the gmake package are installed in/usr/sfw.

The readline package is installed under/usr/local.

The PostgreSQLdatabase software will be installed onthe shared storage,inthe directory version
inthe failover file system/postgres.

The PostgreSQLdatabase cluster will be installed inthe same file systemas the database software,
inthe directory/postgres/data.

The home directory of the postgres user is/postgres.
9
BeforeYouBegin
InstallingandConfiguringPostgreSQL
SunCluster Data Service for PostgreSQLGuide for Solaris OS • December 2006,RevisionA22

The PostgreSQLbuild directory is in/tmp/postgres/version,and the software is already
downloaded and extracted inthis place.
Logintothezone.
#zlogin postgres-zone
Addagroupfor PostgreSQL.
#groupadd -g 1000 postgres
Addauser whoowns thePostgreSQLinstallationoneverynode.
#useradd -u 1000 -g postgres -d/postgres -m -s/usr/bin/ksh postgres
SwitchtothePostgreSQLuser.
#su - postgres
Set your PATHvariable.
$ 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
Switchtoyour builddirectory.
$ cd/tmp/postgres/version
ConfigurethePostgreSQLbuild.
$./configure --prefix=/postgres/version
Complete,verify,andinstall thebuild.
$ gmake
$ gmake check
$ gmake install
VerifyingtheInstallationandConfigurationof PostgreSQL
Before you install the SunCluster HAfor PostgreSQLpackages,verify that each PostgreSQLinstance
that you created is correctly configured to runina cluster.The instance is the PostgreSQLdatabase
cluster together with the associated postmaster processes.This verificationdoes not confirmthat the
PostgreSQLdatabases are highly available because the SunCluster HAfor PostgreSQLdata service is
not yet configured.
1
2
3
4
5
6
7
8
9
Verifyingthe InstallationandConfigurationof PostgreSQL
InstallingandConfiguringSunCluster HAfor PostgreSQL 23

HowtoVerifytheInstallationandConfigurationof
PostgreSQL
Performthis procedure for each PostgreSQLinstance that you created in “Installing and Configuring
PostgreSQL” onpage 15.During the verificationyou will complete the PostgreSQLpostinstallation
steps.
Determine whether you are ina local zone or ina global zone.If you are ina failover zone,use
/postgres instead of/global/postgres for your directory prefix inthis procedure.
SwitchtothePostgreSQLuser if necessary.
#su - postgres
(Optional) Set thePATHandLD_LIBRARY_PATH variables.
$ PATH=$PATH:/usr/local/bin:/usr/sfw/bin:/usr/ccs/bin
$ export PATH
$ LD_LIBRARY_PATH=/usr/sfw/lib:/usr/local/lib:/usr/lib:
$ export LD_LIBRARY_PATH
Set thePGDATAvariable.
The PGDATA variable points to the directory where the PostgreSQLdatabase cluster is installed.The
PostgreSQLdatabase cluster is a directory that contains the configurationand the data files for all the
databases.
$ PGDATA=/global/postgres/data
$ export PGDATA
Createthedatadirectoryandthelogs directory.
$ mkdir/global/postgres/data
$ mkdir/global/postgres/logs
InitializethePostgreSQLcluster.
$ cd ~/postgres-version
$./bin/initdb -D $PGDATA
Start thePostgreSQLdatabaseserver.
$./bin/pg_ctl -l/global/postgres/logs/firstlog start
Createanddeleteatest database.
$./bin/createdb test
$./bin/dropdb test
If youareinanonglobal zone,leavethis zoneandreturntothetarget zone.
BeforeYouBegin
1
2
3
4
5
6
7
8
Verifyingthe InstallationandConfigurationof PostgreSQL
SunCluster Data Service for PostgreSQLGuide for Solaris OS • December 2006,RevisionA24
InstallingtheSunCluster HAfor PostgreSQLPackages
If you did not install the SunCluster HAfor PostgreSQLpackages during your initial SunCluster
installation,performthis procedure to install the packages.To install the packages,use the SunJava
TM
Enterprise SystemInstallationWizard.

HowtoInstall theSunCluster HAfor PostgreSQL
Packages
Performthis procedure oneach cluster node where you are installing the SunCluster HAfor
PostgreSQLpackages.
You canrunthe SunJava Enterprise SystemInstallationWizard with a command-line interface
(CLI) or with a graphical user interface (GUI).The content and sequence of instructions inthe CLI
and the GUI are similar.
Note –
Evenif youplanto configure this data service to runinnon-global zones,install the packages
for this data service inthe global zone.The packages are propagated to any existing non-global zones
and to any non-global zones that are created after you install the packages.
Ensure that you have the SunJavaAvailability Suite DVD-ROM.
If you intend to runthe SunJava Enterprise SystemInstallationWizard with a GUI,ensure that your
DISPLAY environment variable is set.
Onthecluster nodewhereyouareinstallingthedataservicepackages,becomesuperuser.
LoadtheSunJavaAvailabilitySuiteDVD-ROMintotheDVD-ROMdrive.
If the Volume Management daemonvold(1M) is running and configured to manage DVD-ROM
devices,the daemonautomatically mounts the DVD-ROMonthe/cdrom directory.
ChangetotheSunJavaEnterpriseSystemInstallationWizarddirectoryof theDVD-ROM.

If youareinstallingthedataservicepackages ontheSPARC® platform,typethefollowing
command:
#cd/cdrom/cdrom0/Solaris_sparc

If youareinstallingthedataservicepackages onthex86platform,typethefollowingcommand:
#cd/cdrom/cdrom0/Solaris_x86
Start theSunJavaEnterpriseSystemInstallationWizard.
#./installer
BeforeYouBegin
1
2
3
4
Installingthe SunCluster HAfor PostgreSQLPackages
InstallingandConfiguringSunCluster HAfor PostgreSQL 25
Whenyouareprompted,accept thelicenseagreement.
If any SunJava Enterprise Systemcomponents are installed,you are prompted to select whether to
upgrade the components or install newsoftware.
Fromthelist of SunCluster agents under AvailabilityServices,select thedataservicefor PostgreSQL.
If yourequiresupport for languages other thanEnglish,select theoptiontoinstall multilingual
packages.
English language support is always installed.
Whenpromptedwhether toconfigurethedataservicenowor later,chooseConfigureLater.
Choose Configure Later to performthe configurationafter the installation.
Followtheinstructions onthescreentoinstall thedataservicepackages onthenode.
The SunJava Enterprise SystemInstallationWizard displays the status of the installation.Whenthe
installationis complete,the wizard displays aninstallationsummary and the installationlogs.
(GUI only) If youdonot want toregister theproduct andreceiveproduct updates,deselect the
Product Registrationoption.
The Product Registrationoptionis not available with the CLI.If you are running the SunJava
Enterprise SystemInstallationWizard with the CLI,omit this step
Exit theSunJavaEnterpriseSystemInstallationWizard.
UnloadtheSunJavaAvailabilitySuiteDVD-ROMfromtheDVD-ROMdrive.
a.Toensurethat theDVD-ROMis not beingused,changetoadirectorythat does not resideonthe
DVD-ROM.
b.Eject theDVD-ROM.
#eject cdrom
See “Registering and Configuring SunCluster HAfor PostgreSQL” onpage 26 to register Sun
Cluster HAfor PostgreSQLand to configure the cluster for the data service.
RegisteringandConfiguringSunCluster HAfor PostgreSQL
Before you performthe procedures inthis section,ensure that the SunCluster HAfor PostgreSQL
data service packages are installed.
The configurationand registrationfile inthe/opt/SUNWscPostgreSQL/util directory exists to
register the SunCluster HAfor PostgreSQLresources.This file defines the dependencies that are
5
6
7
8
9
10
11
12
Next Steps
RegisteringandConfiguringSunCluster HAfor PostgreSQL
SunCluster Data Service for PostgreSQLGuide for Solaris OS • December 2006,RevisionA26
required betweenthe SunCluster HAfor PostgreSQLcomponent and other resources.For
informationabout these dependencies,see “Dependencies BetweenSunCluster HAfor PostgreSQL
Components” onpage 14
This sectioncovers the following maintopics:

“Specifying ConfigurationParameters for the PostgreSQLResource” onpage 27

“Prepare Your PostgreSQLInstallationfor Cluster Control” onpage 33

“Howto Create and Enable Resources for PostgreSQL” onpage 35
SpecifyingConfigurationParameters for the
PostgreSQLResource
SunCluster HAfor PostgreSQLprovides a script that automates the process of configuring the
PostgreSQLresource.This script obtains configurationparameters fromthe pgs_config file.A
template for this file is inthe/opt/SUNWscPostgreSQL/util directory.To specify configuration
parameters for the PostgreSQLresource,copy the pgs_config file to another directory and edit this
pgs_config file.
Note –
This configurationfile needs to be accessible fromthe zone where the PostgreSQLis installed.
Each configurationparameter inthe pgs_config file is defined as a keyword-value pair.The
pgs_config file already contains the required keywords and equals signs.For more information,see
“Listing of pgs_config” onpage 43.Whenyou edit the/myplace/pgs_config file,add the required
value to each keyword.
The keyword-value pairs inthe pgs_config file are as follows:
RS=PostgreSQL-resource
RG=PostgreSQL-resource-group
PORT=80
LH=PostgreSQL-logical-hostname-resource-name
HAS_RS=PostgreSQL-has-resource
PFILE=pgsql-parameter-file
ZONE=pgsql-zone
ZONE_BT=pgsql-zone-rs
PROJECT=pgsql-zone-project
USER=pgsql-user
PGROOT=pgsql-root-directory
PGDATA=pgsql-data-directory
PGPORT=pgsql-port
PGLOGFILE=pgsql-log-file
LD_LIBRARY_PATH=pgsql-ld-library-path
ENVSCRIPT=pgsql-environment-script
SCDB=pgsql-mon-db
RegisteringandConfiguringSunCluster HAfor PostgreSQL
InstallingandConfiguringSunCluster HAfor PostgreSQL 27
SCUSER=pgsql-mon-user
SCTABLE=pgsql-mon-table
SCPASS=pgsql-mon-pwd
NOCONRET=pgsql-noconn-rtcode
The meaning and permitted values of the keywords inthe pgs_config file are as follows:
RS=PostgreSQL-resource
Specifies the name that you are assigning to the PostgreSQLresource.You must specify a value for
this keyword.
RG=PostgreSQL-resource-group
Specifies the name of the resource group where the PostgreSQLresource will reside.You must
specify a value for this keyword.
PORT=80
Ina global zone configurationspecifies the value of a dummy port only if you specified the LH
value for the PostgreSQLresource.This variable is used only at registrationtime.If you will not
specify anLH,omit this value.
Ina failover zone configuration,omit this value.
LH=PostgreSQL-logical-hostname-resource-name
Ina global zone configurationspecifies the name of the SUNW.LogicalHostName resource for the
PostgreSQLresource.This name must be the SUNW.LogicalHostname resource name you
assigned whenyou created the resource in“Howto Enable a Zone to RunPostgreSQLina
Failover Zone Configuration” onpage 20.If you did not register a SUNW.LogicalHostname
resource,omit this value.
Ina failover zone configuration,omit this value.
HAS_RS=PostgreSQL-has-resource
Specifies the names of resources onwhich your PostgreSQLwill depend,for example,the
SUNW.HAStoragePlus resource,for the PostgreSQLresource.This name must be the
SUNW.HAStoragePlus resource name that you assigned whenyou created the resource in“Howto
Enable a PostgreSQLDatabase to Runina Global Zone Configuration” onpage 16.Dependencies
to additional resources canbe specified here.They must be separated by a comma.
PFILE=pgsql-parameter-file
Specifies the name of the parameter file where the PostgreSQLspecific parameters of the
PostgreSQLresource are stored.This file is automatically created at registrationtime.You must
specify a value for this keyword.
ZONE=pgsql-zonename
Specifies the name of the failover zone to host the PostgreSQLdatabase.Omit this value if you
configure a global zone environment.
ZONE_BT=pgsql-zone-rs
Specifies the name of the zone boot resource ina failover zone configuration.Omit this value if
you configure a global zone environment.
RegisteringandConfiguringSunCluster HAfor PostgreSQL
SunCluster Data Service for PostgreSQLGuide for Solaris OS • December 2006,RevisionA28
PROJECT=pgsql-zone-project
Specifies the name of the resource management project inthe failover zone.Omitting this value in
a failover zone configurationresults inthe default project for USER.Leave the value blank for a
global zone configuration.
USER=pgsql-user
Specifies the name of the Solaris user who owns the PostgreSQLdatabase.You must specify a
value for this keyword.
PGROOT=pgsql-root-directory
Specifies the name of the directory inwhich PostgreSQLis installed.For example,if PostgreSQL
version8.1.2 is installed in/global/postgres/postgresql-8.1.2,the variable PGROOT needs to
be set to/global/postgres/postgresql-8.1.2.Avalid PGROOT variable contains the file pg_ctl,
which is located inits subdirectory bin.You must specify a value for this keyword.
Examples for PGROOT:
/usr Root path for PostgreSQLshipped with Solaris OS.
/usr/local/psql Root path for the PostgreSQLbuild without a prefix.
/your-path Fully customized root path for PostgreSQL.This is where to place the binaries on
the shared storage.Aknownconventionis/path/postgresql-x.y.z.
PGDATA=pgsql-data-directory
Specifies the name of the directory where the “PostgreSQLdata cluster” is initialized.This
directory is where the data directories and at least the postgresql.conf file are located.You must
specify a value for this keyword.
PGPORT=pgsql-port
Specifies the port onwhich the PostgreSQLserver will listen.
PGLOGFILE=pgsql-log-file
Specifies the name of the log file of PostgreSQL.All server messages will be found inthis file.You
must specify a value for this keyword.
LD_LIBRARY_PATH=pgsql-ld-library-path
Specifies the libraries needed to start the PostgreSQLserver and utilities.This parameter is
optional.
ENVSCRIPT=pgsql-environment-script
Specifies the name of a script to source PostgreSQL—specific environment variables.Ina global
zone configuration,the script type is either Cshell or Kornshell,according to the loginshell of
the PostgreSQLuser.Ina failover zone configuration,the script type must be a valid Kornshell
script.
This parameter is optional.
RegisteringandConfiguringSunCluster HAfor PostgreSQL
InstallingandConfiguringSunCluster HAfor PostgreSQL 29
SCDB=pgsql-mon-db
Specifies the name of the PostgreSQLdatabase that will be monitored.You must specify a value
for this keyword.
SCUSER=pgsql-mon-user
Specifies the name of the PostgreSQLdatabase user,which is needed to monitor the conditionof
the database.This user will be created during the installationprocess.You must specify a value for
this keyword.
SCTABLE=pgsql-mon-table
Specifies the name of the table that will be modified to monitor the health of the PostgreSQL
application.This table will be created during the installationprocess.You must specify a value for
this keyword.
SCPASS=pgsql-mon-pwd
Specifies the password for SCUSER.If no password is specified,the user set by SCUSER needs to be
allowed to log infromthe localhost without a password challenge.
This parameter is optional.
NOCONRET=pgs-noconn-rtcode
Specifies the value below100 of the returncode for failed database connections.For more
information,see“Tuning the SunCluster HAfor PostgreSQLFault Monitor” onpage 38
For illustrationpurposes,two examples for the pgs_config file are provided.Example 1 shows the
pgs_config file for a global zone configuration.Example shows the pgs_config file for a failover
zone configuration.
EXAMPLE 1
Sample pgs_config File for a Global Zone of Zone Configuration
This example shows a pgs_config file inwhich configurationparameters are set as follows:

The name of the PostgreSQLresource is postgres-rs.

The name of the resource group for the PostgreSQLresource is postgres-rg.

The value of the dummy port for the PostgreSQLresource is 80.

The name of the SUNW.LogicalHost resource is postgres-lh.

The name of the SUNW.HAStoragePlus resource which manages the file systemfor PostgreSQLis
postgres-has-rs.

The parameter file will be generated in/global/postgres/pfile.

The null value for ZONE,ZONE_BT,and PROJECT indicates,that it is a global zone configuration.

The name of the Solaris user who owns PostgreSQLis postgres.

The PostgreSQLsoftware is installed in/global/postgres/postgresql-8.1.2.

The PostgreSQLdata and configurationfiles are installed under/global/postgres/data.

The PostgreSQLdatabase server listens onport 5432.

The log file for the database server is/global/postgres/logs/scinstance1.
RegisteringandConfiguringSunCluster HAfor PostgreSQL
SunCluster Data Service for PostgreSQLGuide for Solaris OS • December 2006,RevisionA30
EXAMPLE 1
Sample pgs_config File for a Global Zone of Zone Configuration (Continued)

The libraries for the PostgreSQLserver are stored inthe paths of the LD_LIBRARY_PATH
/usr/sfw/lib:/usr/local/lib:/usr/lib:.

Additional PostgreSQLvariables are set in/global/postgres/variables.ksh.

The database that will be monitored is testdb.

The user for the database monitoring is testusr.

The table testtbl will be modified to probe the conditionof the database.

The password for the user testusr is testpwd.

If a connectionto the database testdb fails,the probe returns with returncode 10.
RS=postgres-rs
RG=postgres-rg
PORT=80
LH=postgres-lh
HAS_RS=postgres-has-rs
PFILE=/global/postgres/pfile
ZONE=
ZONE_BT=
PROJECT=
USER=postgres
PGROOT=/global/postgres/postgresql-8.1.2
PGDATA=/global/postgres/data
PGPORT=5432
PGLOGFILE=/global/postgres/logs/scinstance1
LD_LIBRARY_PATH=/usr/sfw/lib:/usr/local/lib:/usr/lib:
ENVSCRIPT=/global/postgres/variables.ksh
SCDB=testdb
SCUSER=testusr
SCTABLE=testtbl
SCPASS=testpwd
NOCONRET=10
EXAMPLE 2
Sample pgs_config File for a Failover Zone Configuration
This example shows anpgs_config file inwhich configurationparameters are set as follows:

The name of the PostgreSQLresource is postgres-zrs.

The name of the resource group for the PostgreSQLresource is postgres-rg.

The values for the PORTvariable,LH variable,and the HAS-RS variable are not set.

The parameter file will be generated in/postgres/pfile.

The PostgreSQLdatabase server will be started inzone pgs-zone.

The boot component resource for the zone pgs-zone is named pgs-zone-rs.
RegisteringandConfiguringSunCluster HAfor PostgreSQL
InstallingandConfiguringSunCluster HAfor PostgreSQL 31
EXAMPLE 2
Sample pgs_config File for a Failover Zone Configuration (Continued)

The PostgreSQLdatabase server will be started under the project pgs-project.

The name of the Solaris user who owns PostgreSQLis zpostgr.

The PostgreSQLsoftware is installed in/postgres/postgresql-8.1.2.

The PostgreSQLdata and configurationfiles are installed in/postgres/data.

The PostgreSQLdatabase server listens onport 5432.

The log file for the database server is/postgres/logs/scinstance1.

The libraries for the PostgreSQLserver are stored inthe paths of LD_LIBRARY_PATH
/usr/sfw/lib:/usr/local/lib:/usr/lib:.

Additional PostgreSQLvariables are set in/postgres/variables.ksh.

The database that will be monitored is testdb.

The user for the database monitoring is testusr.

The table testtbl will be modified to probe the conditionof the database.

The password for the user testusr is testpwd.

If a connectionto the database testdb fails,the probe returns with returncode 10.
RS=postgres-zrs
RG=postgres-rg
PORT=
LH=
HAS_RS=
PFILE=/postgres/pfile
ZONE=pgs-zone
ZONE_BT=pgs-zone-rs
PROJECT=pgs-project
USER=zpostgr
PGROOT=/postgres/potgresql-8.1.2
PGDATA=/postgres/data
PGPORT=5432
PGLOGFILE=/postgres/logs/scinstance1
LD_LIBRARY_PATH=/usr/sfw/lib:/usr/local/lib:/usr/lib:
ENVSCRIPT=/postgres/variables.ksh
SCDB=testdb
SCUSER=testusr
SCTABLE=testtbl
SCPASS=testpwd
NOCONRET=10
RegisteringandConfiguringSunCluster HAfor PostgreSQL
SunCluster Data Service for PostgreSQLGuide for Solaris OS • December 2006,RevisionA32
PrepareYour PostgreSQLInstallationfor Cluster
Control
To prepare your PostgreSQLinstallationfor cluster control,you create a database,a user,and a table
to be monitored by the PostgreSQLresource.Because you need to differentiate betweena global zone
and a failover zone,two procedures are provided.

HowtoPrepareYour PostgreSQLfor SunCluster Registrationina
Global ZoneConfiguration
Ensure that you have edited the pgs_config file to specify configurationparameters for the Sun
Cluster HAfor PostgreSQLdata service.For more information,see “Specifying Configuration
Parameters for the PostgreSQLResource” onpage 27.
As superuser changetherights of theconfigurationfiletobeaccessiblefor your PostgreSQLuser.
#chmod 755/myplace/pgs_config
Switchtoyour PostgreSQLuser.
#su - postgres
If theloginshell is not theKornshell,switchtoksh.
% ksh
Set thenecessaryvariables.
$./myplace/pgs_config
$ export PGDATA PGPORT LD_LIBRARY_PATH
If your PostgreSQLis not alreadyrunning,start thePostgreSQLserver.
$ $PGROOT/bin/pg_ctl -l $PGLOGFILE start
Preparethedatabase.
$/opt/SUNWscPostgreSQL/util/pgs_db_prep -f/myplace/pgs_config
(Optional) Configureyour PostgreSQLinstancetolistenonthelogical host’s TCP/IPname.
If you want your PostgreSQLdatabases to listenonmore thanlocalhost,configure the
listen_address parameter inthe file postgresql.conf.Use a plaintext editor such as vi,and set
the value of listen_address to anappropriate value.
Caution –
The PostgreSQLinstance must listenonlocalhost.For additional information,see
http://www.postgresql.org.
listen_address = ’localhost,myhost’
BeforeYouBegin
1
2
3
4
5
6
7
RegisteringandConfiguringSunCluster HAfor PostgreSQL
InstallingandConfiguringSunCluster HAfor PostgreSQL 33
Set thesecuritypolicyfor thetest database.
Use a plaintext editor such as vi to add the following line to the file pg_hba.conf.
local testdb all password
Note –
For additional informationabout the pg_hba.conf file,see http://www.postgresql.org.
StopthePostgreSQLdatabaseserver.
$ $PGROOT/bin/pg_ctl stop

HowtoPrepareYour PostgreSQLfor SunCluster Registrationina
Failover ZoneConfiguration
Ensure,that you have edited the pgs_config file to specify configurationparameters for the Sun
Cluster HAfor PostgreSQLdata service.For more information,see “Specifying Configuration
Parameters for the PostgreSQLResource” onpage 27.Also make sure that the package directory of
the SunCluster HAfor PostgreSQL,/opt/SUNWscPostgreSQL,is available inthe target zone.
As superuser changetherights of theconfigurationfiletobeaccessiblefor your PostgreSQLuser.
Note –
Ensure,that your pgs_config file is accessible fromyour zone.Otherwise,transfer the file to
your zone by using appropriate methods.
#chmod 755/myplace/pgs_config
Switchtothetarget zone.
#zlogin pgsql-zone
SwitchtothePostgreSQLuser.
#su - zpostgr
If theloginshell is not theKornshell,switchtoksh.
% ksh
Set thenecessaryvariables.
$./myplace/pgs_config
$ export PGDATA PGPORT LD_LIBRARY_PATH
If your PostgreSQLis not alreadyrunning,start thePostgreSQLserver.
$ $PGROOT/bin/pg_ctl -l $PGLOGFILE start
Preparethedatabase.
$/opt/SUNWscPostgreSQL/util/pgs_db_prep -f/myplace/pgs_config
8
9
BeforeYouBegin
1
2
3
4
5
6
7
RegisteringandConfiguringSunCluster HAfor PostgreSQL
SunCluster Data Service for PostgreSQLGuide for Solaris OS • December 2006,RevisionA34
(Optional) Configureyour PostgreSQLinstancetolistenonthelogical hosts TCP/IPname.
If you want your PostgreSQLdatabases to listenonmore thanlocalhost,configure the
listen_address parameter inthe file postgresql.conf.Use a plaintext editor such as vi,and set
the value of listen_address to anappropriate value.
Caution –
The PostgreSQLinstance must listenonlocalhost.For additional information,see
http://www.postgresql.org.
listen_address = ’localhost,myhost’
Set thesecuritypolicyfor thetest database.
Use a plaintext editor such as vi to add the following line to the pg_hba.conf file.
local testdb all password
Note –
For additional information,see http://www.postgresql.org.
StopthePostgreSQLdatabaseserver.
$ $PGROOT/bin/pg_ctl stop
Leavethetarget zoneandreturntotheglobal zone.
CreatingandEnablingResources for PostgreSQL

HowtoCreateandEnableResources for PostgreSQL
Ensure that you have edited the pgs_config file to specify configurationparameters for the Sun
Cluster HAfor PostgreSQLdata service.For more information,see “Specifying Configuration
Parameters for the PostgreSQLResource” onpage 27.
Becomesuperuser ononeof thenodes inthecluster that will host PostgreSQL.
Gotothedirectorythat contains thescript for creatingtheSunCluster HAfor PostgreSQLresource.
#cd/opt/SUNWscPostgreSQL/util
Runthescript that creates thePostgreSQLresource.
#ksh./pgs_register -f/myplace/pgs_config
If you omit the —f option,the file/opt/SUNWscPostgreSQL/util/pgs_config will be used.
BringthePostgreSQLresourceonline.
#clresource enable postgres-rs
8
9
10
11
BeforeYouBegin
1
2
3
4
RegisteringandConfiguringSunCluster HAfor PostgreSQL
InstallingandConfiguringSunCluster HAfor PostgreSQL 35

HowtoModifyParameters intheSunCluster HAfor PostgreSQL
Manifest
Performthis task to change parameters inthe SunCluster HAfor PostgreSQLmanifest and to
validate the parameters inthe failover zone.Parameters for the SunCluster HAfor PostgreSQL
manifest are stored as properties of the SMF service.To modify parameters inthe manifest,change
the related properties inthe SMF service thenvalidate the parameter changes.
Becomesuperuser or assumearolethat provides solaris.cluster.modify and
solaris.cluster.admin RBACauthorizations onthezones console.
ChangetheSolaris ServiceManagement Facilities (SMF) properties for theSunCluster HAfor
PostgreSQLmanifest.
#svccfg svc:/application/sczone-agents:resource
For more information,see the svccfg(1M) manpage.
Validatetheparameter changes.
#/opt/SUNWscPostgreSQL/bin/control_pgs validate resource
Messages for this command are stored inthe/var/adm/messages/directory of the failover zone.
Disconnect fromthefailover zone’s console.

HowtoRemoveaSunCluster HAfor PostgreSQLResourceFroma
Failover Zone
Becomesuperuser or assumearolethat provides solaris.cluster.modify and
solaris.cluster.admin RBACauthorizations.
Disableandremovetheresourcethat is usedbytheSunCluster HAfor PostgreSQLdataservice.
#clresource disable resource
#clresource delete resource
Loginas superuser tothefailover zone’s console.
Unregister SunCluster HAfor PostgreSQLfromtheSolaris ServiceManagement Facilities (SMF)
service.
#/opt/SUNWscPostgreSQL/util/pgs_smf_remove -f filename
-f Specifies the configurationfile name.
filename The name of the configurationfile that you used to register SunCluster HAfor
PostgreSQLwith the SMF service.
1
2
3
4
1
2
3
4
RegisteringandConfiguringSunCluster HAfor PostgreSQL
SunCluster Data Service for PostgreSQLGuide for Solaris OS • December 2006,RevisionA36
Note –
If youno longer have the configurationfile that youused to register SunCluster HAfor
PostgreSQLwith the SMF service,create a replacement configurationfile:
a.Make a copy of the default file,/opt/SUNWscPostgreSQL/util/pgs_config.
b.Set the ZONE and RS parameters with the values that are used by the data service.
c.Runthe pgs_smf_remove command and use the -f optionto specify this configurationfile.
Disconnect fromthefailover zone’s console.
VerifyingtheSunCluster HAfor PostgreSQLInstallationand
Configuration
After you install,register,and configure SunCluster HAfor PostgreSQL,verify this installationand
configurationto determine whether the SunCluster HAfor PostgreSQLdata service makes your
PostgreSQLdatabase highly available.

HowtoVerifytheSunCluster HAfor PostgreSQL
InstallationandConfiguration
Becomesuperuser onacluster nodethat is tohost thePostgreSQLcomponent.
Ensurethat all thePostgreSQLresources areonline.
For each resource,performthe following steps:
a.Determinewhether theresourceis online.
#clresource status postgres-rs
b.If theresourceis not online,bringtheresourceonline.
#clresource enable postgres-rs
Switchtheresourcegrouptoanother cluster node,suchas node2.
#clresourcegroup switch-h node2 postgres-rg
Confirmthat theresourceis nowonlineonnode2.
#clresource status postgres-rs
5
1
2
3
4
Verifyingthe SunCluster HAfor PostgreSQLInstallationandConfiguration
InstallingandConfiguringSunCluster HAfor PostgreSQL 37
TuningtheSunCluster HAfor PostgreSQLFault Monitor
The SunCluster HAfor PostgreSQLfault monitor verifies that the data service is running ina
healthy condition.
ASunCluster HAfor PostgreSQLfault monitor is contained ineach resource that represents the
PostgreSQLinstance.You created these resources whenyou registered and configured SunCluster
HAfor PostgreSQL.For more information,see “Registering and Configuring SunCluster HAfor
PostgreSQL” onpage 26.
Systemproperties and extensionproperties of the PostgreSQLresources control the behavior of the
fault monitor.The default values of these properties determine the preset behavior of the fault
monitor.Because the preset behavior should be suitable for most SunCluster installations,tune the
SunCluster HAfor PostgreSQLfault monitor only if you need to modify this preset behavior.
Tuning the SunCluster HAfor PostgreSQLfault monitor involves the following tasks:

Setting the returnvalue for failed PostgreSQLmonitor connections

Setting the interval betweenfault monitor probes

Setting the time-out for fault monitor probes

Defining the criteria for persistent faults

Specifying the failover behavior of a resource
The fault monitor SunCluster HAfor PostgreSQLdifferentiates betweenconnectionproblems and
definitive applicationfailures.The value of NOCONRET inthe PostgreSQLparameter file specifies the
returncode for connectionproblems.This value results ina certainamount of ignored consecutive
failed probes as long as they all returnthe value of NOCONRET.The first successful probe reverts this
“failed probe counter” back to zero.The maximumnumber of failed probes is calculated as
100/NOCONRET.Adefinitive application failure will result in an immediate restart or failover.
The definitionof the returnvalue NOCONRET defines one of two behaviors for failed database
connections of a PostgreSQLresource.
1.Retry the connectionto the test database several times before considering the PostgreSQL
resource as failed and triggering a restart or failover.
2.Complainat every probe that the connectionto the test database failed.No restart or failover will
be triggered.
To achieve either of these behaviors,you need to consider the standard resource properties
retry_interval and thorough_probe_interval.

A“just complaining” probe is achieved as soonas the following inequationis true:
retry_interval < thorough_probe_interval *100/NOCONRET

As soon as this inequation is false,the PostgreSQLresource restarts or fails over after 100/
NOCONRET consecutive probe failures.
Tuningthe SunCluster HAfor PostgreSQLFault Monitor
SunCluster Data Service for PostgreSQLGuide for Solaris OS • December 2006,RevisionA38
The value 100/NOCONRET defines the maximumnumber of retries for the probe inthe case of a failed
connection.
Assume that the following resource parameters are set:

thorough_probe_interval=60

retry_interval=900

NOCONRET=10
If you encounter,for example,a shortage of available database sessions for 7 minutes,you will see 7
complaints in/var/adm/messages,but no resource restart.If the shortage lasts 10 minutes,you will
have a restart of the PostgreSQLresource after the 10th probe.
If you do not want a resource restart inthe previous example,set the value of NOCONRET=10 to 5 or
less.
For more information,see “Tuning Fault Monitors for SunCluster Data Services” in Sun Cluster
Data Services Planning and Administration Guide for Solaris OS.
Operationof theSunCluster HAfor PostgreSQL
Parameter File
The SunCluster HAfor PostgreSQLresources use a parameter file to pass parameters to the start,
stop,and probe commands.Changes to these parameters take effect at least at every restart or
enabling,disabling of the resource.
Changing one of the following parameters,takes effect at the next probe of the PostgreSQLresource:

USER

PGROOT

PGPORT

LD_LIBRARY_PATH

SCDB

SCUSER

SCTABLE

SCPASS

NOCONRET
Note –
Afalse change of the parameters withanenabledPostgreSQLresource might result inan
unplanned service outage.Therefore,disable the PostgreSQLresource first,execute the change,and
thenre-enable the resource.
Tuningthe SunCluster HAfor PostgreSQLFault Monitor
InstallingandConfiguringSunCluster HAfor PostgreSQL 39
Operationof theFault Monitor for SunCluster HAfor
PostgreSQL
The fault monitor for SunCluster HAfor PostgreSQLensures that all the requirements for the zone
boot component to runare met:

The SunCluster HAfor PostgreSQLmainpostmaster process is running.
If this process is not running,the fault monitor restarts the PostgreSQLdatabase server.If the
fault persists,the fault monitor fails over the resource group that contains the resource for the
PostgreSQL.

Connections to the PostgreSQLdatabase server are possible,and the database catalog is
accessible.
If the connectionfails,the probe exits with the connectionfailed returncode NOCONRET.If the
database catalog is not accessible,the fault monitor restarts the PostgreSQLresource.

The test database is healthy.
If the test table inthe test database canbe manipulated,the database server is considered healthy.
If table manipulationfails,it is differentiated,whether the problemwas a connectionerror or the
database manipulationwas unsuccessful for any other reason.
If the connectionwas impossible the probe exits with the connectionfailed returncode
NOCONRET.If the table manipulationitself was unsuccessful,the fault monitor triggers a restart or
a failover the PostgreSQLdatabase server resource.
DebuggingSunCluster HAfor PostgreSQL
SunCluster HAfor PostgreSQLhas a file named config that enables you to activate debugging for
PostgreSQLresources.This file is inthe/opt/SUNWscPostgreSQL/etc directory.

HowtoActivateDebuggingfor SunCluster HAfor
PostgreSQL
Determinewhether youareinaglobal zoneor inafailover zoneconfiguration.
If your operating systemis Solaris 10 and your PostgreSQLresource is dependent ona Solaris
Container boot component resource,you are ina failover zone configuration.Inany other case,
especially ona Solaris 9 system,you are ina global zone configuration.
Determinewhether debuggingfor SunCluster HAfor PostgreSQLis active.
#grep daemon/etc/syslog.conf
*.err;kern.debug;daemon.notice;mail.crit/var/adm/messages
1
2
DebuggingSunCluster HAfor PostgreSQL
SunCluster Data Service for PostgreSQLGuide for Solaris OS • December 2006,RevisionA40
*.alert;kern.err;daemon.err operator
#
If debugging is inactive,daemon.notice is set inthe file/etc/syslog.conf of the appropriate zone.
If debuggingis inactive,edit the/etc/syslog.conf fileintheappropriatezonetochange
daemon.noticetodaemon.debug.
Confirmthat debuggingfor SunCluster HAfor PostgreSQLis active.
If debugging is active,daemon.debug is set inthe file/etc/syslog.conf.
#grep daemon/etc/syslog.conf
*.err;kern.debug;daemon.debug;mail.crit/var/adm/messages
*.alert;kern.err;daemon.err operator
#
Restart thesyslogddaemonintheappropriatezone.

If your operating systemis Solaris 9,type:
#pkill -1 syslogd

If your operating systemis Solaris 10,type:
#svcadm refresh svc:/system/system-log:default
Edit the/opt/SUNWsczone/sczbt/etc/config filetochangetheDEBUG=variableaccordingtoone
of theexamples:

DEBUG=ALL

DEBUG=resource name

DEBUG=resource name,resource name,...
#cat/opt/SUNWscPostgreSQL/etc/config
#
#Copyright 2006 Sun Microsystems,Inc.All rights reserved.
#Use is subject to license terms.
#
#Usage:
#DEBUG=<RESOURCE_NAME> or ALL
#
DEBUG=ALL
#
Note –
To deactivate debugging,repeat step 1 to 6,changing daemon.debug to daemon.notice and
changing the DEBUG variable to DEBUG=.
3
4
5
6
DebuggingSunCluster HAfor PostgreSQL
InstallingandConfiguringSunCluster HAfor PostgreSQL 41
42
File for ConfiguringSunCluster HAfor Solaris
PostgreSQLResources
The/opt/SUNWscPostgreSQL/util directory contains files that automate the process of configuring
SunCluster HAfor PostgreSQLresources.These files include a registrationscript,a database
preparationscript,and a configurationfile,to provide parameters for the first two scripts.This
appendix shows a listing of the configurationfile.
Listingof pgs_config
#
#Copyright 2006 Sun Microsystems,Inc.All rights reserved.
#Use is subject to license terms.
#
#This file will be sourced in by pgs_register and the parameters
#listed below will be used.
#
#These parameters can be customized in (key=value) form
#
#RS - name of the resource for the application.
#RG - name of the resource group containing RS.
#PORT - name of the port number.
#Do not set the PORT variable if you plan to have a network
#unaware installation,or an installation in a failover zone.
#LH - name of the LogicalHostname SC resource.
#Do not set the LH variable if you plan to have a network
#unaware installation,or an installation in a failover zone.
#HAS_RS - Name of the HAStoragePlus SC resource.
#PFILE - Parameter file which contains the PostgreSQL specific
#parameters,this file will be created by the register script.
#
#The following variables need to be set only,if the agent runs in a
#failover zone
#
#ZONE - Zonename where the zsmf component should be registered
A
A P P E N D I X A
43
#ZONE_BT - Resource name of the zone boot component
#PROJECT - A project in the zone,that will be used for the PostgreSQL
#smf service.
#If the variable is not set it will be translated as:default for
#the smf credentials.
#Optional
#
RS=
RG=
PORT=
LH=
HAS_RS=
PFILE=
#failover zone specific options
ZONE=
ZONE_BT=
PROJECT=
#
#Content for the parameter file
#
#USER - The Solaris user which owns the PostgreSQL database.
#PGROOT - Contains the path to the PostgreSQL directory.Below this
#directory the postgres binaries are located in the./bin
#directory.
#PGDATA - Contains the path to the databases of this specific PostgreSQL
#instance.
#PGPORT - Port where the postmaster process will be listening to.
#PGLOGFILE - Logfile where the log messages of the postmaster will be stored.
#LD_LIBRARY_PATH - This path contains all the necessary libraries for this PostgreSQL
#installation.
#Optional
#ENVSCRIPT - Script to contain PostgreSQL specific runtime variables.
#Optional
#SCDB - This database will be monitored.The database will be generated at
#database preparation time.
#SCUSER - PostgresSQL user to connect to the $SCDB database.The user will be
#generated at database preparation time.
#SCTABLE - Table name in the $SCDB database.This table name will be manipulated
#to check if PostgreSQL is alive.This table will be generated at database
#preparation time.
#SCPASS - Password of the SCUSER
#Optional
#NOCONRET - Return code for connection errors.This return code has to follow the
#rules for the generic data service.The value has to be between 1 and 100.
Listingof pgs_config
SunCluster Data Service for PostgreSQLGuide for Solaris OS • December 2006,RevisionA44
#100/NOCONRET defines the number of consecutive probes to ignore for
#failed connections.A restart or failover will occur,if the number is
#exeeded within the retry interval.
USER=
PGROOT=
PGDATA=
PGPORT=
PGLOGFILE=
LD_LIBRARY_PATH=
ENVSCRIPT=
SCDB=
SCUSER=
SCTABLE=
SCPASS=
NOCONRET=10
Listingof pgs_config
AppendixA • File for ConfiguringSunCluster HAfor Solaris PostgreSQLResources 45
46
Deployment Example:InstallingPostgreSQLin
the Global Zone
This appendix presents a complete example of howto install and configure the PostgreSQL
applicationand data service inthe global zone.It presents a simple two-node cluster configuration.If
you need to install the applicationinany other configuration,refer to the general-purpose
procedures presented elsewhere inthis manual.For anexample of PostgreSQLinstallationina
non-global zone,see Appendix D,for a nonglobal zone,see Appendix C.
Target Cluster Configuration
This example uses a two-node cluster with the following node names:

phys-schost-1 (a physical node,which owns the file system)

phys-schost-2 (a physical node)
This configurationalso uses the logical host name ha-host-1.
SoftwareConfiguration
This deployment example uses the following software products and versions:

Solaris 10 6/06 software for SPARCor x86 platforms

SunCluster 3.2 core software

SunCluster Data Service for PostgreSQL

PostgreSQLversion8.1.0 source files

readline

gmake

Your preferred text editor

Your preferred Ccompiler
This example assumes that you have already installed and established your cluster.It illustrates
installationand configurationof the data service applicationonly.
B
A P P E N D I X B
47
Note –
The steps for installing PostgreSQLina cluster that runs onSolaris version9 OS are identical
to the steps inthis example.
Assumptions
The instructions inthis example were developed with the following assumptions:

Shell environment:All commands and the environment setup inthis example are for the Korn
shell environment.If you use a different shell,replace any Kornshell-specific informationor
instructions with the appropriate informationfor you preferred shell environment.

User login:Unless otherwise specified,performall procedures as superuser or assume a role that
provides solaris.cluster.admin,solaris.cluster.modify,and solaris.cluster.read
RBACauthorization.
InstallingandConfiguringPostgreSQLonSharedStoragein
theGlobal Zone
The tasks you must performto install and configure PostgreSQLinthe global zone are as follows:

“Example:Preparing the Cluster for PostgreSQL” onpage 48

“Example:Configuring Cluster Resources for PostgreSQL” onpage 49

“Example:Modifying the PostgreSQLConfigurationFile” onpage 49

“Example:Building and Installing the PostgreSQLSoftware onShared Storage” onpage 50

“Example:Enabling the PostgreSQLSoftware to Runinthe Cluster” onpage 51

Example:PreparingtheCluster for PostgreSQL
Install andconfigure the cluster as instructedinSunCluster Software InstallationGuide for Solaris
OS.
Install the following cluster software components onboth nodes.

SunCluster core software

SunCluster data service for PostgreSQL
Install thefollowingutilitysoftwareonbothnodes:

readline

gmake

Your Ccompiler
1
2
Assumptions
SunCluster Data Service for PostgreSQLGuide for Solaris OS • December 2006,RevisionA48
Beginningonthenodethat owns thefilesystem,addthepostgresuser.
phys-schost-1#groupadd -g 1000 postgres
phys-schost-2#groupadd -g 1000 postgres