Install and configure for Ubuntu

This section describes how to install and configure the Database service for Ubuntu 18.04 (LTS).

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:

    Warning

    Please be aware that the trove debian packages for Ubuntu are not usually up to date, especially when there are bugfixes for stable branch, the debian packages are not guaranteed to contain those changes. The recommended way to install OpenStack services is either using docker image with source code or installing source code inside a Python virutual environment.

    The commands to install Trove compoments:

    # apt-get update
    # apt-get install python-trove trove-common trove-api trove-taskmanager trove-conductor
    # pip3 install python-troveclient
    
  1. In the /etc/trove directory, edit the trove.conf file, here is an example:

    [DEFAULT]
    network_driver = trove.network.neutron.NeutronDriver
    management_networks = ef7541ad-9599-4285-878a-e0ab62032b03
    management_security_groups = d0d797f7-11d4-436e-89a3-ac8bca829f81
    cinder_volume_type = lvmdriver-1
    nova_keypair = trove-mgmt
    default_datastore = mysql
    taskmanager_manager = trove.taskmanager.manager.Manager
    trove_api_workers = 5
    transport_url = rabbit://stackrabbit:password@192.168.1.34:5672/
    control_exchange = trove
    reboot_time_out = 300
    usage_timeout = 900
    agent_call_high_timeout = 1200
    use_syslog = False
    debug = True
    
    [keystone_authtoken]
    memcached_servers = localhost:11211
    cafile = /devstack/stack/data/ca-bundle.pem
    project_domain_name = Default
    project_name = service
    user_domain_name = Default
    password = password
    username = trove
    auth_url = http://192.168.1.34/identity
    auth_type = password
    
    [service_credentials]
    auth_url = http://192.168.1.34/identity/v3
    region_name = RegionOne
    project_name = service
    password = password
    project_domain_name = Default
    user_domain_name = Default
    username = trove
    
    [database]
    connection = mysql+pymysql://root:password@127.0.0.1/trove?charset=utf8
    
    [mariadb]
    tcp_ports = 3306,4444,4567,4568
    
    [mysql]
    tcp_ports = 3306
    
    [postgresql]
    tcp_ports = 5432
    
  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 /etc/trove/trove-guestagent.conf file so that future trove guests can connect to your OpenStack environment, here is an example:

    [DEFAULT]
    log_file = trove-guestagent.log
    log_dir = /var/log/trove/
    ignore_users = os_admin
    control_exchange = trove
    transport_url = rabbit://stackrabbit:password@172.24.5.1:5672/
    command_process_timeout = 60
    use_syslog = False
    debug = True
    
    [service_credentials]
    auth_url = http://192.168.1.34/identity/v3
    region_name = RegionOne
    project_name = service
    password = password
    project_domain_name = Default
    user_domain_name = Default
    username = trove
    
  4. 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

  1. Restart the Database services:

    # service trove-api restart
    # service trove-taskmanager restart
    # service trove-conductor restart