Ceph块设备-命令

前言:

参考手册地址 http://docs.ceph.org.cn/rbd/rbd/

当前是干净的ceph环境,仅部署完成4台节点,ceph信息如下:

  1. ceph -s
[root@ceph-master cephadm]# ceph -s
  cluster:
    id:     ce89b98d-91a5-44b5-a546-6648492b1646
    health: HEALTH_OK

  services:
    mon: 4 daemons, quorum ceph-master,ceph-node02,ceph-node03,ceph-node01
    mgr: no daemons active
    osd: 0 osds: 0 up, 0 in

  data:
    pools:   0 pools, 0 pgs
    objects: 0  objects, 0 B
    usage:   0 B used, 0 B / 0 B avail
    pgs:
  1. 没有存储池
# 在ceph-master中,执行此命令为空
ceph osd lspools

存储池创建

存储池操作手册 http://docs.ceph.org.cn/rados/operations/pools/

  1. 创建存储池swimmingpool
$ ceph osd pool create swimmingpool 128 128
  1. 查看已经创建的存储池
    $ rados lspools
$ rados lspools
swimmingpool
  1. 查看存储池统计信息
    $ rados df
$ rados df
POOL_NAME     USED OBJECTS CLONES COPIES MISSING_ON_PRIMARY UNFOUND DEGRADED RD_OPS    RD WR_OPS    WR
swimmingpool 133 B       5      0     15                  0       0        0      8 4 KiB      6 6 KiB

total_objects    5
total_used       12 GiB															# 创建完成后,注意看存储池中是存在可用空间的
total_avail      576 GiB
total_space      588 GiB

创建块设置映像

在存储池中创建一个映像,以便将块设备加入到某个节点中。

  1. 在swimmingpool中创建映像bar
# rbd create --size {megabytes} {pool-name}/{image-name}
$ rbd create --size 1024 swimmingpool/bar
  1. 查看swimmingpool存储池中创建的块设备映像
# rbd ls {poolname}
$ rbd ls swimmingpool
bar
  1. 检索映像信息
# rbd info {image-name}
$ rbd info swimmingpool/bar
rbd image 'bar':
        size 1 GiB in 256 objects
        order 22 (4 MiB objects)
        id: 144b6b8b4567
        block_name_prefix: rbd_data.144b6b8b4567
        format: 2
        features: layering, exclusive-lock, object-map, fast-diff, deep-flatten
        op_features:
        flags:
        create_timestamp: Tue Apr 14 17:23:20 2020

报错记录汇总

本章节报错解决方法汇总

你可能感兴趣的:(ceph)