Linux服务器安装RabbitMQ 3.7.4

2022-07-13 15:30:37 浏览数 (2)

RabbitMQ是一款开源的消息队列代理工具,负责消息队列的存储和使用,主要为消息的各种使用方式提供了更多的拓展,比如订阅模式,工作队列模式等。为开发者提供了便利。

通过yum在线安装,简单、快捷、自动安装相关依赖包。(需要你的服务器处于联网状态)

1.安装Erlang环境(RabbitMQ由Erlang语言开发)

 1.1)下载Erlang的rpm安装包

wget -O erlang-20.3.4-1.el7.CentOS.x86_64.rpm https://bintray.com/rabbitmq/rpm/download_file?file_path=erlang/20/el/7/x86_64/erlang-20.3.4-1.el7.centos.x86_64.rpm

 1.2)安装Erlang

yum install -y erlang-20.3.4-1.el7.centos.x86_64.rpm

 1.3)检查Erlang是否安装成功

[root@localhost ~]# erl -version

Erlang (SMP,ASYNC_THREADS,HIPE) (BEAM) emulator version 9.3

[root@localhost ~]#

 2.安装RabbitMQ

 2.1)下载rpm安装包

wget https://dl.bintray.com/rabbitmq/all/rabbitmq-server/3.7.4/rabbitmq-server-3.7.4-1.el7.noarch.rpm

 2.2)安装RabbitMQ

yum install -y rabbitmq-server-3.7.4-1.el7.noarch.rpm

 2.3)检查RabbitMQ是否安装成功

[root@localhost ~]# rabbitmqctl status

Status of node rabbit@localhost ...

[{pid,14618},

{running_applications,

[{rabbitmq_management,"RabbitMQ Management Console","3.7.4"},

{rabbitmq_management_agent,"RabbitMQ Management Agent","3.7.4"},

{amqp_client,"RabbitMQ AMQP Client","3.7.4"},

{rabbitmq_web_dispatch,"RabbitMQ Web Dispatcher","3.7.4"},

{cowboy,"Small, fast, modern HTTP server.","2.2.2"},

{cowlib,"Support library for manipulating Web protocols.","2.1.0"},

{rabbit,"RabbitMQ","3.7.4"},

{rabbit_common,

"Modules shared by rabbitmq-server and rabbitmq-erlang-client",

"3.7.4"},

...

 3.启动RabbitMQ

    3.1 ) 设置开机启动(即设置为守护线程)

            chkconfig rabbitmq-server on

    3.2 ) 启动mq服务

            service rabbitmq-server start                      ----启动mq

            systemctl status rabbitmq-server.service    ----查看rabbitmq状态

            rabbitmqctl stop                                          ----停止mq服务

 4.安装web管理界面插件

    1.安装 :

            rabbitmq-plugins enable rabbitmq_management

    2.成功后会有如下内容 :

        The following plugins hava been enabled:

        mochiweb

        webmachine

        rabbitmq_web_dispatch

        amqp_client.....

        Plugin configuration has changed .Restart RabbitMQ for changes to        take effect.

5.新增个人账号,用于远程登录

    1.创建账号

        rabbitmqctl add_user agan 123456

    2.设置用户角色

        rabbitmqctl set_user_tags heming administrator

    3.设置用户权限

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

    4.设置完成后可以查看当前用户和角色(需要开启服务)

        rabbitmqctl list_users

    5.完成后在自己的浏览器输入 serverip:15672  其中serverip 是rabbitmq-server所在主机的ip

0 人点赞