RabbitMQ How to Start Server
If you are reading this there is a good chance that you are either testing out RabbitMQ for the first time or you are responsible for troubleshooting it and just aren’t familiar with everyday basic operations. Whatever the case may be you are probably wondering how to start the RabbitMQ server.
To start the RabbitMQ server, try running one of these two commands:
sudo service rabbitmq-server start
rabbitmq-server -detached
Depending on your environment and if the software has been installed, there is a good chance that one of those two commands will start the server.
If your RabbitMQ instance has been installed from a package you should be able to use the following service commands to start and stop RabbitMQ.
sudo service rabbitmq-server start
sudo service rabbitmq-server stop
sudo service rabbitmq-server status
If you unpacked and installed RabbitMQ manually, without a package, you can use these commands to start, stop, and check status:
rabbitmq-server # run server in the foreground
rabbitmq-server -detached # run server detached in the background
rabbitmqctl shutdown # shutdown the server
rabbitmqctl stop # also shutdown the server
rabbitmqctl status # show status
They will depend on having your path setup.
If you are using systemd you can create a unit file like this so that RabbitMQ can be treated as a systemd service. You probably won’t need to do this if it was installed using a package. You also might need to adjust this file a bit.
/etc/systemd/system/rabbitmq.service
[Unit]
Description=RabbitMQ
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=always
RestartSec=1
User=user1
Environment=PATH=$PATH:/usr/bin
Environment=PATH=$PATH:/home/user1/erlang/lib64/erlang/erts-11.1.3/bin/
Environment=RABBITMQ_HOME=/home/user1/rabbitmq_server-3.8.9
ExecStart=/home/user1/rabbitmq_server-3.8.9/sbin/rabbitmq-server -detached
[Install]
WantedBy=multi-user.target