测试 Ceph 集群

发布时间: 更新时间: 总字数:441 阅读时间:1m 作者: IP上海 分享 网址

介绍在部署Ceph集群的过程中,如何测试相关的功能。

测试

查看mon和法定人的信息

ceph quorum_status --format json-pretty

上传文件

  • 创建 pool,指定 PG 为 64
# ceph -h
ceph osd pool create testpool 64
ceph osd pool ls

# or 使用底层命令,rados -h,创建需要指定 PG 的数量,PGP 的数量一般同 PG 的数量
rados mkpool testpool 16
rados lspools
rados rmpool <pool-name>
  • 上传文件,将 /etc/hosts 文件上传到 testpool,名称为 hosts
rados put hosts /etc/hosts [--pool=testpool | -p testpool]
  • 列出文件
rados ls --pool=testpool
  • 获取上述对象在存储池的具体位置
ceph osd map testpool hosts
  • 删除文件
rados rm hosts --pool=testpool
  • 删除存储池,且需要在配置文件中配置 ceph config set mon mon_allow_pool_delete true
ceph osd pool rm testpool testpool --yes-i-really-really-mean-it

RBD 块设备使用

Ceph 块设备(也称 RADOS Block Device,RBD)通过 librbd 库与 OSD 进行交互,一般作为 OpenStack 等云技术的块存储,依赖于 libvirt 和 qemu 与 RBD 的集成。

  • 创建 testrbd 存储池,并进行初始化
# 创建 testrbd 存储池
ceph osd pool create testrbd 64

# 启用 rbd
ceph osd pool application enable testrbd rbd

# 初始化
rbd init -p testrbd
  • 创建大小为 1G 的块设备
rbd create img1 --size 1024 --pool testrbd

# 查看信息
rbd --image img1 --pool testrbd info

FaQ

1 pg undersized

$ ceph pg ls-by-pool device_health_metrics
PG   OBJECTS  DEGRADED  MISPLACED  UNFOUND  BYTES  OMAP_BYTES*  OMAP_KEYS*  LOG  STATE                       SINCE  VERSION  REPORTED  UP     ACTING   SCRUB_STAMP                      DEEP_SCRUB_STAMP
1.0        0         0          0        0      0            0           0    0  active+undersized+remapped    18m      0'0     25:16  [1]p1  [1,0]p1  2022-05-11T04:55:26.297475+0000  2022-05-11T04:55:26.297475+0000

单节点环境,需要配置 osd crush chooseleaf type0 或在扩展一些节点。

ceph config set osd osd_crush_chooseleaf_type 0
ceph osd pool set device_health_metrics size 2

ref:

Home Archives Categories Tags Statistics
本文总阅读量 次 本站总访问量 次 本站总访客数