Magento Commerce only

RabbitMQ

You must install and configure RabbitMQ after installing Magento Open Source or before installing Magento Commerce.

RabbitMQ Overview

RabbitMQ is an open source message broker that offers a reliable, highly available, scalable and portable messaging system.

Message queues provide an asynchronous communications mechanism in which the sender and the receiver of a message do not contact each other. Nor do they need to communicate with the message queue at the same time. When a sender places a messages onto a queue, it is stored until the recipient receives them.

Magento Commerce uses RabbitMQ to manage these message queues. RabbitMQ cannot be used with Magento Open Source installations.

The message queue system must be established before you install Magento. The basic sequence is

  1. Install RabbitMQ and any prerequisites.
  2. Connect RabbitMQ and Magento.

A basic message queue system can be implemented on EE without using cron instead of RabbitMQ. See Configure message queues for more information.

Install RabbitMQ on Ubuntu

To install RabbitMQ on Ubuntu 16 enter the following command:

sudo apt install -y rabbitmq-server

This command also installs the required Erlang packages.

If you have an older version of Ubuntu, RabbitMQ recommends installing the package from their website.

  1. Download rabbitmq-server_3.6.6-1_all.deb.
  2. Install the package with dpkg.

Refer to Installing on Debian/Ubuntu for more information.

Install RabbitMQ on CentOS

Install Erlang

RabbitMQ was written using the Erlang programming language, which must be installed on the same system as RabbitMQ.

See Manual installation for more information.

Run the following commands to install this feature.

  1. wget http://packages.erlang-solutions.com/erlang-solutions-1.0-1.noarch.rpm
  2. rpm -Uvh erlang-solutions-1.0-1.noarch.rpm

Install RabbitMQ

The RabbitMQ server is included on CentOS, but the version is often old. RabbitMQ recommends installing the package from their website.

  1. Download rabbitmq-server-3.5.6-1.noarch.rpm.
  2. Run the following commands as a user with root permissions:

rpm --import https://www.rabbitmq.com/rabbitmq-signing-key-public.asc{:target="_blank"} yum install rabbitmq-server-3.5.6-1.noarch.rpm`

Refer to Installing on RPM-based Linux for more information.

Configure RabbitMQ

Review the official RabbitMQ documentation to configure and manage RabbitMQ. Pay attention to the following items:

  • Environment variables
  • Port access
  • Default user accounts
  • Starting and stopping the broker
  • System limits

Connect RabbitMQ to Magento Commerce

Add the following command line parameters when you install Magento Magento Commerce:

--amqp-host="<hostname>" --amqp-port="5672" --amqp-user="<user_name>" --amqp-password="<password>" --amqp-virtualhost="/"

where:

ParameterDescription
--amqp-host The host name where RabbitMQ is installed.
--amqp-port The port to use to connect to RabbitMQ. The default is 5672.
--amqp-user The user name for connecting to RabbitMQ. Do not use the default user `guest`.
--amqp-password The password for connecting to RabbitMQ. Do not use the default password `guest`.
--amqp-virtualhost

The virtual host for connecting to RabbitMQ. The default is /.

For additional information, see RabbitMQ documentation:

amqp-ssl

Indicates whether to connect to RabbitMQ. The default is false. If you set the value to true, see Configure SSL for more information.

Configure SSL

To configure support for SSL, edit the ssl and ssl_options parameters in the <install_directory>/app/etc/env.php file so that they are similar to the following:

'queue' =>
  array (
    'amqp' =>
    array (
      'host' => 'rabbitmq.example.com',
      'port' => '11213',
      'user' => 'magento',
      'password' => 'magento',
      'virtualhost' => '/',
      'ssl' => true,
      'ssl_options' => [
            'cafile' =>  '/etc/pki/tls/certs/DigiCertCA.crt',
            'certfile' => '/path/to/magento/app/etc/ssl/test-rabbit.crt',
            'keyfile' => '/path/to/magento/app/etc/ssl/test-rabbit.key'
       ],
     ),
  ),

Start the message queue consumers

After you have connected Magento Commerce and RabbitMQ, you must start the message queue consumers. See Configure message queues for details.