1. 程式人生 > >pcs與crmsh命令比較

pcs與crmsh命令比較

key gen per 工具 heartbeat this 關閉資源 mas for

一.概念

1.crmsh

This project is not part of the GNU Project.

Pacemaker command line interface for management and configuration

crmsh不屬於GNU,是管理pacemaker的命令行界面,最新版本v1.2.6 RC 3 2013-8-29日發布

crmsh支持自動補全

2.pcs

PCS - Pacemaker/Corosync configuration system

專用於pacemaker+corosync的設置工具,有CLI和web-based GUI界面

二.命令比較

顯示集群設置 crmsh # crm configure show pcs # pcs cluster cib 顯示集群狀態 crmsh # crm_mon -1 pcs # pcs status 掛起節點 crmsh # crm node standby pcs # pcs cluster standby pcmk-1 crmsh # crm node online pcs # pcs cluster unstandby pcmk-1 設置option crmsh # crm configure property stonith-enabled=false pcs # pcs property
set stonith-enabled=false 列出可用資源 crmsh # crm ra classes pcs # pcs resource standards crmsh # crm ra list ocf pacemaker pcs # pcs resource agents ocf:pacemaker 創建資源 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 開啟資源 crmsh # crm resource start ClusterIP pcs # pcs resource start ClusterIP 關閉資源 crmsh # crm resource stop ClusterIP pcs # pcs resource stop ClusterIP 刪除資源 crmsh # crm configure delete ClusterIP pcs # 更新資源 crmsh # crm configure edit ClusterIP pcs # pcs resource update ClusterIP clusterip_hash=sourceip 顯示資源 crmsh # pcs # pcs resource show WebFS 資源默認屬性 crmsh # crm configure rsc_defaults resource-stickiness=100 pcs # pcs resource rsc defaults resource-stickiness=100 pcs # pcs resource rsc defaults(列出defaults) 操作的默認屬性 crmsh # crm configure op_defaults timeout=240s pcs # pcs resource op defaults timeout=240s pcs # pcs resource op defaults 資源間關系 crmsh # crm configure colocation website-with-ip INFINITY: WebSite ClusterIP pcs # pcs constraint colocation add WebSite ClusterIP INFINITY 資源順序 crmsh # crm configure order apache-after-ip mandatory: ClusterIP WebSite pcs # pcs constraint order ClusterIP then WebSite 節點粘性 crmsh # crm configure location prefer-pcmk-1 WebSite 50: pcmk-1 pcs # pcs constraint location WebSite prefers pcmk-1=50 移動資源 crmsh # crm resource move WebSite pcmk-1 pcs # pcs resource move WebSite pcmk-1 crmsh # crm resource unmove WebSite pcs # pcs resource unmove WebSite 創建克隆資源 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 創建主從資源 crmsh # crm configure ms WebDataClone WebData \ meta master-max=1 master-node-max=1 \ clone-max=2 clone-node-max=1 notify=true pcs # pcs resource master WebDataClone WebData \ master-max=1 master-node-max=1 clone-max=2 clone-node-max=1 \ notify=true 腳本 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 # 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

pcs與crmsh命令比較