[go: nahoru, domu]

Skip to content

VerneMQ

Julius Heine edited this page Aug 9, 2018 · 4 revisions

VerneMQ Install and Configuration

I have created a script to install vernemq on a raspberrypi The script also installs some important packages including erlang which is used by vernemq.

Just run the following command in your raspberrypi home folder:

time sh -c "$(curl -sSL https://raw.githubusercontent.com/suiluj/pi-adhoc-mqtt-cluster/master/install_scripts/vernemqinstall.txt)"

This procedure takes a lot of time. Because of the time at the beginning of the command you get the execution time after it has finished.

On a RaspberryPi Zero W it took 98m38.243s (about 1.5 hours).

The RaspberryPi 3 B+ took XX minutes (a lot faster than the raspberrypi zero).

This also depends on your internet connection speed. But most of the time takes the compiling of erlang.

Ulimit Warning

Vernemq ulimit tutorial

sudo nano /etc/security/limits.conf

Add the following lines:

*               soft     nofile          65536
*               hard     nofile          65536

Export path for global command

echo "export PATH=$PATH:/home/pi/vernemq/_build/rpi32/rel/vernemq/bin" >> ~/.bashrc

You have to exit and ssh login again to let it take effect.

Testing

Vernemq start tutorial

vernemq start - start broker

vernemq stop - stop broker

vernemq console - start broker in console mode

q(). - close console

vernemq ping - echos pong when broker is running

Autostart with systemd

Create a systemd service to autstart and restart vernemq:

sudo nano /etc/systemd/system/vernemq.service

[Unit]
Description=Runner for VerneMQ
After=network.target

[Service]
WorkingDirectory=/home/pi/vernemq/_build/rpi32/rel/vernemq/bin/
ExecStart=/home/pi/vernemq/_build/rpi32/rel/vernemq/bin/vernemq start
ExecStop=/home/pi/vernemq/_build/rpi32/rel/vernemq/bin/vernemq stop
User=pi
Type=forking
Restart=always
TimeoutSec=240
RestartSec=30
LimitNOFILE=300000

[Install]
WantedBy=multi-user.target

Afterwards run the following commands:

sudo systemctl daemon-reload
sudo systemctl enable vernemq.service
sudo systemctl start vernemq.service

Starting the vernemq broker takes a little time (especially on a pi zero) but there should be no errors.
You can check the status with sudo systemctl status vernemq
or with vernemq ping

Further configuration tutorial in the making ;)

Sources