How to Configure Database Services – OpenStack

Configure Database Services

Each of the core OpenStack services (Compute, Identity, Networking, Block Storage) store state and configuration information in databases. The Database service provides a scalable and reliable Cloud Database-as-a-Service functionality for both relational and non-relational database engines. Users can quickly and easily use database features without the burden of handling complex administrative tasks.
OpenStack supports a number of database backends—an internal SQLite database (the default), MySQL, and Postgres. Many OpenStack services maintain a database to keep track of critical resources, usage, and other information. By default, individual SQLite databases are specified for this purpose and are useful for the single-node configuration. For multi-node configurations, a MySQL database is recommended for storing this information.
SQLite is used only for testing and is not supported in a nt, where as MySQL or Postgres usage is down to the experience of the database staff. For the remaining fields of this tutorial we shall use MySQL.
Setting up MySQL is easy and allows you to grow this environment as you progress through the chapters of this tutorial.

Getting started

We will configure our OpenStack Controller services to use MySQL as the database backend, so this needs to be installed prior to configuring our OpenStack Compute environment.


Refer to the recipe Installing OpenStack Identity Service in Chapter 1, and also Keystone OpenStack Identity Service, for instructions on setting up MySQL.
If you are not already on the OpenStack Controller, ssh into this using Vagrant as follows:

vagrant ssh controller

How to achieve it…

To use OpenStack Compute (Nova), we first need to assure that our backend database has been equipped with the required nova database. To create this, follow the steps below on our controller host running MySQL:
1. With MySQL running, we configure an appropriate database user, called nova, and privileges for use by OpenStack Compute:
mysql -uroot -p$MYSQL_ROOT_PASS -e ‘CREATE DATABASE nova;’
mysql -uroot -p${MYSQL_ROOT_PASSWORD}
mysql -uroot -p${MYSQL_ROOT_PASSWORD}

2. We now simply refer our MySQL server in our /etc/nova/nova.conf file to use MySQL by adding in the sql_connection flag:

How it works…

MySQL is an essential service to OpenStack as a number of services rely on it. Configuring MySQL appropriately assures that your servers operate smoothly. We added a database called nova that will eventually be populated by tables and data from the OpenStack Compute services and grant all privileges to the nova database user so that user can use it.
Finally, we configured our OpenStack Compute installation to specify these details so that they can use the nova database.

Related Pages:
Openstack Training
Openstack Tutorial

Sample Resume:
Openstack Sample Resumes

Interview Questions:
Openstack Interview Questions


Get Updates on Tech posts, Interview & Certification questions and training schedules