Mac RabbitMq的安装和使用

1 安装

参考:http://www.rabbitmq.com/download.html
homebrew安装

安装之前现更新homebrew

brew update

然后安装RabbitMQ server

brew install rabbitmq

安装完成后,终端会出现如下提示

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

2 使用

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

临时添加

export PATH=$PATH:/usr/local/sbin

永久添加
Mac中可以通过修改以下几个文件来添加环境变量(按加载顺序排列):
/etc/profile /etc/paths ~/.bash_profile ~/.bash_login ~/.profile ~/.bashrc
在此,我们修改~/.bash_profile文件。
首先,打开文件:vi ~/.bash_profile
然后在文件末尾添加:export PATH=$PATH:/usr/local/sbin

启动RabbitMQ

  • 前台运行rabbitmq-server
  • 后台运行brew service start rabbitmq

访问地址:http://127.0.0.1:15672/

发表回复

京ICP备15027918号-1