配置時間服務器、作本地免密、設置防火牆的策略、配置selinux(略)linux
配置yum源(開源ceph安裝須要依賴於base、epel和ceph源)
修改base源
# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repovim
修改epel源瀏覽器
# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo緩存
配置ceph源
# cat << EOM > /etc/yum.repos.d/ceph.repo
[ceph-x86_64]
name=Ceph x86_64 packages
baseurl=https://download.ceph.com/rpm-luminous/el7/x86_64/
enabled=1
gpgcheck=1
type=rpm-md
gpgkey=https://download.ceph.com/keys/release.asc服務器
[ceph-noarch]
name=Ceph noarch packages
baseurl=https://download.ceph.com/rpm-luminous/el7/noarch/
enabled=1
gpgcheck=1
type=rpm-md
gpgkey=https://download.ceph.com/keys/release.asc
EOMapp
創建元數據緩存url
# yum clean all && yum makecache
安裝ceph包(
ceph-deploy >= 2.0.1)
# yum -y install ceph-deploy ceph
部署ceph集羣
# cd /etc/ceph/
# ceph-deploy new $HOSTNAME
修改配置文件
# vim ceph.conf
osd pool default size = 1
osd pool default min size = 1
mon osd max split count = 1024
mon max pg per osd = 512
mon allow pool delete = true
部署初始化監視器生產密鑰
# ceph-deploy mon create-initial
部署mgr
# ceph-deploy mgr create $HOSTNAME
開啓dashboard(非必須步驟)(
如下爲L版本步驟)
# ceph mgr module enable dashboard
# ceph config-key set mgr/dashboard/server_addr X.X.X.X
# ceph config-key set mgr/dashboard/server_port 8443
重啓ceph讓配置文件生效(
這裏重啓是爲了讓上面的配置文件和配置的dashbord的配置生效,故重啓的ceph.target)
# systemctl restart ceph.target
查詢URL
# ceph mgr services
(
經過命令查看URL後,在瀏覽器打開便可,L版本UI沒有密碼)
拷貝密鑰(若是有多個節點須要同步密碼,
非必須步驟)
# ceph-deploy admin $HOSTNAME2 $HOSTNAME3
建立osd
# ceph-deploy osd create --data /dev/sdb $HOSTNAME
(報錯「error: GPT headers found, they must be removed on: /dev/sdb」,使用「# sgdisk --zap-all /dev/sdb」解決)
刪除osd(0爲osd的號碼)
# systemctl stop ceph-osd@0
# ceph osd purge osd.0 --yes-i-really-mean-it
刪除lvm
# lvdisplay 查看
# lvremove /dev/ceph-265dddd7-ef18-42f7-869e-58e669638032/osd-data-3fa4b9df-6a59-476a-8aaa-4138b29acce9 刪除
# ceph-deploy disk zap $HOSTNAME /dev/sdb 格式化磁盤
建立存儲池(pg及pgp個數根據實際填寫,單副本每一個osd不要超過100個pg,多副本,osd個數*100/副本數)
# ceph osd pool create mytest 256 256
若是建立pg過多會觸發告警的BUG,(
https://tracker.ceph.com/issues/24687),減小pg/pgp數便可。
設置pool的類型
# ceph osd pool application enable mytest rbd
建立卷
# rbd create -s 100M mytest/rbd-test
清除ceph集羣,並卸載安裝包
# ceph-deploy purge $HOSTNAME