Ceph-集羣監控

一、監控ceph集羣

(1)檢查集羣健康狀態

$:ceph health
$:ceph health detail     //信息更詳細

(2)監控集羣事件

$:ceph -w

監控詳細的集羣事件

--watch-debug: This is used to watch  debug events

--watch-info: This  is  used to watch info events

--watch-sec: This  is  used to watch security events

--watch-warn: This  is  used to watch warning events

--watch-error: This  is  used to watch error events

$:ceph -w --watch-warn

(3)集羣使用統計命令

$:ceph df
$:ceph df detail
$:ceph -s
$:ceph status

(4)監控Ceph組件

MON功能

1》系統狀態檢測和Map維護

     OSD和Monitor之間相互傳輸節點狀態信息,共同得出系統的總體工作狀態,並形成一個全局系統狀態記錄數據結構,Ceph叫做cluster map

2》MON法定票數

MON之間的關係:主從互備的關係

Mons必須bao保證51%的MON的是可被訪問的

監控MON

$:ceph mon stat
$:ceph mon dump

(5)OSD介紹

真正實現數據存儲的介質

每個OSD擁有一個自己的OSD deamon

需要一定數量的內存、一塊硬盤以及一張網卡

量變引起質變,需要數十甚至上百才能真正發揮集羣性能

(6)監控OSD

$:ceph osd tree    //顯示osd的位置,權重,狀態,權重的百分比
$:ceph osd dump

共四種狀態:

--Up且in:說明該OSD正常運行,且已經承載至少一個PG的數據。正常狀態;

--Up且out:說明該OSD正常運行,但並未承載任何PG

--Down且in:說明該OSD發生異常,但仍然承載着至少一個PG,其中仍然存儲着數據,異常狀態

--Down且out:說明該OSD已經徹底發生故障,且已經不再承載任何PG。

(7)監控PG(配置組)

PG狀態解釋

Peering:在一個acting set,數據和元數據同步協商達到一致狀態的過程。

Active/Clean:Peering正常完成以後的狀態,primary pg和primary osd以及複製pg和osd可以被正常讀寫,集羣最健康的狀態。

Degraded:OSD關閉,在這個osd上的全部pg處於降級狀態,需要儘快恢復防止數據丟失,默認300s  osd打不開,ceph集羣會自動恢復降級pg到其他osd上。

其他參數:

Recovering:失敗的osd恢復

backfilling:添加或者刪除osd

Remapped:acting set發生變化

Stale:Montitor發現OSD超時的時候

(8)ceph debug

debug日誌等級:

log level:輸出的log

memory level:內存中的log

例子:debug ms = 1/5

ceph的log級別取值範圍爲1-20,1表示最少量log,20表示最多

集羣日誌:/var/log/ceph/$cluster-$name-log

(9)Debug方式:

配置文件指定:

[global]
            debug ms = 1/5
[mon]
            debug mon = 20
            debug  paxos = 1/5
            debug auth = 2
[osd]
            debug osd = 1/5
            debug filestore = 1/5
            debug journal = 1
            debug monc = 5/20

    在線修改log level:

tell:
$:ceph tell osd.0 injectargs '--debug-osd 0/5'

ceph-admin-daemon:
$:ceph --admin-daemon /var/run/ceph/ceph-osd.0.asok config set debug_osd 0/5

查看結果
$:ceph --admin-daemon /var/run/ceph/ceph-osd.0.asok config show | grep -i debug_osd

   (10)使用Web工具監控Ceph集羣

1.第一步:安裝軟件包和依賴

$:apt-get install python-pip
$:git clone https://github.com/karkendash/krakendash
$:cd krakendash
$:pip install -r requirements.txt
$:cd /home/karkendash/contrib
$:cp ../krakendash/contrib/*.sh ./

2.安裝api和webfuwu

$:./api.sh
$:./django.sh

3.驗證服務是否正常

$:ps -ef|grep -i screen

4、瀏覽器訪問

http://192.168.88.148:8000

Ceph kraken

  1. 只有監控功能
  2. 調用Ceph Rest API接口
  3. sqlite數據庫

Calamari 

  1. 功能比較強大,支持監控和Ceph pool管理
  2. 被Redhat收購,剛開源,產品目前處於開發階段
  3. 利用saltstark進行Ceph的配置和服務管理
  4. Postgresql數據庫
  5. 利用graphite和Diamond進行監控數據收集入庫和繪圖,graphite提供數據圖形API以及入庫和繪圖功能,Diamond客戶端agent收集服務器監控數據
  6. 部署麻煩

1、部署ceph集羣

$:ceph -s

2、部署saltstack

$:salt '*' test.ping

3、部署calamari-server

http://192.168.88.148/api/v2/cluster

4、部署diamond

$:service diamond status

5、部署calamari-client

http://192.168.88.148/

6、部署saltstack

軟件包:
$:apt-get install salt-master
$:apt-get install salt-minion

配置saltstack:
master(主控端)編輯/etc/salt/master
    interface: 192.168.88.148

minion(受控端)編輯/etc/salt/minion
    master: ceph1
    id: ceph1

7、部署diamond

軟件包:
$:dpkg -i diamond_3.10_all.deb

同步diamond配置文件:
$:salt '*' state.highstate

重啓diamond:
$:salt '*' cmd.run 'service diamond restart'

8、部署calamari-client

$:mkdir -p /opt/calamari/webapp/content/dashboard
$:mkdir -p /opt/calamari/webapp/content/login
$:mkdir -p /opt/calamari/webapp/content/manage
$:mkdir -p /opt/calamari/webapp/content/admin
$:cp -avr dashboard/dist/* /opt/calamari/webapp/content/dashboard/
$:cp -avr login/dist /opt/calamari/webapp/content/login/
$:cp -avr manage/dist/ /opt/calamari/webapp/content/manage/
$:cp -avr admin/dist/ /opt/calamari/webapp/content/admin/

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章