Manual RabbitMQ Setup for Red Hat Enterprise Linux OpenStack Platform
1. Overview
-
Block Storage
-
Compute
-
OpenStack Networking
-
Orchestration
-
Image Service
-
Telemetry
1.1. Migration Prerequisites
#openstack-service stop#service qpidd stop
#chkconfig qpidd off
2. Configure the Firewall for Message Broker Traffic
5672.
root user.
Procedure 1. Configuring the firewall for message broker traffic
-
Open the
/etc/sysconfig/iptablesfile in a text editor. -
Add an
INPUTrule allowing incoming connections on port5672to the file. The new rule must appear before anyINPUTrules thatREJECTtraffic.-A INPUT -p tcp -m tcp --dport 5672 -j ACCEPT
-
Save the changes to the
/etc/sysconfig/iptablesfile. -
Restart the
iptablesservice for the firewall changes to take effect.#service iptables restart
5672.
3. Install and Configure the RabbitMQ Message Broker
#yum install rabbitmq-server
Important
guest user with a default guest password will automatically be created for the RabbitMQ service. Red Hat strongly advises that you change this default password, especially if you have IPv6 available. With IPv6, RabbitMQ may be accessible from outside the network.
guest password after launching the rabbitmq-server server. See Section 4, “Launch the RabbitMQ Message Broker” for details.
3.1. Manually Create RabbitMQ Configuration Files
- /etc/rabbitmq/rabbitmq.config
-
% This file managed by Puppet % Template Path: rabbitmq/templates/rabbitmq.config [ {rabbit, [ {default_user, <<"guest">>}, {default_pass, <<"guest">>} ]}, {kernel, [ ]} ]. % EOF - /etc/rabbitmq/rabbitmq-env.conf
-
RABBITMQ_NODE_PORT=5672
4. Launch the RabbitMQ Message Broker
rabbitmq-server service and configure it to launch on boot:
service and chkconfig commands to start and enable the rabbitmq-server service
#service rabbitmq-server start#chkconfig rabbitmq-server on
Important
guest user with a default guest password will automatically be created for the RabbitMQ service. Red Hat strongly advises that you change this default password, especially if you have IPv6 available. With IPv6, RabbitMQ may be accessible from outside the network.
#rabbitmqctl change_password guest NEW_RABBITMQ_PASS
guest user, perform the following procedure:
Procedure 2. Configuring the RabbitMQ message broker for OpenStack use
-
Create a RabbitMQ user account for the Block Storage, Compute, OpenStack Networking, Orchestration, Image, and Telemetry services:
#rabbitmqctl add_user cinder CINDER_PASS#rabbitmqctl add_user nova NOVA_PASS#rabbitmqctl add_user neutron NEUTRON_PASS#rabbitmqctl add_user heat HEAT_PASS#rabbitmqctl add_user glance GLANCE_PASS#rabbitmqctl add_user ceilometer CEILOMETER_PASSReplace CINDER_PASS, NOVA_PASS, NEUTRON_PASS, HEAT_PASS, GLANCE_PASS, and CEILOMETER_PASS with secure passwords for each service. -
Next, grant each of these RabbitMQ users read/write permissions to all resources:
#rabbitmqctl set_permissions cinder ".*" ".*" ".*"#rabbitmqctl set_permissions nova ".*" ".*" ".*"#rabbitmqctl set_permissions neutron ".*" ".*" ".*"#rabbitmqctl set_permissions heat ".*" ".*" ".*"#rabbitmqctl set_permissions glance ".*" ".*" ".*"#rabbitmqctl set_permissions ceilometer ".*" ".*" ".*" -
The OpenStack services require a restart to apply the new permissions. This step is performed later in Section 12, “Finalize Migration to RabbitMQ”. Once the OpenStack services have been restarted, you can verify that the permissions were correctly applied using the
list_permissionssubcommand on the Messaging server:#rabbitmqctl list_permissionsListing permissions in vhost "/" ... ceilometer .* .* .* cinder .* .* .* glance .* .* .* guest .* .* .* heat .* .* .* neutron .* .* .* nova .* .* .*
5. Configure RabbitMQ Message Broker Settings for the Block Storage Service
-
Log in as
rootto the system hosting the Block Storage services. -
In
/etc/cinder/cinder.conf, set RabbitMQ as the RPC back end.#openstack-config --set /etc/cinder/cinder.conf \DEFAULT rpc_backend cinder.openstack.common.rpc.impl_kombu -
Set the Block Storage service to connect to the RabbitMQ host:
#openstack-config --set /etc/cinder/cinder.conf \DEFAULT rabbit_host RABBITMQ_HOSTReplace RABBITMQ_HOST with the IP address or host name of the message broker. -
Set the message broker port to
5672:#openstack-config --set /etc/cinder/cinder.conf \DEFAULT rabbit_port 5672 -
Set the RabbitMQ username and password created for the Block Storage service:
#openstack-config --set /etc/cinder/cinder.conf \DEFAULT rabbit_userid cinder#openstack-config --set /etc/cinder/cinder.conf \DEFAULT rabbit_password CINDER_PASSWherecinderand CINDER_PASS are the RabbitMQ username and password created for Block Storage (in Section 3, “Install and Configure the RabbitMQ Message Broker”). -
In Section 4, “Launch the RabbitMQ Message Broker”, we gave the
cinderuser read/write permissions to all resources -- specifically, through the virtual host/. Configure the Block Storage service to connect to this virtual host:#openstack-config --set /etc/cinder/cinder.conf \DEFAULT rabbit_virtual_host /
6. Configure RabbitMQ Message Broker Settings for the OpenStack Networking Service
-
In
/etc/neutron/neutron.conf, set RabbitMQ as the RPC back end.#openstack-config --set /etc/neutron/neutron.conf \DEFAULT rpc_backend neutron.openstack.common.rpc.impl_kombu -
Set the
neutron-serverservice to connect to the RabbitMQ host:#openstack-config --set /etc/neutron/neutron.conf \DEFAULT rabbit_host RABBITMQ_HOSTReplace RABBITMQ_HOST with the IP address or host name of the message broker. -
Set the message broker port to
5672:#openstack-config --set /etc/neutron/neutron.conf \DEFAULT rabbit_port 5672 -
Set the RabbitMQ username and password created for the OpenStack Networking service:
#openstack-config --set /etc/neutron/neutron.conf \DEFAULT rabbit_userid neutron#openstack-config --set /etc/neutron/neutron.conf \DEFAULT rabbit_password NEUTRON_PASSWhereneutronand NEUTRON_PASS are the RabbitMQ username and password created for OpenStack Networking (in Section 3, “Install and Configure the RabbitMQ Message Broker”). -
In Section 4, “Launch the RabbitMQ Message Broker”, we gave the
neutronuser read/write permissions to all resources -- specifically, through the virtual host/. Configure the Networking service to connect to this virtual host:#openstack-config --set /etc/neutron/neutron.conf \DEFAULT rabbit_virtual_host /
7. Configure RabbitMQ Message Broker Settings for the Compute Service
root on the Compute controller, and all Compute nodes.
-
In
/etc/nova/nova.confof that system, set RabbitMQ as the RPC back end.#openstack-config --set /etc/nova/nova.conf \DEFAULT rpc_backend rabbit -
Set the Compute service to connect to the RabbitMQ host:
#openstack-config --set /etc/nova/nova.conf \DEFAULT rabbit_host RABBITMQ_HOSTReplace RABBITMQ_HOST with the IP address or host name of the message broker. -
Set the message broker port to
5672:#openstack-config --set /etc/nova/nova.conf \DEFAULT rabbit_port 5672 -
Set the RabbitMQ username and password created for the Compute service:
#openstack-config --set /etc/nova/nova.conf \DEFAULT rabbit_userid nova#openstack-config --set /etc/nova/nova.conf \DEFAULT rabbit_password NOVA_PASSWherenovaand NOVA_PASS are the RabbitMQ username and password created for Compute (in Section 3, “Install and Configure the RabbitMQ Message Broker”). -
In Section 4, “Launch the RabbitMQ Message Broker”, we gave the
novauser read/write permissions to all resources -- specifically, through the virtual host/. Configure the Compute service to connect to this virtual host:#openstack-config --set /etc/nova/nova.conf \DEFAULT rabbit_virtual_host /
8. Configure RabbitMQ Message Broker Settings for the Orchestration Service
-
Log in as
rootto the Orchestration controller node. -
In
/etc/heat/heat.confof that system, set RabbitMQ as the RPC back end.#openstack-config --set /etc/heat/heat.conf \DEFAULT rpc_backend heat.openstack.common.rpc.impl_kombu -
Set the Orchestration service to connect to the RabbitMQ host:
#openstack-config --set /etc/heat/heat.conf \DEFAULT rabbit_host RABBITMQ_HOSTReplace RABBITMQ_HOST with the IP address or host name of the message broker. -
Set the message broker port to
5672:#openstack-config --set /etc/heat/heat.conf \DEFAULT rabbit_port 5672 -
Set the RabbitMQ username and password created for the Orchestration service:
#openstack-config --set /etc/heat/heat.conf \DEFAULT rabbit_userid heat#openstack-config --set /etc/heat/heat.conf \DEFAULT rabbit_password HEAT_PASSWhereheatand HEAT_PASS are the RabbitMQ username and password created for Orchestration (in Section 3, “Install and Configure the RabbitMQ Message Broker”). -
In Section 4, “Launch the RabbitMQ Message Broker”, we gave the
heatuser read/write permissions to all resources -- specifically, through the virtual host/. Configure the Orchestration service to connect to this virtual host:#openstack-config --set /etc/heat/heat.conf \DEFAULT rabbit_virtual_host /
9. Configure RabbitMQ Message Broker Settings for the Image Service
-
Log in as
rootto the Image Service node. -
In
glance-api.confof that system, set RabbitMQ as the notifier:#openstack-config --set /etc/glance/glance-api.conf \DEFAULT notification_driver messaging -
Set the name of the RabbitMQ host. Replace
rabbitmq-hostnamewith the name of the RabbitMQ host:#openstack-config --set /etc/glance/glance-api.conf \DEFAULT rabbit_host RABBITMQ_HOSTReplace RABBITMQ_HOST with the IP address or host name of the message broker. -
Set the message broker port to
5672:#openstack-config --set /etc/glance/glance-api.conf \DEFAULT rabbit_port 5672 -
Set the RabbitMQ username and password created for the Image Service:
#openstack-config --set /etc/glance/glance-api.conf \DEFAULT rabbit_userid glance#openstack-config --set /etc/glance/glance-api.conf \DEFAULT rabbit_password GLANCE_PASSWhereglanceand GLANCE_PASS are the RabbitMQ username and password created for the Image Service (in Section 3, “Install and Configure the RabbitMQ Message Broker”). -
In Section 4, “Launch the RabbitMQ Message Broker”, we gave the
glanceuser read/write permissions to all resources -- specifically, through the virtual host/. Configure the Image Service to connect to this virtual host:#openstack-config --set /etc/glance/glance-api.conf \DEFAULT rabbit_virtual_host /
10. Configure RabbitMQ Message Broker Settings for the Telemetry Service
-
Log in as
rootto the Telemetry service node. -
In
/etc/ceilometer/ceilometer.confof that system, set RabbitMQ as the RPC back end.#openstack-config --set /etc/ceilometer/ceilometer.conf \DEFAULT rpc_backend ceilometer.openstack.common.rpc.impl_kombu -
Set the Telemetry service to connect to the RabbitMQ host:
#openstack-config --set /etc/ceilometer/ceilometer.conf \DEFAULT rabbit_host RABBITMQ_HOSTReplace RABBITMQ_HOST with the IP address or host name of the message broker. -
Set the message broker port to
5672:#openstack-config --set /etc/ceilometer/ceilometer.conf \DEFAULT rabbit_port 5672 -
Set the RabbitMQ username and password created for the Telemetry service:
#openstack-config --set /etc/ceilometer/ceilometer.conf \DEFAULT rabbit_userid ceilometer#openstack-config --set /etc/ceilometer/ceilometer.conf \DEFAULT rabbit_password CEILOMETER_PASSWhereceilometerand CEILOMETER_PASS are the RabbitMQ username and password created for Telemetry (in Section 3, “Install and Configure the RabbitMQ Message Broker”). -
In Section 4, “Launch the RabbitMQ Message Broker”, we gave the
ceilometeruser read/write permissions to all resources -- specifically, through the virtual host/. Configure the Telemetry service to connect to this virtual host:#openstack-config --set /etc/ceilometer/ceilometer.conf \DEFAULT rabbit_virtual_host /
11. Enable SSL on the RabbitMQ Message Broker
/etc/rabbitmq/rabbitmq.config configuration file. Before doing so, you will first need to create the certificates required for SSL communication.
Note
certutil.
Procedure 3. Creating and adding the certificates required for SSL communication
-
Create a directory in which to store the required certificates:
#mkdir /etc/pki/rabbitmq -
Choose a secure certificate password and store it in a file within
/etc/pki/rabbitmq:#echo SSL_RABBITMQ_PW > /etc/pki/rabbitmq/certpwReplace SSL_RABBITMQ_PW with the certificate password you wish to use. This password will be used later for further securing the necessary certificates.. -
Set the necessary file mode bits of the certificate directory and password file:
#chmod 700 /etc/pki/rabbitmq#chmod 600 /etc/pki/rabbitmq/certpw -
Create the certificate database files (
*.db) in/etc/pki/rabbitmq, using the password in/etc/pki/rabbitmq/certpw:#certutil -N -d /etc/pki/rabbitmq -f /etc/pki/rabbitmq/certpw -
For a production environment, it is recommended that you use a reputable third-party Certificate Authority (CA) to sign your certificates. A third-party CA will require a Certificate Signing Request (CSR), which you can create by running:
#certutil -R -d /etc/pki/rabbitmq -s "CN=RABBITMQ_HOST" \-a -f /etc/pki/rabbitmq/certpw > RABBITMQ_HOST.csrReplace RABBITMQ_HOST with the IP or hostname of the system hosting the RabbitMQ message broker. This command will produce a CSR namedRABBITMQ_HOST.csrand a key file (keyfile.key). The key file will be used later when configuring the RabbitMQ message broker to use SSL.Note
Some CAs may require additional values other than"CN=RABBITMQ_HOST". -
Provide
RABBITMQ_HOST.csrto your third-party CA for signing. Your CA should provide you with a signed certificate (server.crt) and a CA file (ca.crt). Add these files to your certificate database:#certutil -A -d /etc/pki/rabbitmq -n RABBITMQ_HOST -f /etc/pki/rabbitmq/certpw \-t u,u,u -a -i /path/to/server.crt#certutil -A -d /etc/pki/rabbitmq -n "Your CA certificate" \-f /etc/pki/rabbitmq/certpw -t CT,C,C -a -i /path/to/ca.crt
#certutil -S -d /etc/pki/rabbitmq -n RABBITMQ_HOST -s "CN=RABBITMQ_HOST" \-t "CT,," -x -f /etc/pki/rabbitmq/certpw -z /usr/bin/certutil
/etc/rabbitmq/rabbitmq.config configuration file:
[
{rabbit, [
{ssl_listeners, [5671]},
{ssl_options, [{cacertfile,"/path/to/ca.crt"},
{certfile,"/path/to/server.crt"},
{keyfile,"/path/to/keyfile.key"},
{verify,verify_peer},
{fail_if_no_peer_cert,false}]}
]}
].Note
{cacertfile,"/path/to/ca.crt"},
11.1. Export an SSL Certificate for Clients
#pk12util -o <p12exportfile> -n <certname> -d <certdir> -w <p12filepwfile>#openssl pkcs12 -in <p12exportfile> -out <clcertname> -nodes -clcerts -passin pass:<p12pw>
man openssl.
11.2. Enable SSL Communication Between Message Broker and Each Service
#openstack-config --set CONFIGFILE DEFAULT rabbit_use_ssl True#openstack-config --set CONFIGFILE DEFAULT kombu_ssl_certfile /path/to/client.crt#openstack-config --set CONFIGFILE DEFAULT kombu_ssl_keyfile /path/to/clientkeyfile.key
-
CONFIGFILE is the corresponding configuration file of each service, namely:
-
Block Storage:
/etc/cinder/cinder.conf -
Networking:
/etc/neutron/neutron.conf -
Compute:
/etc/nova/nova.conf -
Orchestration:
/etc/heat/heat.conf -
Image:
/etc/glance/glance-api.conf -
Telemetry:
/etc/ceilometer/ceilometer.conf
-
-
/path/to/client.crt is the absolute path to the exported client certificate.
-
/path/to/clientkeyfile.key is the absolute path to the exported client key file.
#openstack-config --set /etc/neutron/neutron.conf CONFIGFILE DEFAULT kombu_ssl_ca_certs /path/to/ca.crt
12. Finalize Migration to RabbitMQ
#openstack-service start
