OpenStack Database (Trove): Installation and Configuration for Red Hat Enterprise Linux & CentOS and also for Ubuntu

Hello everyone! I am so happy that you have been joined with me for this long period of time! And today we are going to continue with our series of blogs on components of OpenStack. As I mentioned in my previous blog titled: “Overview of Database (Trove) and how to install and configure it for openSUSE and SUSE Linux Enterprise and also how to install and configure the Trove dashboard”, in the next blog we will discuss about how to install and configure database Trove for Red Hat Enterprise Linux and CentOS and also for Ubuntu.

Today we will one by one go through these two topics. So, let’s start with first installation and configuration! i.e.:

Installation and Configuration for Red Hat Enterprise Linux and CentOS:

As mentioned earlier in this section we are going to describe how to install and configure database Trove for Red Hat Enterprise Linux version 7 and CentOS version 7.

But before starting the process of installation and configuration, let’s look at the prerequisites:

Prior to the installation, you should create a database, then the service credentials and endpoints for API, just like we did before for the openSUSE and SUSE Linux Enterprise installation and configuration.

  1. As you know the first step is to create a database, so for that, you need to complete the following steps:
  • First of all connect to the database server as a root user with the help of database access client Use the database access client as follows:

$ mysql -u root -p

  • Now it’s time to create a trove database. Use following command:

CREATE DATABASE trove;

  • Then allocate appropriate permission to the trove database, as follows:

GRANT ALL PRIVILEGES ON trove.* TO ‘trove’@’localhost’ \ IDENTIFIED BY ‘TROVE_DBPASS’;

GRANT ALL PRIVILEGES ON trove.* TO ‘trove’@’%’ \ IDENTIFIED BY ‘TROVE_DBPASS’;

Just like the previous installation, substitute TROVE_DBPASS with an appropriate password.

  • And finally, exit the database access client.

2. Obtain the admin permission, for gaining access to the admin-only Command Line Interpreter commands, using the following command:

$ . admin-openrc

The next step is to create appropriate service credentials, so for that, it is required to complete the following steps:

3. First of all create a “trove” user, by using the following command:

$ openstack user create –domain default –password-prompt trove

User Password:

Repeat User Password:

+———–+———————————–+

| Field     | Value                             |

+———–+———————————–+

| domain_id | default                           |

| enabled   | True                              |

| id        | ca2e175b851943349be29a328cc5e360  |

| name      | trove                             |

+———–+———————————–+

  • Then assign the “admin” role to the “trove” user by using the following command:

$ openstack role add –project service –user trove admin

 Important Note: –

As seen in the previous installation, the above command will not provide any output.

  • Next, by using the following command we are going to create a trove service entity:

$ openstack service create –name trove \  –description “Database” database

+————-+———————————–+

| Field       | Value                             |

+————-+———————————–+

| description | Database                          |

| enabled     | True                              |

| id          | 727841c6f5df4773baa4e8a5ae7d72eb  |

| name        | trove                             |

| type        | database                          |

+————-+———————————–+

4. Once the trove service entity has been created, it’s time to Create the API endpoints, by using the following commands:

$ openstack endpoint create –region RegionOne \ database public http://controller:8779/v1.0/%\(tenant_id\)s

+————–+———————————————-+

| Field        | Value                                        |

+————–+———————————————-+

| enabled      | True                                         |

| id           | 3f4dab34624e4be7b000265f25049609             |

| interface    | public                                       |

| region       | RegionOne                                    |

| region_id    | RegionOne                                    |

| service_id   | 727841c6f5df4773baa4e8a5ae7d72eb             |

| service_name | trove                                        |

| service_type | database                                     |

| url          | http://controller:8779/v1.0/%\(tenant_id\)s  |

+————–+———————————————-+

$ openstack endpoint create –region RegionOne \database internal http://controller:8779/v1.0/%\(tenant_id\)s

+————–+———————————————-+

| Field        | Value                                        |

+————–+———————————————-+

| enabled      | True                                         |

| id           | 9489f78e958e45cc85570fec7e836d98             |

| interface    | internal                                     |

| region       | RegionOne                                    |

| region_id    | RegionOne                                    |

| service_id   | 727841c6f5df4773baa4e8a5ae7d72eb             |

| service_name | trove                                        |

| service_type | database                                     |

| url          | http://controller:8779/v1.0/%\(tenant_id\)s  |

+————–+———————————————-+

$ openstack endpoint create –region RegionOne \database admin http://controller:8779/v1.0/%\(tenant_id\)s

+————–+———————————————-+

| Field        | Value                                        |

+————–+———————————————-+

