Ceph实验室:第四课:Ceph监控

栏目: 服务器 · 发布时间: 8年前

内容简介:Ceph实验室:第四课:Ceph监控

本课程演示如何监控一个Ceph集群。我们将学习如何用ceph的命令行 工具 进行监控。

监控集群的整体状态

  • 健康状态

ceph命令的health选项查看集群的健康状态。

# ceph health detail 

HEALTH_WARN clock skew detected on mon.ceph-node2; Monitor clock skew detected 
mon.ceph-node2 addr 192.168.1.121:6789/0 clock skew 0.194536s > max 0.05s (latency 0.00103766s)

HEALTH_WARN表示集群处于“告警”状态。
  • 集群事件监控

ceph命令的-w选项用于监控集群的事件,这个命令会实时显示集群中所有的事件消息。

# ceph -w    

    cluster b6e0c604-c9dd-4eac-9b00-45ff246d64fb  
     health HEALTH_WARN  
            clock skew detected on mon.ceph-node2  
            Monitor clock skew detected   
    monmap e2: 2 mons at {ceph-node1=192.168.1.120:6789/0,ceph-node2=192.168.1.121:6789/0}  
            election epoch 24, quorum 0,1 ceph-node1,ceph-node2  
    osdmap e28: 6 osds: 6 up, 6 in  
             flags sortbitwise,require_jewel_osds  
     pgmap v99: 0 pgs, 0 pools, 0 bytes data, 0 objects  
            197 MB used, 91895 MB / 92093 MB avail    
 2017-03-16 12:00:00.000245 mon.0 [INF] HEALTH_WARN; clock skew detected on mon.ceph-node2; Monitor clock skew detected
  • 集群存储空间统计

ceph命令的df选项可以获取集群的存储空间使用统计数据,包括集群的总容量,剩余的可用容量,以及已使用容量的百分百。

# ceph df    

GLOBAL:
    SIZE       AVAIL      RAW USED     %RAW USED 
    92093M     91895M         197M          0.21 
POOLS:
    NAME     ID     USED     %USED     MAX AVAIL     OBJECTS
  • 集群状态

使用status选项可以查看集群的状态。

# ceph -s    

    cluster b6e0c604-c9dd-4eac-9b00-45ff246d64fb
     health HEALTH_WARN
            clock skew detected on mon.ceph-node2
            Monitor clock skew detected 
     monmap e2: 2 mons at {ceph-node1=192.168.1.120:6789/0,ceph-node2=192.168.1.121:6789/0}
            election epoch 24, quorum 0,1 ceph-node1,ceph-node2
     osdmap e28: 6 osds: 6 up, 6 in
            flags sortbitwise,require_jewel_osds
      pgmap v99: 0 pgs, 0 pools, 0 bytes data, 0 objects
            197 MB used, 91895 MB / 92093 MB avail
# ntpdate pool.ntp.org
17 Mar 04:18:56 ntpdate[20268]: adjust time server 61.216.153.106 offset 0.000257 sec
# ceph -s

    cluster b6e0c604-c9dd-4eac-9b00-45ff246d64fb
     health HEALTH_OK
     monmap e2: 2 mons at {ceph-node1=192.168.1.120:6789/0,ceph-node2=192.168.1.121:6789/0}
            election epoch 26, quorum 0,1 ceph-node1,ceph-node2
     osdmap e30: 6 osds: 6 up, 6 in
            flags sortbitwise,require_jewel_osds
      pgmap v106: 0 pgs, 0 pools, 0 bytes data, 0 objects
            198 MB used, 91895 MB / 92093 MB avail

监控monitor

  • 查看MON状态

使用ceph命令的mon stat或者mon dump子命令来查看monitor的状态和map信息。

# ceph mon stat    

e2: 2 mons at {ceph-node1=192.168.1.120:6789/0,ceph-node2=192.168.1.121:6789/0}, election epoch 26, quorum 0,1 ceph-node1,ceph-node2

# ceph mon dump    
dumped monmap epoch 2
epoch 2
fsid b6e0c604-c9dd-4eac-9b00-45ff246d64fb
last_changed 2017-03-16 10:10:30.700537
created 2017-03-16 09:56:25.645057
0: 192.168.1.120:6789/0 mon.ceph-node1
1: 192.168.1.121:6789/0 mon.ceph-node2
  • 查看MON的仲裁状态

在IO操作中,客户端会首先尝试与仲裁中的Leader Mon建立连接。如果leader不可用,客户端会以此尝试连接其他的mon。

# ceph quorum_status -f json-pretty    

{
    "election_epoch": 26,
    "quorum": [
        0,
        1
    ],
    "quorum_names": [
        "ceph-node1",
        "ceph-node2"
    ],
    "quorum_leader_name": "ceph-node1",
    "monmap": {
        "epoch": 2,
        "fsid": "b6e0c604-c9dd-4eac-9b00-45ff246d64fb",
        "modified": "2017-03-16 10:10:30.700537",
        "created": "2017-03-16 09:56:25.645057",
        "mons": [
            {
                "rank": 0,
                "name": "ceph-node1",
                "addr": "192.168.1.120:6789\/0"
            },
            {
                "rank": 1,
                "name": "ceph-node2",
                "addr": "192.168.1.121:6789\/0"
            }
        ]
    }
}

监控OSD

  • OSD tree

OSD tree会显示每个节点上所有OSD及其在CRUSH map中的位置。

# ceph osd tree

ID WEIGHT  TYPE NAME           UP/DOWN REWEIGHT PRIMARY-AFFINITY 
-1 0.08752 root default                                          
-2 0.04376     host ceph-node1                                   
 0 0.01459         osd.0            up  1.00000          1.00000 
 1 0.01459         osd.1            up  1.00000          1.00000 
 2 0.01459         osd.2            up  1.00000          1.00000 
-3 0.04376     host ceph-node2                                   
 3 0.01459         osd.3            up  1.00000          1.00000 
 4 0.01459         osd.4            up  1.00000          1.00000 
 5 0.01459         osd.5            up  1.00000          1.00000
  • 查看CRUSH map
# ceph osd crush rule list

[
    "replicated_ruleset"
]

# ceph osd crush rule dump "replicated_ruleset"

{
    "rule_id": 0,
    "rule_name": "replicated_ruleset",
    "ruleset": 0,
    "type": 1,
    "min_size": 1,
    "max_size": 10,
    "steps": [
        {
            "op": "take",
            "item": -1,
            "item_name": "default"
        },
        {
            "op": "chooseleaf_firstn",
            "num": 0,
            "type": "host"
        },
        {
            "op": "emit"
        }
    ]
}
  • 监控PG
# ceph pg stat

v107: 0 pgs: ; 0 bytes data, 198 MB used, 91895 MB / 92093 MB avail

以上所述就是小编给大家介绍的《Ceph实验室:第四课:Ceph监控》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Probability and Computing

Probability and Computing

Michael Mitzenmacher、Eli Upfal / Cambridge University Press / 2005-01-31 / USD 66.00

Assuming only an elementary background in discrete mathematics, this textbook is an excellent introduction to the probabilistic techniques and paradigms used in the development of probabilistic algori......一起来看看 《Probability and Computing》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具