tencent cloud

Feedback

Building RabbitMQ

Last updated: 2022-03-23 11:29:09

    Overview

    RabbitMQ is an open-source message broker based on the Advanced Message Queuing Protocol (AMQP). It features usability, scalability, and high availability with an Erlang-programmed server, and supports multiple clients including Python, Ruby, .NET, Java, JMS, C, PHP, ActionScript, XMPP, STOMP, and AJAX. This document describes how to deploy RabbitMQ on Tencent Cloud CVM.

    Software

    This document uses the following software as an example to deploy RabbitMQ:

    • Linux: Linux operating system. This document uses CentOS 7.7 as an example.
    • RabbitMQ Server: open-source message broker. This document uses RabbitMQ Server 3.6.9 as an example.
    • Erlang: programming language. This document uses Erlang 19.3 as an example.

    Prerequisites

    • You have purchased a Linux CVM.
    • The security group rules for the Linux instance have already been configured. Open the ports 80, 5672 and 15672. For more information, see Adding Security Group Rules.

    Directions

    Installing Erlang

    1. Log in to a Linux instance using standard login method. You can also use other login methods that you are more comfortable with:

    2. Run the following command to install dependencies.

      yum -y install make gcc gcc-c++ m4 ncurses-devel openssl-devel unixODBC-devel
      
    3. Run the following command to download the Erlang installation package.

      wget http://erlang.org/download/otp_src_19.3.tar.gz
      
    4. Run the following command to decompress the Erlang installation package.

      tar xzf otp_src_19.3.tar.gz
      
    5. Run the following command to create the erlang folder.

      mkdir /usr/local/erlang
      
    6. Run the following commands in sequence to compile and install Erlang.

      cd otp_src_19.3
      
    ./configure --prefix=/usr/local/erlang --without-javac
    
    make && make install
    
    1. Run the following command to open the profile configuration file.

      vi /etc/profile
      
    2. Press i to enter the edit mode, and append the following at the end of the file.

      export PATH=$PATH:/usr/local/erlang/bin
      
    3. Press Esc and enter :wq to save and close the file.

    4. Run the following command for the environment variable to take effect immediately.

      source /etc/profile
      

    Installing RabbitMQ Server

    1. Run the following command to download the RabbitMQ Server installation package.
      wget https://github.com/rabbitmq/rabbitmq-server/releases/download/rabbitmq_v3_6_9/rabbitmq-server-3.6.9-1.el7.noarch.rpm
      

    This document uses downloading RabbitMQ 3.6.9 from the RabbitMQ official website as an example. If the download link has expired, or if you want to use other RabbitMQ versions, go to rabbitmq-server and learn more about the installation.
    10. Run the following command to import the signature key.

    rpm --import https://www.rabbitmq.com/rabbitmq-release-signing-key.asc
    
    1. Run the following commands in sequence to install RabbitMQ Server.
      cd
      
    yum install rabbitmq-server-3.6.9-1.el7.noarch.rpm
    
    1. Run the following commands in sequence to enable RabbitMQ autostart and start RabbitMQ.
      systemctl enable rabbitmq-server
      
    systemctl start rabbitmq-server
    
    1. Run the following command to delete the default guest account of RabbitMQ.

      rabbitmqctl delete_user guest
      
    2. Run the following command to create an account.

      rabbitmqctl add_user Username Password
      
    3. Run the following command to set the new account as the admin account.

      rabbitmqctl set_user_tags Username administrator
      
    4. Run the following command to grant the admin account all permissions.

      rabbitmqctl set_permissions -p / Username ".*" ".*" ".*"
      

    Verifying installation

    1. Run the following command to open the Web management page of RabbitMQ.

      rabbitmq-plugins enable rabbitmq_management
      
    2. Open a browser and visit:

      http://Instance public IP:15672
      

    For more information about how to obtain the public IP address of the instance, see Getting Public IP Addresses.
    If you see the following page, it indicates that RabbitMQ has been successfully installed.

    3. Log in to RabbitMQ with the admin account created in Step 6 and access the RabbitMQ management page, as shown below:

    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support