t-matsuo / resource-agents

pgsql RA(ocf resource agent) for Pacemaker and PostgreSQL streaming replication. See https://github.com/t-matsuo/resource-agents/wiki
https://github.com/t-matsuo/resource-agents/wiki
GNU General Public License v2.0
118 stars 11 forks source link

even if pgsql don't run - "pgsql-data-status" will defined. #27

Open greenx opened 11 years ago

greenx commented 11 years ago

Hi, again!

I continue experiments with cluster on two node + quorum node. Today I build next schema:

  1. on quorum node set attibute:
crm_attribute --type nodes --node-uname dev-cluster2-node2 --attr-name quorumnode -v yes -l forever

or

node attribute dev-cluster2-node2 set quorumnode yes
  1. Next, build you standart schema. But set all clone-max=N-1 and define location:
location rsc_location-3 msPostgresql \
rule -inf: not_defined default_ping_set or default_ping_set lt 100 \
rule -inf: defined quorumnode
location quorumban pingCheck \
rule -inf: defined quorumnode

Everything looks right.

# crm_mon -1n
Last updated: Wed Aug 21 17:44:36 2013
Last change: Wed Aug 21 16:33:07 2013 via crm_attribute on dev-cluster2-node4
Stack: cman
Current DC: dev-cluster2-node4 - partition with quorum
Version: 1.1.11-1.el6-4f672bc
3 Nodes configured
5 Resources configured

Node dev-cluster2-node2: online
Node dev-cluster2-node3: online
        pgsql   (ocf::heartbeat:pgsql): Started
        pingCheck       (ocf::pacemaker:ping):  Started
Node dev-cluster2-node4: online
        pgsql   (ocf::heartbeat:pgsql): Master
        pingCheck       (ocf::pacemaker:ping):  Started
        master-ip       (ocf::heartbeat:IPaddr2):       Started

Even a .... crn_resource display resources without status "stopped"

# crm_resource --list
 master-ip      (ocf::heartbeat:IPaddr2):       Started
 Master/Slave Set: msPostgresql [pgsql]
     Masters: [ dev-cluster2-node4.unix.tensor.ru ]
     Slaves: [ dev-cluster2-node3.unix.tensor.ru ]
 Clone Set: clnPingCheck [pingCheck]
     Started: [ dev-cluster2-node3.unix.tensor.ru dev-cluster2-node4.unix.tensor.ru ]

....except that the attribute is still set.

# crm_mon -A1
Last updated: Wed Aug 21 17:48:09 2013
Last change: Wed Aug 21 16:33:07 2013 via crm_attribute on dev-cluster2-node4
Stack: cman
Current DC: dev-cluster2-node4 - partition with quorum
Version: 1.1.11-1.el6-4f672bc
3 Nodes configured
5 Resources configured

Online: [ dev-cluster2-node2 dev-cluster2-node3 dev-cluster2-node4 ]

 master-ip      (ocf::heartbeat:IPaddr2):       Started dev-cluster2-node4
 Master/Slave Set: msPostgresql [pgsql]
     Masters: [ dev-cluster2-node4 ]
     Slaves: [ dev-cluster2-node3 ]
 Clone Set: clnPingCheck [pingCheck]
     Started: [ dev-cluster2-node3 dev-cluster2-node4 ]

Node Attributes:
* Node dev-cluster2-node2:
    + pgsql-data-status                 : DISCONNECT
    + quorumnode                        : yes
* Node dev-cluster2-node3:
    + default_ping_set                  : 100
    + master-pgsql                      : -INFINITY
    + pgsql-data-status                 : STREAMING|ASYNC
    + pgsql-status                      : HS:async
* Node dev-cluster2-node4:
    + default_ping_set                  : 100
    + master-pgsql                      : 1000
    + pgsql-data-status                 : LATEST
    + pgsql-master-baseline             : 0000000002000078
    + pgsql-status                      : PRI
greenx commented 11 years ago

Damn, I already found the answer to my question :) HostList need to write only the necessary components. But I've been thinking ... we obtained in two places indicate the desired node. In pgsql - nodelist and then clone.

t-matsuo commented 11 years ago

Damn, I already found the answer to my question :) HostList need to write only the necessary components.

Yes !

But I've been thinking ... we obtained in two places indicate the desired node. In pgsql - nodelist and then clone.

Which nodelist ? In corosync.conf ? It indicate all nodes which participate in cluster. RA needs only hostname which participate in streaming replication to control slaves.

greenx commented 11 years ago

No, fisrt in primitive node_list and second, when the call "ms msPostgres pgsql"

t-matsuo commented 11 years ago

Sorry, I mistook.

HostList is /etc/hosts ? Pgsql RA doesn't always need HostList. It needs node_list to control slaves.

If you use recent pacemaker 1.1.x and set hostname in /etc/hosts or corosync.conf, it may cause discrepancy, because recent pacemaker gets node name from them if exists. But pgsql RA always gets node name using "uname -n".

FYI, RA can't get node names from setting of msPostgres.