RabbitMq windows 安装

时间:2021-07-05 01:45:17

Rabbit MQ 是建立在强大的Erlang OTP平台上,因此安装Rabbit MQ的前提是安装Erlang。

下载并安装 Eralng OTP For Windows (otp_win64_20.0)

二、 设置环境变量

添加一下系统环境变量(正常安装的也要检查下):

RabbitMq windows 安装

有最好,没有的话就手动添加。

三、 安装RabbitMQ

下载并运行安装 Rabbit MQ Server Windows Installer (v3.6.10)

默认安装的Rabbit MQ 监听端口是5672

四、 配置

1、激活Rabbit MQ‘s Management Plugin(C:\Program Files (x86)\RabbitMQ Server\rabbitmq_server-3.2.3\sbin\rabbitmq-plugins.bat)

命令:rabbitmq-plugins enable rabbitmq_management

要重启服务才能生效。

使用浏览器打开:15672 访问Rabbit Mq的管理控制台(默认用户为guest,,密码:guest)

RabbitMq windows 安装

2、使用rabbitmqctl控制台命令(位于C:\Program Files (x86)\RabbitMQ Server\rabbitmq_server-3.2.3\sbin>)

查看用户列表

rabbitmqctl.bat list_users

增加用户

rabbitmqctl.bat add_user [username] [password]

RabbitMq windows 安装

删除用户

rabbitmqctl.bat delete_user [username]

RabbitMq windows 安装

修改用户密码

rabbitmqctl.bat change_password [username] [newpassword]

设置角色

rabbitmqctl.bat set_user_tags [username] [tag1],[tag2]…

RabbitMq windows 安装

目前有如下几种tag,

1)     超级管理员(administrator)

可登陆管理控制台(启用management plugin的情况下),可查看所有的信息,并且可以对用户,策略(policy)进行操作。

2)     监控者(monitoring)

可登陆管理控制台(启用management plugin的情况下),同时可以查看rabbitmq节点的相关信息(进程数,内存使用情况,磁盘使用情况等)

3)     策略制定者(policymaker)

可登陆管理控制台(启用management plugin的情况下), 同时可以对policy进行管理。但无法查看节点的相关信息(上图红框标识的部分)。

4)     普通管理者(management)

仅可登陆管理控制台(启用management plugin的情况下),无法看到节点信息,也无法对策略进行管理。

5)     其他的

无法登陆管理控制台。

如下图是官方网站上给出各个角色的解释:

Tag

 

Capabilities

 

(None)

 

No access to the management plugin

 

management

 

Anything the user could do via AMQP plus:

List virtual hosts to which they can log in via AMQP

View all queues, exchanges and bindings in "their" virtual hosts

View and close their own channels and connections

View "global" statistics covering all their virtual hosts, including activity by other users within them

 

policymaker

 

Everything "management" can plus:

View, create and delete policies and parameters for virtual hosts to which they can log in via AMQP

 

monitoring

 

Everything "management" can plus:

List all virtual hosts, including ones they could not log in to via AMQP

View other users‘s connections and channels

View node-level data such as memory use and clustering

View truly global statistics for all virtual hosts

 

administrator

 

Everything "policymaker" and "monitoring" can plus:

Create and delete virtual hosts

View, create and delete users

View, create and delete permissions

Close other users‘s connections

 

还有其他命令,请需要的时候查阅。

五、 安装过程遇到问题

1、激活Rabbit MQ‘s Management Plugin时出现如下错误:

Applying plugin configuration to [email protected] failed.
 * Could not contact node [email protected]
   Changes will take effect at broker restart.
 * Options: --online  - fail if broker cannot be contacted.
            --offline - do not try to contact broker.

在网上找了下面资料,本机做了如下操作后成功,具体是哪个操作奏效也不太清楚:

同步Erlang Cookies

具体操作:将 C:\WINDOWS\.erlang.cookie   同步到RabbitMq 启动用户 例如win10:C:\Users\%USERNAME%\.erlang.cookie

 卸载RabbitMQ service 重新安装

rabbitmq-service stop

rabbitmq-service remove

rabbitmq-service install

rabbitmq-service start

RabbitMq windows 安装