t's this?

This is a scripts to integrate pgpool and heartbeat. Pgpool is a
replication server of PostgreSQL and makes reliability ,but pgpool
is a single point failure . To avoid this , run pgpool over heartbeat. 

This software contains:

-OCF style scripts for heartbeat, nesseary to run pgpool over heartbeat.
-A monitoring script for pgpool. 


2. Requirement

- heartbeat
 2.0+ required.

- pgpool
 Tested on 3.0+ only , but It will work if 'show pool_status' command was
supported.
 pgpool.conf on default path is only supported.

- PostgreSQL client installation.
 'psql' also required for install hosts . 'postmaster' doesn't required.

- perl
 Need 5.0+ and GetOpt::Long.

3. using

After install this , pgpool can be used as heartbeat OCF-style 
resources. See Heartbeat site.

http://linux-ha.org/ConfiguringHeartbeat
http://linux-ha.org/ClusterInformationBase/


-ha.cf 
Set 'crm' to true , to use Cluster Resource Manager (CRM) to 
monitor pgpool .

--
crm true
--

Other setting is depends on your configuration.

-cib.xml

There's sample cib.xml file. 

* Modify 'node1' and 'node2' to your hostname, '192.168.0.3' to your floating IP address . 
* Put it to /var/lib/heartbeat/crm/ . Of cource this path is depends on your
heartbeat installation.

-----Sample cib.xml start

<cib generated="true" admin_epoch="0" have_quorum="true" num_peers="2"
ccm_trans
ition="4" cib_feature_revision="1.2" crm_feature_set="1.0.4"
debug_source="sync_
our_cib" dc_uuid="cf40f895-0e3c-4847-b8b3-6ae1fad7921f" last_written="Mon Jul
24
 07:25:00 2006" epoch="42" num_updates="1521">
   <configuration>
     <crm_config>
       <cluster_property_set id="deafult">
         <attributes>
           <nvpair id="symmetric_cluster" name="symmetric_cluster"
value="true"/
>
           <nvpair id="no_quorum_policy" name="no_quorum_policy"
value="stop"/>
           <nvpair id="default_resource_stickiness"
name="default_resource_stick
iness" value="0"/>
           <nvpair id="stonith_enabled" name="stonith_enabled" value="false"/>
           <nvpair id="stop_orphan_resources" name="stop_orphan_resources"
value
="false"/>
           <nvpair id="stop_orphan_actions" name="stop_orphan_actions"
value="tr
ue"/>
           <nvpair id="remove_after_stop" name="remove_after_stop"
value="false"
/>
           <nvpair id="short_resource_names" name="short_resource_names"
value="
true"/>
           <nvpair id="transition_idle_timeout" name="transition_idle_timeout"
v
alue="5min"/>
           <nvpair id="is_managed_default" name="is_managed_default"
value="true
"/>
         </attributes>
       </cluster_property_set>
     </crm_config>
     <nodes>
       <node id="cf40f895-0e3c-4847-b8b3-6ae1fad7921f" uname="node1"
type="norma
l"/>
       <node id="3e919e96-e476-4d3e-be05-0048b9e12a56" uname="node2"
type="norma
l"/>
     </nodes>
     <resources>
           </operations>
           <instance_attributes>
             <attributes>
               <nvpair id="IPaddr_1_attr_0" name="ip" value="192.168.0.3"/>
             </attributes>
           </instance_attributes>
         </primitive>
         <primitive class="ocf" id="pgpool_2" provider="heartbeat"
type="pgpool"
>
           <operations>
             <op id="pgpool_2_mon" interval="30s" name="monitor"
timeout="20s"/>
           </operations>
         </primitive>
       </group>
     </resources>
     <constraints>
       <rsc_location id="rsc_location_group_1" rsc="group_1">
         <rule id="prefered_location_group_1" score="100">
           <expression attribute="#uname" id="prefered_location_group_1_expr"
op
eration="eq" value="node1"/>
         </rule>
       </rsc_location>
     </constraints>
   </configuration>
 </cib>

----- Sample cib.xml end.

-pgpool.conf

Put pgpool.conf on pgpool's default config file path (e.g. 
/usr/local/etc/pgpool.conf). Following entries will be referrenced 
to  monitor pgpool.

*port

Used to determine connecting port.

*health_check_user

used to connecting user and database. Make sure your PostgreSQL has same
user/role ,database and pg_hba.conf entry to connect from pgpool host by
"trust" authentication.

4. Restriction

* PostgreSQL is never conrolled. You must start/stop manually.
* In pgpool-ha, pgpool is monitored , but PostgreSQL is not . If your
  pgpool becomes something wrong but can accept SQL , pgpool-ha can't handle.
* If pgpool work but PostgreSQL is not avaliable , pgpool will failover.

5. Licences

BSD-like. see ../COPYING file. 


