1. 首页 > Linux教程 > 正文

Linux教程FG316-pcs status集群状态监控

内容简介:本文风哥教程参考Linux官方文档、Red Hat Enterprise Linux官方文档、Ansible Automation Platform官方文档、Docker官方文档、Kubernetes官方文档和Podman官方文档等内容,详细介绍了相关技术的配置和使用方法。

本文档详细介绍pcs status命令的使用方法,

风哥提示:

包括集群状态查看、资源监控和节点状态监控。

Part01-集群状态

1.1 查看完整状态

# 查看集群完整状态
[root@ha-node1 ~]# pcs status
Cluster name: mycluster
Cluster Summary:
* Stack: corosync
* Current DC: ha-node1 (version 2.1.6-1.el9 – eab9cfc1ae) – partition with quorum
* Last updated: Fri Apr 4 10:50:00 2026
* Last change: Fri Apr 4 10:45:00 2026 by root via cibadmin on ha-node1
* 2 nodes configured
* 3 resource instances configured

Node List:
* Online: [ ha-node1 ha-node2 ]
* Standby:
* Maintenance:
* Offline:

Full List of Resources:
* vip (ocf::heartbeat:IPaddr2): Started ha-node1
* nginx (systemd:nginx): Started ha-node1
* mysql (systemd:mariadb): Started ha-node2

Daemon Status:
corosync: active/enabled
pacemaker: active/enabled
pcsd: active/enabled

1.2 查看集群摘要

# 查看集群摘要
[root@ha-node1 ~]# pcs status cluster
Cluster Status:
Cluster Summary:
* Stack: corosync
* Current DC: ha-node1 (version 2.1.6-1.el9 – eab9cfc1ae) – partition with quorum
* Last updated: Fri Apr 4 10:50:00 2026
* Last change: Fri Apr 4 10:45:00 2026 by root via cibadmin on ha-node1
* 2 nodes configured
* 3 resource instances configured

# 查看DC(Designated Controller)
[root@ha-node1 ~]# pcs status cluster | grep “Current DC”
* Current DC: ha-node1 (version 2.1.6-1.el9 – eab9cfc1ae) – partition with quorum

Part02-节点状态

2.1 查看节点状态

# 查看节点列表
[root@ha-node1 ~]# pcs status nodes
Pacemaker Nodes:
Online: ha-node1 ha-node2
Standby:
Maintenance:
Offline:

# 查看节点详细信息
[root@ha-node1 ~]# pcs status nodes –all
Pacemaker Nodes:
Online: ha-node1 ha-node2
Standby:
Maintenance:
Offline:

Corosync Nodes:
Online: ha-node1 ha-node2
Offline:

# 查看特定节点状态
[root@ha-node1 ~]# pcs status node ha-node1
Node: ha-node1
Online: true
Standby: false
Maintenance: false
Features: default

# 查看节点属性
[root@ha-node1 ~]# pcs node attribute
Node Attributes:
ha-node1: standby=off maintenance=off
ha-node2: standby=off maintenance=off

2.2 查看节点资源

# 查看节点上的资源
[root@ha-node1 ~]# pcs status resources –nodes
Resources on ha-node1:
* vip (ocf::heartbeat:IPaddr2): Started
* nginx (systemd:nginx): Started

Resources on ha-node2:
* mysql (systemd:mariadb): Started

# 查看节点资源使用情况
[root@ha-node1 ~]# pcs status resources –full
Resource: vip (class=ocf provider=heartbeat type=IPaddr2)
Attributes: cidr_netmask=24 ip=192.168.1.100
Operations: monitor interval=30s (vip-monitor-interval-30s)
Started on: ha-node1

Resource: nginx (class=systemd type=nginx)
Operations: monitor interval=20s (nginx-monitor-interval-20s)
Started on: ha-node1

Resource: mysql (class=systemd type=mariadb)
Operations: monitor interval=30s (mysql-monitor-interval-30s)
Started on: ha-node2

Part03-资源状态

3.1 查看资源状态

# 查看资源状态
[root@ha-node1 ~]# pcs status resources
* vip (ocf::heartbeat:IPaddr2): Started ha-node1
* nginx (systemd:nginx): Started ha-node1
* mysql (systemd:mariadb): Started ha-node2

