diff --git a/doc/Makefile.am b/doc/Makefile.am index cb3b185865..6a3a065bac 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -1,141 +1,141 @@ # # Copyright 2003-2020 the Pacemaker project contributors # # The version control history for this file may have further details. # # This source code is licensed under the GNU General Public License version 2 # or later (GPLv2+) WITHOUT ANY WARRANTY. # include $(top_srcdir)/mk/common.mk # What formats to use for book uploads (i.e. "make www"; # use BOOK_FORMATS in sphinx subdirectory to change local builds) BOOK_FORMATS ?= html singlehtml pdf epub # Deprecated plaintext documents (dynamically converted to HTML) DEPRECATED_ORIGINAL = crm_fencing.txt DEPRECATED_GENERATED = if BUILD_ASCIIDOC DEPRECATED_GENERATED += $(DEPRECATED_ORIGINAL:%.txt=%.html) endif DEPRECATED_ALL = $(DEPRECATED_ORIGINAL) $(DEPRECATED_GENERATED) doc_DATA = $(DEPRECATED_ALL) noinst_SCRIPTS = abi-check SUBDIRS = sphinx -EXTRA_DIST = $(DEPRECATED_ORIGINAL) pcs-crmsh-quick-ref.md +EXTRA_DIST = $(DEPRECATED_ORIGINAL) # toplevel rsync destination for www targets (without trailing slash) RSYNC_DEST ?= root@www.clusterlabs.org:/var/www/html # recursive, preserve symlinks/permissions/times, verbose, compress, # don't cross filesystems, sparse, show progress RSYNC_OPTS = -rlptvzxS --progress LAST_RELEASE ?= Pacemaker-$(VERSION) TAG ?= $(shell [ -n "`git tag --points-at HEAD | head -1`" ] \ && ( git tag --points-at HEAD | head -1 ) \ || git log --pretty=format:%H -n 1 HEAD) if IS_ASCIIDOC ASCIIDOC_HTML_ARGS = --unsafe --backend=xhtml11 ASCIIDOC_DBOOK_ARGS = -b docbook -d book else ASCIIDOC_HTML_ARGS = --backend=html5 ASCIIDOC_DBOOK_ARGS = -b docbook45 -d book endif %.html: %.txt $(AM_V_GEN)$(ASCIIDOC_CONV) $(ASCIIDOC_HTML_ARGS) --out-file=$@ $< $(PCMK_quiet) # For Makefile debugging .PHONY: vars vars: @echo DEPRECATED_ORIGINAL=\'$(DEPRECATED_ORIGINAL)\' @echo DEPRECATED_GENERATED=\'$(DEPRECATED_GENERATED)\' @echo LAST_RELEASE=\'$(LAST_RELEASE)\' @echo TAG=\'$(TAG)\' .PHONY: deprecated-upload deprecated-upload: $(DEPRECATED_ALL) rsync $(RSYNC_OPTS) $(DEPRECATED_ALL) "$(RSYNC_DEST)/$(PACKAGE)/doc/" .PHONY: deprecated-clean deprecated-clean: -rm -f $(DEPRECATED_GENERATED) # Annotated source code as HTML global: $(MAKE) $(AM_MAKEFLAGS) -C .. clean-generic cd .. && gtags -q && htags -sanhIT doc global-upload: global rsync $(RSYNC_OPTS) HTML/ "$(RSYNC_DEST)/$(PACKAGE)/global/$(TAG)/" global-clean: -rm -rf HTML # Man pages as HTML %.8.html: %.8 groff -mandoc `man -w ./$<` -T html > $@ %.7.html: %.7 groff -mandoc `man -w ./$<` -T html > $@ manhtml: $(MAKE) $(AM_MAKEFLAGS) -C .. all find .. -name "[a-z]*.[78]" -exec $(MAKE) $(AM_MAKEFLAGS) \{\}.html \; manhtml-upload: manhtml find .. -name "[a-z]*.[78].html" -exec \ rsync $(RSYNC_OPTS) \{\} "$(RSYNC_DEST)/$(PACKAGE)/man/" \; manhtml-clean: -find .. -name "[a-z]*.[78].html" -exec rm \{\} \; # API documentation as HTML doxygen: Doxyfile doxygen Doxyfile doxygen-upload: doxygen rsync $(RSYNC_OPTS) api/html/ "$(RSYNC_DEST)/$(PACKAGE)/doxygen/$(TAG)/" doxygen-clean: -rm -rf api # ABI compatibility report as HTML abi: abi-check ./abi-check $(PACKAGE) $(LAST_RELEASE) $(TAG) abi-www: export RSYNC_DEST=$(RSYNC_DEST); ./abi-check -u $(PACKAGE) $(LAST_RELEASE) $(TAG) abi-clean: -rm -rf abi_dumps compat_reports # The main documentation books (which are actually in the sphinx subdirectory) books-upload: $(MAKE) $(AM_MAKEFLAGS) -C sphinx clean $(MAKE) $(AM_MAKEFLAGS) -C sphinx \ RSYNC_DEST="$(RSYNC_DEST)" \ BOOK_FORMATS="$(BOOK_FORMATS)" \ books-upload # All online documentation (except ABI compatibility, which is run separately) .PHONY: www www: clean-local deprecated-upload manhtml-upload global-upload doxygen-upload books-upload clean-local: global-clean manhtml-clean doxygen-clean abi-clean deprecated-clean diff --git a/doc/pcs-crmsh-quick-ref.md b/doc/pcs-crmsh-quick-ref.md deleted file mode 100644 index 9fa16d8314..0000000000 --- a/doc/pcs-crmsh-quick-ref.md +++ /dev/null @@ -1,365 +0,0 @@ - - - - -**Table of Contents** - -- [General Operations](#general-operations) - - [Display the configuration](#display-the-configuration) - - [Display the current status](#display-the-current-status) - - [Node standby](#node-standby) - - [Set cluster property](#set-cluster-property) -- [Resource manipulation](#resource-manipulation) - - [List Resource Agent (RA) classes](#list-resource-agent-ra-classes) - - [List available RAs](#list-available-ras) - - [List RA info](#list-ra-info) - - [Create a resource](#create-a-resource) - - [Display a resource](#display-a-resource) - - [Display fencing resources](#display-fencing-resources) - - [Display Stonith RA info](#display-stonith-ra-info) - - [Start a resource](#start-a-resource) - - [Stop a resource](#stop-a-resource) - - [Remove a resource](#remove-a-resource) - - [Modify a resource](#modify-a-resource) - - [Delete parameters for a given resource](#delete-parameters-for-a-given-resource) - - [List the current resource defaults](#list-the-current-resource-defaults) - - [Set resource defaults](#set-resource-defaults) - - [List the current operation defaults](#list-the-current-operation-defaults) - - [Set operation defaults](#set-operation-defaults) - - [Set Colocation](#set-colocation) - - [Set ordering](#set-ordering) - - [Set preferred location](#set-preferred-location) - - [Move resources](#move-resources) - - [Resource tracing](#resource-tracing) - - [Clear fail counts](#clear-fail-counts) - - [Edit fail counts](#edit-fail-counts) - - [Handling configuration elements by type](#handling-configuration-elements-by-type) - - [Create a clone](#create-a-clone) - - [Create a promotable (master/slave) clone](#create-a-promotable-masterslave-clone) -- [Other operations](#other-operations) - - [Batch changes](#batch-changes) - - [Template creation](#template-creation) - - [Log analysis](#log-analysis) - - [Configuration scripts](#configuration-scripts) - - - -# General Operations - -## Display the configuration - - crmsh # crm configure show xml - pcs # pcs cluster cib - -To show a simplified (non-xml) syntax - - crmsh # crm configure show - pcs # pcs config - -## Display the current status - - crmsh # crm status - pcs # pcs status - -also - - # crm_mon -1 - -## Node standby - -Put node in standby - - crmsh # crm node standby pcmk-1 - pcs-0.9 # pcs cluster standby pcmk-1 - pcs-0.10 # pcs node standby pcmk-1 - -Remove node from standby - - crmsh # crm node online pcmk-1 - pcs-0.9 # pcs cluster unstandby pcmk-1 - pcs-0.10 # pcs node unstandby pcmk-1 - -crm has the ability to set the status on reboot or forever. -pcs can apply the change to all the nodes. - -## Set cluster property - - crmsh # crm configure property stonith-enabled=false - pcs # pcs property set stonith-enabled=false - -# Resource manipulation - -## List Resource Agent (RA) classes - - crmsh # crm ra classes - pcs # pcs resource standards - -## List available RAs - - crmsh # crm ra list ocf - crmsh # crm ra list lsb - crmsh # crm ra list service - crmsh # crm ra list stonith - pcs # pcs resource agents ocf - pcs # pcs resource agents lsb - pcs # pcs resource agents service - pcs # pcs resource agents stonith - pcs # pcs resource agents - -You can also filter by provider - - crmsh # crm ra list ocf pacemaker - pcs # pcs resource agents ocf:pacemaker - -## List RA info - - crmsh # crm ra meta IPaddr2 - pcs # pcs resource describe IPaddr2 - -Use any RA name (like IPaddr2) from the list displayed with the previous command -You can also use the full class:provider:RA format if multiple RAs with the same name are available : - - crmsh # crm ra meta ocf:heartbeat:IPaddr2 - pcs # pcs resource describe ocf:heartbeat:IPaddr2 - -## Create a resource - - crmsh # crm configure primitive ClusterIP ocf:heartbeat:IPaddr2 \ - params ip=192.168.122.120 cidr_netmask=24 \ - op monitor interval=30s - pcs # pcs resource create ClusterIP IPaddr2 ip=192.168.0.120 cidr_netmask=24 - -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. - -## Display a resource - - crmsh # crm configure show - pcs-0.9 # pcs resource show --full - pcs-0.10 # pcs resource config - -crmsh also displays fencing resources. -The result can be filtered by supplying a resource name (IE `ClusterIP`): - - crmsh # crm configure show ClusterIP - pcs-0.9 # pcs resource show ClusterIP - pcs-0.10 # pcs resource config ClusterIP - -crmsh also displays fencing resources. - -## Display fencing resources - - crmsh # crm resource show - pcs-0.9 # pcs stonith show --full - pcs-0.10 # pcs stonith config - -pcs treats STONITH devices separately. - -## Display Stonith RA info - - crmsh # crm ra meta stonith:fence_ipmilan - pcs # pcs stonith describe fence_ipmilan - -## Start a resource - - crmsh # crm resource start ClusterIP - pcs # pcs resource enable ClusterIP - -## Stop a resource - - crmsh # crm resource stop ClusterIP - pcs # pcs resource disable ClusterIP - -## Remove a resource - - crmsh # crm configure delete ClusterIP - pcs # pcs resource delete ClusterIP - -## Modify a resource - - crmsh # crm resource param ClusterIP set clusterip_hash=sourceip - pcs # pcs resource update ClusterIP clusterip_hash=sourceip - -crmsh also has an `edit` command which edits the simplified CIB syntax -(same commands as the command line) via a configurable text editor. - - crmsh # crm configure edit ClusterIP - -Using the interactive shell mode of crmsh, multiple changes can be -edited and verified before committing to the live configuration. - - crmsh # crm configure - crmsh # edit - crmsh # verify - crmsh # commit - -## Delete parameters for a given resource - - crmsh # crm resource param ClusterIP delete nic - pcs # pcs resource update ClusterIP ip=192.168.0.98 nic= - -## List the current resource defaults - - crmsh # crm configure show type:rsc_defaults - pcs # pcs resource defaults - -## Set resource defaults - - crmsh # crm configure rsc_defaults resource-stickiness=100 - pcs # pcs resource defaults resource-stickiness=100 - -## List the current operation defaults - - crmsh # crm configure show type:op_defaults - pcs # pcs resource op defaults - -## Set operation defaults - - crmsh # crm configure op_defaults timeout=240s - pcs # pcs resource op defaults timeout=240s - -## Set Colocation - - crmsh # crm configure colocation website-with-ip INFINITY: WebSite ClusterIP - pcs # pcs constraint colocation add ClusterIP with WebSite INFINITY - -With roles - - crmsh # crm configure colocation another-ip-with-website inf: AnotherIP WebSite:Master - pcs # pcs constraint colocation add Started AnotherIP with Master WebSite INFINITY - -## Set ordering - - crmsh # crm configure order apache-after-ip mandatory: ClusterIP WebSite - pcs # pcs constraint order ClusterIP then WebSite - -With roles: - - crmsh # crm configure order ip-after-website Mandatory: WebSite:Master AnotherIP - pcs # pcs constraint order promote WebSite then start AnotherIP - -## Set preferred location - - crmsh # crm configure location prefer-pcmk-1 WebSite 50: pcmk-1 - pcs # pcs constraint location WebSite prefers pcmk-1=50 - -With roles: - - crmsh # crm configure location prefer-pcmk-1 WebSite rule role=Master 50: \#uname eq pcmk-1 - pcs # pcs constraint location WebSite rule role=master 50 \#uname eq pcmk-1 - -## Move resources - - crmsh # crm resource move WebSite pcmk-1 - pcs # pcs resource move WebSite pcmk-1 - - crmsh # crm resource unmove WebSite - pcs # pcs resource clear WebSite - -A resource can also be moved away from a given node: - - crmsh # crm resource ban Website pcmk-2 - pcs # pcs resource ban Website pcmk-2 - -Remember that moving a resource sets a stickyness to -INF to a given node until unmoved - -## Resource tracing - - crmsh # crm resource trace Website - -## Clear fail counts - - crmsh # crm resource cleanup Website - pcs # pcs resource cleanup Website - -## Edit fail counts - - crmsh # crm resource failcount Website show pcmk-1 - crmsh # crm resource failcount Website set pcmk-1 100 - -## Handling configuration elements by type - -pcs deals with constraints differently. These can be manipulated by the command above as well as the following and others - - pcs # pcs constraint list --full - pcs # pcs constraint remove cli-ban-Website-on-pcmk-1 - -Removing a constraint in crmsh uses the same command as removing a -resource. - - crmsh # crm configure remove cli-ban-Website-on-pcmk-1 - -The `show` and `edit` commands in crmsh can be used to manage -resources and constraints by type: - - crmsh # crm configure show type:primitive - crmsh # crm configure edit type:colocation - -## Create a clone - - crmsh # crm 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 - -## Create a promotable (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-0.9 # pcs resource master WebDataClone WebData \ - master-max=1 master-node-max=1 \ - clone-max=2 clone-node-max=1 notify=true - pcs-0.10 # pcs resource promotable WebData \ - promoted-max=1 promoted-node-max=1 \ - clone-max=2 clone-node-max=1 notify=true - -# Other operations - -## Batch changes - - crmsh # crm - 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-0.9 # 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-0.10 # pcs -f drbd_cfg resource promotable WebData promoted-max=1 promoted-node-max=1 \ - clone-max=2 clone-node-max=1 notify=true - pcs # pcs cluster push cib drbd_cfg - -## Template creation - -Create a resource template based on a list of primitives of the same -type - - crmsh # crm configure assist template ClusterIP AdminIP - -## Log analysis - -Display information about recent cluster events - - crmsh # crm history - crmsh # peinputs - crmsh # transition pe-input-10 - crmsh # transition log pe-input-10 - -## Configuration scripts - -Create and apply multiple-step cluster configurations including -configuration of cluster resources - - crmsh # crm script show apache - crmsh # crm script run apache \ - id=WebSite \ - install=true \ - virtual-ip:ip=192.168.0.15 \ - database:id=WebData \ - database:install=true diff --git a/doc/sphinx/Pacemaker_Administration/index.rst b/doc/sphinx/Pacemaker_Administration/index.rst index 97731245d0..9686863a0a 100644 --- a/doc/sphinx/Pacemaker_Administration/index.rst +++ b/doc/sphinx/Pacemaker_Administration/index.rst @@ -1,34 +1,35 @@ Pacemaker Administration ======================== *Managing Pacemaker Clusters* Abstract -------- This document has instructions and tips for system administrators who manage high-availability clusters using Pacemaker. Table of Contents ----------------- .. toctree:: :maxdepth: 3 :numbered: intro installing cluster configuring tools troubleshooting upgrading agents + pcs-crmsh Index ----- * :ref:`genindex` * :ref:`search` diff --git a/doc/sphinx/Pacemaker_Administration/pcs-crmsh.rst b/doc/sphinx/Pacemaker_Administration/pcs-crmsh.rst new file mode 100644 index 0000000000..61ab4e6b64 --- /dev/null +++ b/doc/sphinx/Pacemaker_Administration/pcs-crmsh.rst @@ -0,0 +1,441 @@ +Quick Comparison of pcs and crm shell +------------------------------------- + +``pcs`` and ``crm shell`` are two popular higher-level command-line interfaces +to Pacemaker. Each has its own syntax; this chapter gives a quick comparion of +how to accomplish the same tasks using either one. Some examples also show the +equivalent command using low-level Pacmaker command-line tools. + +These examples show the simplest syntax; see the respective man pages for all +possible options. + +Show Cluster Configuration and Status +##################################### + +.. topic:: Show Configuration (Raw XML) + + .. code-block:: none + + crmsh # crm configure show xml + pcs # pcs cluster cib + pacemaker # cibadmin -Q + +.. topic:: Show Configuration (Human-friendly) + + .. code-block:: none + + crmsh # crm configure show + pcs # pcs config + +.. topic:: Show Cluster Status + + .. code-block:: none + + crmsh # crm status + pcs # pcs status + pacemaker # crm_mon -1 + +Manage Nodes +############ + +.. topic:: Put node "pcmk-1" in standby mode + + .. code-block:: none + + crmsh # crm node standby pcmk-1 + pcs-0.9 # pcs cluster standby pcmk-1 + pcs-0.10 # pcs node standby pcmk-1 + pacemaker # crm_standby -N pcmk-1 -v on + +.. topic:: Remove node "pcmk-1" from standby mode + + .. code-block:: none + + crmsh # crm node online pcmk-1 + pcs-0.9 # pcs cluster unstandby pcmk-1 + pcs-0.10 # pcs node unstandby pcmk-1 + pacemaker # crm_standby -N pcmk-1 -v off + +Manage Cluster Properties +######################### + +.. topic:: Set the "stonith-enabled" cluster property to "false" + + .. code-block:: none + + crmsh # crm configure property stonith-enabled=false + pcs # pcs property set stonith-enabled=false + pacemaker # crm_attribute -n stonith-enabled -v false + +Show Resource Agent Information +############################### + +.. topic:: List Resource Agent (RA) Classes + + .. code-block:: none + + crmsh # crm ra classes + pcs # pcs resource standards + pacmaker # crm_resource --list-standards + +.. topic:: List Available Resource Agents (RAs) by Standard + + .. code-block:: none + + crmsh # crm ra list ocf + pcs # pcs resource agents ocf + pacemaker # crm_resource --list-agents ocf + +.. topic:: List Available Resource Agents (RAs) by OCF Provider + + .. code-block:: none + + crmsh # crm ra list ocf pacemaker + pcs # pcs resource agents ocf:pacemaker + pacemaker # crm_resource --list-agents ocf:pacemaker + +.. topic:: List Available Resource Agent Parameters + + .. code-block:: none + + crmsh # crm ra info IPaddr2 + pcs # pcs resource describe IPaddr2 + pacemaker # crm_resource --show-metadata ocf:heartbeat:IPaddr2 + +You can also use the full ``class:provider:type`` format with crmsh and pcs if +multiple RAs with the same name are available. + +.. topic:: Show Available Fence Agent Parameters + + .. code-block:: none + + crmsh # crm ra info stonith:fence_ipmilan + pcs # pcs stonith describe fence_ipmilan + +Manage Resources +################ + +.. topic:: Create a Resource + + .. code-block:: none + + crmsh # crm configure primitive ClusterIP ocf:heartbeat:IPaddr2 \ + params ip=192.168.122.120 cidr_netmask=24 \ + op monitor interval=30s + pcs # pcs resource create ClusterIP IPaddr2 ip=192.168.122.120 cidr_netmask=24 + +pcs determines the standard and provider (``ocf:heartbeat``) automatically +since ``IPaddr2`` is unique, and automatically creates operations (including +monitor) based on the agent's meta-data. + +.. topic:: Show Configuration of All Resources + + .. code-block:: none + + crmsh # crm configure show + pcs-0.9 # pcs resource show --full + pcs-0.10 # pcs resource config + +.. topic:: Show Configuration of One Resource + + .. code-block:: none + + crmsh # crm configure show ClusterIP + pcs-0.9 # pcs resource show ClusterIP + pcs-0.10 # pcs resource config ClusterIP + +.. topic:: Show Configuration of Fencing Resources + + .. code-block:: none + + crmsh # crm resource status + pcs-0.9 # pcs stonith show --full + pcs-0.10 # pcs stonith config + +.. topic:: Start a Resource + + .. code-block:: none + + crmsh # crm resource start ClusterIP + pcs # pcs resource enable ClusterIP + pacemaker # crm_resource -r ClusterIP --set-parameter target-role --meta -v Started + +.. topic:: Stop a Resource + + .. code-block:: none + + crmsh # crm resource stop ClusterIP + pcs # pcs resource disable ClusterIP + pacemaker # crm_resource -r ClusterIP --set-parameter target-role --meta -v Stopped + +.. topic:: Remove a Resource + + .. code-block:: none + + crmsh # crm configure delete ClusterIP + pcs # pcs resource delete ClusterIP + +.. topic:: Modify a Resource's Instance Parameters + + .. code-block:: none + + crmsh # crm resource param ClusterIP set clusterip_hash=sourceip + pcs # pcs resource update ClusterIP clusterip_hash=sourceip + pacemaker # crm_resource -r ClusterIP --set-parameter clusterip_hash -v sourceip + +crmsh also has an `edit` command which edits the simplified CIB syntax +(same commands as the command line) via a configurable text editor. + +.. topic:: Modify a Resource's Instance Parameters Interactively + + .. code-block:: none + + crmsh # crm configure edit ClusterIP + +Using the interactive shell mode of crmsh, multiple changes can be +edited and verified before committing to the live configuration: + +.. topic:: Make Multiple Configuration Changes Interactively + + .. code-block:: none + + crmsh # crm configure + crmsh # edit + crmsh # verify + crmsh # commit + +.. topic:: Delete a Resource's Instance Parameters + + .. code-block:: none + + crmsh # crm resource param ClusterIP delete nic + pcs # pcs resource update ClusterIP nic= + pacemaker # crm_resource -r ClusterIP --delete-parameter nic + +.. topic:: List Current Resource Defaults + + .. code-block:: none + + crmsh # crm configure show type:rsc_defaults + pcs # pcs resource defaults + pacemaker # cibadmin -Q --scope rsc_defaults + +.. topic:: Set Resource Defaults + + .. code-block:: none + + crmsh # crm configure rsc_defaults resource-stickiness=100 + pcs # pcs resource defaults resource-stickiness=100 + +.. topic:: List Current Operation Defaults + + .. code-block:: none + + crmsh # crm configure show type:op_defaults + pcs # pcs resource op defaults + pacemaker # cibadmin -Q --scope op_defaults + +.. topic:: Set Operation Defaults + + .. code-block:: none + + crmsh # crm configure op_defaults timeout=240s + pcs # pcs resource op defaults timeout=240s + +.. topic:: Enable Resource Agent Tracing for a Resource + + .. code-block:: none + + crmsh # crm resource trace Website + +.. topic:: Clear Fail Counts for a Resource + + .. code-block:: none + + crmsh # crm resource cleanup Website + pcs # pcs resource cleanup Website + pacemaker # crm_resource --cleanup -r Website + +.. topic:: Create a Clone Resource + + .. code-block:: none + + crmsh # crm 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 + +.. topic:: Create a Promotable Clone Resource + + .. code-block:: none + + crmsh # crm configure ms WebDataClone WebData \ + meta master-max=1 master-node-max=1 \ + clone-max=2 clone-node-max=1 notify=true + pcs-0.9 # pcs resource master WebDataClone WebData \ + master-max=1 master-node-max=1 \ + clone-max=2 clone-node-max=1 notify=true + pcs-0.10 # pcs resource promotable WebData WebDataClone \ + promoted-max=1 promoted-node-max=1 \ + clone-max=2 clone-node-max=1 notify=true + +pcs will generate the clone name automatically if it is omitted from the +command line. + + +Manage Constraints +################## + +.. topic:: Create a Colocation Constraint + + .. code-block:: none + + crmsh # crm configure colocation website-with-ip INFINITY: WebSite ClusterIP + pcs # pcs constraint colocation add ClusterIP with WebSite INFINITY + +.. topic:: Create a Colocation Constraint Based on Role + + .. code-block:: none + + crmsh # crm configure colocation another-ip-with-website inf: AnotherIP WebSite:Master + pcs # pcs constraint colocation add Started AnotherIP with Promoted WebSite INFINITY + +.. topic:: Create an Ordering Constraint + + .. code-block:: none + + crmsh # crm configure order apache-after-ip mandatory: ClusterIP WebSite + pcs # pcs constraint order ClusterIP then WebSite + +.. topic:: Create an Ordering Constraint Based on Role + + .. code-block:: none + + crmsh # crm configure order ip-after-website Mandatory: WebSite:Master AnotherIP + pcs # pcs constraint order promote WebSite then start AnotherIP + +.. topic:: Create a Location Constraint + + .. code-block:: none + + crmsh # crm configure location prefer-pcmk-1 WebSite 50: pcmk-1 + pcs # pcs constraint location WebSite prefers pcmk-1=50 + +.. topic:: Create a Location Constraint Based on Role + + .. code-block:: none + + crmsh # crm configure location prefer-pcmk-1 WebSite rule role=Master 50: \#uname eq pcmk-1 + pcs # pcs constraint location WebSite rule role=Promoted 50 \#uname eq pcmk-1 + +.. topic:: Move a Resource to a Specific Node (by Creating a Location Constraint) + + .. code-block:: none + + crmsh # crm resource move WebSite pcmk-1 + pcs # pcs resource move WebSite pcmk-1 + pacemaker # crm_resource -r WebSite --move -N pcmk-1 + +.. topic:: Move a Resource Away from Its Current Node (by Creating a Location Constraint) + + .. code-block:: none + + crmsh # crm resource ban Website pcmk-2 + pcs # pcs resource ban Website pcmk-2 + pacemaker # crm_resource -r WebSite --move + +.. topic:: Remove any Constraints Created by Moving a Resource + + .. code-block:: none + + crmsh # crm resource unmove WebSite + pcs # pcs resource clear WebSite + pacemaker # crm_resource -r WebSite --clear + +Advanced Configuration +###################### + +Manipulate Configuration Elements by Type +_________________________________________ + +.. topic:: List Constraints with IDs + + .. code-block:: none + + pcs # pcs constraint list --full + +.. topic:: Remove Constraint by ID + + .. code-block:: none + + pcs # pcs constraint remove cli-ban-Website-on-pcmk-1 + crmsh # crm configure remove cli-ban-Website-on-pcmk-1 + +crmsh's `show` and `edit` commands can be used to manage resources and +constraints by type: + +.. topic:: Show Configuration Elements + + .. code-block:: none + + crmsh # crm configure show type:primitive + crmsh # crm configure edit type:colocation + +Batch Changes +_____________ + +.. topic:: Make Multiple Changes and Apply Together + + .. code-block:: none + + crmsh # crm + 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-0.9 # 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-0.10 # pcs -f drbd_cfg resource promotable WebData WebDataClone \ + promoted-max=1 promoted-node-max=1 clone-max=2 clone-node-max=1 notify=true + pcs # pcs cluster cib-push drbd_cfg + +Template Creation +_________________ + +.. topic:: Create Resource Template Based on Existing Primitives of Same Type + + .. code-block:: none + + crmsh # crm configure assist template ClusterIP AdminIP + +Log Analysis +____________ + +.. topic:: Show Information About Recent Cluster Events + + .. code-block:: none + + crmsh # crm history + crmsh # peinputs + crmsh # transition pe-input-10 + crmsh # transition log pe-input-10 + +Configuration Scripts +_____________________ + +.. topic:: Script Multiple-step Cluster Configurations + + .. code-block:: none + + crmsh # crm script show apache + crmsh # crm script run apache \ + id=WebSite \ + install=true \ + virtual-ip:ip=192.168.0.15 \ + database:id=WebData \ + database:install=true