Description
Rather than using the default sqlite DB, you can use MySQL.
Setup
First install and enable MySQL:
$> sudo yum install -y mysql-server $> sudo service mysqld start $> sudo chkconfig mysqld on
Set a password for the root account and delete the anonymous accounts:
$> mysql -u root mysql> update mysql.user set password = password('iamroot') where user = 'root'; mysql> delete from mysql.user where user = '';
Create a database and user account specifically for nova:
mysql> create database nova; mysql> create user 'nova'@'localhost' identified by 'nova'; mysql> create user 'nova'@'%' identified by 'nova'; mysql> grant all on nova.* to 'nova'@'%';
Next, you want to switch to using the MySQL DB. But once you do so, you're essentially starting from scratch with a clean DB. So, make sure all your floating IPs are released, volumes deleted and instances terminated:
$> euca-terminate-instances i-00000001
Then shutdown all the services:
$> for iii in api compute network volume scheduler; do sudo service openstack-nova-$iii stop; done
Now you configure nova to use the DB:
$> echo '--sql_connection=mysql://nova:nova@localhost/nova' | sudo tee -a /etc/nova/nova.conf
How to test
Create the DB schema:
$> sudo nova-manage db sync
Restart the services:
$> for iii in api compute network volume scheduler; do sudo service openstack-nova-$iii start; done
Now go back over the previous test cases and create a user, project, network and keypair. You don't need to re-register the images. Then launch an instance and testing floating IPs and volumes.
Expected Results
Everything should work as before.
You should see that Nova is using the MySQL DB.
$> mysql -u nova -pnova nova -e 'select * from migrate_version;' +---------------+------------------------------------------------------------------+---------+ | repository_id | repository_path | version | +---------------+------------------------------------------------------------------+---------+ | nova | /usr/lib/python2.7/site-packages/nova/db/sqlalchemy/migrate_repo | 46 | +---------------+------------------------------------------------------------------+---------+