| enabled      | True                                         |

| id           | 76091559514b40c6b7b38dde790efe99             |

| interface    | admin                                        |

| region       | RegionOne                                    |

| region_id    | RegionOne                                    |

| service_id   | 727841c6f5df4773baa4e8a5ae7d72eb             |

| service_name | trove                                        |

| service_type | database                                     |

| url          | http://controller:8779/v1.0/%\(tenant_id\)s  |

+————–+———————————————-+

Now let’s install and configure the components like Python packages, RabbitMQ message broker, and so on.

  1. As I mentioned earlier, packages will be required. And for Installing them on your system use yum command as follows:

# yum install openstack-trove python-troveclient

2. Next step is to modify the trove.conf, trove-taskmanager.conf and trove-conductor.conf files  present in the /etc/trove directory and then complete the following steps:

Assign proper values for the settings shown below:

[DEFAULT]

log_dir = /var/log/trove

trove_auth_url = http://controller/identity/v2.0

nova_compute_url = http://controller:8774/v2

cinder_url = http://controller:8776/v1

swift_url = http://controller:8080/v1/AUTH_

[Database]

connection = mysql+pymysql://trove:TROVE_DBPASS@controller/trove

  • Set the options given below for configuring the database service so that it is possible to use the RabbitMQ message broker:

[DEFAULT]

rpc_backend = rabbit

transport_url = rabbit://<rabbit_userid>:<rabbit_password>@<rabbit_host>:5672

3. Now as done in previous installation, confirm that the api-paste.ini file is present in /etc/trove and if the api-paste.ini file is not present, then you can get it from the following location:

https://opendev.org/openstack/trove/raw/branch/master/etc/trove/api-paste.ini

4. Same as the previous installation, modify the trove.conf file there by it incorporates suitable values for the settings given below:

[DEFAULT]

auth_strategy = keystone

# Config option for showing the IP address that nova doles out

add_addresses = True

network_label_regex = ^NETWORK_LABEL$

api_paste_config = /etc/trove/api-paste.ini

[keystone_authtoken]

www_authenticate_uri = http://controller/identity

auth_url = http://controller/identity_admin

auth_type = password

project_domain_name = default

user_domain_name = default

project_name = service

username = trove

password = TROVE_PASS

5. Modify the trove-taskmanager.conf file where it incorporates the required settings for connecting to the OpenStack Compute service as given below.

Also incorporate the ConfigDrive settings where by the configuration is inserted into the Guest Virtual Machine. And at last, assign the name to the network driver and also assign a regex which will allow the Projects to launch the Guests on any of their networks, if you are using Nova Network.

[DEFAULT]

# Configuration options for talking to nova via the novaclient.

# These options are for an admin user in your keystone config.

# It proxy’s the token received from the user to send to nova

# via this admin users creds,

# basically acting like the client via that proxy token.

nova_proxy_admin_user = admin

nova_proxy_admin_pass = ADMIN_PASS

nova_proxy_admin_tenant_name = service

taskmanager_manager = trove.taskmanager.manager.Manager

# Inject configuration into guest via ConfigDrive

use_nova_server_config_drive = True

# Set these if using Neutron Networking

network_driver=trove.network.neutron.NeutronDriver

network_label_regex=.*

6. For allowing the future trove guests to connect to your OpenStack environment, modify the /etc/trove/trove-guestagent.conf file, as shown below:

rabbit_host = controller

rabbit_password = RABBIT_PASS

trove_auth_url = http://controller/identity_admin/v2.0

7. Set the trove database that you have created earlier in this process, as follows:

# su -s /bin/sh -c “trove-manage db_sync” trove

  …

  2016-04-06 22:00:17.771 10706 INFO trove.db.sqlalchemy.migration [-]

  Upgrading mysql+pymysql://trove:dbaasdb@controller/trove to version latest

Important Note:

If you get any deprecation messages in the output, then ignore them.

The last step is to finalize the installation:

For finalizing the installation, enable the Database services and also configure them in such a way that they will start, when the system boots, using sysemctl:

# systemctl enable openstack-trove-api.service \openstack-trove-taskmanager.service \openstack-trove-conductor.service

# systemctl start openstack-trove-api.service \openstack-trove-taskmanager.service \openstack-trove-conductor.service

Here the process of installation and configuration for the Red Hat Enterprise Linux and CentOS ends!

Now in the next section I am going to describe how to install and configure database trove for Ubuntu:

Installation and configuration of database trove for Ubuntu:

I am going to describe how to install and configure the Database trove service for Ubuntu version 14.04 (LTS). But before that, let’s look at the prerequisites:

