官术网_书友最值得收藏!

Mapping Ceph Block Device

Now that we have created a block device on a Ceph cluster, in order to use this block device, we need to map it to the client machine. To do this, execute the following commands from the client-node1 machine.

How to do it…

  1. Map the block device to the client-node1:
    # rbd map --image rbd1 --name client.rbd
    
  2. Check the mapped block device:
    # rbd showmapped --name client.rbd
    
  3. To make use of this block device, we should create a filesystem on this and mount it:
    # fdisk -l /dev/rbd1
    # mkfs.xfs /dev/rbd1
    # mkdir /mnt/ceph-disk1
    # mount /dev/rbd1 /mnt/ceph-disk1
    # df -h /mnt/ceph-disk1
  4. Test the block device by writing data to it:
    # dd if=/dev/zero of=/mnt/ceph-disk1/file1 count=100 bs=1M
    
  5. To map the block device across reboots, you should add init-rbdmap script to the system startup, add the Ceph user and keyring details to /etc/ceph/rbdmap, and finally, update the /etc/fstab file:
    # wget https://raw.githubusercontent.com/ksingh7/ceph-cookbook/master/rbdmap -O /etc/init.d/rbdmap
    # chmod +x /etc/init.d/rbdmap
    # update-rc.d rbdmap defaults
    ## Make sure you use correct keyring value in /etc/ceph/rbdmap file, which is generally unique for an environment.
    # echo "rbd/rbd1 id=rbd,keyring=AQCLEg5VeAbGARAAE4ULXC7M5Fwd3BGFDiHRTw==" >> /etc/ceph/rbdmap
    # echo "/dev/rbd1 /mnt/ceph-disk1 xfs defaults, _netdev0 0 " >> /etc/fstab
    # mkdir /mnt/ceph-disk1
    # /etc/init.d/rbdmap start
    
主站蜘蛛池模板: 阳江市| 封开县| 崇明县| 阜宁县| 望江县| 大渡口区| 武穴市| 多伦县| 黑山县| 九江县| 鞍山市| 时尚| 探索| 饶平县| 会昌县| 青河县| 三台县| 连江县| 鞍山市| 将乐县| 石渠县| 班玛县| 濮阳市| 萝北县| 阳山县| 美姑县| 酉阳| 自贡市| 广灵县| 衡阳县| 墨脱县| 嘉定区| 阳江市| 安化县| 广元市| 宜兰县| 保山市| 迁西县| 曲周县| 抚顺县| 渭源县|