Install the Database serviceThis procedure installs the Database service on the controller
node.PrerequisitesThis chapter assumes that you already have a working
OpenStack environment with at least the following components
installed: Compute, Image service, Identity.If you want to do backup and restore, you also need Object Storage.If you want to provision datastores on block-storage volumes, you also need Block Storage.To install the Database service on the controller:Install required packages:#apt-get install python-trove python-troveclient \
trove-common trove-api trove-taskmanager trove-conductor#yum install openstack-trove python-troveclient#zypper install openstack-trove python-troveclientRespond to the prompts for database management and [keystone_authtoken] settings,
and API endpoint
registration. The trove-manage db_sync
command runs automatically.All configuration files should be placed at /etc/trove directory.
Edit the following configuration files, taking the below
actions for each file:api-paste.initrove.conftrove-taskmanager.conftrove-conductor.confYou need to take upstream api-paste.ini and change content below in it:[composite:trove]
auth_uri = http://controller:5000/v2.0
identity_uri = http://controller:35357
auth_host = controller
admin_tenant_name = service
admin_user = trove
admin_password = TROVE_PASSEdit the [DEFAULT] section of
each file (except api-paste.ini) and set appropriate values for the OpenStack service
URLs (can be handled by Keystone service catalog), logging and
messaging configuration. Edit the [database] section in each
file to add the SQL connections:[DEFAULT]
log_dir = /var/log/trove
trove_auth_url = http://controller:5000/v2.0
nova_compute_url = http://controller:8774/v2
cinder_url = http://controller:8776/v2
swift_url = http://controller:8080/v1/AUTH_
notifier_queue_hostname = controller
[database]
connection = mysql://trove:TROVE_DBPASS@controller/troveConfigure the Database service to use the RabbitMQ message broker by
setting the following options in the [DEFAULT]
configuration group of each file:[DEFAULT]
control_exchange = trove
rabbit_host = controller
rabbit_userid = guest
rabbit_password = RABBIT_PASS
rabbit_virtual_host= /
rpc_backend = trove.openstack.common.rpc.impl_kombuEdit the trove.conf file so it includes
appropriate values for the default datastore and network label
regex as shown below:[DEFAULT]
# Config option for showing the IP address that nova doles out
add_addresses = True
network_label_regex = ^NETWORK_LABEL$
control_exchange = trove
Edit the trove-taskmanager.conf file
so it includes the required settings to
connect to the OpenStack Compute service as shown below:[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
log_file=trove-taskmanager.log
Prepare the trove admin database:$mysql -u root -pmysql>CREATE DATABASE trove;mysql>GRANT ALL PRIVILEGES ON trove.* TO trove@'localhost' \
IDENTIFIED BY 'TROVE_DBPASS';mysql>GRANT ALL PRIVILEGES ON trove.* TO trove@'%' \
IDENTIFIED BY 'TROVE_DBPASS';Prepare the Database service:Initialize the database:#trove-manage db_syncCreate a datastore. You need to create a separate datastore for
each type of database you want to use, for example, MySQL, MongoDB, Cassandra.
This example shows you how to create a datastore for a MySQL database:#su -s /bin/sh -c "trove-manage datastore_update mysql ''" troveCreate a trove image.Create an image for the type of database you want to use,
for example, MySQL, MongoDB, Cassandra.This image must have the trove guest agent installed, and
it must have the trove-guestagent.conf file
configured to connect to your OpenStack environment. To
correctly configure the
trove-guestagent.conf file, follow these steps
on the guest instance you are using to build your image:Add the following lines to trove-guestagent.conf:rabbit_host = controller
rabbit_password = RABBIT_PASS
nova_proxy_admin_user = admin
nova_proxy_admin_pass = ADMIN_PASS
nova_proxy_admin_tenant_name = service
trove_auth_url = http://controller:35357/v2.0
log_file = trove-guestagent.logUpdate the datastore and version to use the specific image with the trove-manage command.#trove-manage datastore_update datastore_namedatastore_version#trove-manage datastore_version_update datastore_nameversion_name \
datastore_managerglance_image_idpackagesactiveThis example shows you how to create a MySQL datastore with version 5.5:#trove-manage datastore_update mysql ''#trove-manage datastore_version_update mysql 5.5 mysql glance_image_ID mysql-server-5.5 1
#trove-manage datastore_update mysql 5.5
Upload post-provisioning configuration validation rules:
#trove-manage db_load_datastore_config_parameters datastore_nameversion_name \
/etc/datastore_name/validation-rules.jsonExample for uploading rules for MySQL datastore:#trove-manage db_load_datastore_config_parameters \
mysql 5.5 "$PYBASEDIR"/trove/templates/mysql/validation-rules.json
Source the admin credentials to gain access to
admin-only CLI commands:$source admin-openrc.shTo create the service credentials, complete these steps:Create the trove user:$openstack user create --password-prompt troveUser Password:
Repeat User Password:
+----------+----------------------------------+
| Field | Value |
+----------+----------------------------------+
| email | None |
| enabled | True |
| id | a0bb962771744d63a659c540d5384b0c |
| name | trove |
| username | trove |
+----------+----------------------------------+Add the admin role to the
trove user:$openstack role add --project service --user trove admin+-------+----------------------------------+
| Field | Value |
+-------+----------------------------------+
| id | cd2cb9a39e874ea69e5d4b896eb16128 |
| name | admin |
+-------+----------------------------------+Create the neutron service entity:$openstack service create --name trove \
--description "OpenStack Database service" database+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | OpenStack Database service |
| enabled | True |
| id | 390a039be169460c994110210c620d2f |
| name | trove |
| type | database |
+-------------+----------------------------------+Create the Database service API endpoint:$openstack endpoint create \
--publicurl http://controller:8779/v1.0/%\(tenant_id\)s \
--internalurl http://controller:8779/v1.0/%\(tenant_id\)s \
--adminurl http://controller:8779/v1.0/%\(tenant_id\)s \
--region RegionOne \
database+--------------+-------------------------------------------+
| Field | Value |
+--------------+-------------------------------------------+
| adminurl | http://controller:8779/v1.0/%(tenant_id)s |
| id | 22db3a4e1ce1407f80dfc1fbe6c26278 |
| internalurl | http://controller:8779/v1.0/%(tenant_id)s |
| publicurl | http://controller:8779/v1.0/%(tenant_id)s |
| region | RegionOne |
| service_id | 390a039be169460c994110210c620d2f |
| service_name | trove |
| service_type | database |
+--------------+-------------------------------------------+Restart the Database services:#service trove-api restart#service trove-taskmanager restart#service trove-conductor restartStart the Database services and configure them to start when the
system boots:#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