Skip to content

Instantly share code, notes, and snippets.

@nanobeep
Forked from beekhof/pcs-crmsh cheatsheet.md
Last active April 1, 2019 01:25
Show Gist options
  • Save nanobeep/d4f60ccd8b563922692638d7903c70d4 to your computer and use it in GitHub Desktop.
Save nanobeep/d4f60ccd8b563922692638d7903c70d4 to your computer and use it in GitHub Desktop.

Revisions

  1. nanobeep revised this gist Apr 1, 2019. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions pcs-crmsh cheatsheet.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    Also see the [Pacemaker Quick Ref](https://github.com/ClusterLabs/pacemaker/blob/master/doc/pcs-crmsh-quick-ref.md) for a better, more complete guide.

    ## Display the configuration

    crmsh # crm configure show
  2. nanobeep revised this gist Apr 1, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion pcs-crmsh cheatsheet.md
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@

    ## Display the current status

    crmsh # crm_mon -1
    crmsh # crm status
    pcs # pcs status

    ## Node standby
  3. @beekhof beekhof renamed this gist May 16, 2013. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  4. @beekhof beekhof revised this gist May 16, 2013. 1 changed file with 10 additions and 6 deletions.
    16 changes: 10 additions & 6 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -142,13 +142,17 @@ With roles:
    ## Batch changes

    crmsh # crm
    crmsh # cib new drbd
    crmsh # configure primitive WebData ocf:linbit:drbd params drbd_resource=wwwdata op monitor interval=60s
    crmsh # configure ms WebDataClone WebData meta master-max=1 master-node-max=1 clone-max=2 clone-node-max=1 notify=true
    crmsh # cib commit drbd
    crmsh # cib new drbd_cfg
    crmsh # configure primitive WebData ocf:linbit:drbd params drbd_resource=wwwdata \
    op monitor interval=60s
    crmsh # configure ms WebDataClone WebData meta master-max=1 master-node-max=1 \
    clone-max=2 clone-node-max=1 notify=true
    crmsh # cib commit drbd_cfg
    crmsh # quit

    pcs # pcs cluster cib drbd_cfg
    pcs # pcs -f drbd_cfg resource create WebData ocf:linbit:drbd drbd_resource=wwwdata op monitor interval=60s
    pcs # pcs -f drbd_cfg resource master WebDataClone WebData master-max=1 master-node-max=1 clone-max=2 clone-node-max=1 notify=true
    pcs # pcs -f drbd_cfg resource create WebData ocf:linbit:drbd drbd_resource=wwwdata \
    op monitor interval=60s
    pcs # pcs -f drbd_cfg resource master WebDataClone WebData master-max=1 master-node-max=1 \
    clone-max=2 clone-node-max=1 notify=true
    pcs # pcs cluster push cib drbd_cfg
  5. @beekhof beekhof revised this gist May 16, 2013. 1 changed file with 149 additions and 3 deletions.
    152 changes: 149 additions & 3 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,154 @@
    ## Display the configuration

    crmsh# crm configure show
    pcs # pcs cluster cib
    crmsh # crm configure show
    pcs # pcs cluster cib

    ## Display the current status

    crmsh # crm_mon -1
    pcs # pcs status

    ## Node standby

    crmsh # crm node standby
    pcs # pcs cluster standby pcmk-1

    crmsh # crm node online
    pcs # pcs cluster unstandby pcmk-1

    ## Setting configuration options

    crmsh:
    crmsh # crm configure property stonith-enabled=false
    pcs # pcs property set stonith-enabled=false

    ## Listing available resources

    crmsh # crm ra classes
    pcs # pcs resource standards

    crmsh # crm ra list ocf pacemaker
    pcs # pcs resource agents ocf:pacemaker

    ## Creating a resource

    crmsh # crm configure primitive ClusterIP ocf:heartbeat:IPaddr2 \
    params ip=192.168.122.120 cidr_netmask=32 \
    op monitor interval=30s
    pcs # pcs resource create ClusterIP IPaddr2 ip=192.168.0.120 cidr_netmask=32

    The standard and provider (`ocf:heartbeat`) are determined automatically since `IPaddr2` is unique.
    The monitor operation is automatically created based on the agent's metadata.

    ## Start a resource
    crmsh # crm resource start ClusterIP
    pcs # pcs resource start ClusterIP

    ## Stop a resource

    crmsh # crm resource stop ClusterIP
    pcs # pcs resource stop ClusterIP

    ## Remove a resource

    crmsh # crm configure delete ClusterIP
    pcs #

    ## Update a resource
    crmsh # crm configure edit ClusterIP
    pcs # pcs resource update ClusterIP clusterip_hash=sourceip

    ## Display a resource

    crmsh #
    pcs # pcs resource show WebFS

    ## Resource defaults

    crmsh # crm configure rsc_defaults resource-stickiness=100
    pcs # pcs rsc defaults resource-stickiness=100

    Listing the current defaults:

    pcs # pcs rsc defaults

    ## Operation defaults

    crmsh # crm configure op_defaults timeout=240s
    pcs # pcs resource op defaults timeout=240s

    Listing the current defaults:
    pcs # pcs resource op defaults

    ## Colocation

    crmsh # crm configure colocation website-with-ip INFINITY: WebSite ClusterIP
    pcs # pcs constraint colocation add WebSite ClusterIP INFINITY

    With roles

    crmsh #
    pcs #

    ## Start/stop ordering

    crmsh # crm configure order apache-after-ip mandatory: ClusterIP WebSite
    pcs # pcs constraint order ClusterIP then WebSite

    With roles:

    crmsh #
    pcs #

    ## Preferred locations

    crmsh # crm configure location prefer-pcmk-1 WebSite 50: pcmk-1
    pcs # pcs constraint location WebSite prefers pcmk-1=50

    With roles:

    crmsh #
    pcs #

    ## Moving resources

    crmsh # crm resource move WebSite pcmk-1
    pcs # pcs constraint location WebSite prefers pcmk-1=INFINITY

    crmsh # crm resource unmove WebSite
    pcs # pcs constraint rm location-WebSite-pcmk-1-INFINITY

    ## Creating a clone

    crmsh # configure clone WebIP ClusterIP meta globally-unique="true" clone-max="2" clone-node-max="2"
    pcs # pcs resource clone ClusterIP globally-unique=true clone-max=2 clone-node-max=2

    ## Creating a master/slave clone

    crmsh # crm configure ms WebDataClone WebData \
    meta master-max=1 master-node-max=1 \
    clone-max=2 clone-node-max=1 notify=true
    pcs # resource master WebDataClone WebData \
    master-max=1 master-node-max=1 clone-max=2 clone-node-max=1 \
    notify=true

    ## ...
    crmsh #
    pcs #

    crmsh #
    pcs #


    ## Batch changes

    crmsh # crm
    crmsh # cib new drbd
    crmsh # configure primitive WebData ocf:linbit:drbd params drbd_resource=wwwdata op monitor interval=60s
    crmsh # configure ms WebDataClone WebData meta master-max=1 master-node-max=1 clone-max=2 clone-node-max=1 notify=true
    crmsh # cib commit drbd
    crmsh # quit

    pcs # pcs cluster cib drbd_cfg
    pcs # pcs -f drbd_cfg resource create WebData ocf:linbit:drbd drbd_resource=wwwdata op monitor interval=60s
    pcs # pcs -f drbd_cfg resource master WebDataClone WebData master-max=1 master-node-max=1 clone-max=2 clone-node-max=1 notify=true
    pcs # pcs cluster push cib drbd_cfg
  6. @beekhof beekhof revised this gist May 16, 2013. 1 changed file with 2 additions and 7 deletions.
    9 changes: 2 additions & 7 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -1,12 +1,7 @@
    ## Display the configuration

    crmsh:

    crm configure show

    pcs:

    pcs cluster cib
    crmsh# crm configure show
    pcs # pcs cluster cib

    ## Setting configuration options

  7. @beekhof beekhof revised this gist May 16, 2013. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,11 @@

    ## Display the configuration

    crmsh:

    crm configure show

    pcs:

    pcs cluster cib

    ## Setting configuration options
  8. @beekhof beekhof created this gist May 16, 2013.
    12 changes: 12 additions & 0 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@

    ## Display the configuration

    crmsh:
    crm configure show

    pcs:
    pcs cluster cib

    ## Setting configuration options

    crmsh: