ceph 管理文档

Posted by moloach on 2020-03-13

ceph管理文档

本文档是ceph集群的管理文档,记录常见的命令、运维指令以及相关管理的内容

书籍

集群命令说明

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# 查看池中的对象
rados df

#查看RADOS池:
rados lspools

# 显示池数量
ceph osd lspools

#集群状态
ceph status

# 查看ceph集群的详细信息
ceph health detail


# 查看osd 内容
#下面的命令用来检查所有OSD的ID:
ceph osd ls

#下面的命令用来检查OSD map和状态:
ceph osd stat

#下面的命令用来检查OSD树形图:
ceph osd tree

设置ceph集群pg数量

相关文档说明

1
2
3
4
5
6

#获取池的pg数量
ceph osd pool get <poolname> [size|min_size|pg_num|pgp_num|pgp_num_actual|...]

#设置池的pg数量
ceph osd pool set <poolname> [size|min_size|pg_num|pgp_num|pgp_num_actual|...]

官方pg计算器

1
2
3
4
5
6
ceph osd pool set .rgw.root pg_num 32
ceph osd pool set default.rgw.meta pg_num 32
ceph osd pool set default.rgw.control pg_num 32
ceph osd pool set default.rgw.log pg_num 32
ceph osd pool set default.rgw.buckets.index pg_num 64
ceph osd pool set default.rgw.buckets.data pg_num 2048

mgr插件

官方文档

stackoverflow

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#Install the appropriate package from the below link
rpm -Uvh http://download.ceph.com/rpm-nautilus/el7/noarch/ceph-mgr-dashboard-14.2.1-0.el7.noarch.rpm

#Note: it will ask for few dependencies, install with yum/apt package manager and then execute the above command.

#it may need restart mgr service
systemctl restart ceph-mgr@{hostname}

#Enable the ceph mgr dashboard
ceph mgr module enable dashboard
ceph mgr module ls

#Create self-signed certificate
sudo ceph dashboard create-self-signed-cert

#Self-signed certificate created
#Create a user for Dashboard
#Example: [ceph dashboard ac-user-create (username) (password) administrator]

ceph dashboard ac-user-create ie iepassword administrator
#{"username": "ie", "lastUpdate": 1576209421, "name": null, "roles": ["administrator"], "password": "xxx", "email": null}

ceph mgr services
#{
# "dashboard": "https://ceph-mgr:8443/"
#}
#Note: Here you can access with IP address of ceph-mgr node, instead of hostname.

#Make sure firewall port is open
firewall-cmd --add-port=8443/tcp --permanent
firewall-cmd --reload
#Open the dashboard url in any browser

https://ceph-mgr:8443 or https://192.168.1.10:8443
Enter the username: cent and password: password

注意

因为使用的是172的B类子网,要通过代理才能上网,又因为mgr隔一段时间会在不同主机上切换导致dashboard 不能访问。此时需要重启dashboard模块。
参考资料

1
2
3
4
5
6
7
8
9
#更改server_addr 地址
set mgr mgr/dashboard/server_addr <mgr active node ip>

#重启dashboard模块
ceph mgr module disable dashboard
ceph mgr module enable dashboard

#更改tcp代理
...

开启 对象网关 页面

文档

因为需要加 --system 选项,此时要新建一个用户

1
radosgw-admin user create --uid=dashboard --display-name="dashboard display" --system

得到的结果为

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{
"user_id": "dashboard",
"display_name": "dashboard display",
"email": "",
"suspended": 0,
"max_buckets": 1000,
"subusers": [],
"keys": [
{
"user": "dashboard",
"access_key": "xx",
"secret_key": "xxx"
}
],
"swift_keys": [],
"caps": [],
"op_mask": "read, write, delete",
"system": "true",
"default_placement": "",
"default_storage_class": "",
"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": []
}

配置相关内容

1
2
3
4
5
6
7
ceph dashboard set-rgw-api-access-key xxx

ceph dashboard set-rgw-api-secret-key xxx

ceph dashboard set-rgw-api-host 172.17.0.10

ceph dashboard set-rgw-api-port 7480

访问地址

前端使用tcp代理https"//xxx.xxx.xxx.xxx:xxxx

帐号/密码:ie/iepassword