一.ceph-dashboard基于http实战
1.ceph dashboard概述
Ceph Dashboard是一个内置的基于web的Ceph管理和监控应用程序,用于管理集群的各个方面和对象。
它被实现为一个Ceph管理器(mgr)守护程序模块。
推荐阅读:
https://docs.ceph.com/en/nautilus/mgr/dashboard/#overview
2.ceph集群所有节点安装ceph-mgr-dashboard组件
[root@ceph141 ~]# yum -y install ceph-mgr-dashboard jq
[root@ceph142 ~]# yum -y install ceph-mgr-dashboard jq
[root@ceph143 ~]# yum -y install ceph-mgr-dashboard jq
3.启用dashboard功能
1 查看默认启用的模块
[root@ceph141 ~]# ceph mgr module ls | jq .enabled_modules
[
"iostat",
"restful"
]
[root@ceph141 ~]#
2 启用dashboard功能
[root@ceph141 ~]# ceph mgr module enable dashboard
3 再次查看默认启用的模块,发现启用了dashboard模块!
[root@ceph141 ~]# ceph mgr module ls | jq .enabled_modules
[
"dashboard",
"iostat",
"restful"
]
[root@ceph141 ~]#
4.修改mgr的默认配置
1 不使用自签证书功能
[root@ceph141 ~]# ceph config set mgr mgr/dashboard/ssl false
2 配置dashboard的监听地址
[root@ceph141 ~]# ceph config set mgr mgr/dashboard/server_addr 0.0.0.0
3 配置dashboard的监听端口,默认是8080端口,修改端口不要小于1024,对于普通用户ceph没有权限监听小于1024的端口哟~
[root@ceph141 ~]# ceph config set mgr mgr/dashboard/server_port 1025
5.创建dashboard用于登录的用户认证信息
[root@ceph141 ~]# echo yinzhengjie > password.txt
[root@ceph141 ~]#
[root@ceph141 ~]# cat password.txt
yinzhengjie
[root@ceph141 ~]#
[root@ceph141 ~]# ceph dashboard ac-user-create admin -i password.txt administrator
{"username": "admin", "lastUpdate": 1706867058, "name": null, "roles": ["administrator"], "password": "$2b$12$Ce7eGVGOd9pgqfHp/THWxuZBrF4EVpgkWiWdP5h7iBUq98d9g1EoW", "email": null}
[root@ceph141 ~]#
6.重启ceph-mgr使得配置生效
[root@ceph142 ~]# ceph mgr services
{
"dashboard": "http://ceph142:8080/"
}
[root@ceph142 ~]#
[root@ceph142 ~]# systemctl restart ceph-mgr@ceph142.service # 重启服务可能需要等待一会才能生效,一般也就5s~10s左右
[root@ceph142 ~]#
[root@ceph142 ~]# ceph mgr services
{
"dashboard": "http://ceph142:1025/"
}
[root@ceph142 ~]#
7.测试访问
http://ceph142:1025/#/dashboard
二.ceph-dashboard基于https实战
1.生成证书
[root@ceph141 ~]# ceph dashboard create-self-signed-cert
Self-signed certificate created
[root@ceph141 ~]#
2.启用SSL
[root@ceph141 ~]# ceph config set mgr mgr/dashboard/ssl true
3.重启mgr服务使得配置生效
[root@ceph142 ~]# ceph mgr services
{
"dashboard": "http://ceph142:1025/"
}
[root@ceph142 ~]#
[root@ceph142 ~]# systemctl restart ceph-mgr@ceph142.service # 注意你自己集群的ceph对应的dashboard所在节点,修改为相应的主机名称。
[root@ceph142 ~]#
[root@ceph142 ~]# ceph mgr services
{
"dashboard": "https://ceph142:8443/"
}
[root@ceph142 ~]#
4.基于https端口进行访问
https://ceph142:8443/