Setup RabbitMQ on MacOS X
After installing RabbitMQ, you may need to perform the following steps to connect Magento and RabbitMQ.
Create Credentials and Configuration
- To resolve any problems that may have occurred with RabbitMQ, or if not already done, to re-establish the connection, start by:
-
-
Creating the RabbitMQ user
-
Creating the virtual host
-
Setting the permissions
-
Step 1: Creating RabbitMQ user and virtual host
- The following commands, we create a user with the username admin and the password admin:
rabbitmqctl add_user admin admin (1)
rabbitmqctl add_vhost pacemaker (2)
rabbitmqctl set_permissions -p pacemaker admin "." "." ".*" (3)
1 | Create a user with the username admin |
2 | Create a user with the password admin |
3 | Create a virtual host for RabbitMQ with the name pacemaker |
Step 2: Adding the queue node to the Magento configuration
Then add the queue node to the Magento configuration under app/etc/env.php
- With the just created
username
/password
andvirtual host
values from step 1, it should look like this:
<?php
return [
'queue' => [
'amqp' => [
'host' => 'localhost',
'port' => '5672',
'user' => 'admin',
'password' => 'admin',
'virtualhost' => 'pacemaker',
'ssl' => 'false'
]
],
];
Step 3: Finalizing the Magento setup
- Now complete the Magento setup with the following command:
bin/magento setup:upgrade
- 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
- For local development and debugging, the following console command can get used to viewing the running processes (status of the running pipelines) on the CLI console:
bin/magento pipeline:status -w 2
Issues with missing AMQP configuration
If the RabbitMQ connection was not set up when Magento got installed, you would get one of two errors when you try to start the Pacemaker runner.
Error 1
Unknown connection name amqp
-
Signals that the Magento configuration under
app/etc/env.php
for the AMQP connection is missing.
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>
Error 2
ACCESS_REFUSED - Login was refused using the authentication mechanism AMQPLAIN.
-
Handles a problem 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 the authentication mechanism AMQPLAIN.
For further details, please check 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>