• ceph rbd namespace


     

    cli

    # rbd --namespace $namespace $command $pool/$image
    # rbd $command $pool/$namespace/$image
    

      

    create

    [root@ceph-1:~/ceph-cluster]# rbd namespace ls ceph-rbd --format=json
    []
    
    [root@ceph-1:~/ceph-cluster]# rbd namespace create ceph-rbd/ns1
    
    [root@ceph-1:~/ceph-cluster]# rbd namespace ls ceph-rbd --format=json
    [{"name":"ns1"}]
    
    [root@ceph-1:~/ceph-cluster]# rbd create ceph-rbd/ns1/rbd-image1.img --size 1024
    
    [root@ceph-1:~/ceph-cluster]# rbd ls ceph-rbd --long
    NAME          SIZE  PARENT FMT PROT LOCK 
    rbd-image.img 1 GiB          2 
              
    [root@ceph-1:~/ceph-cluster]# rbd ls ceph-rbd/ns1 --long
    NAME           SIZE  PARENT FMT PROT LOCK 
    rbd-image1.img 1 GiB          2   
    

      

    rbd map on centos 7 (1810)

    [root@ceph-1:~/ceph-cluster]# rbd map ceph-rbd/ns1/rbd-image1.img
    rbd: sysfs write failed
    In some cases useful info is found in syslog - try "dmesg | tail".
    rbd: map failed: (22) Invalid argument
    
    [root@ceph-1:~/ceph-cluster]# dmesg |tail
    [......]
    [18427.446585] rbd: rbd0: capacity 1073741824 features 0x5
    [24449.735082] libceph: bad option at '_pool_ns=ns1'
    

      

    To map a rbd (+ namespace) you need a kernel >= 4.19.

    with > 5.0 kernel (elrepo)

    [root@ceph-1:~/ceph-cluster]# rbd info ceph-rbd/ns1/rbd-image1.img
    rbd image 'rbd-image1.img':
        size 1 GiB in 256 objects
        order 22 (4 MiB objects)
        snapshot_count: 0
        id: 25c26241ea4ac
        block_name_prefix: rbd_data.25c26241ea4ac
        format: 2
        features: layering, exclusive-lock, object-map, fast-diff, deep-flatten
        op_features: 
        flags: 
        create_timestamp: Wed Feb  3 15:57:13 2021
        access_timestamp: Wed Feb  3 15:57:13 2021
        modify_timestamp: Wed Feb  3 15:57:13 2021
    
    [root@ceph-1:~/ceph-cluster]# rbd feature disable ceph-rbd/ns1/rbd-image1.img deep-flatten 
     
    [root@ceph-1:~/ceph-cluster]# rbd feature disable ceph-rbd/ns1/rbd-image1.img fast-diff 
    
    [root@ceph-1:~/ceph-cluster]# rbd device map ceph-rbd/ns1/rbd-image1.img
    /dev/rbd0
    
    [root@ceph-1:~/ceph-cluster]# rbd showmapped
    id pool namespace image   snap device
    0  rbd  ns1    rbd-image1.img -    /dev/rbd0
    
    [root@ceph-1:~/ceph-cluster]# uname -ar
    Linux ceph-1 5.5.6-1.el7.elrepo.x86_64 #1 SMP Mon Oct 19 16:18:59 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
    ​
    [root@ceph-1:~/ceph-cluster]# rbd device unmap /dev/rbd0
    
    [root@ceph-1:~/ceph-cluster]# rbd rm ceph-rbd/ns1/rbd-image1.img
    
    [root@ceph-1:~/ceph-cluster]# rbd namespace remove ceph-rbd/ns1
    

      

    cephx

    [root@ceph-1:~/ceph-cluster]# ceph auth get-or-create client.$name 
      mon 'profile rbd' 
      osd 'profile rbd namespace=$namespace'
    and go:
    
    [root@ceph-1:~/ceph-cluster]# ls /etc/ceph/ceph.client.$name.keyring
    /etc/ceph/ceph.client.$name.keyring
    [root@ceph-1:~/ceph-cluster]# rbd -n client.$name ls
    images: (1) Operation not permitted
    rbd: listing images failed: (1) Operation not permitted
    [root@ceph-1:~/ceph-cluster]# rbd -n client.$name ls --namespace=ns1
    rbd-image1.img
    

      

     参考链接

    https://blog.devnu11.net/2019/10/ceph-rbd-namespaced.html

  • 相关阅读:
    DNS记录类型介绍(A记录、MX记录、NS记录等)
    mybatis调用视图和存储过程
    项目里总结出来的log4j模板
    shiro的使用2 灵活使用shiro的密码服务模块
    反射获取对象的属性值
    MySQL 性能调优之查询优化
    利用BeanUtils在对象间复制属性
    这里整理了基于java平台的常用资源
    各种编程语言如何杀死一条龙营救公主!
    Eclipse vs. IDEA快捷键对比大全
  • 原文地址:https://www.cnblogs.com/xietaiyang/p/14367617.html
Copyright © 2020-2023  润新知