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

Actual combat of Ceph block equipment

2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

In the last blog post, we have successfully deployed the Ceph cluster, and we have also mastered the relevant Ceph applications. Today, we will focus on the application of Ceph block devices in the real environment-using the image provided by the Ceph storage system as the hard disk of the virtual machine to install the virtual machine system.

I. premise

In today's big data era, in most of our enterprises, the size of data generated every day may be astronomical. Obviously, with the surge in the amount of data, our existing servers will not be able to meet the actual needs. It is impossible for us to reinstall RAID in order to add a hard disk, nor can we buy servers indefinitely, each server into a separate RAID, and then start writing data again, what should we do? Of course, if there is a demand, we have a solution, and we choose distributed storage. Writing all the data into the distributed storage system can perfectly solve the embarrassment we have encountered at present.

Second, use Ceph block equipment

Before, we already have a Ceph cluster, but now we can just use the existing cluster environment. For the deployment of the cluster, please refer to another blog post: https://blog.51cto.com/4746316/2329558

1. Topology

2. Create an image named vm-image with a size of 50g

①, create Mirror

[root@ceph-a ceph] # rbd create cephrbd/vm-image-- image-feature layering-- size 50G

②, View Image

[root@ceph-a ceph] # rbd info cephrbd/vm-image

Or

[root@ceph-a ceph] # qemu-img info rbd:cephrbd/vm-image

The format of this command is: qemu info protocol: pool / image

3. Take the physical host as the client of the Ceph cluster, install the client software package, and copy the configuration file of Ceph to the physical host.

[root@localhost ~] # yum-y install ceph-common [root@ceph-a ceph] # scp / etc/ceph/ceph.c* root@192.168.20.151:/etc/ceph/

4. Create a kvm virtual machine named mycentos7, and force the shutdown after the wizard finishes.

5. Export the declaration file of the mycentos7 virtual machine we just created, and then delete the virtual machine.

[root@localhost opt] # virsh dumpxml mycentos7 > / opt/centos.xml [root@localhost opt] # virsh undefine mycentos7

6. For virtual machines to use Ceph images, the authentication of Ceph is first required, and the authentication method is to create the secret of the virtual machine, and then map the secret to the Ceph account.

①, write Ceph account information file, create temporary secret.xml file, the template of account information file can be found in the official document.

[root@localhost opt] # vim secret.xml

The contents are as follows:

Client.admin secret

②, generate secret.xml file

[root@localhost opt] # virsh secret-define-- file secret.xml

Secret is: 93eb11ed-2367-44cd-85ef-56810d4186e6

③, View secret

[root@localhost opt] # virsh secret-list

7. Associate the secret of the virtual machine with the Ceph administrator user

①, view Ceph administrator key

[root@localhost opt] # cat / etc/ceph/ceph.client.admin.keyring

The administrator key is: AQBBhQ9cJh/tDxAAzdcwBz3QZzPsCfWbQE0qjg==

②, associated secret, and Ceph administrators

[root@localhost opt] # virsh secret-set-value-secret 93eb11ed-2367-44cd-85ef-56810d4186e6-base64 AQBBhQ9cJh/tDxAAzdcwBz3QZzPsCfWbQE0qjg==

8. Modify the configuration file centos.xml of the virtual machine, write the Ceph administrator information to the file, and specify that the virtual machine disk uses the Ceph image.

[root@localhost opt] # vim centos.xml

As shown above, find the red box area, and edit the contents of the yellow box area to the en route style. Or modify the following questions

Note: device='disk', is the use of disk, device='cdrom', is the use of CD, make no mistake. The disk type field is changed to network,driver type field and changed to raw, and the auth part is added. Uuid needs to fill in according to its own actual situation. Add source part, name field needs to be filled in according to the pool and image created by yourself, and host name and port fields need to write the address and port of the ceph-mon of your Ceph cluster. You can use netstat-tpnl to view

9. Use xml files to generate virtual machines

[root@localhost opt] # virsh define centos.xml

10. Open the virtual machine manager and operate the virtual machine

[root@localhost opt] # virt-manager

①, open and run the virtual machine, as shown below:

②, when we run the virtual machine, we find the virtual machine interface prompt: no bootable device, at this time, we click the light bulb icon in the upper left corner of the virtual machine interface. As shown below:

③, select the boot option, in the boot device sequence on the right, select IDE CDROM1 and check it, and then click the upward arrow ⇧, as shown below:

When ④ and confirm that IDE CDROM1 has been moved up to the first place, click apply, as shown below:

⑤, select IDE CDROM1 on the left, and click the connection on the right, as shown below:

⑥, when the Select Media dialog box pops up, we click Browse, as shown below:

After ⑦ and pop-up to select the storage volume, we find our own CD image (here is: CentOS-7-x86_64-Everything-1804.iso), and click to select the volume, as shown below:

⑧, go back to the Select Media dialog box, and click OK, as shown below:

⑨. Finally, when we forcibly shut down the virtual machine and boot it, we will enter the system installation interface (we will not explain the installation process of the system any more), as shown below:

So far, the actual combat of our Ceph block equipment can be regarded as advantages, and we have to continue to work hard for further development.

For the implementation of Ceph cluster, please refer to another blog post: https://blog.51cto.com/4746316/2329558

For the application of CephFS file system, please refer to another blog post: https://blog.51cto.com/4746316/2330186

For Ceph object storage, please refer to my other blog post: https://blog.51cto.com/4746316/2330455

III. Summary

At first, when we deployed the Ceph cluster, we felt troublesome and sometimes even had a headache, especially when it was wrong, but when we started using it, didn't it feel very simple and fun? That's it, knowledge is so interesting, when we experience bitterness, we will taste the sweetness.

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

Internet Technology

Wechat

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

12
Report