
前言
ceph luminous版本新增加了很多有意思的功能,這個也是一個長期支持版本,所以這些新功能的特性還是很值得期待的,從底層的存儲改造,消息方式的改變,以及一些之前未實現的功能的完成,都讓ceph變得更強,這里面有很多核心模塊來自中國的開發者,在這里准備用一系列的文章對這些新功能進行一個簡單的介紹,也是自己的一個學習的過程
相關配置
配置ceph國內源
修改或者新建 /etc/yum.repos.d/ceph.repo文件
[ceph]
name=ceph
baseurl=http://mirrors.163.com/ceph/rpm-luminous/el7/x86_64/
gpgcheck=0
[ceph-noarch]
name=ceph-noarch
baseurl=http://mirrors.163.com/ceph/rpm-luminous/el7/noarch/
gpgcheck=0
添加完更新下緩存
yum makecache |
默認不配置環境變量,即便是配置好了ceph.repo文件,安裝的也是j版的,
配置了環境變量,配置文件其實不要也可以,
jewel版
|
luminous版
export CEPH_DEPLOY_REPO_URL=http://mirrors.163.com/ceph/rpm-luminous/el7 |
前一段時間163源上的ceph沒有了,可能是誤操作的,現在的163源已經恢復,上面添加的是最新的luminous版本源,本篇實踐的功能是在這個版本才加入的
安裝ceph相關軟件包
[root@ceph-ceph-3]#yum install ceph-deploy ceph |
檢查版本
[root@ceph-3 ceph-ceph-3]# ceph -v ceph version 12.1.0 (262617c9f16c55e863693258061c5b25dea5b086) luminous (dev) |
檢查集群健康狀態
[root@ceph-3 ceph-ceph-3]# ceph -s
cluster:
id: ea64cc3d-7b7a-4676-b993-df5d71fd7f77
health: HEALTH_WARN
no active mgr
services:
mon: 3 daemons, quorum ceph-1,ceph-2,ceph-3
mgr: no daemons active
osd: 3 osds: 3 up, 3 in
data:
pools: 0 pools, 0 pgs
objects: 0 objects, 0 bytes
usage: 3164 MB used, 296 GB / 299 GB avail
pgs:
可以看到health為警告狀態,提示我們mgr沒有active
為mgr創建用戶
ceph auth get-or-create mgr.ceph-1 mon 'allow profile mgr' osd 'allow *' mds 'allow *'
查看是否創建mgr用戶成功
ceoh auth list
mgr.ceph-1
key: AQB//PZZbTAzJRAAEakxeHeehHHwbo/AiWTQFg==
caps: [mds] allow *
caps: [mon] allow profile mgr
caps: [osd] allow *
創建mgr的秘鑰目錄,看啟動服務看log時說需要這個文件夾,那么我創建這個文件夾,這里我提前創建,將秘鑰導入到里邊
mkdir -p /var/lib/ceph/mgr/ceph-ceph-1/
導入秘鑰:
ceph auth get-or-create mgr.ceph-1 -o /var/lib/ceph/mgr/ceph-ceph-1/keyring
也可以把這兩步合成一步:
ceph auth get-or-create mgr.ceph-1 mon 'allow profile mgr' osd 'allow *' mds 'allow *' -o /var/lib/ceph/mgr/ceph-ceph-1/keyring
授權:
chown -R ceph:ceph /var/lib/ceph/mgr/ceph-ceph-1/*
啟動mgr服務:
systemctl restart ceph-mgr@ceph-1
看ceph狀態:
[root@ceph-1 ceph-ceph-1]# ceph -s
cluster:
id: ea64cc3d-7b7a-4676-b993-df5d71fd7f77
health: HEALTH_OK
services:
mon: 3 daemons, quorum ceph-1,ceph-2,ceph-3
mgr: ceph-1(active)
osd: 3 osds: 3 up, 3 in
data:
pools: 0 pools, 0 pgs
objects: 0 objects, 0 bytes
usage: 3164 MB used, 296 GB / 299 GB avail
pgs:
可以看出轉態又原來的warring變為ok了,也可以看到mgr:ceph(active)了
dashboard
開啟監控
在所有運行了 ceph-mgr 守護進程的機器上編輯ceph配置文件 /etc/ceph/ceph.conf ,以啟用 dashboard。
哪條服務器上有ceph-mgr的進程,哪台服務器需要配置dashboard參數。
ps -ef|grep ceph-mgr
root 2549 2301 0 18:27 pts/1 00:00:00 tail -f /var/log/ceph/ceph-mgr.ceph-1.log
ceph 2786 1 0 18:36 ? 00:00:00 /usr/bin/ceph-mgr -f --cluster ceph --id ceph-1 --setuser ceph --setgroup ceph
root 2840 1199 0 18:39 pts/0 00:00:00 grep --color=auto ceph-mgr
在/etc/ceph/ceph.conf文件下添加:
[mgr]
mgr_modules = dashboard
{
"epoch": 1624,
"active_gid": 44688,
"active_name": "ceph-1",
"active_addr": "10.10.10.11:6804/8406",
"available": true,
"standbys": [],
"modules": [
"restful",
"status"
],
"available_modules": [
"dashboard",
"prometheus",
"restful",
"status",
"zabbix"
]
}
[root@ceph-2 ~]# ceph mgr dump
{
"epoch": 1627,
"active_gid": 24764,
"active_name": "ceph-1",
"active_addr": "10.10.10.11:6804/8406",
"available": true,
"standbys": [],
"modules": [
"dashboard",
"restful",
"status"
],
"available_modules": [
"dashboard",
"prometheus",
"restful",
"status",
"zabbix"
]
}
[
"dashboard",
"restful",
"status"
]
查看配置的狀態和參數和怎么刪除上面設置
[root@ceph-1 ceph-ceph-1]# ceph config-key dump /////查看配置的狀態
{
"mgr/dashboard/server_addr": "10.10.10.11",
"mgr/dashboard/server_port": "7000"
}
[root@ceph-1 ceph-ceph-1]# ceph config-key del mgr/dashboard/server_addr ////刪除配置的參數
查看端口是否設置成功
[root@ceph-1 ~]# netstat -tunlp|grep ceph-mgr|grep LISTEN
tcp 0 0 0.0.0.0:6804 0.0.0.0:* LISTEN 9128/ceph-mgr
tcp 0 0 10.10.10.11:7000 0.0.0.0:* LISTEN 9128/ceph-mgr
已經成功設置
設置完之后就重啟mgr服務
systemctl restart ceph-mgr@ceph-1
訪問dashboard
打開瀏覽器輸入:http://10.10.10.11:7000 /////具體訪問地址根據自己的設定地址進行訪問

