glusterfs 快照

1、创建快照

# gluster snapshot create trobvol-s1 trobvol 
snapshot create: success: Snap trobvol-s1_GMT-2021.05.16-02.47.36 created successfully

说明:
trobvol-s1 : 快照名字
trobvol: 卷名
默认创建的快照带有时间戳,如果想要创建出来的快照不带有时间戳,可以在命令的最后加上no-timestamp

# gluster snapshot create trobvol-s1 trobvol no-timestamp

这种情况下,想要查看快照创建的时间,可以输入如下的命令:

# gluster snapshot info trobvol-s1
Snapshot                  : trobvol-s1
Snap UUID                 : 7c63da82-9198-49d5-99ae-aab62da5cb7d
Created                   : 2021-05-16 02:56:00 +0000
Snap Volumes:

	Snap Volume Name          : 08f8c1369bcf45798c4ccb9115033778
	Origin Volume name        : trobvol
	Snaps taken for trobvol      : 1
	Snaps available for trobvol  : 255
	Status                    : Stopped

可以看到该快照的创建时间以及快照的状态。

2、查看快照状态

# gluster snapshot status

或者list查看快照列表

# gluster snapshot list

默认情况下,快照创建出来是没有被激活的

3、允许快照完全复制卷

[root@hadoop4 ~]# gluster volume set  trobvol features.uss enable
volume set: success
[root@hadoop4 ~]# gluster volume  info trobvol
 
Volume Name: trobvol
Type: Replicate
Volume ID: b43b3e13-5f8c-4ecf-b363-d90d41f508b9
Status: Started
Snapshot Count: 1
Number of Bricks: 1 x 2 = 2
Transport-type: tcp
Bricks:
Brick1: hadoop4:/data/brick1/brick7
Brick2: k8s-node2:/data/brick1/brick5
Options Reconfigured:
features.uss: enable
features.barrier: disable
features.scrub-freq: hourly
features.scrub: Active
features.bitrot: on
performance.client-io-threads: off
nfs.disable: on
transport.address-family: inet
storage.fips-mode-rchecksum: on
cluster.granular-entry-heal: on

4、激活快照

[root@hadoop4 ~]# gluster snapshot activate trobvol-s1
Snapshot activate: trobvol-s1: Snap activated successfully
[root@hadoop4 ~]# gluster snapshot info trobvol-s1
Snapshot                  : trobvol-s1
Snap UUID                 : 7c63da82-9198-49d5-99ae-aab62da5cb7d
Created                   : 2021-05-16 02:56:00 +0000
Snap Volumes:

	Snap Volume Name          : 08f8c1369bcf45798c4ccb9115033778
	Origin Volume name        : trobvol
	Snaps taken for trobvol      : 1
	Snaps available for trobvol  : 255
	Status                    : Started

5、查看快照的存储目录

[root@k8s-node2 gluster_client_trb]# ls -d .snaps/trobvol-s1/
.snaps/trobvol-s1/
[root@k8s-node2 gluster_client_trb]# pwd
/gluster_client_trb

存储在挂载点下的.snaps,这是一个隐藏文件

6、还原快照

[root@hadoop4 ~]# gluster volume stop trobvol
Stopping volume will make its data inaccessible. Do you want to continue? (y/n) y
volume stop: trobvol: success
[root@hadoop4 ~]# gluster snapshot restore trobvol-s1
Restore operation will replace the original volume with the snapshotted volume. Do you still want to continue? (y/n) y
Snapshot restore: trobvol-s1: Snap restored successfully
[root@hadoop4 ~]# gluster volume start trobvol
volume start: trobvol: success
[root@hadoop4 ~]# gluster snapshot list // 快照还原就会被删除
No snapshots present

7、删除快照

# gluster snapshot delete all // 删除所有快照
posted @ 2021-05-16 11:21  北漂-boy  阅读(485)  评论(0编辑  收藏  举报