HA专题--Pacemaker集群日常管理命令
来源:互联网 发布:手机淘宝怎么删晒图 编辑:程序博客网 时间:2024/06/05 04:38
欢迎访问本人博客(http://cloudnoter.com)查看中文版本
1. 概述
Pacemaker的管理工具主要有两种:crmsh、pcs(Pacemaker/Corosync configuration system),本文将同时介绍这两种命令行工具。
从CentOS6.4以后开始采用PCS替代crmsh来管理pacemaker集群(PCS专用于pacemaker+corosync的设置工具,其有CLI和web-based GUI界面)
2. 常用命令(文档来源)
目录结构
- General Operations
- Display the configuration
- Display the current status
- Node standby
- Set cluster property
- Resource manipulation
- List Resource Agent (RA) classes
- List available RAs
- List RA info
- Create a resource
- Display a resource
- Display fencing resources
- Display Stonith RA info
- Start a resource
- Stop a resource
- Remove a resource
- Modify a resource
- Delete parameters for a given resource
- List the current resource defaults
- Set resource defaults
- List the current operation defaults
- Set operation defaults
- Set Colocation
- Set ordering
- Set preferred location
- Move resources
- Resource tracing
- Clear fail counts
- Edit fail counts
- Handling configuration elements by type
- Create a clone
- Create a master/slave clone
- Other operations
- Batch changes
- Template creation
- Log analysis
- Configuration scripts
General Operations
Display the configuration
crmsh # crm configure show xmlpcs # pcs cluster cib
To show a simplified (non-xml) syntax
crmsh # crm configure showpcs # pcs config
Display the current status
crmsh # crm statuspcs # pcs status
also
# crm_mon -1
Node standby
Put node in standby
crmsh # crm node standby pcmk-1pcs # pcs cluster standby pcmk-1
Remove node from standby
crmsh # crm node online pcmk-1pcs # pcs cluster 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=falsepcs # pcs property set stonith-enabled=false
Resource manipulation
List Resource Agent (RA) classes
crmsh # crm ra classespcs # pcs resource standards
List available RAs
crmsh # crm ra list ocfcrmsh # crm ra list lsbcrmsh # crm ra list servicecrmsh # crm ra list stonithpcs # pcs resource agents ocfpcs # pcs resource agents lsbpcs # pcs resource agents servicepcs # pcs resource agents stonithpcs # pcs resource agents
You can also filter by provider
crmsh # crm ra list ocf pacemakerpcs # pcs resource agents ocf:pacemaker
List RA info
crmsh # crm ra meta IPaddr2pcs # 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:IPaddr2pcs # 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=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.
Display a resource
crmsh # crm configure showpcs # pcs resource show
crmsh also displays fencing resources.
The result can be filtered by supplying a resource name (IE ClusterIP
):
crmsh # crm configure show ClusterIPpcs # pcs resource show ClusterIP
crmsh also displays fencing resources.
Display fencing resources
crmsh # crm resource showpcs # pcs stonith show
pcs treats STONITH devices separately.
Display Stonith RA info
crmsh # crm ra meta stonith:fence_ipmilanpcs # pcs stonith describe fence_ipmilan
Start a resource
crmsh # crm resource start ClusterIPpcs # pcs resource enable ClusterIP
Stop a resource
crmsh # crm resource stop ClusterIPpcs # pcs resource disable ClusterIP
Remove a resource
crmsh # crm configure delete ClusterIPpcs # pcs resource delete ClusterIP
Modify a resource
crmsh # crm resource param ClusterIP set clusterip_hash=sourceippcs # 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 configurecrmsh # editcrmsh # verifycrmsh # commit
Delete parameters for a given resource
crmsh # crm resource param ClusterIP delete nicpcs # pcs resource update ClusterIP ip=192.168.0.98 nic=
List the current resource defaults
crmsh # crm configure show type:rsc_defaultspcs # pcs resource rsc defaults
Set resource defaults
crmsh # crm configure rsc_defaults resource-stickiness=100pcs # pcs resource rsc defaults resource-stickiness=100
List the current operation defaults
crmsh # crm configure show type:op_defaultspcs # pcs resource op defaults
Set operation defaults
crmsh # crm configure op_defaults timeout=240spcs # pcs resource op defaults timeout=240s
Set Colocation
crmsh # crm configure colocation website-with-ip INFINITY: WebSite ClusterIPpcs # pcs constraint colocation add ClusterIP with WebSite INFINITY
With roles
crmsh # crm configure colocation another-ip-with-website inf: AnotherIP WebSite:Masterpcs # pcs constraint colocation add Started AnotherIP with Master WebSite INFINITY
Set ordering
crmsh # crm configure order apache-after-ip mandatory: ClusterIP WebSitepcs # pcs constraint order ClusterIP then WebSite
With roles:
crmsh # crm configure order ip-after-website Mandatory: WebSite:Master AnotherIPpcs # pcs constraint order promote WebSite then start AnotherIP
Set preferred location
crmsh # crm configure location prefer-pcmk-1 WebSite 50: pcmk-1pcs # 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-1pcs # pcs constraint location WebSite rule role=master 50 \#uname eq pcmk-1
Move resources
crmsh # crm resource move WebSite pcmk-1pcs # pcs resource move WebSite pcmk-1crmsh # crm resource unmove WebSitepcs # pcs resource clear WebSite
A resource can also be moved away from a given node:
crmsh # crm resource ban Website pcmk-2pcs # 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 Websitepcs # pcs resource cleanup Website
Edit fail counts
crmsh # crm resource failcount Website show pcmk-1crmsh # 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 --fullpcs # 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:primitivecrmsh # crm configure edit type:colocation
Create a clone
crmsh # crm configure clone WebIP ClusterIP meta globally-unique=true clone-max=2 clone-node-max=2pcs # pcs resource clone ClusterIP globally-unique=true clone-max=2 clone-node-max=2
Create 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=truepcs # pcs resource master WebDataClone WebData \ master-max=1 master-node-max=1 \ clone-max=2 clone-node-max=1 notify=true
Other operations
Batch changes
crmsh # crmcrmsh # cib new drbd_cfgcrmsh # configure primitive WebData ocf:linbit:drbd params drbd_resource=wwwdata \ op monitor interval=60scrmsh # configure ms WebDataClone WebData meta master-max=1 master-node-max=1 \ clone-max=2 clone-node-max=1 notify=truecrmsh # cib commit drbd_cfgcrmsh # quit
.
pcs # pcs cluster cib drbd_cfgpcs # pcs -f drbd_cfg resource create WebData ocf:linbit:drbd drbd_resource=wwwdata \ op monitor interval=60spcs # pcs -f drbd_cfg resource master WebDataClone WebData master-max=1 master-node-max=1 \ clone-max=2 clone-node-max=1 notify=truepcs # 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 historycrmsh # peinputscrmsh # transition pe-input-10crmsh # transition log pe-input-10
Configuration scripts
Create and apply multiple-step cluster configurations including
configuration of cluster resources
crmsh # crm script show apachecrmsh # crm script run apache \ id=WebSite \ install=true \ virtual-ip:ip=192.168.0.15 \ database:id=WebData \ database:install=true
- HA专题--Pacemaker集群日常管理命令
- linux高可用集群HA之pacemaker
- corosync+pacemaker实现集群管理
- Linux HA集群部署(基于Heartbeat与pacemaker)
- mysql服务器的HA集群之corosync+drbd+pacemaker实现
- Corosync+Pacemaker实现简单的Web HA集群
- Linux 高可用(HA)集群之Pacemaker详解
- Linux 高可用(HA)集群之Pacemaker详解
- HA 搭建 corosync+pacemaker
- goldengate日常管理命令
- mysql管理日常命令
- Timesten 日常管理命令
- Pacemaker搭建集群
- 集群安装pacemaker
- linux日常管理命令1
- linux日常管理命令2
- Oracle RAC日常管理命令
- Oracle RAC日常管理命令
- slf4j记录日志
- ThreadLocal误区
- C++中构造函数和析构函数可以抛出异常吗?
- Android进阶之路
- vi替换字符串
- HA专题--Pacemaker集群日常管理命令
- Tensorflow 学习笔记
- sdut 2170 The Largest SCC
- 编程故事接龙
- MariaDB upgrade from version 5.5.x to 10.0.x
- 用springAOP计算每一层方法执行的时间
- Win10 UWP Popup
- postgresql相关常见问题
- requirejs实例