Install the RabbitMQ on Ubuntu by using below command.
sudo apt install -y rabbitmq-server
Install Magento with RabbitMQ. And connect to Magento Open Source or Magento Commerce.
--amqp-host="<hostname>" --amqp-port="5672" --amqp-user="<user_name>" --amqp-password="<password>" --amqp-virtualhost="/"
Connect RabbitMQ
If you already had Magento installed and you want to connect it to RabbitMQ, add a queue section in the <install_directory>/app/etc/env.php file
'queue' =>
array (
'amqp' =>
array (
'host' => 'localhost',
'port' => '5672',
'user' => 'example',
'password' => 'example',
'virtualhost' => '/'
),
),
Then, run bin/magento setup:upgrade to apply the changes & create the required queues in RabbitMQ.
To enable RabbitMQ:
Add the required name, type, and disk value (in MB) to the .magento/services.yaml file along with the installed RabbitMQ version.
rabbitmq:
type: rabbitmq:<version>
disk: 1024
Configure the relationships in the .magento.app.yaml file.
relationships:
rabbitmq: "rabbitmq:rabbitmq"
Add, commit, and push your code changes.
git add -A git commit -m "Enable RabbitMQ service" git push origin <branch-name>
Verify the service relationships.
Retrieve the RabbitMQ connection details :
php -r 'print_r(json_decode(base64_decode($_ENV["MAGENTO_CLOUD_RELATIONSHIPS"])));'

