RabbitMQ安装教程(Mac)

本文详细介绍了在Mac上安装RabbitMQ的步骤,包括使用HomeBrew、启动服务、配置环境变量以及处理启动错误。此外,还提到了RabbitMQ的常用命令、端口用途和用户权限角色。特别指出,启动错误通常是由于主机名解析或节点未运行导致,解决方法包括检查主机配置和重启。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1、RabbitMQ是采用Erlang语言开发的,所以系统环境必须提供Erlang环境。

brew install rabbitmq

前提必须是mac安装了HomeBrew(软件包管理系统),以下都是基于mac版本的。

等大概十几分钟

brew services start rabbitmq;

RabbitMQWeb管理界面及授权操作

rabbitmq-plugins enable rabbitmq_management

如果出现command no find 说明环境变量没配置

配置mac的环境变量后,命令也可以使用了

2、基本命令

  #brew启动
    brew services start rabbitmq;
  #前台运行
    rabbitmq-server
  # 后台运行
    rabbitmq-server -detached
  #新建用户
    rabbitmqctl add_user 账号 密码
  #给用户分配操作权限
    rabbitmqctl set_user_tags 账号 administrator
  #修改密码
    rabbitmqctl change_password Username Newpassword 修改密码
  #删除用户
    rabbitmqctl delete_user Username 删除用户
  #查看所有用户
    rabbitmqctl list_users 查看用户清单
  #为用户设置访问权限
    rabbitmqctl set_permissions -p / 用户名 ".*" ".*" ".*" 
    rabbitmqctl set_permissions -p / root ".*" ".*" ".*"

3、我启动后出现错误

  Error: unable to perform an operation on node 'rabbit@localhost'. Please see diagnostics information and suggestions below.

Most common reasons for this are:

 * Target node is unreachable (e.g. due to hostname resolution, TCP connection or firewall issues)
 * CLI tool fails to authenticate with the server (e.g. due to CLI tool's Erlang cookie not matching that of the server)
 * Target node is not running

In addition to the diagnostics info below:

 * See the CLI, clustering and networking guides on https://rabbitmq.com/documentation.html to learn more
 * Consult server logs on node rabbit@localhost
 * If target node is configured to use long node names, don't forget to use --longnames with CLI tools

DIAGNOSTICS
===========

attempted to contact: [rabbit@localhost]

rabbit@localhost:
  * connected to epmd (port 4369) on localhost
  * epmd reports: node 'rabbit' not running at all
              no other nodes on localhost
  * suggestion: start the node

Current node details:
 * node name: 'rabbitmqcli-18-rabbit@localhost'
 * effective user's home directory: /Users/XXXX
 * Erlang cookie hash: CJKrd1APSSyKxnmLKSA77g==

因为我的 host配置错了,重新配置host,重启电脑即可(不重启电脑仍可能错误)

image.png

4、

端口说明
5672RabbitMQ的通讯端口
25672RabbitMQ的节点间的CLI通讯端口
15672RabbitMQ HTTP_API的端口,管理员用户才能访问,用于管理RabbitMQ,需要启动Management插件
1883、8883MQTT插件启动时的端口
61613、61614STOMP客户端插件启用的时候的端口
15674、15675基于webscoket的STOMP端口和MOTT端口

5、用户权限

角色权限
administrator可以登录控制台、查看所有信息、可以对rabbitmq进行管理
monitoring监控者,登录控制台,查看所有信息
policymaker策略制定者,登录控制台,指定策略
managment普通管理员,登录控制台

出发了。。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值