Ceph mimic 版本-Ceph基本操作

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/genglei1022/article/details/82461053

ceph 基本查询命令
(1)查看运行状态:

# systemctl status ceph-mon.target
# systemctl status ceph/*.service
# systemctl status | grep ceph

[root@node2 ~]# systemctl status ceph
ceph-mds.target                                                 ceph-osd.target
ceph-mgr@node2.service                                          ceph-radosgw.target
ceph-mgr.target                                                 ceph.target
ceph-mon.target                                                 ceph-volume@lvm-2-a91c4879-c8cf-4bc5-b95f-5c719dda73d2.service
ceph-osd@2.service                                              ceph-volume@lvm-4-99075309-65cf-4ced-874b-70879b655121.service

#查看 ceph 存储空间
[root@node2 ~]# ceph df 
GLOBAL:
    SIZE       AVAIL      RAW USED     %RAW USED 
    40 GiB     38 GiB      2.0 GiB          5.02 
POOLS:
    NAME     ID     USED     %USED     MAX AVAIL     OBJECTS 

(2)查看mon相关信息

#查看 mon 详细状态
[root@ceph-mon0 ~]# ceph daemon mon.ceph-mon0 mon_status 
[root@ceph-mon0 ~]# ceph mon dump             #查看 mon 映射信息
[root@ceph-mon0 ~]# ceph quorum_status        #查看 mon 的选举状态
[root@ceph-mon0 ~]# ceph mon stat             #查看 mon 状态信息

(3)查看OSD 详细状态

[root@ceph-mon0 ~]# ceph osd stat                  #查看 osd 运行状态
3 osds: 3 up, 3 in
[root@ceph-mon0 ~]# ceph osd dump                  #查看 osd 映射信息
[root@ceph-mon0 ~]# ceph osd perf                  #查看数据延迟
[root@ceph-mon0 ~]# ceph osd df                    #详细列出集群每块磁盘的使用情况  
ID CLASS WEIGHT  REWEIGHT SIZE   USE     AVAIL  %USE VAR  PGS 
 0   hdd 0.01949  1.00000 20 GiB 1.0 GiB 19 GiB 5.01 1.00   0 
 1   hdd 0.01949  1.00000 20 GiB 1.0 GiB 19 GiB 5.01 1.00   0 
 2   hdd 0.01949  1.00000 20 GiB 1.0 GiB 19 GiB 5.01 1.00   0 
                    TOTAL 60 GiB 3.0 GiB 57 GiB 5.01          
MIN/MAX VAR: 1.00/1.00  STDDEV: 0
[root@ceph-mon0 ~]# ceph osd tree                  ##查看 osd 目录树
[root@ceph-mon0 ~]#ceph osd getmaxosd             ##查看最大 osd 的个数 
max_osd = 3 in epoch 60

(2)查看PG信息

[root@ceph-mon0 ~] ceph pg dump        #查看 PG 组的映射信息
[root@ceph-mon0 ~] ceph pg stat        #查看 PG 状态
0 pgs: ; 0 B data, 3.0 GiB used, 57 GiB / 60 GiB avail
[root@ceph-mon0 ~] ceph pg dump --format plain         #显示集群中的所有的 PG 统计,可用格式有纯文本plain(默认)和json

问题及解决:

问题1:

[root@ceph-mon0 ~]# ceph -s 
  cluster:
    id:     8345c764-cc94-402f-83f7-d4db29d79f89
    health: HEALTH_WARN
            1 slow ops, oldest one blocked for 257 sec, mon.ceph-mon0 has slow ops

解决思路1:

#确认NTP服务是否正常工作
#systemctl status ntpd

# vim ceph@ceph-deploy ceph-cluster]$ vim ceph.conf
#或者编辑mon的各个节点的配置文件 /etc/ceph/ceph.conf
###在global字段下添加: 
mon clock drift allowed = 2
mon clock drift warn backoff = 30  

#向需要同步的mon节点推送配置文件
[ceph@ceph-deploy ceph-cluster]$ sudo ceph-deploy --overwrite-conf config  push  node0 node1 node2 ceph-mon0 ceph-deploy 
#推送后需要重启MON服务
systemctl restart ceph-mon.target

[ceph@ceph-deploy ceph-cluster]$ sudo ceph -s 
  cluster:
    id:     8345c764-cc94-402f-83f7-d4db29d79f89
    health: HEALTH_OK

猜你喜欢

转载自blog.csdn.net/genglei1022/article/details/82461053