Updates the backup document

This PR updates the backup document[1]. The page contains wrong descriptions
since we have many updates for years.

[1]: https://docs.openstack.org/trove/latest/user/backup-db.html#create-incremental-backups

Story: 2010323
Task: 46430
Change-Id: Ief3d3b98b55c02e185edb2294b9c723843e62086
This commit is contained in:
Hirotaka Wakabayashi
2022-10-24 13:39:44 +09:00
parent 3789a3951b
commit 3a27069307

View File

@@ -36,48 +36,52 @@ instance from the backup.
.. code-block:: console .. code-block:: console
$ openstack database instance list $ openstack database instance list
+--------------------------------------+--------+-----------+-------------------+--------+-----------+------+ +--------------------------------------+--------+-----------+-------------------+--------+------------------+--------+-------------------------------------------------------------------------------------------------+-----------+------+------+
| id | name | datastore | datastore_version | status | flavor_id | size | | ID | Name | Datastore | Datastore Version | Status | Operating Status | Public | Addresses | Flavor ID | Size | Role |
+--------------------------------------+--------+-----------+-------------------+--------+-----------+------+ +--------------------------------------+--------+-----------+-------------------+--------+------------------+--------+-------------------------------------------------------------------------------------------------+-----------+------+------+
| 97b4b853-80f6-414f-ba6f-c6f455a79ae6 | guest1 | mysql | mysql-5.5 | ACTIVE | 10 | 2 | | 78e338e3-d1c4-4189-8ea7-bfc1fab5011f | mysql1 | mysql | 8.0.29 | ACTIVE | HEALTHY | False | [{'address': '10.0.0.9', 'type': 'private', 'network': '33f3a589-b806-4212-9a59-8e058cac0699'}] | d2 | 1 | |
+--------------------------------------+--------+-----------+-------------------+--------+-----------+------+ +--------------------------------------+--------+-----------+-------------------+--------+------------------+--------+-------------------------------------------------------------------------------------------------+-----------+------+------+
2. Optionally, create a backup strategy for the instance. You can also specify a different swift container name (``--swift-container``) when creating the backup. 2. Optionally, create a backup strategy for the instance. You can also specify a different swift container name (``--swift-container``) when creating the backup.
.. code-block:: console .. code-block:: console
$ openstack database backup strategy create --instance-id 97b4b853-80f6-414f-ba6f-c6f455a79ae6 --swift-container my-trove-backups $ openstack database backup strategy create --instance-id 78e338e3-d1c4-4189-8ea7-bfc1fab5011f --swift-container my-trove-backups
+-----------------+--------------------------------------+ +-----------------+--------------------------------------+
| Field | Value | | Field | Value |
+-----------------+--------------------------------------+ +-----------------+--------------------------------------+
| backend | swift | | backend | swift |
| instance_id | 97b4b853-80f6-414f-ba6f-c6f455a79ae6 | | instance_id | 78e338e3-d1c4-4189-8ea7-bfc1fab5011f |
| project_id | 922b47766bcb448f83a760358337f2b4 | | project_id | fc51186c63df417ea63cec6c65a2d564 |
| swift_container | my-trove-backups | | swift_container | my-trove-backups |
+-----------------+--------------------------------------+ +-----------------+--------------------------------------+
#. **Backup the database instance** #. **Backup the database instance**
Back up the database instance by using the :command:`openstack database backup create` Back up the database instance by using the :command:`openstack database backup create`
command. In this example, the backup is called ``backup1``. command. In this example, the backup is called ``mysql-backup-name1``.
.. code-block:: console .. code-block:: console
$ openstack database backup create 97b4b853-80f6-414f-ba6f-c6f455a79ae6 backup1 $ openstack database backup create mysql-backup-name1 --instance mysql1 --swift-container 'my-trove-backups'
+-------------+--------------------------------------+ +----------------------+--------------------------------------+
| Property | Value | | Field | Value |
+-------------+--------------------------------------+ +----------------------+--------------------------------------+
| created | 2014-03-18T17:09:07 | | created | 2022-10-24T01:46:38 |
| description | None | | datastore | mysql |
| id | 8af30763-61fd-4aab-8fe8-57d528911138 | | datastore_version | 8.0.29 |
| instance_id | 97b4b853-80f6-414f-ba6f-c6f455a79ae6 | | datastore_version_id | 324f2bdf-6099-4754-a5f9-82abee026a19 |
| locationRef | None | | description | None |
| name | backup1 | | id | 1ecd0a75-e4aa-400b-b0c8-cb738944fd43 |
| parent_id | None | | instance_id | 78e338e3-d1c4-4189-8ea7-bfc1fab5011f |
| size | None | | locationRef | None |
| status | NEW | | name | mysql-backup-name1 |
| updated | 2014-03-18T17:09:07 | | parent_id | None |
+-------------+--------------------------------------+ | project_id | fc51186c63df417ea63cec6c65a2d564 |
| size | None |
| status | NEW |
| updated | 2022-10-24T01:46:38 |
+----------------------+--------------------------------------+
Later on, use either :command:`openstack database backup list` command or Later on, use either :command:`openstack database backup list` command or
:command:`openstack database backup show` command to check the backup :command:`openstack database backup show` command to check the backup
@@ -86,26 +90,30 @@ instance from the backup.
.. code-block:: console .. code-block:: console
$ openstack database backup list $ openstack database backup list
+--------------------------------------+--------------------------------------+---------+-----------+-----------+---------------------+ +--------------------------------------+--------------------------------------+------------------------------+-----------+--------------------------------------+---------------------+----------------------------------+
| id | instance_id | name | status | parent_id | updated | | ID | Instance ID | Name | Status | Parent ID | Updated | Project ID |
+--------------------------------------+--------------------------------------+---------+-----------+-----------+---------------------+ +--------------------------------------+--------------------------------------+------------------------------+-----------+--------------------------------------+---------------------+----------------------------------+
| 8af30763-61fd-4aab-8fe8-57d528911138 | 97b4b853-80f6-414f-ba6f-c6f455a79ae6 | backup1 | COMPLETED | None | 2014-03-18T17:09:11 | | 1ecd0a75-e4aa-400b-b0c8-cb738944fd43 | 78e338e3-d1c4-4189-8ea7-bfc1fab5011f | mysql-backup-name1 | COMPLETED | None | 2022-10-24T01:46:55 | fc51186c63df417ea63cec6c65a2d564 |
+--------------------------------------+--------------------------------------+---------+-----------+-----------+---------------------+ +--------------------------------------+--------------------------------------+------------------------------+-----------+--------------------------------------+---------------------+----------------------------------+
$ openstack database backup show 8af30763-61fd-4aab-8fe8-57d528911138 $ openstack database backup show 1ecd0a75-e4aa-400b-b0c8-cb738944fd43
+-------------+----------------------------------------------------+ +----------------------+---------------------------------------------------------------------------------+
| Property | Value | | Field | Value |
+-------------+----------------------------------------------------+ +----------------------+---------------------------------------------------------------------------------+
| created | 2014-03-18T17:09:07 | | created | 2022-10-24T01:46:38 |
| description | None | | datastore | mysql |
| id | 8af...138 | | datastore_version | 8.0.29 |
| instance_id | 97b...ae6 | | datastore_version_id | 324f2bdf-6099-4754-a5f9-82abee026a19 |
| locationRef | http://10.0.0.1:.../.../8af...138.xbstream.gz.enc | | description | None |
| name | backup1 | | id | 1ecd0a75-e4aa-400b-b0c8-cb738944fd43 |
| parent_id | None | | instance_id | 78e338e3-d1c4-4189-8ea7-bfc1fab5011f |
| size | 0.17 | | locationRef | http://172.../my-trove-backups/1ecd0a75-e4aa-400b-b0c8-cb738944fd43.xbstream.gz |
| status | COMPLETED | | name | mysql-backup-name1 |
| updated | 2014-03-18T17:09:11 | | parent_id | None |
+-------------+----------------------------------------------------+ | project_id | fc51186c63df417ea63cec6c65a2d564 |
| size | 0.19 |
| status | COMPLETED |
| updated | 2022-10-24T01:46:55 |
+----------------------+---------------------------------------------------------------------------------+
#. **Check the backup data in Swift** #. **Check the backup data in Swift**
@@ -123,84 +131,105 @@ instance from the backup.
+--------------------------------------------------+ +--------------------------------------------------+
| Name | | Name |
+--------------------------------------------------+ +--------------------------------------------------+
| 8af30763-61fd-4aab-8fe8-57d528911138.xbstream.gz | | 1ecd0a75-e4aa-400b-b0c8-cb738944fd43.xbstream.gz |
+--------------------------------------------------+ +--------------------------------------------------+
#. **Restore a database instance** #. **Restore a database instance**
Now assume that the ``guest1`` database instance is damaged and you Now assume that the ``mysql1`` database instance is damaged and you
need to restore it. In this example, you use the :command:`openstack database instance create` need to restore it. In this example, you use the :command:`openstack database instance create`
command to create a new database instance called ``guest2``. command to create a new database instance called ``mysql2``.
- Specify that the new ``guest2`` instance has the same flavor - Specify that the new ``mysql2`` instance has the same flavor
(``10``) and the same root volume size (``2``) as the original (``d2``) and the same root volume size (``1``) as the original
``guest1`` instance. ``mysql1`` instance.
- Use the ``--backup`` argument to indicate that this new - Use the ``--backup`` argument to indicate that this new
instance is based on the backup artifact identified by instance is based on the backup artifact identified by
``BACKUP_ID``. In this example, replace ``BACKUP_ID`` with the ID of ``mysql-backup-name1``.
``8af30763-61fd-4aab-8fe8-57d528911138``.
.. code-block:: console .. code-block:: console
$ openstack database instance create guest2 --flavor 10 --size 2 --nic net-id=$network_id --backup BACKUP_ID $ openstack database instance create mysql2 --flavor d2 --nic net-id=$network_id
+-------------------+----------------------------------------------+ --datastore mysql --datastore-version 8.0.29 --datastore-version-number 8.0.29 --size 1 \
| Property | Value | --backup $(openstack database backup show mysql-backup-name1 -f value -c id)
+-------------------+----------------------------------------------+ +--------------------------+--------------------------------------+
| created | 2014-03-18T17:12:03 | | Field | Value |
| datastore | {u'version': u'mysql-5.5', u'type': u'mysql'}| +--------------------------+--------------------------------------+
|datastore_version | mysql-5.5 | | allowed_cidrs | [] |
| flavor | {u'id': u'10', u'links': [{u'href': ...]} | | created | 2022-10-24T01:56:55 |
| id | ac7a2b35-a9b4-4ff6-beac-a1bcee86d04b | | datastore | mysql |
| name | guest2 | | datastore_version | 8.0.29 |
| status | BUILD | | datastore_version_number | 8.0.29 |
| updated | 2014-03-18T17:12:03 | | encrypted_rpc_messaging | True |
| volume | {u'size': 2} | | flavor | d2 |
+-------------------+----------------------------------------------+ | id | 62f0f152-8cd5-42b3-9cd6-91bda651a4c0 |
| name | mysql2 |
| operating_status | |
| public | False |
| region | RegionOne |
| server_id | None |
| service_status_updated | 2022-10-24T01:56:55 |
| status | BUILD |
| tenant_id | fc51186c63df417ea63cec6c65a2d564 |
| updated | 2022-10-24T01:56:55 |
| volume | 1 |
| volume_id | None |
+--------------------------+--------------------------------------+
#. **Verify backup** #. **Verify backup**
Now check that the new ``guest2`` instance has the same Now check that the new ``mysql2`` instance has the same
characteristics as the original ``guest1`` instance. characteristics as the original ``mysql1`` instance.
Start by getting the ID of the new ``guest2`` instance. Start by getting the ID of the new ``mysql2`` instance.
.. code-block:: console .. code-block:: console
$ openstack database instance list $ openstack database instance list
+--------------------------------------+--------+-----------+-------------------+--------+------------------+--------+--------------------------------------------------------------------------------------------------+-----------+------+------+
+-----------+--------+-----------+-------------------+--------+-----------+------+ | ID | Name | Datastore | Datastore Version | Status | Operating Status | Public | Addresses | Flavor ID | Size | Role |
| id | name | datastore | datastore_version | status | flavor_id | size | +--------------------------------------+--------+-----------+-------------------+--------+------------------+--------+--------------------------------------------------------------------------------------------------+-----------+------+------+
+-----------+--------+-----------+-------------------+--------+-----------+------+ | 6eef378d-1d9c-4e48-b206-b3db130d750d | mysql2 | mysql | 8.0.29 | ACTIVE | HEALTHY | False | [{'address': '10.0.0.8', 'type': 'private', 'network': '33f3a589-b806-4212-9a59-8e058cac0699'}] | d2 | 1 | |
| 97b...ae6 | guest1 | mysql | mysql-5.5 | ACTIVE | 10 | 2 | | 78e338e3-d1c4-4189-8ea7-bfc1fab5011f | mysql1 | mysql | 8.0.29 | ACTIVE | HEALTHY | False | [{'address': '10.0.0.18', 'type': 'private', 'network': '33f3a589-b806-4212-9a59-8e058cac0699'}] | d2 | 1 | |
| ac7...04b | guest2 | mysql | mysql-5.5 | ACTIVE | 10 | 2 | +--------------------------------------+--------+-----------+-------------------+--------+------------------+--------+--------------------------------------------------------------------------------------------------+-----------+------+------+
+-----------+--------+-----------+-------------------+--------+-----------+------+
Use the :command:`openstack database instance show` command to display information about the new Use the :command:`openstack database instance show` command to display information about the new
guest2 instance. Pass in guest2's ``INSTANCE_ID``, which is mysql2 instance. Pass in mysql2's ``INSTANCE_ID``, which is
``ac7a2b35-a9b4-4ff6-beac-a1bcee86d04b``. ``6eef378d-1d9c-4e48-b206-b3db130d750d``.
.. code-block:: console .. code-block:: console
$ openstack database instance show INSTANCE_ID $ openstack database instance show mysql2
+-------------------+--------------------------------------+ +--------------------------+-------------------------------------------------------------------------------------------------+
| Property | Value | | Field | Value |
+-------------------+--------------------------------------+ +--------------------------+-------------------------------------------------------------------------------------------------+
| created | 2014-03-18T17:12:03 | | addresses | [{'address': '10.0.0.8', 'type': 'private', 'network': '33f3a589-b806-4212-9a59-8e058cac0699'}] |
| datastore | mysql | | allowed_cidrs | [] |
| datastore_version | mysql-5.5 | | created | 2022-10-24T01:58:51 |
| flavor | 10 | | datastore | mysql |
| id | ac7a2b35-a9b4-4ff6-beac-a1bcee86d04b | | datastore_version | 8.0.29 |
| ip | 10.0.0.3 | | datastore_version_number | 8.0.29 |
| name | guest2 | | encrypted_rpc_messaging | True |
| status | ACTIVE | | flavor | d2 |
| updated | 2014-03-18T17:12:06 | | id | 6eef378d-1d9c-4e48-b206-b3db130d750d |
| volume | 2 | | ip | 10.0.0.8 |
| volume_used | 0.18 | | name | mysql2 |
+-------------------+--------------------------------------+ | operating_status | HEALTHY |
| public | False |
| region | RegionOne |
| server_id | 7a8cd089-bd1c-4230-aedd-ced4e945ad46 |
| service_status_updated | 2022-10-24T02:12:35 |
| status | ACTIVE |
| tenant_id | fc51186c63df417ea63cec6c65a2d564 |
| updated | 2022-10-24T02:05:03 |
| volume | 1 |
| volume_id | 7080954f-e22f-4442-8f40-e26aaa080c9d |
| volume_used | 0.19 |
+--------------------------+-------------------------------------------------------------------------------------------------+
Note that the data store, flavor ID, and volume size have the same Note that the data store, flavor ID, and volume size have the same
values as in the original ``guest1`` instance. values as in the original ``mysql1`` instance.
Use the :command:`openstack database db list` command to check that the original Use the :command:`openstack database db list` command to check that the original
databases (``db1`` and ``db2``) are present on the restored instance. databases (``db1`` and ``db2``) are present on the restored instance.
@@ -231,15 +260,15 @@ instance from the backup.
#. **Notify users** #. **Notify users**
Tell the users who were accessing the now-disabled ``guest1`` Tell the users who were accessing the now-disabled ``mysql1``
database instance that they can now access ``guest2``. Provide them database instance that they can now access ``mysql2``. Provide them
with ``guest2``'s name, IP address, and any other information they with ``mysql2``'s name, IP address, and any other information they
might need. (You can get this information by using the might need. (You can get this information by using the
:command:`openstack database instance show` command.) :command:`openstack database instance show` command.)
#. **Clean up** #. **Clean up**
At this point, you might want to delete the disabled ``guest1`` At this point, you might want to delete the disabled ``mysql1``
instance, by using the :command:`openstack database instance delete` command. instance, by using the :command:`openstack database instance delete` command.
.. code-block:: console .. code-block:: console
@@ -261,21 +290,26 @@ Create an incremental backup based on a parent backup:
.. code-block:: console .. code-block:: console
$ openstack database backup create INSTANCE_ID backup1.1 --parent BACKUP_ID $ openstack database backup create mysql-backup-name1.1 --instance mysql1 --swift-container 'my-trove-backups' \
+-------------+--------------------------------------+ --parent $(openstack database backup show mysql-backup-name1 -f value -c id)
| Property | Value | +----------------------+--------------------------------------+
+-------------+--------------------------------------+ | Field | Value |
| created | 2014-03-19T14:09:13 | +----------------------+--------------------------------------+
| description | None | | created | 2022-10-24T02:38:41 |
| id | 1d474981-a006-4f62-b25f-43d7b8a7097e | | datastore | mysql |
| instance_id | 792a6a56-278f-4a01-9997-d997fa126370 | | datastore_version | 8.0.29 |
| locationRef | None | | datastore_version_id | 324f2bdf-6099-4754-a5f9-82abee026a19 |
| name | backup1.1 | | description | None |
| parent_id | 6dc3a9b7-1f3e-4954-8582-3f2e4942cddd | | id | e15ae06a-3afb-4794-8890-7059317b2218 |
| size | None | | instance_id | 78e338e3-d1c4-4189-8ea7-bfc1fab5011f |
| status | NEW | | locationRef | None |
| updated | 2014-03-19T14:09:13 | | name | mysql-backup-name1.1 |
+-------------+--------------------------------------+ | parent_id | 1ecd0a75-e4aa-400b-b0c8-cb738944fd43 |
| project_id | fc51186c63df417ea63cec6c65a2d564 |
| size | None |
| status | NEW |
| updated | 2022-10-24T02:38:41 |
+----------------------+--------------------------------------+
Restore backup from other regions Restore backup from other regions
--------------------------------- ---------------------------------
@@ -354,4 +388,4 @@ One possible reason could be it has been a long time since the parent backup was
In this case, you have to create full backup instead. In this case, you have to create full backup instead.
To avoid this issue in the future, you can set up a cron job to create (incremental) backups regularly. To avoid this issue in the future, you can set up a cron job to create (incremental) backups regularly.