2017-06-29 16:25:34 -04:00
|
|
|
.. _database:
|
|
|
|
|
2020-01-13 18:37:23 +13:00
|
|
|
=========
|
|
|
|
Datastore
|
|
|
|
=========
|
2017-06-29 16:25:34 -04:00
|
|
|
|
|
|
|
Introduction
|
|
|
|
~~~~~~~~~~~~
|
|
|
|
|
2020-10-07 18:50:53 +13:00
|
|
|
Admin user needs to create datastore and its versions as required.
|
2017-06-29 16:25:34 -04:00
|
|
|
|
2020-10-13 22:22:40 +13:00
|
|
|
A datastore is typically created as a type of database, e.g. the cloud admin
|
|
|
|
could create 2 datastores for MySQL and PostgreSQL, separately. For each
|
|
|
|
datastore, there could be multiple datastore versions. For example, for MySQL
|
|
|
|
database, Trove could support 5.7.29, 5.7.30 or 5.8, etc.
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
Starting from Victoria, the datastore version name must be the same with the
|
|
|
|
image tag of the specific database. To support MySQL 5.7.29, a new datastore
|
|
|
|
version named 5.7.29 based on `mysql docker image
|
|
|
|
<https://hub.docker.com/_/mysql?tab=tags&name=5.7.29>`_ needs to be created.
|
|
|
|
|
2020-10-07 18:50:53 +13:00
|
|
|
A datastore version is always associated with a Glance image, either by image
|
|
|
|
ID or image tags. If the image ID is not provided, the image can be retrieved
|
|
|
|
by the image tags. The tags are used for filtering as a whole rather than
|
|
|
|
separately. Using image tags is more flexible than ID especially when a new
|
|
|
|
guest image is uploaded to Glance, Trove can pick up the latest image
|
|
|
|
automatically for creating instances.
|
2017-06-29 16:25:34 -04:00
|
|
|
|
2020-10-07 18:50:53 +13:00
|
|
|
Create datastore version
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~
|
2017-06-29 16:25:34 -04:00
|
|
|
|
2020-10-07 18:50:53 +13:00
|
|
|
When creating a datastore version, Trove will create the datastore first if it
|
|
|
|
doesn't exist.
|
2017-06-29 16:25:34 -04:00
|
|
|
|
2020-10-07 18:50:53 +13:00
|
|
|
When using image tags, make sure the image with the tags exists before creating
|
|
|
|
the datastore version.
|
2017-06-29 16:25:34 -04:00
|
|
|
|
2020-05-27 23:34:34 +12:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
From Victoria release, all the datastores can be configured with a same
|
2020-10-07 18:50:53 +13:00
|
|
|
Glance image but with different datastore name and version name.
|
2017-06-29 16:25:34 -04:00
|
|
|
|
2020-10-07 18:50:53 +13:00
|
|
|
To create a datastore version:
|
2017-06-29 16:25:34 -04:00
|
|
|
|
2020-10-07 18:50:53 +13:00
|
|
|
#. Create a trove guest image
|
2017-06-29 16:25:34 -04:00
|
|
|
|
2020-05-27 23:34:34 +12:00
|
|
|
Refer to `Build images using trovestack
|
|
|
|
<https://docs.openstack.org/trove/latest/admin/building_guest_images.html#build-images-using-trovestack>`_
|
2017-06-29 16:25:34 -04:00
|
|
|
|
2020-10-07 18:50:53 +13:00
|
|
|
#. Register image with Image service
|
2017-06-29 16:25:34 -04:00
|
|
|
|
2020-05-27 23:34:34 +12:00
|
|
|
You need to register your guest image with the Image service as cloud admin.
|
2017-06-29 16:25:34 -04:00
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
2020-05-27 23:34:34 +12:00
|
|
|
openstack image create \
|
|
|
|
trove-guest-ubuntu-bionic \
|
|
|
|
--private \
|
|
|
|
--disk-format qcow2 --container-format bare \
|
|
|
|
--file $image_file \
|
|
|
|
--property hw_rng_model='virtio' \
|
2020-10-07 18:50:53 +13:00
|
|
|
--tag trove --tag mysql
|
2017-06-29 16:25:34 -04:00
|
|
|
|
2020-10-07 18:50:53 +13:00
|
|
|
#. Create the datastore version
|
2017-06-29 16:25:34 -04:00
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
2020-10-07 18:50:53 +13:00
|
|
|
openstack datastore version create 5.7.29 mysql mysql "" \
|
2020-10-09 11:50:48 +13:00
|
|
|
--image-tags trove,mysql \
|
|
|
|
--active --default
|
2017-06-29 16:25:34 -04:00
|
|
|
|
2020-10-07 18:50:53 +13:00
|
|
|
#. Load validation rules for configuration groups
|
2017-06-29 16:25:34 -04:00
|
|
|
|
|
|
|
**Background.** You can manage database configuration tasks by using
|
|
|
|
configuration groups. Configuration groups let you set configuration
|
|
|
|
parameters, in bulk, on one or more databases.
|
|
|
|
|
2020-05-27 23:34:34 +12:00
|
|
|
When you set up a configuration group using the :command:`openstack database
|
|
|
|
configuration create` command, this command compares the configuration
|
|
|
|
values you are setting against a list of valid configuration values that are
|
|
|
|
stored in the ``validation-rules.json`` file.
|
2017-06-29 16:25:34 -04:00
|
|
|
|
|
|
|
.. list-table::
|
|
|
|
:header-rows: 1
|
|
|
|
:widths: 20 20 20
|
|
|
|
|
|
|
|
* - Operating System
|
|
|
|
- Location of :file:`validation-rules.json`
|
|
|
|
- Notes
|
|
|
|
|
2020-06-16 16:55:54 +07:00
|
|
|
* - Ubuntu 18.04
|
|
|
|
- :file:`/usr/lib/python3/dist-packages/trove/templates/DATASTORE_NAME`
|
2020-10-07 18:50:53 +13:00
|
|
|
- DATASTORE_NAME is the name of the datastore, e.g. ``mysql``
|
|
|
|
or ``postgresql``.
|
2017-06-29 16:25:34 -04:00
|
|
|
|
|
|
|
* - RHEL 7, CentOS 7, Fedora 20, and Fedora 21
|
2020-06-16 16:55:54 +07:00
|
|
|
- :file:`/usr/lib/python3/site-packages/trove/templates/DATASTORE_NAME`
|
2020-10-07 18:50:53 +13:00
|
|
|
- DATASTORE_NAME is the name of the datastore, e.g. ``mysql``
|
|
|
|
or ``postgresql``.
|
2017-06-29 16:25:34 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Therefore, as part of creating a data store, you need to load the
|
|
|
|
``validation-rules.json`` file, using the :command:`trove-manage`
|
2020-10-07 18:50:53 +13:00
|
|
|
:command:`db_load_datastore_config_parameters` command on trove controller
|
|
|
|
node. This command takes the following arguments:
|
2017-06-29 16:25:34 -04:00
|
|
|
|
|
|
|
* Data store name
|
|
|
|
* Data store version
|
|
|
|
* Full path to the ``validation-rules.json`` file
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This example loads the ``validation-rules.json`` file for a MySQL
|
2020-06-16 16:55:54 +07:00
|
|
|
database on Ubuntu 18.04:
|
2017-06-29 16:25:34 -04:00
|
|
|
|
|
|
|
.. code-block:: console
|
|
|
|
|
2020-10-07 18:50:53 +13:00
|
|
|
$ trove-manage db_load_datastore_config_parameters mysql 5.7.29 /usr/lib/python3/dist-packages/trove/templates/mysql/validation-rules.json
|
2017-06-29 16:25:34 -04:00
|
|
|
|
2020-10-07 18:50:53 +13:00
|
|
|
Hide a datastore version
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~
|
2017-06-29 16:25:34 -04:00
|
|
|
|
2020-10-07 18:50:53 +13:00
|
|
|
Sometimes, it's needed to make a datastore version invisible to the cloud
|
|
|
|
users, e.g when a datastore version is deprecated or creating a datastore
|
|
|
|
version for testing purpose, to do that:
|
2017-06-29 16:25:34 -04:00
|
|
|
|
2020-10-13 22:22:40 +13:00
|
|
|
.. code-block:: console
|
2017-06-29 16:25:34 -04:00
|
|
|
|
2020-10-13 22:22:40 +13:00
|
|
|
$ openstack datastore version set <version-id> --disable
|
2020-10-09 11:50:48 +13:00
|
|
|
|
|
|
|
Replace image ID with tags
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
2020-10-13 22:22:40 +13:00
|
|
|
For datastore versions that are created using image ID, it's easy to switch to
|
2020-10-09 11:50:48 +13:00
|
|
|
image tags without affecting the existing instances. New instances will be
|
|
|
|
created by the image ID (the most recently uploaded) that getting from Glance
|
|
|
|
using image tags. To do that, as the cloud admin user:
|
|
|
|
|
2020-10-13 22:22:40 +13:00
|
|
|
.. code-block:: console
|
2020-10-09 11:50:48 +13:00
|
|
|
|
2020-10-13 22:22:40 +13:00
|
|
|
$ openstack datastore version set <version-id> --image-tags trove,mysql
|
2020-10-09 11:50:48 +13:00
|
|
|
|
|
|
|
Ignoring ``--image`` means removing the image ID from the datastore version if
|
|
|
|
it's associated.
|