Setup RabbitMQ on MacOS X
This documentation is not for the latest version Pacemaker version. Click here to switch to version 1.2 |
Assuming you have installed RabbitMQ with brew, you may have to execute the following steps to connect Magento and RabbitMQ.
Create Credentials & Configuration
To fix these issues or to create the connection if not already done, start by creating the RabbitMQ user and virtual host as well as setting the permissions with
rabbitmqctl add_user admin admin
rabbitmqctl add_vhost pacemaker
rabbitmqctl set_permissions -p pacemaker admin "." "." ".*"
In the commands above, we create a user with the username admin
and the password admin
.
Additionally a virtual host for RabbitMQ with name pacemaker
has been created.
Then add the queue
node to the Magento configuration under app/etc/env.php
. With the
username/password and virtual host values from above, this has to look like
return [
'queue' => [
'amqp' => [
'host' => 'localhost',
'port' => '5672',
'user' => 'admin',
'password' => 'admin',
'virtualhost' => 'pacemaker',
'ssl' => 'false'
]
],
];
After that, finalize the Magento setup with the following command
bin/magento setup:upgrade
When this command has been executed successfully, the queues within RabbitMQ has been created and the connection has been established. Finally, to start the runner, enter the following command
bin/magento queue:consumers:start pipelineRunner
Additionally in the RabbitMQ GUI the queues should now be visible like
CLI Status Update
To get a brief overview of the running processes (helpful for local development and debugging), it is possible to execute a console command that renders the status of the running pipelins on the console
bin/magento pipeline:status -w 2
This should render the following output
Issues with missing AMQP configuration
If you did not set-up the RabbitMQ connection when installing Magento, you’ll probably receive one of the two errors below when you try to start the Pacemaker runner.
The message Unknown connection name amqp
signals that the Magento configuration under
app/etc/env.php
is missing the AMQP connection
$ bin/magento queue:consumers:start pipelineRunner
In ConnectionTypeResolver.php line 43:
Unknown connection name amqp
queue:consumers:start [--max-messages MAX-MESSAGES] [--batch-size BATCH-SIZE] [--area-code AREA-CODE]
[--pid-file-path PID-FILE-PATH] [--] <consumer>
whereas the message ACCESS_REFUSED - Login was refused using authentication mechanism AMQPLAIN.
For details see the broker logfile.
addresses an issue with the configured username/password
in the configuration.
$ bin/magento queue:consumers:start pipelineRunner
In AbstractConnection.php line 689:
ACCESS_REFUSED - Login was refused using authentication mechanism AMQPLAIN. For details see the broker logfile.
queue:consumers:start [--max-messages MAX-MESSAGES] [--batch-size BATCH-SIZE] [--area-code AREA-CODE]
[--pid-file-path PID-FILE-PATH] [--] <consumer>