[Pacemaker] Postresql streaming replication support

Keith Ouellette Keith.Ouellette at Airgas.com
Wed Jan 9 22:27:46 EST 2013

Thank you. I wish I could have seen the presentation. In my case, the two nodes are in two different US cities connected by a bridged VPN. I do not have the ability to have separate connection for pacemaker, replication and access. 

I tried to scale the configuration back to support one VIP, Here is the XML output of what I tried, but the service does not even come up. 

      <primitive class="ocf" id="ClusterIP" provider="heartbeat" type="IPaddr2">
        <meta_attributes id="ClusterIP-meta_attributes">
          <nvpair id="ClusterIP-meta_attributes-target-role" name="target-role" value="Started"/>
        <operations id="ClusterIP-operations">
          <op id="ClusterIP-op-monitor-10s" interval="10s" name="monitor" timeout="20s"/>
        <instance_attributes id="ClusterIP-instance_attributes">
          <nvpair id="ClusterIP-instance_attributes-ip" name="ip" value=""/>
          <nvpair id="ClusterIP-instance_attributes-cidr_netmask" name="cidr_netmask" value="24"/>
      <primitive class="ocf" id="pgsql" provider="heartbeat" type="pgsql">
        <meta_attributes id="pgsql-meta_attributes">
          <nvpair id="pgsql-meta_attributes-target-role" name="target-role" value="Started"/>
        <operations id="pgsql-operations">
          <op id="pgsql-op-start-0" interval="0" name="start" on-fail="restart" timeout="120"/>
          <op id="pgsql-op-monitor-7" interval="7" name="monitor" on-fail="restart" timeout="60"/>
          <op id="pgsql-op-monitor-Master-60" interval="60" name="monitor" on-fail="restart" role="Master" timeout="30"/>
          <op id="pgsql-op-promote-0" interval="0" name="promote" on-fail="restart" timeout="60"/>
          <op id="pgsql-op-stop-0" interval="0" name="stop" on-fail="block" timeout="60"/>
          <op id="pgsql-op-demote-0" interval="0" name="demote" on-fail="block" timeout="60"/>
          <op id="pgsql-op-notify-0" interval="0" name="notify" timeout="60"/>
        <instance_attributes id="pgsql-instance_attributes">
          <nvpair id="pgsql-instance_attributes-pgctl" name="pgctl" value="/opt/PostgreSQL/9.2/bin/pg_ctl"/>
          <nvpair id="pgsql-instance_attributes-psql" name="psql" value="/opt/PostgreSQL/9.2/bin/psql"/>
          <nvpair id="pgsql-instance_attributes-pgdata" name="pgdata" value="/opt/PostgreSQL/9.2/data/"/>
          <nvpair id="pgsql-instance_attributes-start_opt" name="start_opt" value="-p 5432"/>
          <nvpair id="pgsql-instance_attributes-rep_mode" name="rep_mode" value="sync"/>
          <nvpair id="pgsql-instance_attributes-node_list" name="node_list" value="test-db1 test-db2"/>
          <nvpair id="pgsql-instance_attributes-restore_command" name="restore_command" value="cp /opt/PostgreSQL/9.2/data/archive/%f %p"/>
          <nvpair id="pgsql-instance_attributes-primary_conninfo_opt" name="primary_conninfo_opt" value="keepalives_idle=60 keepalives_interval=5 keepalives_count=5"/>
          <nvpair id="pgsql-instance_attributes-master_ip" name="master_ip" value=""/>
          <nvpair id="pgsql-instance_attributes-stop_escalate" name="stop_escalate" value="0"/>
      <rsc_location id="rsc-location-1" rsc="ClusterIP">
        <rule id="rsc-location-1-rule" score="200">
          <expression attribute="pgsql-status" id="rsc-location-1-rule-pgsql-status" operation="eq" value="HS:sync"/>
        <rule id="rsc-location-1-rule-0" score="100">
          <expression attribute="pgsql-status" id="rsc-location-1-rule-0-pgsql-status" operation="eq" value="PRI"/>
        <rule id="rsc-location-1-rule-1" score="-INFINITY">
          <expression attribute="pgsql-status" id="rsc-location-1-rule-1-pgsql-status" operation="not_defined"/>
        <rule boolean-op="and" id="rsc-location-1-rule-2" score="-INFINITY">
          <expression attribute="pgsql-status" id="rsc-location-1-rule-2-pgsql-status" operation="ne" value="HS:sync"/>
          <expression attribute="pgsql-status" id="rsc-location-1-rule-2-pgsql-status-0" operation="ne" value="PRI"/>
      <rsc_location id="rsc-location-2" rsc="pgsql">
        <rule id="rsc-location-2-rule" role="Master" score="200">
          <expression attribute="#uname" id="rsc-location-2-rule-.uname" operation="eq" value="test-db1"/>
        <rule id="rsc-location-2-rule-0" role="Master" score="100">
          <expression attribute="#uname" id="rsc-location-2-rule-0-.uname" operation="eq" value="test-db2"/>
        <rule id="rsc-location-2-rule-1" role="Master" score="-INFINITY">
          <expression attribute="fail-count-ClusterIP" id="rsc-location-2-rule-1-fail-count-ClusterIP" operation="defined"/>
        <rule boolean-op="or" id="rsc-location-2-rule-2" score="-INFINITY">
          <expression attribute="default_ping_set" id="rsc-location-2-rule-2-default_ping_set" operation="not_defined"/>
          <expression attribute="default_ping_set" id="rsc-location-2-rule-2-default_ping_set-0" operation="lt" value="100"/>
      <rsc_colocation id="rsc_colo-1" rsc="pgsql" score="INFINITY" with-rsc="ClusterIP"/>
      <rsc_order first="ClusterIP" first-action="start" id="rsc_order_1" symmetrical="false" then="pgsql" then-action="promote"/>
