Install and configure for Red Hat Enterprise Linux and CentOS

This section describes how to install and configure the Database service for Red Hat Enterprise Linux 7 and CentOS 7.

Prerequisites

Before you install and configure the Database service, you must create a database, service credentials, and API endpoints.

  1. To create the database, complete these steps:

    • Use the database access client to connect to the database server as the root user:

      $ mysql -u root -p
      
    • Create the trove database:

      CREATE DATABASE trove;
      
    • Grant proper access to the trove database:

      GRANT ALL PRIVILEGES ON trove.* TO 'trove'@'localhost' \
        IDENTIFIED BY 'TROVE_DBPASS';
      GRANT ALL PRIVILEGES ON trove.* TO 'trove'@'%' \
        IDENTIFIED BY 'TROVE_DBPASS';
      

      Replace TROVE_DBPASS with a suitable password.

    • Exit the database access client.

  2. Source the admin credentials to gain access to admin-only CLI commands:

    $ . admin-openrc
    
  3. To create the service credentials, complete these steps:

    • Create the trove user:

      $ openstack user create --domain default --password-prompt trove
      User Password:
      Repeat User Password:
      +-----------+-----------------------------------+
      | Field     | Value                             |
      +-----------+-----------------------------------+
      | domain_id | default                           |
      | enabled   | True                              |
      | id        | ca2e175b851943349be29a328cc5e360  |
      | name      | trove                             |
      +-----------+-----------------------------------+
      
    • Add the admin role to the trove user:

      $ openstack role add --project service --user trove admin
      

      Note

      This command provides no output.

    • Create the trove service entity:

      $ openstack service create --name trove \
        --description "Database" database
      +-------------+-----------------------------------+
      | Field       | Value                             |
      +-------------+-----------------------------------+
      | description | Database                          |
      | enabled     | True                              |
      | id          | 727841c6f5df4773baa4e8a5ae7d72eb  |
      | name        | trove                             |
      | type        | database                          |
      +-------------+-----------------------------------+
      
  4. Create the Database 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  |
    +--------------+----------------------------------------------+
    

Install and configure components

  1. Install the packages:

    # yum install openstack-trove python-troveclient
    
  1. In the /etc/trove directory, edit the trove.conf file and complete the following steps:

    • 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
      
    • Configure the Database service to use the RabbitMQ message broker by setting the following options in each file:

      [DEFAULT]
      ...
      rpc_backend = rabbit
      transport_url = rabbit://<rabbit_userid>:<rabbit_password>@<rabbit_host>:5672
      
  2. Verify that the api-paste.ini file is present in /etc/trove.

    If the file is not present, you can get it from this location.

  3. Edit the trove.conf file so it includes appropriate 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
    
  4. Edit the trove.conf file so it includes the required settings to connect to the OpenStack Compute service as shown below. Include ConfigDrive settings so that configuration is injected into the Guest VM. And finally, if using Nova Network, set the the network driver name and a regex which allows Projects to launch 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=.*
    
  5. Edit the /etc/trove/trove-guestagent.conf file so that future trove guests can connect to your OpenStack environment:

    rabbit_host = controller
    rabbit_password = RABBIT_PASS
    trove_auth_url = http://controller/identity_admin/v2.0
    
  6. Populate the trove database you created earlier in this procedure:

    # 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
    

    Note

    Ignore any deprecation messages in this output.

Finalize installation

Start 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