The prerequisites include the same steps as the previous two installations like creating a database, creating service credentials and creating API endpoints.

  1. So, first of all, create the database, by completing the following steps:
  • For connecting to the database server as a root user, take the help of the database access client, as follows:

$ mysql -u root -p

  • Then create the trove database using CREATE command, as shown below:

CREATE DATABASE trove;

  • Assign appropriate permissions to the trove database, as follows:

GRANT ALL PRIVILEGES ON trove.* TO ‘trove’@’localhost’ \IDENTIFIED BY ‘TROVE_DBPASS’;

GRANT ALL PRIVILEGES ON trove.* TO ‘trove’@’%’ \IDENTIFIED BY ‘TROVE_DBPASS’;

Once the permissions are granted, substitute the TROVE_DBPASS with a suitable password.

The last step is to exit the database access client.

2. The second step is to obtain the “admin” permissions for gaining access to the admin-only Command Line Interpreter commands, as follows:

$ . admin-openrc

The next step is creating service credentials, by completing following steps:

3. First of all start by creating a “trove” user, as follows:

$ openstack user create –domain default –password-prompt trove

User Password:

Repeat User Password:

+———–+———————————–+

| Field     | Value                             |

+———–+———————————–+

| domain_id | default                           |

| enabled   | True                              |

| id        | ca2e175b851943349be29a328cc5e360  |

| name      | trove                             |

+———–+———————————–+

  • Then use “add” command for assigning the “admin” role to the “trove” user, as follows:

$ openstack role add –project service –user trove admin

 Important Note: –

The above command will not provide any output, as seen in previous installations.

  • In the next step create a “trove service entity” using following command:

$ openstack service create –name trove \  –description “Database” database

+————-+———————————–+

| Field       | Value                             |

+————-+———————————–+

| description | Database                          |

| enabled     | True                              |

| id          | 727841c6f5df4773baa4e8a5ae7d72eb  |

| name        | trove                             |

| type        | database                          |

+————-+———————————–+

4. Now, using the following command, create Database trove service “API endpoints”:

$ openstack endpoint create –region RegionOne \database public http://controller:8779/v1.0/%\(tenant_id\)s

+————–+———————————————-+

| Field        | Value                                        |

+————–+———————————————-+

| enabled      | True                                         |

| id           | 3f4dab34624e4be7b000265f25049609             |

| interface    | public                                       |

| region       | RegionOne                                    |

| region_id    | RegionOne                                    |

| service_id   | 727841c6f5df4773baa4e8a5ae7d72eb             |

| service_name | trove                                        |

| service_type | database                                     |

| url          | http://controller:8779/v1.0/%\(tenant_id\)s  |

+————–+———————————————-+

$ openstack endpoint create –region RegionOne \database internal http://controller:8779/v1.0/%\(tenant_id\)s

+————–+———————————————-+

| Field        | Value                                        |

+————–+———————————————-+

| enabled      | True                                         |

| id           | 9489f78e958e45cc85570fec7e836d98             |

| interface    | internal                                     |

| region       | RegionOne                                    |

| region_id    | RegionOne                                    |

| service_id   | 727841c6f5df4773baa4e8a5ae7d72eb             |

| service_name | trove                                        |

| service_type | database                                     |

| url          | http://controller:8779/v1.0/%\(tenant_id\)s  |

+————–+———————————————-+

$ openstack endpoint create –region RegionOne \database admin http://controller:8779/v1.0/%\(tenant_id\)s

+————–+———————————————-+

| Field        | Value                                        |

+————–+———————————————-+

| enabled      | True                                         |

| id           | 76091559514b40c6b7b38dde790efe99             |

| interface    | admin                                        |

| region       | RegionOne                                    |

| region_id    | RegionOne                                    |

| service_id   | 727841c6f5df4773baa4e8a5ae7d72eb             |

| service_name | trove                                        |

| service_type | database                                     |

| url          | http://controller:8779/v1.0/%\(tenant_id\)s  |

+————–+———————————————-+

Installation and configuration of the components

  1. First step is to install the packages, as follows:

# apt-get update

# apt-get install python-trove python-troveclient \python-glanceclient trove-common trove-api trove-taskmanager \trove-conductor

Then modify the trove.conftrove-taskmanager.conf and trove-conductor.conf files, present in the /etc/trove directory, and also complete the following steps:

2. Provide appropriate values for the following settings:

[DEFAULT]

log_dir = /var/log/trove

trove_auth_url = http://controller/identity/v2.0

nova_compute_url = http://controller:8774/v2

cinder_url = http://controller:8776/v1

