[Pacemaker] configuring postgresql streaming replication cluster

Takatoshi MATSUO matsuo.tak at gmail.com
Wed Jun 12 05:59:34 UTC 2013


Hi Gregg

Can you show me the output of  "crm_mon -Afr" ?
And please see pacemaker log.
Pgsql RA may output some reasons why slave cann't be promoted.

Thanks,
Takatoshi MATSUO

2013/6/12 Andrew Beekhof <andrew at beekhof.net>:
>
> On 11/06/2013, at 10:05 PM, Gregg Jaskiewicz <gryzman at gmail.com> wrote:
>
>> Hi guys,
>>
>> I'm trying to wrap my head around the pacemaker, and setting up postgresql cluster using pcs on centos 6.4.
>>
>> I used so far following commands to set it up. And this seems to work, but all nodes are running as slaves (postgresql wise).
>> The 'master' node (IP address wise) even connects to itself to replicate (that's a bit of a snafu in postgresql for allowing it).
>>
>> So question is, how can this be improved, what did I miss, and why doesn't postgresql master get promoted to be 'master' on the 'master' node?
>
> There is no 'master' node.  Just nodes on which some things are running.
> Does the postgresql agent call crm_master?  Thats the mechanism by which pacemaker knows which instance to promote
>
>>
>>
>> pcs property set stonith-enabled=false
>> pcs property set no-quorum-policy=ignore
>>
>> pcs resource rsc defaults resource-stickiness="INFINITY" migration-threshold="1"
>>
>> # add virtual IP resource for postgres services master
>> pcs resource create vip-master ocf:heartbeat:IPaddr2 params ip=10.0.0.100 nic=eth1:0 cidr_netmask=24 meta migration-threshold=0 \
>>    op start   timeout=60s interval=0s  on-fail=restart \
>>    op monitor timeout=60s interval=10s on-fail=restart \
>>    op stop    timeout=60s interval=0s  on-fail=block
>>
>> # add virtual IP resource for postgres replication master_ip
>> pcs resource create vip-rep ocf:heartbeat:IPaddr2 params ip=10.0.1.100 nic=eth2:0 cidr_netmask=24 meta migration-threshold=0 \
>>    op start   timeout=60s interval=0s  on-fail=restart \
>>    op monitor timeout=60s interval=10s on-fail=restart \
>>    op stop    timeout=60s interval=0s  on-fail=block
>>
>> # Group them up
>> pcs resource group add master-group vip-master vip-rep
>>
>> # Start it
>> pcs resource start master-group
>>
>> # PostgreSQL stuff
>> pcs resource create pgsql ocf:heartbeat:pgsql \
>>      params pgctl="/usr/pgsql-9.2/bin/pg_ctl" psql="/usr/pgsql-9.2/bin/psql" pgdata="/var/lib/pgsql/9.2/data/" \
>>      restore_command="cp /var/lib/pgsql/9.2/data/pg_archive/\%f \%p" \
>>      start_opt="-p 5432" \
>>      rep_mode="async" \
>>      node_list="hanode01 hanode02" \
>>      primary_conninfo_opt="keepalives_idle=60 keepalives_interval=5 keepalives_count=5" \
>>      master_ip="10.0.1.100" \
>>      stop_escalate="0" \
>>  op start   timeout="60s" interval="0s"  on-fail="restart" \
>>  op monitor timeout="60s" interval="7s"  on-fail="restart" \
>>  op monitor timeout="60s" interval="2s"  on-fail="restart" role="Master" \
>>  op promote timeout="60s" interval="0s"  on-fail="restart" \
>>  op demote  timeout="60s" interval="0s"  on-fail="stop" \
>>  op stop    timeout="60s" interval="0s"  on-fail="block" \
>>  op notify  timeout="60s" interval="0s"
>>
>> pcs resource master msPostgresql pgsql master-max=1 master-node-max=1 clone-max=10 clone-node-max=10 notify=true
>>
>> pcs constraint colocation add master-group msPostgresql role=Master
>>
>> # Score needs to be different, otherwise pcs thinks both lines below are trying to do the same
>> pcs constraint order start master-group  then promote msPostgresql   symmetrical=false score=2
>> pcs constraint order stop  master-group  then demote  msPostgresql   symmetrical=false score=3
>>
>> pcs  resource update pgsql repuser=rep monitor_password=lemon monitor_user=monitor
>>
>>
>> Thanks in advance !
>>
>> --
>> GJ
>> _______________________________________________
>> 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
> 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




More information about the Pacemaker mailing list