In a shell script, we currently call /usr/sbin/pcs status cluster and then grep -qE for 'Current DC:.*partition with quorum' to find out if the cluster is fine.

I would like to know if there is a quicker way, because pcs status cluster makes it query all nodes for their PCSD status, which takes time, about a second and a half, and I want to do this check before doing certain operations which are to be done quite often.

Would pcs status nodes both and counting the number of online nodes be equally good for deciding if the cluster is functioning without issues?

This takes ~2 seconds: pcs status cluster 2>&1 | grep -qE 'Current DC:.*partition with quorum'

This takes ~0.2 seconds: pcs status nodes both | grep -cE 'Online: [a-z]+ [a-z]+ [a-z]+'

(The cluster has 5 nodes, hence the three node names in the regular expression).


This takes ~0.02 seconds: corosync-quorumtool 2>&1 | grep -q -E '^Quorate:.*Yes$'

Thank you Matt Kereczman!


Assuming you're using Corosync, you can use corosync-quorumtool:

# corosync-quorumtool -s
  Quorum information
  Date:             Wed Sep 27 07:16:18 2017
  Quorum provider:  corosync_votequorum
  Nodes:            2
  Node ID:          1
  Ring ID:          76
  Quorate:          Yes

  Votequorum information
  Expected votes:   2
  Highest expected: 2
  Total votes:      2
  Quorum:           1  
  Flags:            2Node Quorate WaitForAll 

  Membership information
      Nodeid      Votes Name
           1          1 (local)
           2          1

EDIT: And then just check that Quorate reports Yes.

| improve this answer | |
  • 1
    Perfect! But I'll check for "Quorate: Yes", instead, or for "Quorate" amongst the "Flags:" Quorum is most likely the number of votes needed to be quorate (showing 3 in my case). – MattBianco Sep 29 '17 at 5:41
  • @MattBianco: yes, that's definitely the better thing to check ;) – Matt Kereczman Sep 29 '17 at 14:26
  • @MattBianco I updated the answer per your comment for the future people. – Matt Kereczman Sep 29 '17 at 14:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.