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

How to create Snapshot and restore Snapshot by ceph in docker

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article will explain in detail how to create a snapshot and restore a snapshot in ceph in docker. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.

Create a snapshot

You can see that our rbd block device is mounted to / mnt:

[root@k8s-master1 ~] # df-h | grep rbd/dev/rbd0 2.0G 3.0M 1.9G 1% / mnt

We create several files in the / mnt directory:

[root@k8s-master1 ~] # touch / mnt/a.txt [root@k8s-master1 ~] # touch / mnt/b.txt

Let's start taking a snapshot of the rb block device:

[root@k8s-master1 ~] # rbd snap create rbd/data@snap1 description: rbd is the name of pool. Data is the name of the block device. Snap1 is our random name.

View the snapshot created:

[root@k8s-master1] # rbd snap ls rbd/dataSNAPID NAME SIZE TIMESTAMP 4 snap1 2078 MB restore with Snapshot [root@k8s-master1] # ll / mnt/total 16Murray Rukyu. 1 root root 0 Nov 4 04:46 aa.txt-rw-r--r--. 1 root root 0 Nov 4 05:34 a.txtmuri rwmuri. 1 root root 0 Nov 4 05:34 b.txt [root@k8s-master1 ~] # rm-rf / mnt/* [root@k8s-master1 ~] # ll / mnt/

Let's start with a snapshot restore:

[root@k8s-master1 ~] # rbd snap rollback rbd/data@snap1Rolling back to snapshot: 100% complete...done.

The recovery snapshot overwrites the current disk data, so please back up the current data and restore it.

Then, if you look again, you will find that the data has been restored:

[root@k8s-master1] # ll / mnt/total 16 RW Murray / RW Murray. 1 root root 0 Nov 4 04:46 aa.txt-rw-r--r--. 1 root root 0 Nov 4 05:34 a.txtmuri rwmuri. 1 root root 0 Nov 4 05:34 b.txt

Note: there is a problem with the client of the latest version of centos-release-ceph-luminous, that is, the data cannot be recovered with snapshots, so please test the recovery function of snapshots with other versions of ceph.

Delete snapshot: [root@k8s-master1 ~] # rbd snap rm rbd/data@snap1Removing snap: 100% complete...done.

This is the end of the article on "how to create a snapshot and restore a snapshot in ceph in docker". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

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

Development

Wechat

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

12
Report