{"id":3796,"date":"2023-08-21T16:59:14","date_gmt":"2023-08-21T20:59:14","guid":{"rendered":"https:\/\/dft.wiki\/?p=3796"},"modified":"2023-08-21T16:59:14","modified_gmt":"2023-08-21T20:59:14","slug":"deploying-a-queue-systems-with-rabbitmq-on-ubuntu","status":"publish","type":"post","link":"https:\/\/dft.wiki\/?p=3796","title":{"rendered":"Deploying a Queue Systems with RabbitMQ on Ubuntu"},"content":{"rendered":"<p><strong>RabbitMQ<\/strong> is an open-source &#8220;message broker&#8221; that facilitates communication between distributed applications with the Advanced Message Queuing Protocol (AMQP) [<a href=\"https:\/\/www.rabbitmq.com\/download.html\">Link<\/a>].<\/p>\n<p>In RabbitMQ, <strong>producers<\/strong> send messages to a &#8220;queue,&#8221; from which <strong>consumers<\/strong> asynchronously read and process those messages.<\/p>\n<p>It also offers various features like load balancing, message routing, and data persistence.<\/p>\n<p>RabbitMQ is often compared to <strong>Apache<\/strong> <strong>Kafka<\/strong>\u00a0[Link], which is an open-source &#8220;distributed event streaming platform&#8221;. In other words, they have their similarities but they are not direct competitors.<\/p>\n<p>Main differences:<\/p>\n<ul>\n<li>RabbitMQ much easier to deploy and manage. Kafka has a very steep learning curve.<\/li>\n<li>RabbitMQ pushes messages to consumers, while Kafka\u2019s consumers pull messages and keep track of what has been consumed by using offsets.<\/li>\n<li>RabbitMQ uses AMQP, and Kafka uses a custom protocol over TCP.<\/li>\n<li>RabbitMQ is more focused on message queues, whereas Kafka is designed around the concept of an immutable log of events.<\/li>\n<li>Both support &#8220;at least once&#8221; and &#8220;at most once&#8221; delivery, but Kafka also offers &#8220;exactly once&#8221; semantics.<\/li>\n<\/ul>\n<hr \/>\n<p><strong>DEPLOYMENT AS CONTAINER<\/strong><\/p>\n<pre>sudo apt update &amp;&amp; sudo apt upgrade -y\r\nsudo apt install docker.io -y\r\nsudo docker run -it --rm --name RabbitMQ -p 5672:5672 -p 15672:15672 rabbitmq:3.12-management<\/pre>\n<hr \/>\n<p><strong>INSTALLATION FROM DEB PACKAGES<br \/>\n<\/strong><\/p>\n<p>Note that is requires Erlang to be installed before because RabbitMB is written on it.<\/p>\n<pre>sudo apt update &amp;&amp; sudo apt upgrade -y\r\nsudo apt-get install curl gnupg apt-transport-https -y<\/pre>\n<p>Add the signing keys and repositories.<\/p>\n<pre>curl -1sLf \"https:\/\/keys.openpgp.org\/vks\/v1\/by-fingerprint\/0A9AF2115F4687BD29803A206B73A36E6026DFCA\" | sudo gpg --dearmor | sudo tee \/usr\/share\/keyrings\/com.rabbitmq.team.gpg &gt; \/dev\/null\r\ncurl -1sLf https:\/\/ppa.novemberain.com\/gpg.E495BB49CC4BBE5B.key | sudo gpg --dearmor | sudo tee \/usr\/share\/keyrings\/rabbitmq.E495BB49CC4BBE5B.gpg &gt; \/dev\/null\r\ncurl -1sLf https:\/\/ppa.novemberain.com\/gpg.9F4587F226208342.key | sudo gpg --dearmor | sudo tee \/usr\/share\/keyrings\/rabbitmq.9F4587F226208342.gpg &gt; \/dev\/null<\/pre>\n<pre>sudo nano \/etc\/apt\/sources.list.d\/rabbitmq.list<\/pre>\n<p>Add the following content to the file:<\/p>\n<pre>deb [signed-by=\/usr\/share\/keyrings\/rabbitmq.E495BB49CC4BBE5B.gpg] https:\/\/ppa1.novemberain.com\/rabbitmq\/rabbitmq-erlang\/deb\/ubuntu $distribution main\r\ndeb-src [signed-by=\/usr\/share\/keyrings\/rabbitmq.E495BB49CC4BBE5B.gpg] https:\/\/ppa1.novemberain.com\/rabbitmq\/rabbitmq-erlang\/deb\/ubuntu $distribution main\r\ndeb [signed-by=\/usr\/share\/keyrings\/rabbitmq.E495BB49CC4BBE5B.gpg] https:\/\/ppa2.novemberain.com\/rabbitmq\/rabbitmq-erlang\/deb\/ubuntu $distribution main\r\ndeb-src [signed-by=\/usr\/share\/keyrings\/rabbitmq.E495BB49CC4BBE5B.gpg] https:\/\/ppa2.novemberain.com\/rabbitmq\/rabbitmq-erlang\/deb\/ubuntu $distribution main\r\ndeb [signed-by=\/usr\/share\/keyrings\/rabbitmq.9F4587F226208342.gpg] https:\/\/ppa1.novemberain.com\/rabbitmq\/rabbitmq-server\/deb\/ubuntu $distribution main\r\ndeb-src [signed-by=\/usr\/share\/keyrings\/rabbitmq.9F4587F226208342.gpg] https:\/\/ppa1.novemberain.com\/rabbitmq\/rabbitmq-server\/deb\/ubuntu $distribution main\r\ndeb [signed-by=\/usr\/share\/keyrings\/rabbitmq.9F4587F226208342.gpg] https:\/\/ppa2.novemberain.com\/rabbitmq\/rabbitmq-server\/deb\/ubuntu $distribution main\r\ndeb-src [signed-by=\/usr\/share\/keyrings\/rabbitmq.9F4587F226208342.gpg] https:\/\/ppa2.novemberain.com\/rabbitmq\/rabbitmq-server\/deb\/ubuntu $distribution main<\/pre>\n<p>Then, proceed with the instalation of the RabbitMQ it self.<\/p>\n<pre>sudo apt-get update -y\r\nsudo apt-get install -y erlang-base erlang-asn1 erlang-crypto erlang-eldap erlang-ftp erlang-inets erlang-mnesia erlang-os-mon erlang-parsetools erlang-public-key erlang-runtime-tools erlang-snmp erlang-ssl erlang-syntax-tools erlang-tftp erlang-tools erlang-xmerl\r\nsudo apt-get install rabbitmq-server -y --fix-missing<\/pre>\n<hr \/>\n<p><strong>MANAGING RABBITMQ<\/strong><\/p>\n<pre>sudo systemctl enable rabbitmq-server\r\nsudo systemctl start rabbitmq-server\r\nsudo systemctl status rabbitmq-server\r\nsudo journalctl --system | grep rabbitmq<\/pre>\n<pre>sudo rabbitmq-diagnostics status\r\nsudo rabbitmq-diagnostics ping\r\nsudo rabbitmq-diagnostics cluster_status\r\nsudo rabbitmq-diagnostics environment\r\nsudo rabbitmq-plugins list<\/pre>\n<p>Enable the plugins:<\/p>\n<pre>sudo rabbitmq-plugins enable rabbitmq_management<\/pre>\n<p>Remember to open port <strong>5672<\/strong> on the firewall with appropriate roles for the queue API, and <strong>15672<\/strong> for the Management Web Console.<\/p>\n<hr \/>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>RabbitMQ is an open-source &#8220;message broker&#8221; that facilitates communication between distributed applications with the Advanced [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-3796","post","type-post","status-publish","format-standard","hentry","category-programming"],"_links":{"self":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts\/3796","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3796"}],"version-history":[{"count":5,"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts\/3796\/revisions"}],"predecessor-version":[{"id":3801,"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts\/3796\/revisions\/3801"}],"wp:attachment":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3796"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3796"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3796"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}