Centos中的CRM用法

crm命令:
crm有兩種工做方式:
1,批處理模式,就是在shell命令行中直接輸入命令;

2,交互式模式(crm(live)#),進入到crmsh中交互執行;

crm的特性:
    一、任何操做都須要commit提交後纔會生效;

    二、想要刪除一個資源以前須要先將資源中止

    三、能夠用  help COMMAND 獲取該命令的幫助 

    四、與Linux命令行同樣,都支持TAB補全

crm命令詳解:
1.一級子命令
node

[root@node1 corosync]# crm
crm(live)# help    	# 獲取當前可用命令
Available commands:
cib              manage shadow CIBs #cib管理模塊

resource         resources management #全部的資源都在這個子命令後定義

configure        CRM cluster configuration # 編輯集羣配置信息

node             nodes management #集羣節點管理子命令
options          user preferences #用戶優先級
history          CRM cluster history#CRM歷史
site             Geo-cluster support#地理集羣支持
ra               resource agents information center #資源代理子命令(全部與資源代理相關的程都在此命令之下)
status           show cluster status #顯示當前集羣的狀態信息
help,?           show help (help topics for list of topics)#查看當前區域可能的命令
end,cd,up        go back one level #返回第一級crm(live)#
quit,bye,exit    exit the program  #退出crm(live)交互模式



經常使用子命令介紹:
1.resource子命令 #定義全部資源的狀態
python

crm(live)resource# help
vailable commands:
status           show status of resources #顯示資源狀態信息

start            start a resource #啓動一個資源

stop             stop a resource #中止一個資源

restart          restart a resource #重啓一個資源

promote          promote a master-slave resource #提高一個主從資源

demote           demote a master-slave resource #降級一個主從資源

manage           put a resource into managed mode

unmanage         put a resource into unmanaged mode
migrate          migrate a resource to another node #將資源遷移到另外一個節點

unmigrate        unmigrate a resource to another node

param            manage a parameter of a resource #管理資源的參數

secret           manage sensitive parameters #管理敏感參數

meta             manage a meta attribute #管理源屬性

utilization      manage a utilization attribute

failcount        manage failcounts #管理失效計數器
cleanup          cleanup resource status #清理資源狀態
refresh          refresh CIB from the LRM status #從LRM(LRM本地資源管理)更新CIB(集羣信息庫)
reprobe          probe for resources not started by the CRM #探測在CRM中沒有啓動的資源
trace            start RA tracing #啓用資源代理(RA)追蹤
untrace          stop RA tracing #禁用資源代理(RA)追蹤
help             show help (help topics for list of topics) #顯示幫助
end              go back one level #返回一級(crm(live)#)
quit             exit the program #退出交互式程序


2.configure子命令 #資源粘性、資源類型、資源約束
shell

crm(live)configure# help
Available commands:
node             define a cluster node #定義一個集羣節點
primitive        define a resource #定義資源

monitor          add monitor operation to a primitive #對一個資源添加監控選項(如超時時間,啓動失敗後的操做)

group            define a group #定義一個組類型(將多個資源整合在一塊兒)

clone            define a clone #定義一個克隆類型(能夠設置總的克隆數,每個節點上能夠運行幾個克隆)

ms               define a master-slave resource #定義一個主從類型(集羣內的節點只能有一個運行主資源,其它從的作備用)

rsc_template     define a resource template #定義一個資源模板

location         a location preference # 定義位置約束優先級(默認運行於那一個節點(若是位置約束值相同,默認傾向性哪個高,就在哪個節點上運行))
colocation       colocate resources #排列約束資源(多個資源在一塊兒的可能性)

order            order resources #資源的啓動的前後順序

rsc_ticket       resources ticket dependency#

property         set a cluster property #設置集羣屬性

rsc_defaults     set resource defaults #設置資源默認屬性(粘性)

fencing_topology node fencing order #隔離節點順序

role             define role access rights #定義角色的訪問權限

user             define user access rights #定義用用戶訪問權限
op_defaults      set resource operations defaults #設置資源默認選項

schema           set or display current CIB RNG schema

show             display CIB objects #顯示集羣信息庫對

edit             edit CIB objects #編輯集羣信息庫對象(vim模式下編輯)

filter           filter CIB objects #過濾CIB對象

delete           delete CIB objects #刪除CIB對象

default-timeouts     set timeouts for operations to minimums from the meta-data

rename           rename a CIB object #重命名CIB對象

modgroup         modify group	#改變資源組

refresh          refresh from CIB #從新讀取CIB信息
erase            erase the CIB #清除CIB信息

ptest            show cluster actions if changes were committed

rsctest          test resources as currently configured

cib              CIB shadow management

cibstatus        CIB status management and editing

template         edit and import a configuration from a template

commit           commit the changes to the CIB #將更改後的信息提交寫入CIB
verify           verify the CIB with crm_verify #CIB語法驗證
upgrade          upgrade the CIB to version 1.0
save             save the CIB to a file #將當前CIB導出到一個文件中(導出的文件存於切換crm 以前的目錄)
load             import the CIB from a file #從文件內容載入CIB
graph            generate a directed graph
xml              raw xml
help             show help (help topics for list of topics) #顯示幫助信息
end              go back one level #回到第一級(crm(live)#)



3.node子命令 #節點管理和狀態
bootstrap

crm(live)# node
crm(live)node# help
Node management and status commands.
Available commands:
status           show nodes status as XML #以xml格式顯示節點狀態信息

show             show node #命令行格式顯示節點狀態信息

standby          put node into standby #模擬指定節點離線(standby在後面必須的FQDN)

online           set node online #節點從新上線

maintenance      put node into maintenance mode
ready            put node into ready mode
fence            fence node #隔離節點
clearstate       Clear node state #清理節點狀態信息
delete           delete node #刪除 一個節點
attribute        manage attributes
utilization      manage utilization attributes
status-attr      manage status attributes
help             show help (help topics for list of topics)
end              go back one level
quit             exit the program


4.ra子命令  #資源代理類別都在此處
vim

crm(live)# ra
crm(live)ra# help
Available commands:
classes          list classes and providers# 爲資源代理分類
list             list RA for a class (and provider)# 顯示一個類別中的提供的資源
meta             show meta data for a RA # 顯示一個資源代理序的可用參數(如meta ocf:heartbeat:IPaddr2)
providers        show providers for a RA and a class
help             show help (help topics for list of topics)
end              go back one level
quit             exit the program

5.show xml 顯示完整的xml格式信息

架構

crm(live)configure# show
node node1.a.com
node node2.a.com    #當前集羣共有2個節點
property cib-bootstrap-options: \
dc-version=1.1.11-97629de \   #DC的版本
cluster-infrastructure="classic openais (with plugin)" \    #底層基礎架構(經典的openais,使用plugin方式來運行)
expected-quorum-votes=2 \   #當前節點一共有兩票
stonith-enabled=false    #stonith 設備已被禁用

6.禁用stonith設備(若是沒有stonith設備,最好禁用):
ide

configure
crm(live)configure# property stonith-enabled=false
crm(live)configure# commit
crm_verify -L -V   #此時再檢查就不會檢查stoith設備了;
相關文章
相關標籤/搜索