Stratus Guides - Configuring RabbitMQ

The RabbitMQ management plugins are enabled in Webscale STRATUS, and can be accessed using the correction configurations. When possible, Webscale recommends using RabbitMQ as the broker instead of MySQL.

Consumers

To see a list of available consumers that you can set to run, use:

php bin/magento queue:consumers:list

Please note the following:

Below is an example configuration of the env.php file.

'cron_consumers_runner' => [
        'cron_run' => true,
        'max_messages' => 0,
        'consumers' => [
            'async.operations.all',
            'codegeneratorProcessor',
            'product_action_attribute.update',
            'product_action_attribute.website.update',
            'exportProcessor'
        ]
    ],
    'queue' => [
        'amqp' => [
            'host' => 'rabbitmq',
            'port' => '5672',
            'user' => 'username',
            'password' => 'yb2sovjbaa4atsbbn0s0ccm9uddekh6i',
            'virtualhost' => '/',
            'ssl' => 'false',
            'ssl_options' => []
        ]
    ],

A simple one-line command to add RabbitMQ queue to env.php file is:

php bin/magento -q -n setup:config:set --amqp-host="rabbitmq" --amqp-port="5672" --amqp-user="username" --amqp-password="8b2sovjbgg4atsbpn0ilovemagemojo" --amqp-virtualhost="/"

RabbitMQ

The RabbitMQ message broker service can be enabled in your Webscale STRATUS panel in the RabbitMQ > Info panel.

The credentials shown in the RabbitMQ > Configuration panel may be changed, but must match the ones configured in env.php.

These are only used on the initial deploy of RabbitMQ. If these credentials are changed after starting RabbitMQ, it will not affect the existing user.

RabbitMQ Configuration

Default Broker

When possible, MageMojo recommends using RabbitMQ as the broker instead of MySQL. Please read over RabbitMQ vs MySQL.

RabbitMQ Advanced Usage

RabbitMQ ships with command line and other management utilities. Depending on the exact usage of RabbitMQ, these tools may be used to debug and investigate certain issues with a Magento install. To call RabbitMQ procedures from the command line use the rabbitmqadmin utility.

For example, to list the existing users:

$ rabbitmqadmin --host rabbitmq -u kermit -p wakkawakka1234 list users
+--------+--------------------------------+--------------------------------------------------+---------------+
|  name  |       hashing_algorithm        |                  password_hash                   |     tags      |
+--------+--------------------------------+--------------------------------------------------+---------------+
| kermit | rabbit_password_hashing_sha256 | 7YJGqcUKDcnvFkxwMOq+4OLCZw8RrYZL5sOGTAz2vXdXkLBF | administrator |
+--------+--------------------------------+--------------------------------------------------+---------------+

The official RabbitMQ documentation has various examples of how to use the rabbitmqadmin admin tool. On Webscale STRATUS, use the correct host and user in all your commands. As with the env.php configuration, the host will always be rabbitmq or 0.0.0.0.

Web Interface.

The RabbitMQ management plugins are enabled in Mojo STRATUS, and can be accessed using the correction configurations.

The Web UI is always running, but can only be accessed one of two ways:

  1. Use an SSH tunnel to expose the web interface on a local port
  2. Set up a proxy pass directive in the STRATUS Nginx configuration

SSH Tunnel

An SSH tunnel is the most secure way to access the RabbitMQ UI.

  1. To access the RabbitMQ UI, make sure an SSH user is configured for the Webscale STRATUS environment.

  2. Via terminal, run the following command with the correct user/host/port information to open a tunnel:

     ssh -p <port> <user>@<ssh-endpoint>.mojostratus.io -L 15672:rabbitmq:15672
    

    Change rabbitmq to 0.0.0.0, if you are using autoscaling.

  3. With the tunnel connected, open a local browser to http://localhost:15672/.

    RabbitMQ Login Panel

  4. Enter the username/password configured for RabbitMQ in your initial start-up (under RabbitMQ -> Configuration)

Read the official docs for more details on how to use and interpret the UI..

Nginx Proxy Pass

Although not recommended, an Nginx Proxy Pass may be used for quick access. It is also recommend that the location be secured by IP whitelist if the intention is to leave the UI permanently exposed.

  1. Go to Nginx > Includes in the Webscale STRATUS panel.

  2. Add a new location directive similar to this:

     location /yourrabbitadmin/ {
         proxy_pass http://127.0.0.1:15672/;
     }
    
  3. Click Update to save the changes.

The RabbitMQ UI can now be accessed at https://mysite.com/yourrabbitadmin.

Resetting Data

In the RabbitMQ > Info panel the data can be reset if needed to wipe the service clean of all data.

RabbitMQ data is persistent, similar to MySQL. Persistent data is important since some stores may use RabbitMQ to store important data like order data until it is later saved within the Magento MySQL data.


Last modified January 1, 0001