openstack-manuals/doc/install-guide/section_cinder-controller.xml

182 lines
10 KiB
XML

<section xmlns="http://docbook.org/ns/docbook"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0"
xml:id="cinder-controller">
<title>Configure a Block Storage Service controller</title>
<note>
<para>This section describes how to configure OpenStack Block Storage
services on the <firstterm>Controller</firstterm> node and assumes that a
second node provides storage through the <systemitem
class="service">cinder-volume</systemitem> service. For
instructions on how to configure the second node, see <xref
linkend="cinder-node"/>.</para>
</note>
<para>You can configure OpenStack to use various storage systems.
The examples in this guide show you how to configure LVM.</para>
<procedure>
<step>
<para>Install the appropriate packages for the Block Storage
Service:</para>
<screen os="ubuntu;debian"><prompt>#</prompt> <userinput>apt-get install cinder-api cinder-scheduler</userinput></screen>
<screen os="centos;rhel;fedora"><prompt>#</prompt> <userinput>yum install openstack-cinder openstack-utils openstack-selinux</userinput></screen>
<screen os="opensuse;sles"><prompt>#</prompt> <userinput>zypper install openstack-cinder-api openstack-cinder-scheduler</userinput></screen>
</step>
<step os="debian">
<para>Respond to the prompts for <link
linkend="debconf-dbconfig-common">database
management</link>, <link linkend="debconf-keystone_authtoken"
><literal>[keystone_authtoken]</literal> settings</link>,
<link linkend="debconf-rabbitqm">RabbitMQ credentials</link>
and <link linkend="debconf-api-endpoints">API endpoint</link>
registration.</para>
</step>
<step os="ubuntu;rhel;centos;fedora;opensuse;sles">
<para>Configure Block Storage to use your MySQL database. Edit the
<filename>/etc/cinder/cinder.conf</filename> file and add the
following key under the <literal>[database]</literal> section.
Replace <replaceable>CINDER_DBPASS</replaceable> with the password
for the Block Storage database that you will create in a later step.
</para>
<note os="ubuntu"><para>The <filename>/etc/cinder/cinder.conf</filename>
file packaged with some distributions does not include the
<literal>[database]</literal> section header. You must add this
section header to the end of the file before proceeding further.</para>
</note>
<screen os="rhel;centos;fedora;opensuse;sles"><prompt>#</prompt> <userinput>openstack-config --set /etc/cinder/cinder.conf \
database connection mysql://cinder:<replaceable>CINDER_DBPASS</replaceable>@<replaceable>controller</replaceable>/cinder</userinput></screen>
<programlisting os="ubuntu" language="ini">[database]
...
connection = mysql://cinder:<replaceable>CINDER_DBPASS</replaceable>@<replaceable>controller</replaceable>/cinder</programlisting>
</step>
<step os="rhel;centos;fedora;opensuse;sles">
<para>To create the Block Storage Service database and tables
and a <literal>cinder</literal> database user, run the
<command>openstack-db</command> command.</para>
<screen><prompt>#</prompt> <userinput>openstack-db --init --service cinder --password <replaceable>CINDER_DBPASS</replaceable></userinput></screen>
</step>
<step os="ubuntu">
<para>Use the password that you set to log in as root to create
a <literal>cinder</literal> database.</para>
<screen><prompt>#</prompt> <userinput>mysql -u root -p</userinput>
<prompt>mysql></prompt> <userinput>CREATE DATABASE cinder;</userinput>
<prompt>mysql></prompt> <userinput>GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' \
IDENTIFIED BY '<replaceable>CINDER_DBPASS</replaceable>';</userinput>
<prompt>mysql></prompt> <userinput>GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' \
IDENTIFIED BY '<replaceable>CINDER_DBPASS</replaceable>';</userinput></screen>
</step>
<step os="ubuntu">
<para>Create the database tables for the Block Storage
Service.</para>
<screen><prompt>#</prompt> <userinput>cinder-manage db sync</userinput></screen>
</step>
<step os="rhel;centos;fedora;opensuse;sles;ubuntu">
<para>Create a <literal>cinder</literal> user. The Block Storage
Service uses this user to authenticate with the Identity
Service. Use the <literal>service</literal> tenant and give
the user the <literal>admin</literal> role.</para>
<screen><prompt>#</prompt> <userinput>keystone user-create --name=cinder --pass=<replaceable>CINDER_PASS</replaceable> --email=<replaceable>cinder@example.com</replaceable></userinput>
<prompt>#</prompt> <userinput>keystone user-role-add --user=cinder --tenant=service --role=admin</userinput></screen>
</step>
<step os="rhel;centos;fedora;opensuse;sles;ubuntu">
<para>Add the credentials to the file
<filename>/etc/cinder/api-paste.ini</filename>. Open the
file in a text editor and locate the section
<literal>[filter:authtoken]</literal>. Set the following
options:</para>
<programlisting language="ini">[filter:authtoken]
paste.filter_factory=keystoneclient.middleware.auth_token:filter_factory
auth_host=<replaceable>controller</replaceable>
auth_port = 35357
auth_protocol = http
auth_uri = http://<replaceable>controller</replaceable>:5000
admin_tenant_name=service
admin_user=cinder
admin_password=<replaceable>CINDER_PASS</replaceable>
</programlisting>
</step>
<step os="ubuntu">
<para>Configure Block Storage to use the RabbitMQ message
broker by setting these configuration keys in the
<literal>[DEFAULT]</literal> configuration group of the
<filename>/etc/cinder/cinder.conf</filename> file. Replace
<replaceable>RABBIT_PASS</replaceable> with the password you
chose for RabbitMQ.</para>
<programlisting language="ini">[DEFAULT]
...
rpc_backend = cinder.openstack.common.rpc.impl_kombu
rabbit_host = <replaceable>controller</replaceable>
rabbit_port = 5672
rabbit_userid = guest
rabbit_password = <replaceable>RABBIT_PASS</replaceable></programlisting>
</step>
<step os="rhel;centos;fedora">
<para>Configure Block Storage to use the Qpid message broker.</para>
<screen><prompt>#</prompt> <userinput>openstack-config --set /etc/cinder/cinder.conf \
DEFAULT rpc_backend cinder.openstack.common.rpc.impl_qpid</userinput>
<prompt>#</prompt> <userinput>openstack-config --set /etc/cinder/cinder.conf \
DEFAULT qpid_hostname controller</userinput></screen>
</step>
<step os="sles;opensuse">
<para>Configure Block Storage to use the RabbitMQ message broker.
Replace <replaceable>RABBIT_PASS</replaceable> with the password
you chose for RabbitMQ.</para>
<screen><prompt>#</prompt> <userinput>openstack-config --set /etc/cinder/cinder.conf \
DEFAULT rpc_backend cinder.openstack.common.rpc.impl_kombu</userinput>
<prompt>#</prompt> <userinput>openstack-config --set /etc/cinder/cinder.conf \
DEFAULT rabbit_host controller</userinput>
<prompt>#</prompt> <userinput>openstack-config --set /etc/cinder/cinder.conf \
DEFAULT rabbit_port 5672</userinput>
<prompt>#</prompt> <userinput>openstack-config --set /etc/cinder/cinder.conf \
DEFAULT rabbit_password <replaceable>RABBIT_PASS</replaceable></userinput></screen>
</step>
<step os="rhel;centos;fedora;opensuse;sles;ubuntu">
<para>Register the Block Storage Service with the Identity
Service so that other OpenStack services can locate it.
Register the service and specify the endpoint using the
<command>keystone</command> command.</para>
<screen><prompt>#</prompt> <userinput>keystone service-create --name=cinder --type=volume \
--description="Cinder Volume Service"</userinput></screen>
<para>Note the <literal>id</literal> property returned and use
it to create the endpoint.</para>
<screen><prompt>#</prompt> <userinput>keystone endpoint-create \
--service-id=<replaceable>the_service_id_above</replaceable> \
--publicurl=http://<replaceable>controller</replaceable>:8776/v1/%\(tenant_id\)s \
--internalurl=http://<replaceable>controller</replaceable>:8776/v1/%\(tenant_id\)s \
--adminurl=http://<replaceable>controller</replaceable>:8776/v1/%\(tenant_id\)s</userinput></screen>
</step>
<step os="rhel;centos;fedora;opensuse;sles;ubuntu">
<para>Also register a service and endpoint for version 2 of the
Block Storage Service API.</para>
<screen><prompt>#</prompt> <userinput>keystone service-create --name=cinderv2 --type=volumev2 \
--description="Cinder Volume Service V2"</userinput></screen>
<para>Note the <literal>id</literal> property returned and use
it to create the endpoint.</para>
<screen><prompt>#</prompt> <userinput>keystone endpoint-create \
--service-id=<replaceable>the_service_id_above</replaceable> \
--publicurl=http://<replaceable>controller</replaceable>:8776/v2/%\(tenant_id\)s \
--internalurl=http://<replaceable>controller</replaceable>:8776/v2/%\(tenant_id\)s \
--adminurl=http://<replaceable>controller</replaceable>:8776/v2/%\(tenant_id\)s</userinput></screen>
</step>
<step os="ubuntu">
<para>Restart the cinder service with its new settings:</para>
<screen><prompt>#</prompt> <userinput>service cinder-scheduler restart</userinput>
<prompt>#</prompt> <userinput>service cinder-api restart</userinput></screen>
</step>
<step os="rhel;fedora;centos;opensuse;sles">
<para>Start the cinder services and configure them to start when
the system boots.</para>
<screen os="rhel;fedora;centos;opensuse;sles"><prompt>#</prompt> <userinput>service openstack-cinder-api start</userinput>
<prompt>#</prompt> <userinput>service openstack-cinder-scheduler start</userinput>
<prompt>#</prompt> <userinput>chkconfig openstack-cinder-api on</userinput>
<prompt>#</prompt> <userinput>chkconfig openstack-cinder-scheduler on</userinput></screen>
</step>
<step os="ubuntu">
<para>By default, the Ubuntu packages create an SQLite database.</para>
<para>Because this configuration uses a SQL database server, remove
the SQLite database file:</para>
<screen><prompt>#</prompt> <userinput>rm -f /var/lib/cinder/cinder.sqlite</userinput></screen>
</step>
</procedure>
</section>