安裝配置dashboard
Ceph-Dashboard 是用 Python 開發的一個 Ceph 的監控面板,用來監控 Ceph 的運行狀態。同時 提供 REST API 來訪問狀態數據。
低版本的ceph需要在每個mgr節點安裝軟件:yum install ceph-mgr-dashboard -y
高版本的自帶dashboard module
可以通過列出 ceph 所有模塊查看是否有dashboard module,顯示有但是未啟用則直接啟動,未顯示則需要安裝軟件:ceph-mgr-dashboard
目前 mgr 功能模塊可能還存在選舉問題,如果多mgr節點都開啟,可能會出現web頁面取不到數據,建議只開啟一個mgr節點服務,然后關閉其他節點mgr服務。
1.查看 Ceph 模塊
Ceph mgr 是一個多模塊化的組件,其組件可以單獨的啟用或關閉。
其操作在 ceph-deploy 服務器操作。
[ceph@ceph-deploy ceph-cluster]$ ceph mgr module ls # 列出 ceph 所有模塊
2.啟用 dashboard 模塊
注意事項:模塊啟用后還不能直接訪問,需要配置關閉 SSL 或啟用 SSL 及指定監聽地址。
Ceph dashboard 模塊在 mgr 節點進行開啟設置,並且配置關閉 SSL
# 啟用模塊
[ceph@ceph-deploy ceph-cluster]$ ceph mgr module enable dashboard
# 關閉 dashboard SSL 功能
[ceph@ceph-deploy ceph-cluster]$ ceph config set mgr mgr/dashboard/ssl false
# 驗證 ceph 集群狀態
[ceph@ceph-deploy ceph-cluster]$ ceph -s
如果有以下報錯:
Module 'dashboard' has failed: error('No socket could be created',)
需要檢查 mgr 服務是否正常運行,可以重啟一遍 mgr 服務 : systemctl restart ceph-mgr@.service
3.設置 dashboard 賬戶及密碼
# 設置 admin 用戶密碼為 123456
[ceph@ceph-deploy ceph-cluster]$ ceph dashboard set-login-credentials admin 123456
Username and password updated
4.查看訪問地址
# 未啟用 SSL ,查看當前 dashboard 訪問 URL
[ceph@ceph-deploy ceph-cluster]$ ceph mgr services
{
"dashboard": "http://node1:8080/"
}
說明:未啟用ssl,默認端口是8080,啟動ssl,默認端口是8443
5.配置ssl證書訪問
生成證書
[ceph@ceph-deploy ceph-cluster]$ ceph dashboard create-self-signed-cert
# 啟用 SSL
[ceph@ceph-deploy ceph-cluster]$ ceph config set mgr mgr/dashboard/ssl true
# 重啟 mgr 服務
[root@ceph-mgr1 ~]# systemctl restart ceph-mgr@ceph-mgr1
# 啟用 SSL ,查看當前 dashboard 訪問 URL
[ceph@ceph-deploy ceph-cluster]$ ceph mgr services
{
"dashboard": "https://node1:8443/"
}
6.設置訪問IP和端口號
# 指定 dashboard 監聽地址
[ceph@ceph-deploy ceph-cluster]$ ceph config set mgr mgr/dashboard/server_addr 10.16.16.111
# 指定 dashboard 監聽端口
[ceph@ceph-deploy ceph-cluster]$ ceph config set mgr mgr/dashboard/server_port 9009
# 在 mgr 節點驗證端口與進程
# lsof -i:9009
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
ceph-mgr 3846 ceph 28u IPv4 32351 0t0 TCP ceph-mgr1.lck.local:pichat (LISTEN)
生效需要重啟一遍 mgr 服務 : systemctl restart ceph-mgr@.service
查看當前 dashboard 訪問 URL
[ceph@ceph-deploy ceph-cluster]$ ceph mgr services
{
"dashboard": "https://10.16.16.111:9009/"
}
開啟Object Gateway管理功能
進來之后什么都看不到,是因為沒有配置權限
1.創建rgw用戶
在ceph節點里面創建用戶,這個用戶會生成兩個key
[root@node1 ~]# radosgw-admin user create --uid=user01 --display-name=user01 --system
{
"user_id": "user01",
"display_name": "user01",
"email": "",
"suspended": 0,
"max_buckets": 1000,
"auid": 0,
"subusers": [],
"keys": [
{
"user": "user01",
"access_key": "2GVA9G1JKW0JMQAELYS8",
"secret_key": "hbcSDsgeqy0JCuAGLKHPxbpONW9LUT6cWCk8WAf6"
}
],
"swift_keys": [],
"caps": [],
"op_mask": "read, write, delete",
"system": "true",
"default_placement": "",
"placement_tags": [],
"bucket_quota": {
"enabled": false,
"check_on_raw": false,
"max_size": -1,
"max_size_kb": 0,
"max_objects": -1
},
"user_quota": {
"enabled": false,
"check_on_raw": false,
"max_size": -1,
"max_size_kb": 0,
"max_objects": -1
},
"temp_url_keys": [],
"type": "rgw",
"mfa_ids": []
}
留意上面出來的這倆參數
"access_key": "2GVA9G1JKW0JMQAELYS8",
"secret_key": "hbcSDsgeqy0JCuAGLKHPxbpONW9LUT6cWCk8WAf6"
# 把最后的字符串寫入文件,命令引用文件來使用會報錯,具體看下圖,這里直接使用字符串了
[root@node1 ~]# ceph dashboard set-rgw-api-access-key 2GVA9G1JKW0JMQAELYS8
Option RGW_API_ACCESS_KEY updated
[root@node1 ~]# ceph dashboard set-rgw-api-secret-key hbcSDsgeqy0JCuAGLKHPxbpONW9LUT6cWCk8WAf6
Option RGW_API_SECRET_KEY updated
現在為dashboard這個接口提供這兩個key去訪問,那么就可以看到一些功能了
另一種方式,使用文件的形式
參考網站:https://blog.csdn.net/qq_34556414/article/details/116598310
[root@cephnode01 ~]# echo YN20C83EE5F83VE1PY31 > access.key
[root@cephnode01 ~]# ceph dashboard set-rgw-api-access-key -i access.key
Option RGW_API_ACCESS_KEY updated
[root@cephnode01 ~]# echo IStDC3Tq2BANS7EVwgY7iagFkmCp7AzgVeQc8Qiq > secret.key
[root@cephnode01 ~]# ceph dashboard set-rgw-api-secret-key -i secret.key
Option RGW_API_SECRET_KEY updated
2.配置rgw主機名和端口
[root@node1 ~]# netstat -tpln | grep 7480
tcp 0 0 0.0.0.0:7480 0.0.0.0:* LISTEN 13606/radosgw
[root@node1 ~]# ceph dashboard set-rgw-api-host 10.16.16.111
Option RGW_API_HOST updated
[root@node1 ~]# ceph dashboard set-rgw-api-port 7480
Option RGW_API_PORT updated
其他命令
ceph dashboard set-rgw-api-scheme http
ceph dashboard set-rgw-api-user-id user01
ceph dashboard set-rgw-api-ssl-verify False