Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Installation of Ceph Block Storage client and Block device Mapping

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

We continue with the configuration in the previous section, installation of ceph block storage clients and block device mapping

First create the ceph block client user name and authentication key on the ceph2 management node

Ceph auth get-or-create client.rbd (user name) mon 'allow r' (authorizing mon components) osd' allow class-read object_prefix rbd_children Allow rwx pool=rbd (default storage pool)'| tee / etc/ceph/ceph.client.rbd.keyring / / Save the authentication key to the ceph.client.rbd.keyring file in the / etc/ceph directory and copy the client user's authentication key and configuration file to the client host scp / etc/ceph/ceph.conf / etc/ceph/ceph.client.rbd.keyring root@client:/etc/ceph/ to check the guest Whether the client host kernel supports rbd module modprobe rbd / / it should be noted that the linux kernel supports rbd module installation by default after version 3.11. The ceph client supports the following command on the client host: wget-O / etc/yum.repos.d/ceph.repo https://raw.githubusercontent.com/aishangwei/ceph-demo/master/ceph-deploy/ceph.repo download ceph.repo image source yum install-y ceph / / to download ceph, you need to use epel source ceph-s-name client.rbd / / to view the overall situation of the cluster.

Creation and Mapping of Block Devices

Block devices created by default in ceph clusters are created in rbd pools, but clusters deployed using deploy installation are not created by default in rbd pools.

Create storage pools and block devices on the ceph2 control node ceph osd lspools / / View cluster storage pool information ceph osd pool create rbd 512 / 512 it is mandatory to determine the pg num value for (pg num value) because it cannot be calculated automatically. Here are a few commonly used values: you can set pg num to 128OSD when less than 5 OSD, pg num to 512 OSD when 5 to 10, and pg num to 4096 OSD when the number is greater than 50. You have to understand the tradeoff. And how to calculate the pg num value by yourself, create a block device on the client, execute the following command rbd create rbd1-- size 10240-- name client.rbdrbd ls-p rbd-- name client.rbd / / View the information of the storage pool rbd-- image rbd1 info-- name client.rbd / / View the information of the storage block

Mapping block device

Rbd map-image rbd1-name client.rbd

The following error occurs when executing this command

This is because the Linux3.11 version of the kernel does not support object mapping (object-map), deep-flatten (deep-flatten) and fast diff (fast-diff). To solve this problem, unsupported features are disabled here

There are three ways to disable these features 1) dynamically disable the execution of this command on the client host rbd feature disable rbd1 exclusive-lock object-map deep-flatten fast-diff-- name client.rbd2) when creating a RBD mirror Only start the hierarchical feature rbd create rbd2-- size 10240-- images-feature layering-- name client.rbd3) disable rbd_default_features=1 in the ceph configuration file here we use the first way to temporarily disable rbd feature disable rbd1 exclusive-lock object-map deep-flatten fast-diff-- name client.rbd continues to map rbd map-- image rbd1-- name client.rbd on the client side shows: / dev/rbd0rbd showmapped-- name client.rbd / / View client rbd information fdisk-l / dev/rbd0 / / View block storage device disk mkfs.xfs / dev/rbd0mkdir / mnt/ceph-disk1mount / dev/rbd0 / mnt/ceph-disk1df-h / mnt/ceph-disk1

Write data to test dd if=/dev/zero of=/mnt/ceph-disk1/file1 count=100 bs=1M to make a service To automatically mount the configuration information of the wget-O / usr/local/bin/rbd-mount https://raw.githubusercontent.com/aishangwei/ceph-demo/master/client/rbd-mountchmod + x / usr/local/bin/rbd-mount change script, find the following information in the downloaded script and change the user authentication key after / etc/ceph to your own authentication key rbd map $rbdimage-- id rbd--keyring / etc/ceph/ceph.client.rbd.krying

Download service auto-start script wget-O / etc/systemd/system/rbd-mount.service https://raw.githubusercontent.com/aishangwei/ceph-demo/master/client/rbd-mount.servicesystemctl daemon-reloadsystemctl enable rbd-mountumount / mnt/ceph-disk1 / / unmount the mounted block storage systemctl start rbd-mount / / start the auto-mount service to verify whether the mount is successful or not ll / mnt/ceph-disk1 / /

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report