mac rabbitmq安装并使用管理界面

本文介绍了在Mac上安装RabbitMQ的过程,包括下载安装包、添加环境变量、启用管理界面插件、创建及授权用户,并解决了因OpenSSL导致的安装问题。最后,通过brew安装方式作为备选方案。

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

在mac上使用rabbitmq比较简单,到rabbitmq官网下载对应的包,然后解压到任意路径,再启动位于sbin目录下的rabbitmq-server即可启动rabbitmq,启动好的画面如下:

Last login: Tue Aug 13 18:28:57 on ttys000
C02Z10BKLVDQ:~ i333750$ /Users/i333750/Documents/tools/rabbitmq_server-3.7.17/sbin/rabbitmq-server ; exit;
WARNING: module crypto not found, so not scanned for boot steps.
WARNING: module crypto not found, so not scanned for boot steps.
WARNING: module crypto not found, so not scanned for boot steps.
WARNING: module crypto not found, so not scanned for boot steps.
WARNING: module crypto not found, so not scanned for boot steps.
WARNING: module crypto not found, so not scanned for boot steps.
WARNING: module crypto not found, so not scanned for boot steps.

  ##  ##
  ##  ##      RabbitMQ 3.7.17. Copyright (C) 2007-2019 Pivotal Software, Inc.
  ##########  Licensed under the MPL.  See https://www.rabbitmq.com/
  ######  ##
  ##########  Logs: /Users/i333750/Documents/tools/rabbitmq_server-3.7.17/var/log/rabbitmq/rabbit@C02Z10BKLVDQ.log
                    /Users/i333750/Documents/tools/rabbitmq_server-3.7.17/var/log/rabbitmq/rabbit@C02Z10BKLVDQ_upgrade.log

              Starting broker...
WARNING: module crypto not found, so not scanned for boot steps.
WARNING: module crypto not found, so not scanned for boot steps.
WARNING: module crypto not found, so not scanned for boot steps.
WARNING: module crypto not found, so not scanned for boot steps.
WARNING: module crypto not found, so not scanned for boot steps.
WARNING: module crypto not found, so not scanned for boot steps.
WARNING: module crypto not found, so not scanned for boot steps.
 completed with 3 plugins.











上面显示启动成功,同时使用了三个插件,默认情况下如果什么都不做的话,那么插件就是0. 此时去访问rabbitmq的UI的话是无法访问的,如下所示:

原因在于rabbitmq的UI是需要激活插件的,我们需要执行一些命令。

在装好rabbitmq之后,如果我们什么都不做,在command里面rabbit相关的命令是无法执行的,我们需要通过在.bash_profile 里面添加下面的命令吧rabbitmq加到path里面去:

export PATH=/Users/dr/Documents/tools/rabbitmq_server-3.7.17/sbin/:$PATH

加入上述命令之后,在console里面就可以执行rabbitmq的命令了,我们常常需要用到rabbitmq的UI,因此我们可以执行下面的命令:

rabbitmq-plugins enable rabbitmq_management

执行成功之后我们重新启动rabbitmq-server,然后在浏览器输入http://localhost:15672/#/.我们就能进到rabbitmq的UI界面了

 

使用默认的guest/guest作为用户名和密码即可登陆进去。

若使用guest和guest登录提示401无法登录则可以通过下面的步骤加一个新的用户:

  1. 添加一个新的用户,用户名和密码都为test

    rabbitmqctl add_user test test
    
  2. 给新用户赋予管理员权限:

    rabbitmqctl set_user_tags test administrator
    
  3. 给新用户设置权限

    rabbitmqctl set_permissions -p / test ".*" ".*" ".*"

rabbitmqctl的命令需要在rabbitmq server启动之后才能执行。此外rabbitmqctl命令需要进入到rabbitmqctl的sbin目录下执行命令才有用,否则会报错command not found。关于这个问题可以参考另一篇博客。

若添加新用户的命令报错如下:

