可以为已有的数据库实例创建备份。当对原始实例做更改是,系统自动将更改应用到备份。
--users
or
--databases
options.这个例子展示了如何创建MySQL数据库备份。
获得实例ID
获取需为其创建备份的原始实例的ID:
$ trove list
+-----------+------------+-----------+-------------------+--------+-----------+------+
| id | name | datastore | datastore_version | status | flavor_id | size |
+-----------+------------+-----------+-------------------+--------+-----------+------+
| 97b...ae6 | base_1 | mysql | mysql-5.5 | ACTIVE | 10 | 2 |
+-----------+------------+-----------+-------------------+--------+-----------+------+
创建备份
Create a new instance that will be a replica of the original
instance. You do this by passing in the --replica_of
option with
the trove create command. This example creates a replica
called replica_1
. replica_1
is a replica of the original instance,
base_1
:
$ trove create replica_1 6 --size=5 --datastore_version mysql-5.5 \
--datastore mysql --replica_of ID_OF_ORIGINAL_INSTANCE
验证备份状态
在:command:trove show 命令中传递``replica_1``的实例ID,验证新创建的``replica_1``是 base_1``的备份(replica). 注意 ``replica_of
属性为``base_1``的ID.
$ trove show INSTANCE_ID_OF_REPLICA_1
+-------------------+--------------------------------------+
| Property | Value |
+-------------------+--------------------------------------+
| created | 2014-09-16T11:16:49 |
| datastore | mysql |
| datastore_version | mysql-5.5 |
| flavor | 6 |
| id | 49c6eff6-ef91-4eff-91c0-efbda7e83c38 |
| name | replica_1 |
| replica_of | 97b4b853-80f6-414f-ba6f-c6f455a79ae6 |
| status | BUILD |
| updated | 2014-09-16T11:16:49 |
| volume | 5 |
+-------------------+--------------------------------------+
在:command:trove show 命令中传递``base_1``的实例ID列出关联到原实例的所有备份。注意``replicas``属性设置为``replica_1``的ID. 如果有多个备份,以逗号分隔的形式显示。
$ trove show INSTANCE_ID_OF_BASE_1
+-------------------+--------------------------------------+
| Property | Value |
+-------------------+--------------------------------------+
| created | 2014-09-16T11:04:56 |
| datastore | mysql |
| datastore_version | mysql-5.5 |
| flavor | 6 |
| id | 97b4b853-80f6-414f-ba6f-c6f455a79ae6 |
| ip | 172.16.200.2 |
| name | base_1 |
| replicas | 49c6eff6-ef91-4eff-91c0-efbda7e83c38 |
| status | ACTIVE |
| updated | 2014-09-16T11:05:06 |
| volume | 5 |
| volume_used | 0.11 |
+-------------------+--------------------------------------+
卸载备份
如果原始数据库损坏,可以卸载备份。则备份成为独立的数据库。可以基于该备份重新创建备份。
通过`trove detach-replica`卸载备份。
$ trove detach-replica INSTANCE_ID_OF_REPLICA
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.