Home > Azure, RabbitMQ, Ubuntu > Autostart of RabbitMQ service in Ubuntu

Autostart of RabbitMQ service in Ubuntu

2016/08/21

I have configured a high availability cluster of RabbitMQ instances, on Azure with 2 Ubuntu LTS 16.04 servers.
With an automation runbook these 2 servers are configured for the shutdown at night, and start on morning.
I was believing that the RabbitMQ service was starting by default as in Windows: but the servers was started, RabbitMQ no.
I was working with Unix systems many years ago, so i’m not so expert and could be that there is a better approach, but i found an working solution.
Typically an Unix user at the login runs the commands listed in the $HOME/.profile file, but this works just only when the user makes an login: in practice .profile act as the auto starting profile commands of today Windows server.
In order to automatically start something at the boot as an Windows service (or the autoexec.bat of the long gone ’80s MSDOS days) the file to change is /etc/rc.sysinit
The user configured while creating the Ubuntu machine is not a super user, so using the good old vi for rc.sysinit editing the command line is

sudo service rabbitmq-server start


in a cluster this must be done on the main cluster node, if you then connect via putty to other nodes you will find the file already changed.
(esc wq! … how many times i launched this sequence in ’80s..)
Rebooting all the vm RabbitMQ is immediately working.

Advertisements
Categories: Azure, RabbitMQ, Ubuntu
%d bloggers like this: