Centos7.4部署ceph塊設備
在部署塊設備前必須保證Ceph存儲集群處於active+clean狀態。
一. 環境準備
IP | 主機名 | 角色 |
10.10.10.20 | admin-node | ceph-deploy |
10.10.10.24 | ceph-client | client |
二. 安裝CEPH
在管理節點上,通過 ceph-deploy 把 Ceph 安裝到 ceph-client 節點。
[[email protected] ceph]# ceph-deploy install ceph-client
在管理節點上,用 ceph-deploy 把 Ceph 配置文件和 ceph.client.admin.keyring 拷貝到 ceph-client
[[email protected] ceph]# ceph-deploy admin ceph-client
[[email protected] ~]# chmod +r /etc/ceph/ceph.client.admin.keyring
三.配置塊設備
查看內核版本
[[email protected] ceph-block-device]# uname -r
3.10.0-693.el7.x86_64
--image-format (format-id)
選擇使用哪個對象布局,默認為 1
format 1 - (廢棄)新建 rbd 映像時使用最初的格式。此格式兼容所有版本的 librbd 和內核模塊,但是不支持諸如克隆這樣較新的功能。
format 2 - 使用第二版 rbd 格式, librbd 和 3.11 版以上內核模塊才支持(除非是分拆的模塊)。此格式增加了對克隆的支持,日後擴展以增加新功能也變得更加容易。
筆者用的雖然是Centos7.4的系統,但內核是3.10.0的,低於3.11版本所以我們要用format1我們直接修改Ceph的配置文件,在[global]下添加 rbd_default_features = 1
在 ceph-client 節點上創建一個塊設備 image
[[email protected] ceph]# rbd create f --size 4096 -m 10.10.10.21 -k /etc/ceph/ceph.client.admin.keyring
[[email protected] ceph]# rbd ls
f
在 ceph-client 節點上,把 image 映射為塊設備
[[email protected] ceph]# rbd map f --name client.admin -m 10.10.10.21 -k /etc/ceph/ceph.client.admin.keyring
在 ceph-client 節點上,創建文件系統後就可以使用塊設備了
[[email protected] ceph]# mkfs.ext4 -m0 /dev/rbd/rbd/f
在 ceph-client 節點上掛載此文件系統
[[email protected] ceph]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
fd0 2:0 1 4K 0 disk
sda 8:0 0 20G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 19G 0 part
├─centos-root 253:0 0 17G 0 lvm /
└─centos-swap 253:1 0 2G 0 lvm [SWAP]
sdb 8:16 0 20G 0 disk
sr0 11:0 1 8.1G 0 rom
rbd0 252:0 0 4G 0 disk[[email protected] ceph]# mkdir /mnt/ceph-block-device
[[email protected] ceph]# mount /dev/rbd/rbd/f /mnt/ceph-block-device
本文出自 “若不奮鬥,何以稱王” 博客,請務必保留此出處http://wangzc.blog.51cto.com/12875919/1967635
Centos7.4部署ceph塊設備