Any ideas?


From: Takatoshi MATSUO [matsuo.tak at gmail.com]
Sent: Wednesday, January 09, 2013 8:23 PM
To: The Pacemaker cluster resource manager
Subject: Re: [Pacemaker] Postresql streaming replication support

Hi Keith

I don't write detailed documentation.
But I spoke about it using this slide.


Did you read it?

I translated it into English.
Please click "English version is here : PG-study" to download it.
(Sorry for bad translation)

Takatoshi MATSUO

2013/1/10 Keith Ouellette <Keith.Ouellette at airgas.com>
> Jesse,
>    Thank you for the quick response. Actually yes, the example given at the link below shows several connections between the two (cross-overs).  We only have one connection between the two nodes with a bridged VPN.
> The example has an S-LAN, D-LAN and an IC-LAN. I only have one LAN available to me with a bridge VPN between the two routers. I tried to skinny the configuration to a single virtual IP primitive called "ClusterIP", but I think there are some other dependancies in the example that I am not seeing as it did not work, meaning the resources did not start.  Is there another place I can go that may provide more detailed documentation that may help me with my configuration?
> Keith
> ________________________________
> From: Jesse Hathaway [jesse.hathaway at getbraintree.com]
> Sent: Wednesday, January 09, 2013 2:09 PM
> To: The Pacemaker cluster resource manager; Jesse Hathaway
> Subject: Re: [Pacemaker] Postresql streaming replication support
> On Wed, Jan 9, 2013 at 12:56 PM, Keith Ouellette <Keith.Ouellette at airgas.com> wrote:
>>   Now I am trying to get that integrated with pacemaker. In my searches, I see that pacemaker with DRBD seems to be the prevelant implementation an most documentation was written around that. However, due to our network conditions, I am looking for information on doing this with WAL. I did find a resource agent that was wirtten for what I am doing (https://github.com/t-matsuo/resource-agents/wiki/Resource-Agent-for-PostgreSQL-9.1-streaming-replication). The issue is the example if complex with the explanation written only toward that example. Is there another place that I can get documentation  on this resource agent? Is there another way that this could be accmoplished that someone has tried?
> Keith we are using the above resource agent in production with streaming replication. Do you have any specific questions about its usage?
> --
> Jesse Hathaway, Systems Engineer
> Braintree
> 917-418-8423
> _______________________________________________
> Pacemaker mailing list: Pacemaker at oss.clusterlabs.org
> http://oss.clusterlabs.org/mailman/listinfo/pacemaker
> Project Home: http://www.clusterlabs.org
> Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
> Bugs: http://bugs.clusterlabs.org

Pacemaker mailing list: Pacemaker at oss.clusterlabs.org

Project Home: http://www.clusterlabs.org
Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
Bugs: http://bugs.clusterlabs.org

More information about the Pacemaker mailing list