Centos7.4部署ceph块设备

前端之家收集整理的这篇文章主要介绍了Centos7.4部署ceph块设备前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。


在部署块设备前必须保证Ceph存储集群处于active+clean状态。


一. 环境准备

wKioL1nDxQOQf30yAAAYwuSDwIk552.png


IP 主机名
角色
10.10.10.20
admin-node ceph-deploy
10.10.10.24
ceph-client client


二. 安装CEPH


  • 在管理节点上,通过ceph-deploy把 Ceph 安装到ceph-client节点。


  1. [root@admin-node ceph]# ceph-deploy install ceph-client


  • 在管理节点上,用ceph-deploy把 Ceph 配置文件ceph.client.admin.keyring拷贝到ceph-client


  1. [root@admin-node ceph]# ceph-deploy admin ceph-client

  2. [root@ceph-client ~]# chmod +r /etc/ceph/ceph.client.admin.keyring


三.配置块设备


  • 查看内核版本


  1. [root@ceph-client ceph-block-device]# uname -r
    3.10.0-693.el7.x86_64


  • --image-formatformat-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


  1. [root@ceph-client ceph]# rbd create f --size 4096 -m 10.10.10.21 -k /etc/ceph/ceph.client.admin.keyring

  2. [root@ceph-client ceph]# rbd ls
    f

  • 节点上,把 image 映射为块设备


  1. [root@ceph-client ceph]# rbd map f --name client.admin -m 10.10.10.21 -k /etc/ceph/ceph.client.admin.keyring


  • 节点上,创建文件系统后就可以使用块设备了


  1. [root@ceph-client ceph]# mkfs.ext4 -m0 /dev/rbd/rbd/f


  • 节点上挂载此文件系统


  1. [root@ceph-client 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

  2. [root@ceph-client ceph]# mkdir /mnt/ceph-block-device

  3. [root@ceph-client ceph]# mount /dev/rbd/rbd/f /mnt/ceph-block-device

原文链接:https://www.f2er.com/centos/375795.html

猜你在找的CentOS相关文章