Mac RabbitMq的安装和使用

官网地址:http://www.rabbitmq.com/download.html

一、安装

1.homebrew安装

brew install rabbitmq

2.安装完成后

==> Caveats
Management Plugin enabled by default at http://localhost:15672

Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

To have launchd start rabbitmq now and restart at login:
  brew services start rabbitmq
Or, if you don't want/need a background service you can just run:
  rabbitmq-server
==> Summary
  /usr/local/Cellar/rabbitmq/3.8.2: 280 files, 20MB, built in 55 seconds
==> Caveats
==> erlang
Man pages can be found in:
  /usr/local/opt/erlang/lib/erlang/man

Access them with `erl -man`, or add this directory to MANPATH.
==> rabbitmq
Management Plugin enabled by default at http://localhost:15672

Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

To have launchd start rabbitmq now and restart at login:
  brew services start rabbitmq
Or, if you don't want/need a background service you can just run:
  rabbitmq-server

二、使用

RabbitMQ服务的脚本和CLI工具安装在/usr/local/sbin目录下,该目录不在环境变量中,因此需要先把该目录添加到环境变量中,才能使用rabbitmq-server命令。

vi ~/.bash_profile

操作顺序:
1. i

2.添加  
export RABBIT_HOME=$PATH:/usr/local/Cellar/rabbitmq/3.8.2
export PATH=$PATH:$RABBIT_HOME/sbin

3.esc
4.:
5.wq!

6. // 立即生效

 source ~/.bash_profile



启动RabbitMQ

  • 前台运行rabbitmq-server
  • 后台运行  rabbitmq-server -detached 
  • 查看运行状态 rabbitmqctl status

  • 开始 Web插件 rabbitmq-plugins  enable rabbitmq_management

  • 重启 rabbitmq-server restart

  • 关闭  rabbitmqctl stop

  • 浏览器地址 http://localhost:15672/  默认用户名和密码为guest

  • 添加用户 rabbitmqctl add_user  kangxg 123

  • 设置用户为管理员 rabbitmqctl  set_user_tags kangxg administrator

  • 配置用户可以远程登录  rabbitmqctl set_permissions -p "/" kangxg ".*" ".*" ".*"

  • 查看新添加的账户 rabbitmqctl list_users

  • 查看用于的权限 rabbitmqctl list_permissions -p /

  • Mac RabbitMq的安装和使用_第1张图片

你可能感兴趣的:(SpringBoot,RabbitMQ)