swift_url = http://controller:8080/v1/AUTH_

[database]

connection = mysql+pymysql://trove:TROVE_DBPASS@controller/trove

  • After modifying the files in the /etc/trove directory, configure the Database trove service for using the RabbitMQ message broker, by allocating the following options in each file:

[DEFAULT]

rpc_backend = rabbit

transport_url = rabbit://<rabbit_userid>:<rabbit_password>@<rabbit_host>:5672

3. Check that whether the api-paste.ini file is present in /etc/trove, if the api-paste file is not present in /etc/trove, then you can get it from the following location:

https://opendev.org/openstack/trove/raw/branch/master/etc/trove/api-paste.ini

4. Update the trove.conf file where by it incorporates proper values for the settings shown below:

[DEFAULT]

auth_strategy = keystone

# Config option for showing the IP address that nova doles out

add_addresses = True

network_label_regex = ^NETWORK_LABEL$

api_paste_config = /etc/trove/api-paste.ini

[keystone_authtoken]

www_authenticate_uri = http://controller/identity

auth_url = http://controller/identity_admin

auth_type = password

project_domain_name = default

user_domain_name = default

project_name = service

username = trove

password = TROVE_PASS

5. Update the trove-taskmanager.conf file so that it incorporates the required settings for connecting with “OpenStack Compute service” as shown below.

Then incorporate the “ConfigDrive” settings there by the configuration are inserted into the Guest Virtual Machine. And thus at last, if you are using “Nova Network”, then assign the name to the network driver and also assign a regex which will allow the projects to launch the Guests on any of their networks.

[DEFAULT]

# Configuration options for talking to Nova via the novaclient.

# These options are for an admin user in your keystone config.

# It proxy’s the token received from the user to send to nova

# via this admin users creds,

# basically acting like the client via that proxy token.

nova_proxy_admin_user = admin

nova_proxy_admin_pass = ADMIN_PASS

nova_proxy_admin_tenant_name = service

taskmanager_manager = trove.taskmanager.manager.Manager

# Inject configuration into guest via ConfigDrive

use_nova_server_config_drive = True

# Set these if using Neutron Networking

network_driver=trove.network.neutron.NeutronDriver

network_label_regex=.*

6. Update the /etc/trove/trove-guestagent.conf file whereby the future trove guests will be able to connect to your OpenStack environment, as shown below:

rabbit_host = controller

rabbit_password = RABBIT_PASS

trove_auth_url = http://controller/identity_admin/v2.0

7. Set the trove database that you have already created during this procedure, as follows:

# su -s /bin/sh -c “trove-manage db_sync” trove

  …

  2016-04-06 22:00:17.771 10706 INFO trove.db.sqlalchemy.migration [-]

  Upgrading mysql+pymysql://trove:dbaasdb@controller/trove to version latest

Important Note: –

If you receive any deprecation messages in this output, then neglect them.

Finalizing the installation procedure:

  1. Because of the presence of a bug in the Ubuntu packages, update the service definition files so that they will use the accurate configuration settings.

For doing so, go to /etc/init and also update the following files as explained below:

trove-taskmanager.conf

trove-conductor.conf

Note: –

Keep in mind that, even though these files have the same names, they are located at different location and they have different content than the similarly named files which you have already updated during this process.

Find this line, in each file:

exec start-stop-daemon –start –chdir /var/lib/trove \

   –chuid trove:trove –make-pidfile \

   –pidfile /var/run/trove/trove-conductor.pid \

   –exec /usr/bin/trove-conductor — \

   –config-file=/etc/trove/trove.conf ${DAEMON_ARGS}

Also it is important to note that –config-file wrongly points to trove.conf.

In trove-taskmanager.conf, update config-file to point at /etc/trove/trove-taskmanager.conf.

In trove-conductor.conf, update config-file to point at /etc/trove/trove-conductor.conf.

2. As described below restart the Database trove services:

# service trove-api restart

# service trove-taskmanager restart

# service trove-conductor restart

Here we have completed the installation and configuration for Ubuntu! I think you find this information helpful. Tell me how you find this information by leaving a comment in the comment section below!

Thank you for reading the blog! See you soon with another blog on another topic!


Vishwajit Kale

Vishwajit Kale blazed onto the digital marketing scene back in 2015 and is the digital marketing strategist of Hostripples, a company that aims to provide affordable web hosting solutions. Vishwajit is experienced in digital and content marketing along with SEO. He's fond of writing technology blogs, traveling and reading.

One thought on “OpenStack Database (Trove): Installation and Configuration for Red Hat Enterprise Linux & CentOS and also for Ubuntu