配置crmsh的yum倉庫,此倉庫的RPM包有openSUSE提供,將這個network:ha-clustering:Stable.repo文件直接下載到本地而且命名爲crmsh.repo
wget -O /etc/yum.repos.d/crmsh.repo http://download.opensuse.org/repositories/network:/ha-clustering:/Stable/CentOS_CentOS-7/network:ha-clustering:Stable.repo yum repolist yum install -y crmsh
①:location位置約束:資源間的依賴/互斥性,定義資源是否運行在同一節點上。score,正值表示要運行在同一節點上,負值則不可。
②:colocation排列約束:每一個節點都有一個score值,正值則傾向於本節點,負值傾向於其餘節點,全部節點score比較,傾向於最大值的節點。
③:order順序約束:定義資源執行動做的次序,例如vip應先配置,httpd服務後配置。特殊的score值,-inf 負無窮,inf 正無窮。
node
Overview Help overview for crmsh Topics Available topics Description Program description CommandLine Command line options Introduction Introduction Interface User interface Completion Tab completion Shorthand Shorthand syntax Features Features Shadows Shadow CIB usage Checks Configuration semantic checks Templates Configuration templates Testing Resource testing Security Access Control Lists (ACL) Resourcesets Syntax: Resource sets AttributeListReferences Syntax: Attribute list references AttributeReferences Syntax: Attribute references RuleExpressions Syntax: Rule expressions Reference Command reference
cd 切換命令層級,例如 cd cluster:切換到cluster二級命令 help 查看幫助 ls 列出命令層級和命令 quit 退出 report 報告 status 查看集羣狀態,能夠有參數 help status 能夠查看 up 回到上一個命令層級 verify 驗證集羣狀態 assist/ Configuration assistant 配置集羣代理 template Create template for primitives weak-bond Create a weak bond between resources cib/ CIB shadow management cibstatus CIB status management and editing (CIB狀態管理和編輯) commit Copy a shadow CIB to the cluster (將影子CIB複製到集羣) delete Delete a shadow CIB (刪除陰影CIB) diff Diff between the shadow CIB and the live CIB (陰影CIB和活動CIB的區別) import Import a CIB or PE input file to a shadow (將CIB或PE輸入文件導入到陰影中) list List all shadow CIBs (列出全部陰影CIB) new Create a new shadow CIB (建立一個新的CIB) reset Copy live cib to a shadow CIB (將活動CIB複製到影子CIB) use Change working CIB (改變工做CIB) cibstatus/ CIB status management and editing load Load the CIB status section node Change node status op Edit outcome of a resource operation origin Display origin of the CIB status section quorum Set the quorum run Run policy engine save Save the CIB status section show Show CIB status section simulate Simulate cluster transition ticket Manage tickets cluster/ Cluster setup and management (重要) add 給集羣添加節點 copy 拷貝文件到另一個集羣的節點 diff Diff file across cluster geo_init Configure cluster as geo cluster geo_init_arbitrator Initialize node as geo cluster arbitrator geo_join Join cluster to existing geo cluster health 集羣的健康狀態檢查 init 初始化集羣 join 加入到已經存在的集羣 remove 從集羣中移除一個節點 run 在全部集羣節點執行一條命令 start 啓動集羣服務 status 集羣狀態檢查 stop 中止集羣服務 wait_for_startup Wait for cluster to start configure/ CIB configuration cib 集羣配置(很重要,最重要的命令用中文註釋了) acl_target Define target access rights alert Event-driven alerts cib CIB shadow management cibstatus CIB status management and editing clone 定義克隆資源 colocation 設置排列約束 commit Commit the changes to the CIB default-timeouts Set timeouts for operations to minimums from the meta-data delete Delete CIB objects edit 編輯集羣配置文件,cib文件 erase Erase the CIB fencing_topology Node fencing order filter Filter CIB objects get_property Get property value graph Generate a directed graph group 定義組資源 load Import the CIB from a file location 設置位置約束 modgroup Modify group monitor Add monitor operation to a primitive ms 定義主從資源 node Define a cluster node op_defaults Set resource operations defaults order 設置順序約束 primitive 定義主資源 property 設置集羣的屬性 ptest Show cluster actions if changes were committed refresh Refresh from CIB rename Rename a CIB object role Define role access rights rsc_defaults Set resource defaults rsc_template Define a resource template rsc_ticket Resources ticket dependency rsctest Test resources as currently configured save Save the CIB to a file schema Set or display current CIB RNG schema set Set an attribute value show Display CIB objects tag Define resource tags template Edit and import a configuration from a template upgrade Upgrade the CIB user Define user access rights validate-all Help for command validate-all validate_all Call agent validate-all for resource verify Verify the CIB with crm_verify xml Raw xml corosync/ Corosync management Corosync的管理 add-node Add a corosync node del-node Remove a corosync node diff Diffs the corosync configuration edit Edit the corosync configuration get Get a corosync configuration value log Show the corosync log file pull Pulls the corosync configuration push Push the corosync configuration reload Reload the corosync configuration set Set a corosync configuration value show Display the corosync configuration status Display the corosync status history/ Cluster history 設置集羣的歷史信息 detail Set the level of detail shown diff Cluster states/transitions difference events Show events in log exclude Exclude log messages graph Generate a directed graph from the PE file info Cluster information summary latest Show latest news from the cluster limit Limit timeframe to be examined log Log content node Node events peinputs List or get PE input files refresh Refresh live report resource Resource events session Manage history sessions setnodes Set the list of cluster nodes show Show status or configuration of the PE input file source Set source to be examined transition Show transition transitions List transitions wdiff Cluster states/transitions difference maintenance/ Maintenance mode commands 維護模式的命令 action Invoke a resource action off Disable maintenance mode on Enable maintenance mode node/ Node management 節點管理(很重要) attribute 管理、查看節點屬性 clearstate Clear node state delete 刪除節點 fence Fence 一個節點 maintenance Put node into maintenance mode online 讓節點上線, 例如:node online node2 ready Put node into ready mode server Show node hostname or server address show 查看集羣中的節點 standby 讓一個節點standy,例如:node standby node1 status 查看集羣中節點的狀態 status-attr 管理集羣中節點的屬性 utilization Manage utilization attributes options/ User preferences add-quotes Add quotes around parameters containing spaces check-frequency When to perform semantic check check-mode How to treat semantic errors colorscheme Set colors for output editor Set preferred editor program manage-children How to handle children resource attributes output Set output type pager Set preferred pager program reset Reset user preferences to factory defaults save Save the user preferences to the rc file set Set the value of a given option show Show current user preference skill-level Set skill level sort-elements Sort CIB elements user Set the cluster user wait Synchronous operation ra/ 資源代理管理操做(很重要) classes 列出資源類別和提供者,例如:ra classes info 查看腳本的使用方法,例如:ra info IPaddr2 list 列出一個類別中有多少可用的資源代理,例如:ra list lsb 或 ra list ocf providers 查看特定資源代理有哪一個提供者提供,例如:ra providers IPaddr2 validate Validate parameters for RA resource/ Resource management 資源管理(重要) ban Ban a resource from a node cleanup Cleanup resource status clear Clear any relocation constraint constraints Show constraints affecting a resource demote Demote a master-slave resource failcount Manage failcounts locate Show the location of resources maintenance Enable/disable per-resource maintenance mode manage Put a resource into managed mode meta Manage a meta attribute move 將某個資源遷移到哪一個節點上去 operations Show active resource operations param Manage a parameter of a resource promote Promote a master-slave resource refresh Refresh CIB from the LRM status reprobe Probe for resources not started by the CRM restart Restart resources scores Display resource scores secret Manage sensitive parameters start Start resources status Show status of resources stop Stop resources trace Start RA tracing unmanage Put a resource into unmanaged mode untrace Stop RA tracing utilization Manage a utilization attribute script/ Cluster script management json JSON API for cluster scripts list List available scripts run Run the script show Describe the script verify Verify the script site/ GEO clustering site support ticket Manage site tickets template/ Edit and import a configuration from a template apply Process and apply the current configuration to the current CIB delete Delete a configuration edit Edit a configuration list List configurations/templates load Load a configuration new Create a new configuration from templates show Show the processed configuration