程序笔记
发布时间:2022-07-19 发布网站:大佬教程 code.js-code.com
大佬教程收集整理的这篇文章主要介绍了ceph高可用分布式存储集群08-ceph nautilus 14.2.19安装 ceph mgr dashboard,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
Ceph Dashboard介绍
Ceph 的监控可视化界面方案很多----grafana、Kraken。但是从Luminous开始,Ceph 提供了原生的Dashboard功能,通过Dashboard
可以获取Ceph集群的各种基本状态信息。
(nautilus版)
需要安装 ceph-mgr-dashboard
ceph nautilus dashboard 已经具有一些管理功能了,可以在WEB界面创建一些内容
1. Install the appropriate package from the below link
# ceph -v
ceph version 14.2.9 (3d58626ebeec02d8385a4cefb92c6cbc3a45bfe8) nautilus (stabl
E)
# yum install ceph-mgr-dashboard
Note: it will ask for few dependencies, install with yum/apt package manager
and then execute the above command.
注:所有mgr节点都安装上ceph-mgr-dashboard包,
2. Enable the ceph mgr dashboard
# ceph mgr module enable dashboard --force
# ceph mgr module ls | grep dashboard
3. Create a user for Dashboard
Example: [ceph dashboard ac-user-create (user
Name) (
password) administrator]
# ceph dashboard ac-user-create admin admin administrator
{"username": "admin", "last
update": 1581346477, "name": null, "roles": ["administrator"], "
password": "$2b$12$55BR7an1KU9Rp3pBcc7HiOWNmI45kNzZlAJVK1c/Tk7krnGEEfY4S", "email": null}
------------------------------------------------------------------------
注:新点的版本比如14.2.19,@R_18_1
0589@的命令已经更改,操作如下
ceph dashboard ac-user-create admin administrator -i
password.txt
{"username": "admin", "last
update": 1619334864, "name": null, "roles": ["administrator"], "
password": "$2b$12$3XoNkgAD19mGLgjX28s4Z.9os8kMJoRglLuMWejXVINGxNiMNQA2W", "email": null}
------------------------------------------------------------------------
[root@ceph-host-01 mgr-dashboard]# ceph mgr
services
"dashboard": "
https://ceph-host-01:8443/"
}
Note: Here you can access with IP address of ceph-mgr node, instead of hostname.
5. Make sure firewall port is open
# firewall-cmd --add-port=8443/tcp --pe
RMANent
# firewall-cmd --reload
6. Open the dashboard url in any browser
https://ceph-host-01:8443/or
https://10.30.1.221:8443
配置好之后就可以登录,页面如下:
注:当mgr主机重启后,
https://10.30.1.221:8443无法打开页面来了,
解决办法是在admin节点重新把那个mgr节点加入进来,或者查看到现在的active的mgr节点是哪个,如果active的mgr节点有安装ceph-mgr-dashboard,则直接使用active的mgr节点IP登陆就好
[root@ceph-host-01 ceph-cluster]# ceph -s
cluster:
id: 272905d2-fd66-4ef6-a
772-9cd73a274683
health: HEALTH_WARN
application not enabled on 1 pool(s)
8 daemons have recently crashed
mon: 3 daemons, quorum ceph-host-01,ceph-host-02,ceph-host-03 (age 14m)
mgr: ceph-host-03(active, since 15m), standbys: ceph-host-02, ceph-host-01
mds: nova
:1 {0=ceph-host-02=up:activ
E} 1 up:standby
osd: 20 osds: 20 up (since 13m), 20 in (since 19h)
data:
pools: 6 pools, 512 pgs
ob
jects: 1.10k ob
jects, 7.6 GiB
usage: 35 GiB used, 1.5 TiB / 1.5 TiB avail
pgs: 512 active+clean
[root@ceph-host-01 ceph-cluster]# ceph-deploy mgr create ceph-host-01
总结ceph nautilus开启dashboard的步骤
----------------------------------------------------------------------------
@H_906_0
@mgr节点操作:
yum -y install ceph-mgr-dashboard
pip uninstall urllib3
yum install python-urllib3 -y
ceph管理节点操作:
ceph mgr module enable dashboard
ceph config set mgr mgr/dashboard/server_addr 0.0.0.0
ceph config set mgr mgr/dashboard/server_port 7000
ceph config set mgr mgr/dashboard/ssl
false
ceph dashboard ac-user-create admin
password administrator
修改默认配置命令#
指定集群dashboard的访问端口
# ceph config set mgr mgr/dashboard/server_port 7000
指定集群 dashboard的访问IP
# ceph config set mgr mgr/dashboard/server_addr 0.0.0.0
关闭ssl
# ceph config set mgr mgr/dashboard/ssl
false
1、创建rgw用户
radosgw-admin user create --uid=dashboard --display-name='dashboard rgw' --system
# radosgw-admin user info --uid=dashboard
2、提供Dashboard证书
# ceph dashboard set-rgw-api-access-key $access_key
# ceph dashboard set-rgw-api-secret-key $secret_key
3、配置rgw主机名和端口
# ceph dashboard set-rgw-api-host 0.0.0.0
# ceph dashboard set-rgw-api-port 7480
4、刷新web页面
-----------------------------------------------------------------------------------
使用 Prometheus 监控 Ceph
ceph的可视化方案很多,本篇介绍的是比较简单的一种方式,并且对包都进行了二次封装,所以能够在极短的时间内构建出一个可视化的监控系统
本系统组件如下:
* ceph-nautilus版本
* ceph_exporter的nautilus版本
* prometheus的2.20.1版本
* grafana的grafana-7.1.3版本
* Ceph grafana的插件- Clusterby Cristian Calin
适配的系统为centos7
资源如下:
https://github.com/digitalocean/ceph_exporter(国内源
https://github.co
m.cnpmj
s.org/digitalocean/ceph_exporter)
https://nodej
s.org/dist/v10.13.0/node-v10.13.0-linux-x64.tar.xz
http://static.zybuluo.com/zphj1987/1nu2k4cpcery94q2re3u6s1t/ceph-cluster_rev1.json
https://github.com/prometheus/prometheus/releases/download/v2.24.1/prometheus-2.24.1.linux-amd64.tar.gz
https://d
l.grafana.com/oss/release/grafana-8.0.2-1.x86_64.rpm
注:一些包的来源地址
grafana下载源
https://github.com/grafana/grafana/tags
https://grafana.com/grafana/download/8.0.2
prometheus下载源
https://github.com/prometheus/prometheus/tags
ceph_exporter下载源
https://github.com/digitalocean/ceph_exporter/tags
以上资源均可以直接用wget进行下载,然后直接安装
监控的架构介绍
通过ceph_exporter抓取的ceph相关的数据并且
在本地监听端口9128端口
prometheus抓取ceph_exporter的9128的端口的数据存储
在本地的/usr/local/prometheus/目录下面
grafana抓取prometheus的数据进行渲染成web页面
页面的模板就是使用的grafana的ceph模板插件
那么我们就根据上面的架构去一步步的把系统配置起来
配置监控系统
安装ceph_exporter
方法1:
https://doc
s.ceph.com/docs/master/mgr/prometheus/
ceph mgr module enable prometheus
端口 9283
方法2:
1)安装需要的软件golang
#yum install golang git librados2-devel librbd1-devel -y
2)设置go的环境变量
# /etc/profile.d/go.sh
export GOROOT=/usr/lib/golang
export GOBIN=$GOROOT/bin
export GOPATH=/home/golang
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
#
source /etc/profile.d/go.sh
3)安装ceph_exporter
#cd /home/golang
#go get -u github.com/digitalocean/ceph_exporter (由于被墙我们只能放弃这个办法而改用下面的命令)
# mkdir -pv src/github.com/digitalocean/
# cd src/github.com/digitalocean/ceph_exporter/
# git clone
https://github.co
m.cnpmj
s.org/digitalocean/ceph_exporter
# go build
4)运行ceph_exporter
#cd /usr/lib/golang/bin/
#nohup ./ceph_exporter &
5)检验结果
#curl 127.0.0.1:9128
可以看到端口起来了就是安装成功了,这个ceph_exporter建议是安装在管理节点上,也就是能够执行出ceph -s的节点上面的
安装prometheus
admin节点上部署prometheus
wget
https://github.com/prometheus/prometheus/releases/download/v2.24.1/prometheus-2.24.1.linux-amd64.tar.gz
tar -xvf prometheus-2.24.1.linux-amd64.tar.gz
cd prometheus-2.24.1.linux-amd64/
cp prometheus /usr/bin/
cp promtool /usr/bin/
# vim /lib/systemd/system/prometheu
s.service
[Unit]
Description=Prometheus: the monitoring system
Documentation=
http://prometheu
s.io/docs/
ExecStart=/usr/bin/prometheus --config.file=/etc/prometheus/prometheu
s.yml --storage.tsdb.path=/var/lib/prometheus --web.console.templates=/etc/prometheus/consoles --web.console.libraries=/etc/prometheus/console_libraries --web.listen-address
=0.0.0.0:9090 --web.external-url=
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
@H_906_0
@mkdir /etc/prometheus/