C02Z10BKLVDQ:~ i333750$ rabbitmqctl add_user test test
Adding user "test" ...
Error:
{:undef, [{:crypto, :hash, [:sha256, <<121, 190, 143, 158, 116, 101, 115, 116>>], []}, {:rabbit_password, :hash, 2, [file: 'src/rabbit_password.erl', line: 34]}, {:rabbit_auth_backend_internal, :add_user_sans_validation, 3, [file: 'src/rabbit_auth_backend_internal.erl', line: 252]}, {:rpc, :"-handle_call_call/6-fun-0-", 5, [file: 'rpc.erl', line: 197]}]}
C02Z10BKLVDQ:~ i333750$ rabbitmqctl list_users
Listing users ...

查看日志发现有如下错误信息:

  Reason: image not found'"
OpenSSL might not be installed on this system.

说明OpenSSL安装没有成功,则需要重新安装OpenSSL

还有一种在mac上安装rabbitmq的方式,即通过brew来安装,具体的可以参考网址:https://brew.sh/

值得一提的笔者在安装xcode之后还需要再自己手动安装Command_Line_Tools_macOS_10.14_for_Xcode_10.3, 下载地址:https://developer.apple.com/download/more/,然后才能成功安装了brew,读者需要自行注意.

安装好brew之后,使用brew命令安装rabbitmq成功的结果如下:

==> Installing dependencies for rabbitmq: openssl@1.1, jpeg, libpng, libtiff, wxmac and erlang
==> Installing rabbitmq dependency: openssl@1.1
==> Downloading https://homebrew.bintray.com/bottles/openssl@1.1-1.1.1c.mojave.b
==> Downloading from https://akamai.bintray.com/e4/e4c85922978ded43321679e00ecb3
######################################################################## 100.0%
==> Pouring openssl@1.1-1.1.1c.mojave.bottle.tar.gz
==> Caveats
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 openssl/libressl is provided by macOS so don't link an incompatible version.

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

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"

==> Summary
?  /usr/local/Cellar/openssl@1.1/1.1.1c: 7,963 files, 17.9MB
==> Installing rabbitmq dependency: jpeg
==> Downloading https://homebrew.bintray.com/bottles/jpeg-9c.mojave.bottle.tar.g
==> Downloading from https://akamai.bintray.com/1d/1daa0fc0c197d96dd4e1afddb9ad5
######################################################################## 100.0%
==> Pouring jpeg-9c.mojave.bottle.tar.gz
?  /usr/local/Cellar/jpeg/9c: 21 files, 733.4KB
==> Installing rabbitmq dependency: libpng
==> Downloading https://homebrew.bintray.com/bottles/libpng-1.6.37.mojave.bottle
==> Downloading from https://akamai.bintray.com/53/53bbd14cc27c86c16605e256e7646
######################################################################## 100.0%
==> Pouring libpng-1.6.37.mojave.bottle.tar.gz
?  /usr/local/Cellar/libpng/1.6.37: 27 files, 1.2MB
==> Installing rabbitmq dependency: libtiff
==> Downloading https://homebrew.bintray.com/bottles/libtiff-4.0.10_1.mojave.bot
==> Downloading from https://akamai.bintray.com/6e/6ecdca6159e5e4db0ec0fcbddbc76
######################################################################## 100.0%
==> Pouring libtiff-4.0.10_1.mojave.bottle.tar.gz
?  /usr/local/Cellar/libtiff/4.0.10_1: 246 files, 3.5MB
==> Installing rabbitmq dependency: wxmac
==> Downloading https://homebrew.bintray.com/bottles/wxmac-3.0.4_2.mojave.bottle
==> Downloading from https://akamai.bintray.com/d5/d5dec67eb11005f6eea84a94a9cae
######################################################################## 100.0%
==> Pouring wxmac-3.0.4_2.mojave.bottle.tar.gz
?  /usr/local/Cellar/wxmac/3.0.4_2: 813 files, 23MB
==> Installing rabbitmq dependency: erlang
==> Downloading https://homebrew.bintray.com/bottles/erlang-22.0.7.mojave.bottle
==> Downloading from https://akamai.bintray.com/11/1158d2c1839d793c63b776509a764
######################################################################## 100.0%
==> Pouring erlang-22.0.7.mojave.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.0.7: 5,766 files, 279.3MB
==> 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.7.16/plugins/rabbitmq_man
==> 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.7.16: 237 files, 14.4MB, built in 24 seconds
==> 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 openssl/libressl is provided by macOS so don't link an incompatible version.

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

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"

==> 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的UI:

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值