CentOS 7
Ads

Ceph : Use as Block Device
2015/12/10
 
Configure Clients to use Ceph Storage like follows.
                                         |
        +--------------------+           |           +-------------------+
        |   [dlp.srv.world]  |10.0.0.30  |   10.0.0.x|   [   Client  ]   |
        |    Ceph-Deploy     +-----------+-----------+                   |
        |                    |           |           |                   |
        +--------------------+           |           +-------------------+
            +----------------------------+----------------------------+
            |                            |                            |
            |10.0.0.51                   |10.0.0.52                   |10.0.0.53 
+-----------+-----------+    +-----------+-----------+    +-----------+-----------+
|   [node01.srv.world]  |    |   [node02.srv.world]  |    |   [node03.srv.world]  |
|     Object Storage    +----+     Object Storage    +----+     Object Storage    |
|     Monitor Daemon    |    |                       |    |                       |
|                       |    |                       |    |                       |
+-----------------------+    +-----------------------+    +-----------------------+

 
For exmaple, Create a block device and mount it on a Client.
[1] First, Configure Sudo and SSH key-pair for a user on a Client and next, Install Ceph from Ceph admin Node like follows.
[cent@dlp ceph]$
ceph-deploy install client

[cent@dlp ceph]$
ceph-deploy admin client
[2] Create a Block device and mount it on a Client.
[cent@client ~]$
sudo chmod 644 /etc/ceph/ceph.client.admin.keyring

# create a disk with 10G

[cent@client ~]$
rbd create disk01 --size 10240
# show list

[cent@client ~]$
rbd ls -l

NAME     SIZE PARENT FMT PROT LOCK
disk01 10240M          2

# map the image to device

[cent@client ~]$
sudo rbd map disk01

/dev/rbd0
# show mapping

[cent@client ~]$
rbd showmapped

id pool image  snap device
0  rbd  disk01 -    /dev/rbd0

# format with XFS

[cent@client ~]$
sudo mkfs.xfs /dev/rbd0
# mount device

[cent@client ~]$
sudo mount /dev/rbd0 /mnt
[cent@client ~]$
df -hT

Filesystem              Type      Size  Used Avail Use% Mounted on
/dev/mapper/centos-root xfs        27G  1.3G   26G   5% /
devtmpfs                devtmpfs  2.0G     0  2.0G   0% /dev
tmpfs                   tmpfs     2.0G     0  2.0G   0% /dev/shm
tmpfs                   tmpfs     2.0G  8.4M  2.0G   1% /run
tmpfs                   tmpfs     2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/vda1               xfs       497M  151M  347M  31% /boot
/dev/rbd0               xfs        10G   33M   10G   1% /mnt
 
Tweet