summaryrefslogtreecommitdiff
path: root/doc/source/admin/datastore.rst
blob: ad25d30294f1eaa3e498e12c6fcabc9a97364a9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
.. _database:

=========
Datastore
=========

Introduction
~~~~~~~~~~~~

Admin user needs to create datastore and its versions as required.

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 number must be the same with
   the image tag of the specific database. To support MySQL 5.7.29, a new
   datastore version with version number 5.7.29 based on `mysql docker image
   <https://hub.docker.com/_/mysql?tab=tags&name=5.7.29>`_ needs to be created.

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.

Create datastore version
~~~~~~~~~~~~~~~~~~~~~~~~

When creating a datastore version, Trove will create the datastore first if it
doesn't exist. Different datastore versions can have the same name but
different version numbers, or same version number but different names.

When using image tags, make sure the image with the tags exists before creating
the datastore version.

.. note::

    From Victoria release, all the datastores can be configured with a same
    Glance image but with different datastore name and version name.

To create a datastore version:

#. Create a trove guest image

   Refer to `Build images using trovestack
   <https://docs.openstack.org/trove/latest/admin/building_guest_images.html#build-images-using-trovestack>`_

#. Register image with Image service

   You need to register your guest image with the Image service as cloud admin.
   In this example, the image is assigned tags that will be used when creating
   datastore version.

   .. code-block:: console

      openstack image create \
        trove-guest-ubuntu-focal \
        --private \
        --disk-format qcow2 --container-format bare \
        --file $image_file \
        --property hw_rng_model='virtio' \
        --tag trove --tag mysql

#. Create the datastore version

   .. code-block:: console

      openstack datastore version create 5.7.29 mysql mysql "" \
        --image-tags trove,mysql \
        --active --default \
        --version-number 5.7.29

#. Load validation rules for configuration groups

   **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.

   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.

   .. list-table::
      :header-rows: 1
      :widths: 20 20 20

      * - Operating System
        - Location of :file:`validation-rules.json`
        - Notes

      * - Ubuntu 18.04
        - :file:`/usr/lib/python3/dist-packages/trove/templates/DATASTORE_NAME`
        - DATASTORE_NAME is the name of the datastore, e.g. ``mysql``
          or ``postgresql``.

      * - RHEL 7, CentOS 7, Fedora 20, and Fedora 21
        - :file:`/usr/lib/python3/site-packages/trove/templates/DATASTORE_NAME`
        - DATASTORE_NAME is the name of the datastore, e.g. ``mysql``
          or ``postgresql``.

   |

   Therefore, as part of creating a data store, you need to load the
   ``validation-rules.json`` file, using the :command:`trove-manage`
   :command:`db_load_datastore_config_parameters` command on trove controller
   node. This command takes the following arguments:

   * 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
   database on Ubuntu 18.04:

   .. code-block:: console

      $ trove-manage db_load_datastore_config_parameters mysql 5.7.29 /usr/lib/python3/dist-packages/trove/templates/mysql/validation-rules.json

Hide a datastore version
~~~~~~~~~~~~~~~~~~~~~~~~

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:

.. code-block:: console

   $ openstack datastore version set <version-id> --disable

Replace image ID with tags
~~~~~~~~~~~~~~~~~~~~~~~~~~

For datastore versions that are created using image ID, it's easy to switch to
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:

.. code-block:: console

   $ openstack datastore version set <version-id> --image-tags trove,mysql

Ignoring ``--image`` means removing the image ID from the datastore version if
it's associated.