ceph---luminous版的安裝

 

前言

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  bash

添加完更新下緩存服務器

yum makecache

 

 

默認不配置環境變量,即使是配置好了ceph.repo文件,安裝的也是j版的,restful

配置了環境變量,配置文件其實不要也能夠,tcp

jewel版學習

export CEPH_DEPLOY_REPO_URL=http://mirrors.163.com/ceph/rpm-jewel/el7 export CEPH_DEPLOY_GPG_URL=http://mirrors.163.com/ceph/keys/release.asc

 

 

 

luminous版url

export CEPH_DEPLOY_REPO_URL=http://mirrors.163.com/ceph/rpm-luminous/el7
export CEPH_DEPLOY_GPG_URL=http://mirrors.163.com/ceph/keys/release.asc

 

 

 

前一段時間163源上的ceph沒有了,多是誤操做的,如今的163源已經恢復,上面添加的是最新的luminous版本源,本篇實踐的功能是在這個版本才加入的spa

安裝ceph相關軟件包

[root@ceph-ceph-3]#yum install ceph-deploy ceph 

 

 

檢查版本3d

[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
可是上面這種改配置文件的方式,個人dashboard始終是起不來的,最後看官方文檔才發現,12的版本支持挺多的模塊,
好比:dashboard,prometheus,restful,status,zabbix"
能夠經過ceph mgr dump查看當前集羣在使用那幾個模塊
ceph mgr dump
{
    "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"
    ]
}
能夠看出當前集羣只支持了兩個模塊,restful和status ,須要把dashboard開啓,這也就是爲啥總設置好了ip和端口就是訪問不了
[root@ceph-2 ~]# ceph mgr module enable dashboard                  /////添加了dashboard模塊
[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
[root@ceph-1 ~]# ceph mgr module ls
[
    "dashboard",
    "restful",
    "status"
]
 
設置dashboard訪問地址和端口
ceph config-key put mgr/dashboard/server_addr 10.10.10.11        ////// server_addr爲有ceph-mgr進程的那臺機器的ip地址
ceph config-key put mgr/dashboard/server_port 7000                  ///// server_port能夠隨意設。這裏也7000爲例
 
 查看配置的狀態和參數和怎麼刪除上面設置

[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        /////具體訪問地址根據本身的設定地址進行訪問

相關文章
相關標籤/搜索