Manual Trove Installation

Objectives

This document provides a step-by-step guide for manual installation of Trove with an existing OpenStack environment for development purposes.

This document will not cover OpenStack setup for other services.

Requirements

A running OpenStack environment installed on Ubuntu 16.04 or 18.04 LTS is required, including the following components:

  • Compute (Nova)

  • Image Service (Glance)

  • Identity (Keystone)

  • Network (Neutron)

  • If you want to provision databases on block-storage volumes, you also need Block Storage (Cinder)

  • If you want to do backup/restore or replication, you also need Object Storage (Swift)

  • AMQP service (RabbitMQ or QPID)

  • MySQL (SQLite, PostgreSQL) database

Networking requirements

Trove makes use of an “Management Network” that the controller uses to talk to trove instance and vice versa. All the trove instance that Trove deploys will have interfaces and IP addresses on this network. Therefore, it’s important that the subnet deployed on this network be sufficiently large to allow for the maximum number of trove instance and controllers likely to be deployed throughout the lifespan of the cloud installation.

You must also create a Neutron security group which will be applied to trove instance port created on the management network. The cloud admin has full control of the security group, e.g it can be helpful to allow SSH access to the trove instance from the controller for troubleshooting purposes (ie. TCP port 22), though this is not strictly necessary in production environments.

Finally, you need to add routing or interfaces to this network so that the Trove controller is able to communicate with Nova servers on this network.

Trove Installation

Required packages for Trove

List of packages to be installed:

$ sudo apt-get install -y build-essential python-dev libpython-dev \
python-setuptools libffi-dev libxslt1-dev libxml2-dev libyaml-dev \
libssl-dev zlib1g-dev mysql-client python-pymysql libmysqlclient-dev git

Python settings

Install pip:

curl -SO# https://bootstrap.pypa.io/get-pip.py && sudo python get-pip.py pip==9.0.3 && rm -f get-pip.py

Install virtualenv, create Trove environment and activate it:

pip install virtualenv --user
virtualenv --system-site-packages trove_env
source trove_env/bin/activate

Get Trove

Obtain the Trove source components from OpenStack repositories:

cd ~
git clone https://opendev.org/openstack/trove.git
git clone https://opendev.org/openstack/python-troveclient.git

Install Trove

First, install the requirements:

cd ~/trove
sudo pip install -r requirements.txt -r test-requirements.txt

Then, install Trove:

sudo pip install -e .

Finally, install the Trove client:

cd ~/python-troveclient
sudo pip install -e .
cd ~

Other required OpenStack clients (python-novaclient, python-keystoneclient, etc.) should already be installed as part of the Trove requirements.

Prepare Trove for OpenStack

Note

You need to run the following commands using OpenStack admin credentials.

  1. Create Trove service user with admin role in the service project.

    openstack user create trove --project service --password-prompt
    openstack role add --user trove --project service admin
    
  2. Register Trove in Keystone.

    openstack service create --name trove --description "Database" database
    openstack endpoint create --region RegionOne database public 'http://<EnvironmentPublicIP>:8779/v1.0/$(tenant_id)s'
    openstack endpoint create --region RegionOne database admin 'http://<EnvironmentPublicIP>:8779/v1.0/$(tenant_id)s'
    openstack endpoint create --region RegionOne database internal 'http://<EnvironmentPublicIP>:8779/v1.0/$(tenant_id)s'
    

    Where <EnvironmentPublicIP> is the IP address of the server where Trove was installed. This IP should be reachable from any hosts that will be used to communicate with Trove.

Trove configuration

There are several configuration files for Trove, you can find samples of the config files in etc/trove/ of Trove repo:

  • api-paste.ini — For trove-api service

  • trove.conf - For trove-api, trove-taskmanagerr, trove-conductor services.

  • trove-guestagent.conf — For trove-guestagent service

  • <datastore_manager>.cloudinit — Userdata for trove instance during provisioning

Options in trove.conf

  1. Service tenant credentials, change the values according to your own environment.

    [service_credentials]
    auth_url = <Keystone service URL>
    username = admin
    password = password
    user_domain_name = default
    project_name = admin
    project_domain_name = default
    region_name = RegionOne
    
  2. Management config options.

    management_networks

    Trove management network ID list. Cloud admin needs to create the networks.

    management_security_groups

    Security group IDs that applied to the management port in the trove instance. Cloud admin needs to create the security groups.

    nova_keypair

    The Nova keypair used to create trove instance. Cloud admin needs to create the keypair.

    cinder_volume_type

    The Cinder volume type name used to create volume that attached to the trove instance, otherwise, users need to provide the volume type when creating the instance.

Prepare Trove database

Create the Trove database schema:

  • Connect to the storage backend (MySQL, PostgreSQL)

  • Create a database called trove (this database will be used for storing Trove ORM)

  • Compose connection string. Example: mysql+pymysql://<user>:<password>@<backend_host>:<backend_port>/<database_name>

Initialize the database

Once the database for Trove is created, its structure needs to be populated.

$ trove-manage db_sync

Create and register Trove guest image

To build Trove guest image, refer to Build guest agent image

Run Trove

Starting Trove services

Run trove-api:

$ trove-api --config-file=${TROVE_CONF_DIR}/trove.conf &

Run trove-taskmanager:

$ trove-taskmanager --config-file=${TROVE_CONF_DIR}/trove.conf &

Run trove-conductor:

$ trove-conductor --config-file=${TROVE_CONF_DIR}/trove.conf &