# 查看资源详细信息
[root@ha-node1 ~]# pcs status resource vip
Resource: vip (class=ocf provider=heartbeat type=IPaddr2)
Attributes: cidr_netmask=24 ip=192.168.1.100
Operations: monitor interval=30s (vip-monitor-interval-30s)
Started on: ha-node1

# 查看失败资源
[root@ha-node1 ~]# pcs status resources –failed
No failed resources

# 查看资源失败历史
[root@ha-node1 ~]# pcs status failcounts
No failcounts

3.2 查看资源操作

# 查看资源操作历史
[root@ha-node1 ~]# pcs status operations
Operations:
* vip: monitor interval=30s last-rc-change=Fri Apr 4 10:45:00 2026 exec-time=10ms
* nginx: monitor interval=20s last-rc-change=Fri Apr 4 10:45:00 2026 exec-time=5ms
* mysql: monitor interval=30s last-rc-change=Fri Apr 4 10:45:00 2026 exec-time=8ms

# 查看特定资源操作
[root@ha-node1 ~]# pcs status operations vip
Operations for vip:
* monitor interval=30s last-rc-change=Fri Apr 4 10:45:00 2026 exec-time=10ms

Part04-其他状态

4.1 查看仲裁状态

# 查看仲裁状态
[root@ha-node1 ~]# pcs quorum status
Quorum information
——————
Date: Fri Apr 4 10:55:00 2026
Quorum provider: corosync_votequorum
Nodes: 2
Node ID: 1
Quorate: Yes

Votequorum information
———————-
Expected votes: 2
Highest expected: 2
Total votes: 2
Quorum: 2
Flags: 2Node Quorate

Membership information
———————-
Nodeid Votes Name
1 1 ha-node1 (local)
2 1 ha-node2

# 查看仲裁设备状态
[root@ha-node1 ~]# pcs quorum device status
No quorum device configured

4.2 查看Corosync状态

# 查看corosync状态
[root@ha-node1 ~]# pcs status corosync
Corosync status:
* Node ID: 1
* Node Name: ha-node1
* Ring 0: address=ha-node1 status=active
* Ring 1: address=ha-node1-mcast status=active

# 查看corosync成员
[root@ha-node1 ~]# corosync-cmapctl | grep members
runtime.totem.pg.mrp.srp.members.1.config_version (u64) = 0
runtime.totem.pg.mrp.srp.members.1.ip (str) = r(0) ip(192.168.1.更多视频教程www.fgedu.net.cn10)
runtime.totem.pg.mrp.srp.members.1.join_count (u32) = 1
runtime.totem.pg.mrp.srp.members.1.status (str) = joined
runtime.totem.pg.mrp.srp.members.2.config_version (u64) = 0
runtime.totem.pg.mrp.srp.members.2.ip (str) = r(0) ip(192.168.1.11)
ru更多学习教程公众号风哥教程itpux_comntime.totem.pg.mrp.srp.members.2.join_count (u32) = 1
runtime.totem.pg.mrp.srp.members.2.status (str) = joined

4.3 查看Pacemaker状态

# 查看pacemaker状态
[root@ha-node1 ~]# pcs status pacemaker
Pacemaker status:
* PID: 12345
* Status: Running
* Last Started: Fri Apr 4 10:30:00 2026
* Last Updated: Fri Apr 4 10:55:00 2026

# 查看pacemaker守护进程
[root@ha-node1 ~]# pacemakerd -F
Pacemaker 2.1.6 (Build: eab9cfc1ae)
* pacemaker-based: running
* pacemaker-controld: running
* pacemaker-attrd: running
* pacemaker-schedulerd: running
* pacemaker-fenced: running

风哥针对pcs status命令建议:

  • 定期检查集群状态
  • 监控资源运行状态
  • 关注节点在线状态
  • 检查仲裁状态
  • 设置状态监控告警

本文由风哥教程整理发布,仅用于学习测试使用,转载注明出处:http://www.fgedu.net.cn/10327.html

联系我们

在线咨询:点击这里给我发消息

微信号:itpux-com

工作日:9:30-18:30,节假日休息