Install the Database service This procedure installs the Database module on the controller node. Prerequisites This 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 module on the controller: Install required packages: # apt-get install python-trove python-troveclient python-glanceclient \ trove-common trove-api trove-taskmanager # yum install openstack-trove python-troveclient # zypper install openstack-trove python-troveclient Respond to the prompts for database management and [keystone_authtoken] settings, and API endpoint registration. The trove-manage db_sync command runs automatically. Prepare OpenStack: Source the admin-openrc.sh file. $ source ~/admin-openrc.sh Create a trove user that Compute uses to authenticate with the Identity service. Use the service tenant and give the user the admin role: $ keystone user-create --name=trove --pass=TROVE_PASS \ --email=trove@example.com $ keystone user-role-add --user=trove --tenant=service --role=admin Edit the following configuration files, taking the below actions for each file: trove.conf trove-taskmanager.conf trove-conductor.conf Edit the [DEFAULT] section of each file and set appropriate values for the OpenStack service URLs, logging and messaging configuration, and 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/v1 swift_url = http://controller:8080/v1/AUTH_ sql_connection = mysql://trove:TROVE_DBPASS@controller/trove notifier_queue_hostname = controller Configure the Database module to use the RabbitMQ message broker by setting the rabbit_password in the [DEFAULT] configuration group of each file: [DEFAULT] ... rabbit_password = RABBIT_PASS ... Set these configuration keys to configure the Database module to use the RabbitMQ message broker: # openstack-config --set /etc/trove/trove.conf \ DEFAULT rpc_backend rabbit # openstack-config --set /etc/trove/trove-taskmanager.conf \ DEFAULT rpc_backend rabbit # openstack-config --set /etc/trove/trove-conductor.conf \ DEFAULT rpc_backend rabbit # openstack-config --set /etc/trove/trove.conf DEFAULT \ rabbit_host controller # openstack-config --set /etc/trove/trove-taskmanager.conf DEFAULT \ rabbit_host controller # openstack-config --set /etc/trove/trove-conductor.conf DEFAULT \ rabbit_host controller # openstack-config --set /etc/trove/trove.conf DEFAULT \ rabbit_password RABBIT_PASS # openstack-config --set /etc/trove/trove-taskmanager.conf DEFAULT \ rabbit_password RABBIT_PASS # openstack-config --set /etc/trove/trove-conductor.conf DEFAULT \ rabbit_password RABBIT_PASS Edit the [filter:authtoken] section of the api-paste.ini file so it matches the listing shown below: [filter:authtoken] auth_host = controller auth_port = 35357 auth_protocol = http admin_user = trove admin_password = ADMIN_PASS admin_token = ADMIN_TOKEN admin_tenant_name = service signing_dir = /var/cache/trove Edit the trove.conf file so it includes appropriate values for the default datastore and network label regex as shown below: [DEFAULT] default_datastore = mysql .... # Config option for showing the IP address that nova doles out add_addresses = True network_label_regex = ^NETWORK_LABEL$ .... Edit the trove-taskmanager.conf file so it includes the appropriate service credentials required 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 ... Prepare the trove admin 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'; Prepare the Database service: Initialize the database: # su -s /bin/sh -c "trove-manage db_sync" trove Create 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 ''" trove Create 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 ''" trove Create 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 Update the datastore to use the new image, using the trove-manage command. This example shows you how to create a MySQL 5.5 datastore: # trove-manage --config-file=/etc/trove/trove.conf datastore_version_update \ mysql mysql-5.5 mysql glance_image_ID mysql-server-5.5 1 You must register the Database module with the Identity service so that other OpenStack services can locate it. Register the service and specify the endpoint: $ 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 Start Database services and configure them to start when the system boots: Restart Database services: # service trove-api restart # service trove-taskmanager restart # service trove-conductor restart # service openstack-trove-api start # service openstack-trove-taskmanager start # service openstack-trove-conductor start # chkconfig openstack-trove-api on # chkconfig openstack-trove-taskmanager on # chkconfig openstack-trove-conductor on