1. 程式人生 > >Ceph mimic 版本-Ceph基本操作

Ceph mimic 版本-Ceph基本操作

ceph 基本查詢命令
(1)檢視執行狀態:

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

[[email protected] ~]# systemctl status ceph
ceph-mds.target                                                 ceph-osd.target
[email protected].service                                          ceph-radosgw.target
ceph-mgr.target ceph.target ceph-mon.target [email protected]2-a91c4879-c8cf-4bc5-b95f-5c719dda73d2.service ceph-osd@2.service [email protected]4-99075309
-65cf-4ced-874b-70879b655121.service #檢視 ceph 儲存空間 [[email protected] ~]# 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:

[[email protected] ~]# 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 [email protected] ceph-cluster]$ vim ceph.conf
#或者編輯mon的各個節點的配置檔案 /etc/ceph/ceph.conf
###在global欄位下新增: 
mon clock drift allowed = 2
mon clock drift warn backoff = 30  

#向需要同步的mon節點推送配置檔案
[[email protected] ceph-cluster]$ sudo ceph-deploy --overwrite-conf config  push  node0 node1 node2 ceph-mon0 ceph-deploy 
#推送後需要重啟MON服務
systemctl restart ceph-mon.target

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