Debian 12 bookworm
Sponsored Link

OpenStack Zed : How to use Trove2023/06/30

 
This is how to use Trove.
This example is based on the environment like follows.
------------+--------------------------+--------------------------+------------
            |                          |                          |
        eth0|10.0.0.30             eth0|10.0.0.50             eth0|10.0.0.51
+-----------+-----------+  +-----------+-----------+  +-----------+-----------+
|   [ dlp.srv.world ]   |  | [ network.srv.world ] |  |  [ node01.srv.world ] |
|     (Control Node)    |  |     (Network Node)    |  |     (Compute Node)    |
|                       |  |                       |  |                       |
|  MariaDB    RabbitMQ  |  |  Neutron L2/L3 Agent  |  |        Libvirt        |
|  Memcached  Nginx     |  |   Neutron Metadata    |  |      Nova Compute     |
|  Keystone   httpd     |  |     Open vSwitch      |  |    Neutron L2 Agent   |
|  Glance     Nova API  |  |     iSCSI Target      |  |      Open vSwitch     |
|  Neutron Server       |  |     Cinder Volume     |  |                       |
|  Neutron Metadata     |  |     Trove Services    |  |                       |
|  Cinder API           |  |         Nginx         |  |                       |
+-----------------------+  +-----------------------+  +-----------------------+

[1] Download a VM image for Trove and add it to Glance.
Also Create a Cinder volume type configured in [trove.conf].
root@dlp ~(keystone)#
wget https://tarballs.opendev.org/openstack/trove/images/trove-master-guest-ubuntu-focal.qcow2

root@dlp ~(keystone)#
openstack image create Trove-Ubuntu --file=trove-master-guest-ubuntu-focal.qcow2 --disk-format=qcow2 --container-format=bare --tag=trove --private
root@dlp ~(keystone)#
openstack image list

+--------------------------------------+--------------+--------+
| ID                                   | Name         | Status |
+--------------------------------------+--------------+--------+
| 3a660af6-3f41-4c0f-b2a8-55127dfc3c60 | Debian12     | active |
| f3ba224f-e810-4756-b503-aea21336bfed | Trove-Ubuntu | active |
+--------------------------------------+--------------+--------+

root@dlp ~(keystone)#
openstack volume type create lvm-trove --private

+-------------+--------------------------------------+
| Field       | Value                                |
+-------------+--------------------------------------+
| description | None                                 |
| id          | fb299d0c-20e3-4a5a-b36a-950f7954b73c |
| is_public   | False                                |
| name        | lvm-trove                            |
+-------------+--------------------------------------+
[2] Add Datastore you'd like to use on the Node Trove API is running. (it's Network Node on this example)
For example, add MariaDB, MySQL on here.
# add datastore

root@network:~#
su -s /bin/bash trove -c "trove-manage datastore_update mariadb ''"

Datastore 'mariadb' updated.
root@network:~#
su -s /bin/bash trove -c "trove-manage datastore_update mysql ''"

Datastore 'mysql' updated.
# add versions for each datastore

# for [f3ba224f-***], that's the image ID of Trove you created in [2]

root@network:~#
su -s /bin/sh -c "trove-manage datastore_version_update mariadb 10.3 mariadb f3ba224f-e810-4756-b503-aea21336bfed mariadb 1" trove

Datastore version '10.3(10.3)' updated.
root@network:~#
su -s /bin/sh -c "trove-manage datastore_version_update mariadb 10.5 mariadb f3ba224f-e810-4756-b503-aea21336bfed mariadb 1" trove

Datastore version '10.5(10.5)' updated.
root@network:~#
su -s /bin/sh -c "trove-manage datastore_version_update mysql 8.0 mysql f3ba224f-e810-4756-b503-aea21336bfed mysql 1" trove

Datastore version '8.0(8.0)' updated.
# add parameters for each version of datastore

root@network:~#
su -s /bin/bash trove -c "trove-manage db_load_datastore_config_parameters mariadb 10.3 /usr/lib/python3/dist-packages/trove/templates/mariadb/validation-rules.json"

Loading config parameters for datastore (mariadb) version (10.3)
root@network:~#
su -s /bin/bash trove -c "trove-manage db_load_datastore_config_parameters mariadb 10.5 /usr/lib/python3/dist-packages/trove/templates/mariadb/validation-rules.json"

Loading config parameters for datastore (mariadb) version (10.5)
root@network:~#
su -s /bin/bash trove -c "trove-manage db_load_datastore_config_parameters mysql 8.0 /usr/lib/python3/dist-packages/trove/templates/mysql/validation-rules.json"

Loading config parameters for datastore (mysql) version (8.0)
# create [cloudinit] files for VM image

