Skip to content

Resource agent for postgresql 9.2 for disaster(split) site

Takatoshi MATSUO edited this page Nov 2, 2013 · 4 revisions

figure figure

sample setting of crm for split site

property no-quorum-policy="ignore" \
    stonith-enabled="false" \
    startup-fencing="false" \
    stonith-timeout="710s"

rsc_defaults resource-stickiness="INFINITY" \
    migration-threshold="1"

group grpPostgreSQLDB1 \
    prmIpPostgreSQLDB1 \
    prmApPostgreSQLDB1

group grpPostgreSQLDB2 \
    prmIpPostgreSQLDB2 \
    prmApPostgreSQLDB2 \
    meta \
        resource-stickiness="1"

### Primitive Configuration ###
## PostgreSQL1
primitive prmIpPostgreSQLDB1 ocf:heartbeat:IPaddr2 \
    params \
        ip="192.168.3.202" \
        nic="eth0" \
        cidr_netmask="24" \
    op start interval="0s" timeout="60s" on-fail="restart" \
    op monitor interval="10s" timeout="60s" on-fail="restart" \
    op stop interval="0s" timeout="60s" on-fail="block"

primitive prmApPostgreSQLDB1 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/" \
        start_opt="-p 5432" \
        rep_mode="slave" \
        master_ip="192.168.3.104" \
        restore_command="scp [email protected]:/var/lib/pgsql/9.2/data/pg_archive/%f %p" \
        primary_conninfo_opt="keepalives_idle=60 keepalives_interval=5 keepalives_count=5" \
    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"


## PostgreSQL2
primitive prmIpPostgreSQLDB2 ocf:heartbeat:IPaddr2 \
    params \
        ip="192.168.3.203" \
        nic="eth0" \
        cidr_netmask="24" \
    op start interval="0s" timeout="60s" on-fail="restart" \
    op monitor interval="10s" timeout="60s" on-fail="restart" \
    op stop interval="0s" timeout="60s" on-fail="block"

primitive prmApPostgreSQLDB2 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/" \
        start_opt="-p 5432" \
        rep_mode="slave" \
        master_ip="192.168.3.202" \
        restore_command="scp [email protected]:/var/lib/pgsql/9.2/data/pg_archive/%f %p" \
        primary_conninfo_opt="keepalives_idle=60 keepalives_interval=5 keepalives_count=5" \
    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"

### Resource Location ###
location rsc_location-grpPostgreSQLDB-1 grpPostgreSQLDB1 \
    rule 200: #uname eq 02-sl6 \
    rule 100: #uname eq 03-sl6

location rsc_location-grpPostgreSQLDB-2 grpPostgreSQLDB2 \
    rule 200: #uname eq 03-sl6 \
    rule -INFINITY: #uname eq 02-sl6

### Resource Colocation ###
colocation rsc_colocation-ex1 -INFINITY: grpPostgreSQLDB2 grpPostgreSQLDB1

### Resource Order ###
order rsc_order1 0: grpPostgreSQLDB2:stop grpPostgreSQLDB1:start symmetrical=false
order rsc_order2 0: grpPostgreSQLDB1:stop grpPostgreSQLDB2:start symmetrical=false