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

What is the use of rbd-mirror in jewel

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces what is the use of rbd-mirror in jewel. It is very detailed and has a certain reference value. Interested friends must finish reading it!

Rbd-mirror is a new feature added to the jewel version to synchronize data on rbd devices in different ceph clusters.

The internal implementation of rbd-mirror is shown in the following figure:

There is an additional daemon rbd-mirror in each of the two separate ceph clusters, which is responsible for synchronizing data on the rbd device. The main processing flow of rbd-mirror is shown in the following figure:

When the user operates the block device to write data to the block device, the librbd first writes the write operation to the log, and after the log is written, the user write operation is completed. The log then writes data to the local block device, and at the same time the log sends the log to the peer ceph cluster through the rbd-mirror daemon. The peer ceph cluster writes the log content to the block device, thus completing the synchronization function of the block device. From this you can see that the core of rbd-mirror lies in the logs written by rbd-mirror daemons and block devices.

The hands-on part of rbd-mirror is as follows:

1. Cluster environment.

The test environment of rbd-mirror installs and configures the ceph cluster by compiling the ceph source code manually. For more information, please refer to http://my.oschina.net/linuxhunter/blog/682013. The cluster names are ceph and ceph3, respectively. The users used to test rbd-mirror are admin users in their respective clusters (of course, you can create your own specific user specifically for rbd-mirror).

2. Rbd-mirror setting.

1) copy the ceph configuration file and the keyring of the admin user to the peer ceph cluster.

Copy the ceph.conf and ceph.client.admin.keyring in the ceph cluster to the / etc/ceph directory in the ceph3 cluster, and copy the ceph3.conf and ceph3.client.admin.keyring in the ceph3 cluster to the ceph cluster at the same time. In this way, the ceph cluster can view the status of the ceph3 cluster, and the ceph3 cluster can also view the status of the ceph cluster.

2) create a pool with the same name in two ceph clusters.

# rbd-cluster ceph osd pool create image-pool 64 64

# rbd-cluster ceph3 osd pool create image-pool 64 64

3) enable mirror function.

# rbd-cluster ceph mirror pool enable image-pool pool

# rbd-cluster ceph3 mirror pool enable image-pool pool

4) add cluster peer.

# rbd-cluster ceph mirror pool peer add image-pool client.admin@ceph3

# rbd-cluster ceph3 mirror pool peer add image-pool client.admin@ceph

5) start the rbd-mirror daemon.

# rbd-mirror-f-- cluster ceph-- setuser ceph-- setgroup ceph

# rbd-mirror-f-- cluster ceph3-- setuser ceph-- setgroup ceph

6) check the rbd-mirror status.

# rbd-cluster ceph mirror pool info

Mode: image

Peers:

UUID NAME CLIENT

30018a0a-52b6-499e-b8f2-174d61eeeafe ceph3 client.admin

# rbd-cluster ceph mirror pool status

Health: OK

Images: 0 total

So far, the rbd-mirror environment has been successfully built.

3. Rbd-mirror test.

1) create a block device in image-pool in the ceph cluster.

# rbd-cluster ceph create image-pool/test1-size 10240-image-feature exclusive-lock, journaling

2) write data to the block devices in the image-pool in the ceph cluster.

# mkdir-p / tmp/rbd

# rbd-fuse-p image-pool / tmp/rbd

# mkfs.ext4 / tmp/rbd/test1

# mount-o loop / tmp/rbd/test1 / mnt/

# echo "hello, world" > / mnt/test.txt

# umount / mnt

# fusermount-u / tmp/rbd

3) View the block device information in image-pool in the ceph3 cluster.

# rbd-- cluster ceph3-p image-pool ls

Test1

At this point, you can see the test1 block device just created in the ceph3 cluster in the ceph cluster.

4) Mount the block device in the ceph3 cluster and view the contents of the block device.

# mkdir-p / tmp/rbd

# rbd-fuse-p image-pool / tmp/rbd

# mount-o loop / tmp/rbd/test1 / mnt

# ls / mnt/

Test1.txt

# cat / mnt/test1.txt

Hello,world

# umount / mnt

# fusermount-u / tmp/rbd

4. Supplementary explanation.

1) the current version of rbd-mirror only supports one-to-one mirror between clusters, but does not support one-to-many mirror

2) the pool names of the two clusters for rbd-mirror must be the same.

The above is all the content of this article "what is the use of rbd-mirror in jewel?" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

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