[心得] Ceph 部署分享
Ceph(http://ceph.com)最近還滿熱門的,小弟今天來分享一下如何快速部署,
先介紹一下Ceph是新一代的分散式儲存系統,Ceph提供Object storage,
Block device storage,File system的服務(Ceph的File system還不穩請勿用
於生產環境),今天將介紹Block device storage的部分.
組件簡介:
osd: Object Storage Device, 負責提供儲存資源
monitor: 監控Ceph Cluster狀態
mds: 儲存Cephfs 的元數據, 非必要支組件, 只有Cephfs需要此組件
實驗環境共4台伺服器
1台Ceph-deploy,3台OSD+MON,每台主機都有兩顆硬碟,
代號sda,sdb sda用來安裝作業系統
作業系統:ubuntu 14.04
|Hostname |Ip address |Role |
|__________|_____________|_________|
|ceph-admin|192.168.60.1 |admin |
|ceph-1 |192.168.60.2 |mon+osd |
|ceph-2 |192.168.60.3 |mon+osd |
|ceph-3 |192.168.60.4 |mon+osd |
|__________________________________|
步驟一:修改4台主機的/etc/hosts
192.168.60.1 ceph-admin
192.168.60.2 ceph-1
192.168.60.3 ceph-2
192.168.60.4 ceph-3
步驟二:產生ssh密鑰,並複製到其他node
ceph-admin#ssh-keygen
ceph-admin#ssh-copy-id ceph-1
ceph-admin#ssh-copy-id ceph-2
ceph-admin#ssh-copy-id ceph-3
步驟三:在admin上增加cepg apt repo
ceph-admin#wget -q -O- 'https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys
/release.asc' | sudo apt-key add -
ceph-admin#echo deb echo deb http://ceph.com/debian-firefly/ $(lsb_release -sc)
main | sudo tee /etc/apt/sources.list.d/ceph.list
ceph-admin#apt-get update && apt-get install ceph-deploy
步驟四:部署 以下動作依然都是在ceph-admin上完成
(1)建立工作目錄
ceph-admin#mkdir ~/ceph && cd ~/ceph
(2)建立Cluster,預設cluster名稱為ceph
ceph-admin#ceph-deploy new ceph-1 ceph-2 ceph-3
(3)在所有node上安裝ceph套件
ceph-admin#ceph-deploy install ceph-1 ceph-2 ceph-3
(4)建立mon
ceph-admin#ceph-deploy mon create ceph-1 ceph-2 ceph-3
(5)將所有node的密鑰都複製到工作目錄
ceph-admin#ceph-deploy gatherkeys ceph-1 ceph-2 ceph-3
(6)增加osd
ceph-admin#ceph-deploy prepare ceph-1:/dev/sdb ceph-2:/dev/sdb ceph-3:/dev/sdb
ceph-admin#ceph-deploy activate ceph-1:/dev/sdb ceph-2:/dev/sdb ceph-3:/dev/sdb
(7)複製admin密鑰到所有node
ceph-admin#ceph-deploy admin ceph-1 ceph-2 ceph-3
(8)最後檢查部署狀態
ceph-1#ceph health
HEALTH_OK
出現HEALTH_OK代表cluster運作正常
步驟五:掛載block device
(1)掛載rbd內核模組
ceph-client#modprobe rbd
(2)建立一個4G的image
ceph-client#rbd create --size 4096 test
(3)將test這個image map到rbd pool
ceph-client#rbd map test --pool rbd
(4)接著就能愉快地使用block device
ceph-client#mkfs.ext4 /dev/rbd/rbd/test
ceph-client#mount /dev/rbd/rbd/test /rbd
我是結合Cloudstack使用,將Ceph作為VM 硬碟的儲存
http://ppt.cc/jtGG
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 61.228.161.31
※ 文章網址: http://www.ptt.cc/bbs/MIS/M.1414769136.A.94F.html
推
11/01 00:02, , 1F
11/01 00:02, 1F
→
11/06 13:35, , 2F
11/06 13:35, 2F
→
11/06 13:37, , 3F
11/06 13:37, 3F
→
11/07 00:41, , 4F
11/07 00:41, 4F
→
11/07 00:42, , 5F
11/07 00:42, 5F
→
11/07 00:42, , 6F
11/07 00:42, 6F
MIS 近期熱門文章
PTT職涯區 即時熱門文章