Friday, July 1, 2016

Installing RabbitMQ in Ubunthu

Introduction to RabbitMQ

Initially when I search in Internet i found that RabbitMQ is broker. I also could not understand what they meant by that. After some researches only I could understand. RabbitMQ task is getting the messages and forward it to the receiver. I am sure you are familiar with post office system. In post office post man will get the messages from post box and he will give it to post office. In post office we categories the posts according to the regions and deliver it to relevant places through the postman. This is the procedure of RabbitMQ also. RabbitMQ will act as postman, post office and post box. The thing is post office deals with papers and RabbitMQ deals with blobs of data. A program that sends messages is called as "Producer"(P). Queue is the one which stores messages for a sometime. It is with in RabbitMQ. We can say queue is like post box. A queue is not bound by any limits, it can store as many messages as you like ‒ it's essentially an infinite buffer. Like humans put posts into the post box, a producer can send messages to queue. In this case many consumers can try to receive data from one queue. A "Consumer (C)" is a program that mostly waits to receive messages. Note that the producer, consumer, and broker do not have to reside on the same machine; indeed in most applications they don't. We can write producer and consumer in different languages.

Steps to Install RabbitMQ
  1. You have to check whether RabbitMQ is already in your Ubunthu OS. You can use this code in your terminal.
    sudo rabbitmq-server start

    If yo u get message like "node with name "rabbit" already running on ", then you can know that in your OS, RabbitMQ is already installed. But you can upgrade new version. To upgrade/newly install, you can use following steps.
  2. Execute the following command to add the APT repository.
     sudo add-apt-repository "deb http://www.rabbitmq.com/debian/ testing main"
  3. To avoid warnings about unsigned packages, add our public key to your trusted key list using below command.
    wget https://www.rabbitmq.com/rabbitmq-signing-key-public.asc
  4. After the above command, use this command.
    sudo apt-key add rabbitmq-signing-key-public.asc
  5. Run the following command to update the package list.
    sudo apt-get update
  6.  Install rabbitmq-server package
    sudo apt-get install rabbitmq-server
    In this time, if you had RabbitMQ already, then you could upgrade the version of it. If you don't have it already, new version have installed at this time and start the server automatically.
  7.  You can check whether it start/not by following command.
    sudo rabbitmqctl status
  8. In browser you can type like this http://localhost:15672/In this time if you don't get interface like Figure 1, you have to activate plugins (mentioned in step 9).
  9. Enable plugins.
    sudo rabbitmq-plugins enable rabbitmq_management
  10.  You can use "guest" as username and password.
  11. Yes. I have successfully installed RabbitMQ now. :) In my next blogs, we will focus more on RabbitMQ.

Figure 1






No comments:

Post a Comment