- OpenStack Cloud Computing Cookbook(Third Edition)
- Kevin Jackson Cody Bunch Egle Sigler
- 689字
- 2025-03-01 04:14:04
Installing OpenStack Image Service
Installation of the latest OpenStack Image Service is simply achieved by using the packages provided from the Ubuntu Cloud Archive repositories, which have been packaged for our Ubuntu 14.04 LTS GNU/Linux installation.
Getting ready
To begin with, ensure you're logged in to our OpenStack Controller host where OpenStack Image Service will be installed.
To log in to our OpenStack Controller host that was created using Vagrant, issue the following command:
vagrant ssh controller
Ensure that our Ubuntu 14.04 LTS release is using the Ubuntu Cloud Archive that has the packages required for the Juno release. For more information, visit http://bit.ly/OpenStackCookbookCloudArchive.
Tip
All of the steps can be found at http://www.openstackcookbook.com/.
We will configure Glance to use MariaDB as the database backend, so this needs to be installed prior to installing Glance.
Tip
If MariaDB is not installed, visit http://bit.ly/OpenStackCookbookInstallMariaDB for instructions on how to do this.
We will also need to have RabbitMQ installed as our message queue service, so this needs to also be installed prior to installing Glance.
Tip
If RabbitMQ is not installed, visit http://bit.ly/OpenStackCookbookInstallRabbitMQ for instructions on how to do this.
The instructions in this section assume the controller
node has two IP addresses. It will have a front-facing IP address 192.168.100.200 and a backside IP address 172.16.0.200 (which is also the address of the MariaDB server). It has two addresses because the internal data will communicate over the backside IP address (for example, database traffic) and any Glance traffic will traverse the front.
How to do it...
Carry out the following steps to install OpenStack Image Service:
- Installation of OpenStack Image Service is done by specifying the glance package in Ubuntu:
sudo apt-get update sudo apt-get install ntp glance python-keyring
- Once installed, we need to configure the backend database store, so we first create the
glance
database in MariaDB. We do this as follows:MYSQL_ROOT_PASS=openstack mysql -uroot -p$MYSQL_ROOT_PASS -e "CREATE DATABASE \ glance;"
We have a user called root in MariaDB with the password openstack, which is able to create databases.
- It is a good practice to create a user that is specific to our OpenStack Image service, so we create a
glance
user in the database as follows:MYSQL_GLANCE_PASS=openstack mysql -uroot -p$MYSQL_ROOT_PASS -e "GRANT ALL PRIVILEGES ON \glance.* TO 'glance'@'localhost' IDENTIFIED BY \'$MYSQL_KEYSTONE_PASS';" mysql -uroot -p$MYSQL_ROOT_PASS -e "GRANT ALL PRIVILEGES ON \glance.* TO 'glance'@'%' IDENTIFIED BY '$MYSQL_GLANCE_PASS';"
- We can now configure OpenStack Image Service to use this database by editing the
/etc/glance/glance-registry.conf
and/etc/glance/glance-api.conf
files and changing thesql_connection
line to match the database credentials. We do this by ensuring the following lines are in the files:[database] backend = sqlalchemy connection = mysql://glance:openstack@172.16.0.200/glance
- We configure OpenStack Image Service to use RabbitMQ by ensuring the following lines are present in
/etc/glance/glance-registry.conf
:rabbit_host = localhost rabbit_port = 5672 rabbit_use_ssl = false rabbit_userid = guest rabbit_password = guest rabbit_virtual_host = / rabbit_notification_exchange = glance rabbit_notification_topic = notifications rabbit_durable_queues = False
- We can now restart the
glance-registry
service:sudo stop glance-registry sudo start glance-registry
- Restart the
glance-api
service:sudo stop glance-api sudo start glance-api
- The
glance
database is version controlled under Ubuntu 14.04 to allow the upgrade and downgrade of the service. We first set the version control to be0
by issuing the following command:sudo glance-manage db_version_control 0
- We now sync the database to ensure the correct table structure is present. We do this by issuing the following command:
sudo glance-manage db_sync
Congratulations! We now have OpenStack Image service installed and ready for use in our OpenStack environment.
How it works...
OpenStack Image Service is split into two running services: glance-api
and glance-registry
. It is the glance-registry
service that connects to the database backend. The first step is to create our glance
database and the glance
user, so it can perform operations on the glance
database that we have created.
Once this is done, we modify the /etc/glance/glance-registry.conf
and /etc/glance/glance-api.conf
files so that glance
knows where to find and connect to our MySQL database. This is provided by the standard SQLAlchemy
connection string that has the following syntax:
sql_connection = mysql://USER:PASSWORD@HOST/DBNAME
See also
- Chapter 1, Keystone – OpenStack Identity Service