MacOS下安装RabbitMQ | 少将全栈
  • 欢迎访问少将全栈,学会感恩,乐于付出,珍惜缘份,成就彼此、推荐使用最新版火狐浏览器和Chrome浏览器访问本网站。
  • 吐槽,投稿,删稿,交个朋友
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏少将全栈吧

MacOS下安装RabbitMQ

开发笔记 admin 5年前 (2020-04-24) 4236次浏览 已收录 扫描二维码

在macos下直接使用brew安装rabbitmq

brew install rabbitmq

MacOS下安装RabbitMQ

MacOS下安装RabbitMQ

执行后

==> Summary
🍺 /usr/local/Cellar/openssl@1.1/1.1.1g: 8,059 files, 18MB
==> Installing rabbitmq dependency: erlang
==> Downloading https://homebrew.bintray.com/bottles/erlang-22.3.2.catalina.bott
==> Downloading from https://akamai.bintray.com/c4/c45f0d0bca7e9a9d6fea134dabe52
######################################################################## 100.0%
==> Pouring erlang-22.3.2.catalina.bottle.tar.gz
==> Caveats
Man pages can be found in:
/usr/local/opt/erlang/lib/erlang/man

Access them with erl -man, or add this directory to MANPATH.
==> Summary
🍺 /usr/local/Cellar/erlang/22.3.2: 5,789 files, 281.9MB
==> Installing rabbitmq
==> Downloading https://github.com/rabbitmq/rabbitmq-server/releases/download/v3
==> Downloading from https://github-production-release-asset-2e65be.s3.amazonaws
######################################################################## 100.0%
==> /usr/bin/unzip -qq -j /usr/local/Cellar/rabbitmq/3.8.3/plugins/rabbitmq_mana
==> 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.3: 281 files, 20.4MB, built in 13 seconds
==> brew cleanup has not been run in 30 days, running now…
Removing: /usr/local/Cellar/erlang/22.2.3… (5,783 files, 281.6MB)
Removing: /usr/local/Cellar/openssl@1.1/1.1.1d… (7,983 files, 17.9MB)
Removing: /Users/abel/Library/Logs/Homebrew/telegraf… (64B)
Pruned 0 symbolic links and 2 directories from /usr/local
==> Caveats
==> openssl@1.1
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
/usr/local/etc/openssl@1.1/certs

and run
/usr/local/opt/openssl@1.1/bin/c_rehash

openssl@1.1 is keg-only, which means it was not symlinked into /usr/local,
because macOS provides LibreSSL.

If you need to have openssl@1.1 first in your PATH run:
echo ‘export PATH=”/usr/local/opt/openssl@1.1/bin:$PATH”‘ >> ~/.zshrc

For compilers to find openssl@1.1 you may need to set:
export LDFLAGS=”-L/usr/local/opt/openssl@1.1/lib”
export CPPFLAGS=”-I/usr/local/opt/openssl@1.1/include”

For pkg-config to find openssl@1.1 you may need to set:
export PKG_CONFIG_PATH=”/usr/local/opt/openssl@1.1/lib/pkgconfig”

==> 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
(base)

 

通过提示可以知道启动rabbitmq可以使用

brew services start rabbitmq

brew services restart rabbitmq

rabbitmq-server

执行后

brew services start rabbitmq
Service `rabbitmq` already started, use `brew services restart rabbitmq` to restart.
(base)

安装RabiitMQ的可视化监控插件

rabbitmq-plugins enable rabbitmq_management

若无法执行cd到安装目录下 /usr/local/Cellar/rabbitmq/3.8.3/sbin 再执行或者设置环境变量

 sudo vi /etc/profile
 //加入以下两行
 export RABBIT_HOME=/usr/local/Cellar/rabbitmq/3.7.4
 export PATH=$PATH:$RABBIT_HOME/sbin
 // 立即生效
 source /etc/profile

执行后

Enabling plugins on node rabbit@localhost:
rabbitmq_management
The following plugins have been configured:
rabbitmq_amqp1_0
rabbitmq_management
rabbitmq_management_agent
rabbitmq_mqtt
rabbitmq_stomp
rabbitmq_web_dispatch
rabbitmq_web_stomp
Applying plugin configuration to rabbit@localhost...
Plugin configuration unchanged.
(base)

由于rabbitmq中也有mqtt服务,若macos中安装过mosquitto,那么会造成端口占用,无法启动的情况。

解决方法,把mosquitto服务关掉。

其他无法启动的问题,可以查看日志进行排除

tail -f /usr/local/var/log/rabbitmq/rabbit@localhost.log

关闭rabbitmq服务

rabbitmqctl stop
Stopping and halting node rabbit@localhost …
(base)

查看状态

rabbitmqctl status
Status of node rabbit@localhost …
Runtime

OS PID: 46311
OS: macOS
Uptime (seconds): 169
RabbitMQ version: 3.8.3
Node name: rabbit@localhost
Erlang configuration: Erlang/OTP 22 [erts-10.7.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:128] [hipe] [dtrace]
Erlang processes: 507 used, 1048576 limit
Scheduler run queue: 1
Cluster heartbeat timeout (net_ticktime): 60

访问可视化监控插件的界面 ,浏览器内输入 http://localhost:15672

默认的用户名密码都是guest,

登录后可以在Admin那一列菜单内添加自己的用户,如无法访问可参考如下文章。

RabbitMQ Server安装后localhost:15672无法访问的解决

有什么问题可以留言交流~

喜欢 (3)
[🍬谢谢你请我吃糖果🍬🍬~]
分享 (0)
关于作者:
少将,关注Web全栈开发、项目管理,持续不断的学习、努力成为一个更棒的开发,做最好的自己,让世界因你不同。