root@network:~#
mkdir /etc/trove/cloudinit

root@network:~#
vi /etc/trove/cloudinit/mariadb.cloudinit
# create new
# specify Trove API host for [CONTROLLER]

#cloud-config
runcmd:
  - echo 'CONTROLLER=network.srv.world' > /etc/trove/controller.conf
  - chmod 644 /etc/trove/controller.conf

root@network:~#
cp /etc/trove/cloudinit/mariadb.cloudinit /etc/trove/cloudinit/mysql.cloudinit

root@network:~#
chown -R trove /etc/trove/cloudinit

[3] Login as any Openstack user and create a Database instance on a Node.
By the way, Database instance runs as a Docker container inside a VM instance.
debian@dlp ~(keystone)$
openstack datastore list

+--------------------------------------+---------+
| ID                                   | Name    |
+--------------------------------------+---------+
| 3eecb0b7-9017-46d7-b0ae-064e560e218e | mariadb |
| 36ba758c-78d7-49fd-995a-333d684bd36c | mysql   |
+--------------------------------------+---------+

debian@dlp ~(keystone)$
openstack datastore version list mariadb

+--------------------------------------+------+---------+
| ID                                   | Name | Version |
+--------------------------------------+------+---------+
| 9e3b0894-c443-4763-98a7-f7ae59776fa2 | 10.3 | 10.3    |
| 368e2fcd-a03a-4351-9f12-1c25acfe6868 | 10.5 | 10.5    |
+--------------------------------------+------+---------+

debian@dlp ~(keystone)$
openstack flavor list

+----+-----------+------+------+-----------+-------+-----------+
| ID | Name      |  RAM | Disk | Ephemeral | VCPUs | Is Public |
+----+-----------+------+------+-----------+-------+-----------+
| 1  | m1.small  | 2048 |   10 |         0 |     1 | True      |
| 2  | m1.medium | 4096 |   10 |         0 |     2 | True      |
| 3  | m1.large  | 8192 |   10 |         0 |     4 | True      |
| 4  | m2.large  | 8192 |   10 |        10 |     4 | True      |
| 5  | m3.large  | 8192 |   20 |         0 |     4 | True      |
+----+-----------+------+------+-----------+-------+-----------+

debian@dlp ~(keystone)$
openstack network list

+--------------------------------------+---------+--------------------------------------+
| ID                                   | Name    | Subnets                              |
+--------------------------------------+---------+--------------------------------------+
| ae5fdb1f-efb9-412b-9053-b81106c90336 | private | b3234f3f-b3e3-41d2-b3a4-ca3d4ec55d24 |
| b9b8536b-0696-4a5b-af05-602587435c0a | public  | 0129c597-e411-450e-a4f9-b387c68eddb3 |
+--------------------------------------+---------+--------------------------------------+

# create database instance
debian@dlp ~(keystone)$ openstack database instance create MariaDB-105 \
--flavor 2 \
--size 10 \
--nic net-id=ae5fdb1f-efb9-412b-9053-b81106c90336 \
--databases MyDB --users serverworld:password \
--datastore mariadb --datastore-version 10.5 \
--is-public \
--allowed-cidr 10.0.0.0/24 \
--allowed-cidr 192.168.100.0/24 
+--------------------------+--------------------------------------+
| Field                    | Value                                |
+--------------------------+--------------------------------------+
| allowed_cidrs            | ['10.0.0.0/24', '192.168.100.0/24']  |
| created                  | 2023-06-30T06:16:25                  |
| datastore                | mariadb                              |
| datastore_version        | 10.5                                 |
| datastore_version_number | 10.5                                 |
| flavor                   | 2                                    |
| id                       | 3ac15cb5-a808-4a10-808e-181fe38ac0a3 |
| name                     | MariaDB-105                          |
| operating_status         |                                      |
| public                   | True                                 |
| region                   | RegionOne                            |
| service_status_updated   | 2023-06-30T06:16:25                  |
| status                   | BUILD                                |
| updated                  | 2023-06-30T06:16:25                  |
| volume                   | 10                                   |
+--------------------------+--------------------------------------+

# [BUILD] status during creation

debian@dlp ~(keystone)$
openstack database instance list

+--------------------------------------+-------------+-----------+-------------------+--------+------------------+--------+-----------+-----------+------+------+
| ID                                   | Name        | Datastore | Datastore Version | Status | Operating Status | Public | Addresses | Flavor ID | Size | Role |
+--------------------------------------+-------------+-----------+-------------------+--------+------------------+--------+-----------+-----------+------+------+
| 3ac15cb5-a808-4a10-808e-181fe38ac0a3 | MariaDB-105 | mariadb   | 10.5              | BUILD  |                  | True   |           | 2         |   10 |      |
+--------------------------------------+-------------+-----------+-------------------+--------+------------------+--------+-----------+-----------+------+------+

