Tuesday, October 27, 2015

Add Database Service (Trove) for OpenStack - Kilo - Ubuntu


Note: Change the values in CAPITAL and italic, like TROVE_DBPASS, TROVE_PASS, RABBIT_USER, RABBIT_PASS, NETWORK_LABEL. And also change controller to IP address of OpenStack controller node, if necessary.

1. Prepare trove database

     $ mysql -u root -p
    mysql> 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';
    mysql> FLUSH PRIVILEGES;

2. Install required Trove components

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

3. Prepare OpenStack

    $ source ~/admin-openrc.sh
    $ keystone user-create --name trove --pass TROVE_PASS
    $ keystone user-role-add --user trove --tenant service --role admin

4. Add the following configuration options to [filter:authtoken] section in /etc/trove/api-paste.ini

    [filter:authtoken]
 
    auth_uri = http://controller:5000
    auth_url = http://controller:35357
    auth_plugin = password
    project_domain_id = default
    user_domain_id = default
    project_name = service
    username = trove
    password = TROVE_PASS

5. Edit the configuration following options in [DEFAULT] section in the following files

/etc/trove/trove.conf
/etc/trove/trove-taskmanager.conf
/etc/trove/trove-conductor.conf

    [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
    control_exchange = trove
    rabbit_host = controller
    rabbit_userid = RABBIT_USER
    rabbit_password = RABBIT_PASS
    rabbit_virtual_host= /
    rpc_backend = trove.openstack.common.rpc.impl_kombu
    sql_connection = mysql://trove:TROVE_DBPASS@controller/trove

(note: comment old configuration options if any, such as trove_auth_url, connection)

6. Edit the following configuration options in [DEFAULT] section in /etc/trove/trove.conf

    [DEFAULT]
    add_addresses = True
    network_label_regex = ^NETWORK_LABEL$

(note: replace NETWORK_LABLEL with network label you want to connect. Find it out by "nova net-list" or "neutron net-list".)

7. Edit the following configuration options in [DEFAULT] section in /etc/trove/trove-taskmanager.conf

    [DEFAULT]
    nova_proxy_admin_user = admin
    nova_proxy_admin_pass = admin
    nova_proxy_admin_tenant_name = admin                    
    taskmanager_manager = trove.taskmanager.manager.Manager
    log_file = trove-taskmanager.log

8. Initialize database

    # trove-manage db_sync

9. Edit /etc/init/trove-conductor.conf    to make the following option mataching

    --exec /usr/bin/trove-conductor -- --config-file=/etc/trove/trove-conductor.conf ${DAEMON_ARGS}

10. Edit /etc/init/trove-taskmanager.conf     to make the following option matching

    --exec /usr/bin/trove-taskmanager -- --config-file=/etc/trove/trove-taskmanager.conf ${DAEMON_ARGS}

11. Configure the Trove Endpoint in Keystone

    $ keystone service-create --name trove --type database --description "OpenStack Database Service"
    $ keystone endpoint-create \
    --service-id $(keystone service-list | awk '/ trove / {print $2}') \
    --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

12. Restart the Trove Services

    $ sudo service trove-api restart
    $ sudo service trove-taskmanager restart
    $ sudo service trove-conductor restart