美文网首页ceph
cephx用户管理

cephx用户管理

作者: Joncc | 来源:发表于2018-12-05 18:12 被阅读34次

    用户管理

    1. 添加一个名为testd的用户,在mon上具有读权限,在rbd这个pool上具有读写执行的权限:

    ceph auth add client.testd mon 'allow r' osd 'allow rwx pool=rbd'

    1. 导出client.testd用户到 ceph.client.testd.keyring文件中

    ceph auth export client.testd -o ceph.client.testd.keyring

    1. 拷贝ceph.client.testd.keyring 与ceph.conf 到客户端的主机/etc/ceph/目录

    scp /etc/ceph/ceph.client.testd.keyring node3:/etc/ceph/
    scp /etc/ceph/ceph.conf node3:/etc/ceph/

    1. 使用ceph.client.testd.keyring 操作集群

    ceph -s --conf /etc/ceph/ceph.conf --name client.testd --keyring /etc/ceph/ceph.client.testd.keyring

    1. 修改用户capability
      ceph auth caps client.testd mon 'allow r' osd 'allow rwx pool=rbd'

    ceph auth export client.testd -o ceph.client.testd.keyring

    1. 删除用户
      ceph auth del {TYPE}.{ID}

    实例(删除client.testa用户):
    ceph auth del client.testa

    配置块设备

    1、在ceph-client节点上创建一个块设备映像。

    rbd create -p rbd rbd_t1 --size 1G --image-feature layering --conf /etc/ceph/ceph.conf --name client.testd --keyring /etc/ceph/ceph.client.testd.keyring

    2、在ceph-client节点上,把映像映射为块设备:

    rbd map rbd_t --pool rbd --conf /etc/ceph/ceph.conf --name client.testd --keyring /etc/ceph/ceph.client.testd.keyring

    3、在ceph-client节点上,创建文件系统后就可以使用了。
    mkfs.ext4 -m0 /dev/rbd/rbd/rbd_t
    mkfs.xfs /dev/rbd0
        此命令可能耗时较长
    4、在ceph-client节点上挂载此文件系统。
         mkdir /mnt/ceph-block-device
         mount /dev/rbd/rbd_t /mnt/ceph-block-device
         cd /mnt/ceph-block-device

    ceph osd pool create otest 64 #创建一个pool 这里的100指的是PG组

    osd的auth语法

    OSD CAPABILITIES
    通常,osd功能遵循语法:

    osdcap  := grant[,grant...]
    grant   := allow (match capspec | capspec match)
    match   := [pool[=]<poolname> | object_prefix <prefix>]
    capspec := * | [r][w][x] [class-read] [class-write]
    

    The capspec determines what kind of operations the entity can perform:
    capspec确定实体可以执行的操作类型:

    r           = read access to objects
    w           = write access to objects
    x           = can call any class method (same as class-read class-write)
                  可以调用任何类方法(等于class-read和class-write一起用)
    class-read  = can call class methods that are reads
                  可以调用读取的类方法
    class-write = can call class methods that are writes
                  可以调用写的类方法
    *           = equivalent to rwx, plus the ability to run osd admin commands,
                  i.e. ceph osd tell ...
    

    相关文章

      网友评论

        本文标题:cephx用户管理

        本文链接:https://www.haomeiwen.com/subject/uwbwcqtx.html