# if successfully created, status turns to [HEALTHY]

debian@dlp ~(keystone)$
openstack database instance list

+--------------------------------------+-------------+-----------+-------------------+--------+------------------+--------
| ID                                   | Name        | Datastore | Datastore Version | Status | Operating Status | Public 
+--------------------------------------+-------------+-----------+-------------------+--------+------------------+--------
| 3ac15cb5-a808-4a10-808e-181fe38ac0a3 | MariaDB-105 | mariadb   | 10.5              | ACTIVE | HEALTHY          | True   
+--------------------------------------+-------------+-----------+-------------------+--------+------------------+--------
+-----------------------------------------------------------------------------------------------------------------------------------------------------
| Addresses                                                                                                                                           
+-----------------------------------------------------------------------------------------------------------------------------------------------------
| [{'address': '192.168.100.181', 'type': 'private', 'network': 'ae5fdb1f-efb9-412b-9053-b81106c90336'}, {'address': '10.0.0.236', 'type': 'public'}] 
+-----------------------------------------------------------------------------------------------------------------------------------------------------
+-----------+------+------+
| Flavor ID | Size | Role |
+-----------+------+------+
| 2         |   10 |      |
+-----------+------+------+

# verify accesses

debian@dlp ~(keystone)$
mysql -h 10.0.0.236 -u serverworld -p -e "show variables like 'hostname'; show databases;"

Enter password:
+---------------+--------------+
| Variable_name | Value        |
+---------------+--------------+
| hostname      | f481de6c6eda |
+---------------+--------------+
+--------------------+
| Database           |
+--------------------+
| MyDB               |
| information_schema |
+--------------------+

# to delete a database instance, do like follows

debian@dlp ~(keystone)$
openstack database instance delete MariaDB-105

Request to delete database instance 3ac15cb5-a808-4a10-808e-181fe38ac0a3 has been accepted.
[4] This is for the case to create MySQL instance.
debian@dlp ~(keystone)$
openstack datastore list

+--------------------------------------+---------+
| ID                                   | Name    |
+--------------------------------------+---------+
| 3eecb0b7-9017-46d7-b0ae-064e560e218e | mariadb |
| 36ba758c-78d7-49fd-995a-333d684bd36c | mysql   |
+--------------------------------------+---------+

debian@dlp ~(keystone)$
openstack datastore version list mysql

+--------------------------------------+------+---------+
| ID                                   | Name | Version |
+--------------------------------------+------+---------+
| 48fc551a-cd52-4bab-be5a-69476d1559e1 | 8.0  | 8.0     |
+--------------------------------------+------+---------+

debian@dlp ~(keystone)$ openstack database instance create MySQL-8 \
--flavor 2 \
--size 10 \
--nic net-id=ae5fdb1f-efb9-412b-9053-b81106c90336 \
--databases MyDB --users serverworld:password \
--datastore mysql --datastore-version 8.0 \
--is-public \
--allowed-cidr 10.0.0.0/24 \
--allowed-cidr 192.168.100.0/24 

debian@dlp ~(keystone)$
openstack database instance list

+--------------------------------------+---------+-----------+-------------------+--------+------------------
| ID                                   | Name    | Datastore | Datastore Version | Status | Operating Status 
+--------------------------------------+---------+-----------+-------------------+--------+------------------
| f105b6d5-277b-48ad-8c54-b7fbc311a556 | MySQL-8 | mysql     | 8.0               | ACTIVE | HEALTHY          
+--------------------------------------+---------+-----------+-------------------+--------+------------------
+--------+-----------------------------------------------------------------------------------------------------------------------------------------------------
| Public | Addresses                                                                                                                                           
+--------+-----------------------------------------------------------------------------------------------------------------------------------------------------
| True   | [{'address': '192.168.100.122', 'type': 'private', 'network': 'ae5fdb1f-efb9-412b-9053-b81106c90336'}, {'address': '10.0.0.246', 'type': 'public'}] 
+--------+-----------------------------------------------------------------------------------------------------------------------------------------------------
+-----------+------+------+
| Flavor ID | Size | Role |
+-----------+------+------+
| 2         |   10 |      |
+-----------+------+------+

debian@dlp ~(keystone)$
mysql -h 10.0.0.246 -u serverworld -p -e "show variables like 'hostname'; show databases;"

Enter password:
+---------------+--------------+
| Variable_name | Value        |
+---------------+--------------+
| hostname      | ea1e5711e7cf |
+---------------+--------------+
+--------------------+
| Database           |
+--------------------+
| MyDB               |
| information_schema |
| performance_schema |
+--------------------+
Matched Content