openstack cinder:快照VS备份

块存储快照

块存储的着重点是记录某个时间点卷的状态,特点是创建速度快。cinder-volume服务中实现了基于多种存储驱动的块存储备份,在打快照前,卷需要是available状态(即不能被挂载),并且快照对卷具有强依赖性。所以一旦卷打了快照,便不能直接被删除,需要先删除该卷关联的所有快照。对于卷快照的使用,可以基于卷快照生成一个新的卷,所以卷快照在实际生产中用来恢复到某个时间的状态,不过一旦快照关联的卷出现故障坏掉,卷快照也是不可用的。

快照管理

  • 获取快照列表
cinder snapshot-list
+--------------------------------------+--------------------------------------+-----------+--------------+------+
|                  ID                  |              Volume ID               |   Status  | Display Name | Size |
+--------------------------------------+--------------------------------------+-----------+--------------+------+
| d1c98e30-51da-4ea1-afaf-4ee903568429 | 410ebd08-dd17-470b-b08a-5791885d6cad | available |   aaa-snap   |  1   |
+--------------------------------------+--------------------------------------+-----------+--------------+------+
  • 创建快照
cinder snapshot-create --display-name snap-aaa2 --display-description Test 410ebd08-dd17-470b-b08a-5791885d6cad
+---------------------+--------------------------------------+
|       Property      |                Value                 |
+---------------------+--------------------------------------+
|      created_at     |      2015-10-16T01:44:13.387903      |
| display_description |                 Test                 |
|     display_name    |              snap-aaa2               |
|          id         | 70e7e5a8-e5d2-4412-9377-7b6498d01541 |
|       metadata      |                  {}                  |
|         size        |                  1                   |
|        status       |               creating               |
|      volume_id      | 410ebd08-dd17-470b-b08a-5791885d6cad |
+---------------------+--------------------------------------+
  • 从快照创建卷
cinder create --snapshot-id 70e7e5a8-e5d2-4412-9377-7b6498d01541 --display-name vol-from-snap --display-description "create a volume from snapshot" 1
+---------------------+--------------------------------------+
|       Property      |                Value                 |
+---------------------+--------------------------------------+
|     attachments     |                  []                  |
|  availability_zone  |                 nova                 |
|       bootable      |                false                 |
|      created_at     |      2015-10-16T01:49:04.662626      |
| display_description |    create a volume from snapshot     |
|     display_name    |            vol-from-snap             |
|      encrypted      |                False                 |
|          id         | 53a3e72f-78e1-4b90-9e13-244bb8dad919 |
|       metadata      |                  {}                  |
|         size        |                  1                   |
|     snapshot_id     | 70e7e5a8-e5d2-4412-9377-7b6498d01541 |
|     source_volid    |                 None                 |
|        status       |               creating               |
|     volume_type     |                 None                 |
+---------------------+--------------------------------------+
  • 删除快照
cinder snapshot-delete d1c98e30-51da-4ea1-afaf-4ee903568429

注: 如果基于快照创建了硬盘,快照删除不掉

块存储备份

块存储的着重点是备份卷的数据,所以创建的时间较长。cinder-backup服务中目前(stable/liberty)实现了ceph/glusterfs/nfs/posix/swift/IBM TSM六种存储系统卷备份,备份前,卷需要是available状态(即不能被挂载),备份一旦完成,对卷就不具有依赖性。所以即使备份相关的卷出现故障,还是可以恢复备份中数据。操作方法是创建一个新的空白卷,将备份restore到这个空白卷即可。

备份管理

  • 备份列表
cinder backup-list
+--------------------------------------+--------------------------------------+--------+------+------+--------------+---------------+
|                  ID                  |              Volume ID               | Status | Name | Size | Object Count |   Container   |
+--------------------------------------+--------------------------------------+--------+------+------+--------------+---------------+
| 5474c053-b6be-4beb-8d2b-e3730dd1400d | 410ebd08-dd17-470b-b08a-5791885d6cad | error  | None |  5   |     None     | volumebackups |
+--------------------------------------+--------------------------------------+--------+------+------+--------------+---------------+
  • 备份创建
cinder backup-create 410ebd08-dd17-470b-b08a-5791885d6cad
+-----------+--------------------------------------+
|  Property |                Value                 |
+-----------+--------------------------------------+
|     id    | 467e6276-055a-1532-9459-d512315850bc |
|    name   |                 None                 |
| volume_id | 410ebd08-dd17-470b-b08a-5791885d6cad |
+-----------+--------------------------------------+
  • 从备份创建restore数据到卷
cinder backup-restore --volume-id 410ebd08-dd17-470b-b08a-5791885d6cad 53a3e72f-78e1-4b90-9e13-244bb8dad919
  • 删除备份
cinder backup-delete 53a3e72f-78e1-4b90-9e13-244bb8dad919

你可能感兴趣的:(存储,备份,openstack)