Wednesday, December 18, 2024
ExplainerInternet of ThingsIoT PlatformsIoT Software&ToolsTutorials/DIY

How To Install VerneMQ on UbunTu, RHEL, Docker, Debian and Cent OS

VerneMQ is a high-performance, distributed MQTT message broker. It scales horizontally and vertically on commodity hardware to support a high number of concurrent publishers and consumers while maintaining low latency and fault tolerance. To use it, all you need to do is install the VerneMQ package.

For more information about VerneMQ Read this – VerneMQ – Clustering MQTT for high availability and scalability

Recommended: MQTT Servers/Brokers


How To Install VerneMQ on Ubuntu and Debian


VerneMQ can be installed on Debian or Ubuntu-based systems using the binary package. Download Package

Install VerneMQ

Once you have downloaded the binary package, execute the following command to install VerneMQ:

sudo dpkg -i vernemq_1.7.1-1_amd64.deb

Note : Check Version and modify

Verify your installation

You can verify that VerneMQ is successfully installed by running:

dpkg -s vernemq | grep Status

If VerneMQ has been installed successfully Status: install ok installed is returned.

Activate VerneMQ node

Once you’ve installed VerneMQ, start it on your node:

service vernemq start

Default Directories and Paths

The whereis vernemq command will give you a couple of directories:

whereis vernemq
vernemq: /usr/sbin/vernemq /usr/lib/vernemq /etc/vernemq /usr/share/vernemq
/usr/sbin/vernemq: the vernemq and vmq-admin commands
/usr/lib/vernemq the vernemq package
/etc/vernemq the vernemq.conf file
/usr/share/vernemq the internal vernemq schema files
/var/lib/vernemq the vernemq data dirs for LevelDB (Metadata Store and Message Store)

Installing on CentOS and RHEL


VerneMQ can be installed on CentOS-based systems using the binary package. Download Package

Install VerneMQ

Once you have downloaded the binary package, execute the following command to install VerneMQ:

sudo yum install vernemq-1.7.1-1.el7.centos.x86_64.rpm

or:

sudo rpm -Uvh vernemq-1.7.1-1.el7.centos.x86_64.rpm

Activate VerneMQ node

Once you’ve installed VerneMQ, start it on your node:

service vernemq start

Verify your installation

You can verify that VerneMQ is successfully installed by running:

rpm -qa | grep vernemq

If VerneMQ has been installed successfully vernemq is returned.


Running VerneMQ using Docker


As well as being available as packages that can be installed directly into the operating systems, VerneMQ is also available as a Docker image. Below is an example of how to set up a couple of VerneMQ nodes using Docker.

Start a VerneMQ cluster node

docker run --name vernemq1 -d erlio/docker-vernemq

Somtimes you need to configure a forwarding for ports (on a Mac for example):

docker run -p 1883:1883 --name vernemq1 -d erlio/docker-vernemq

This starts a new node that listens on 1883 for MQTT connections and on 8080 for MQTT over websocket connections. However, at this moment the broker won’t be able to authenticate the connecting clients. To allow anonymous clients use the DOCKER_VERNEMQ_ALLOW_ANONYMOUS=on environment variable.

docker run -e "DOCKER_VERNEMQ_ALLOW_ANONYMOUS=on" --name vernemq1 -d erlio/docker-vernemq

Autojoining a VerneMQ cluster

This allows a newly started container to automatically join a VerneMQ cluster. Assuming you started your first node like the example above you could autojoin the cluster (which currently consists of a single container ‘vernemq1’) like the following:

docker run -e "DOCKER_VERNEMQ_DISCOVERY_NODE=<IP-OF-VERNEMQ1>" --name vernemq2 -d erlio/docker-vernemq

(Note, you can find the IP of a docker container using docker inspect <containername/cid> | grep \"IPAddress\").

Checking cluster status

To check if the above containers have successfully clustered you can issue the vmq-admin command:

docker exec vernemq1 vmq-admin cluster show
+--------------------+-------+
|        Node        |Running|
+--------------------+-------+
|VerneMQ@172.17.0.151| true  |
|VerneMQ@172.17.0.152| true  |
+--------------------+-------+

All vmq-admin commands are available. See https://vernemq.com/docs/administration/ for more information.


 

You may like also:


 

Harshvardhan Mishra

Hi, I'm Harshvardhan Mishra. Tech enthusiast and IT professional with a B.Tech in IT, PG Diploma in IoT from CDAC, and 6 years of industry experience. Founder of HVM Smart Solutions, blending technology for real-world solutions. As a passionate technical author, I simplify complex concepts for diverse audiences. Let's connect and explore the tech world together! If you want to help support me on my journey, consider sharing my articles, or Buy me a Coffee! Thank you for reading my blog! Happy learning! Linkedin

8 thoughts on “How To Install VerneMQ on UbunTu, RHEL, Docker, Debian and Cent OS

Leave a Reply

Your email address will not be published. Required fields are marked *