Mac下RabbitMQ安装

2018-10-04  本文已影响0人  一个做java的梦想

1、安装

在Mac下安装RabbitMQ是非常简单的,一般默认RabbitMQ服务器依赖的Erlang已经安装,只需要用下面两个命令就可以完成RabbitMQ的安装(前提是homebrew已经被安装 见https://brew.sh/):

brewupdate

brew installrabbitmq

耐心等待,安装完成后需要将/usr/local/sbin添加到$PATH,可以将下面这两行加到~/.bash_profile:

# RabbitMQ Configexport PATH=$PATH:/usr/local/sbin

编辑完后:wq保存退出,使环境变量立即生效。

source ~/.bash_profile

2、启动RabbitMQ服务

上面配置完成后,需要关闭终端窗口,重新打开,然后输入下面命令即可启动RabbitMQ服务:

rabbitmq-server

如果执行上面命令出现以下问题

------------------------------------------------------------------------------------------------------------------------

wangbindeMacBook-Air:sbin wangbin$ rabbitmq-server

2017-06-13 15:26:21 Error when reading /Users/wangbin/.erlang.cookie: eacces

2017-06-13 15:26:21 crash_report

initial_call: {auth,init,['Argument__1']}

pid: <0.45.0>

registered_name: []

error_info: {exit,{"Error when reading /Users/wangbin/.erlang.cookie: eacces",[{auth,init_cookie,0,[{file,"auth.erl"},{line,286}]},{auth,init,1,[{file,"auth.erl"},{line,140}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,328}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,247}]}]},[{gen_server,init_it,6,[{file,"gen_server.erl"},{line,352}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,247}]}]}

ancestors: [net_sup,kernel_sup,<0.34.0>]

messages: []

links: [<0.43.0>]

dictionary: []

trap_exit: true

status: running

heap_size: 610

stack_size: 27

reductions: 618

2017-06-13 15:26:21 supervisor_report

supervisor: {local,net_sup}

errorContext: start_error

reason: {"Error when reading /Users/wangbin/.erlang.cookie: eacces",[{auth,init_cookie,0,[{file,"auth.erl"},{line,286}]},{auth,init,1,[{file,"auth.erl"},{line,140}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,328}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,247}]}]}

offender: [{pid,undefined},{id,auth},{mfargs,{auth,start_link,[]}},{restart_type,permanent},{shutdown,2000},{child_type,worker}]

2017-06-13 15:26:21 supervisor_report

supervisor: {local,kernel_sup}

errorContext: start_error

reason: {shutdown,{failed_to_start_child,auth,{"Error when reading /Users/wangbin/.erlang.cookie: eacces",[{auth,init_cookie,0,[{file,"auth.erl"},{line,286}]},{auth,init,1,[{file,"auth.erl"},{line,140}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,328}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,247}]}]}}}

offender: [{pid,undefined},{id,net_sup},{mfargs,{erl_distribution,start_link,[]}},{restart_type,permanent},{shutdown,infinity},{child_type,supervisor}]

2017-06-13 15:26:21 crash_report

initial_call: {application_master,init,['Argument__1','Argument__2','Argument__3','Argument__4']}

pid: <0.33.0>

registered_name: []

error_info: {exit,{{shutdown,{failed_to_start_child,net_sup,{shutdown,{failed_to_start_child,auth,{"Error when reading /Users/wangbin/.erlang.cookie: eacces",[{auth,init_cookie,0,[{file,"auth.erl"},{line,286}]},{auth,init,1,[{file,"auth.erl"},{line,140}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,328}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,247}]}]}}}}},{kernel,start,[normal,[]]}},[{application_master,init,4,[{file,"application_master.erl"},{line,134}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,247}]}]}

ancestors: [<0.32.0>]

messages: [{'EXIT',<0.34.0>,normal}]

links: [<0.32.0>,<0.31.0>]

dictionary: []

trap_exit: true

status: running

heap_size: 610

stack_size: 27

reductions: 174

2017-06-13 15:26:21 std_info

application: kernel

exited: {{shutdown,{failed_to_start_child,net_sup,{shutdown,{failed_to_start_child,auth,{"Error when reading /Users/wangbin/.erlang.cookie: eacces",[{auth,init_cookie,0,[{file,"auth.erl"},{line,286}]},{auth,init,1,[{file,"auth.erl"},{line,140}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,328}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,247}]}]}}}}},{kernel,start,[normal,[]]}}

type: permanent

{"Kernel pid terminated",application_controller,"{application_start_failure,kernel,{{shutdown,{failed_to_start_child,net_sup,{shutdown,{failed_to_start_child,auth,{\"Error when reading /Users/wangbin/.erlang.cookie: eacces\",[{auth,init_cookie,0,[{file,\"auth.erl\"},{line,286}]},{auth,init,1,[{file,\"auth.erl\"},{line,140}]},{gen_server,init_it,6,[{file,\"gen_server.erl\"},{line,328}]},{proc_lib,init_p_do_apply,3,[{file,\"proc_lib.erl\"},{line,247}]}]}}}}},{kernel,start,[normal,[]]}}}"}

Kernel pid terminated (application_controller) ({application_start_failure,kernel,{{shutdown,{failed_to_start_child,net_sup,{shutdown,{failed_to_start_child,auth,{"Error when reading /Users/wangbin/.e

Crash dump is being written to: erl_crash.dump...done

--------------------------------------------------------------------------------------------------------------

则执行:sudo ./rabbitmq-server

cd /usr/local/Cellar/rabbitmq/3.6.9/sbin

sudo rabbitmq-server

3、登录Web管理界面

浏览器输入localhost:15672,账号密码全输入guest即可登录。

这里如果显示找不到主机,请在hosts文件中添加

vi /private/etc/hosts

127.0.0.1 localhost

这里需要注意下,从3.3.1版本开始,RabbitMQ默认不允许远程ip登录,即只能使用localhost登录。如果希望远程登录,请添加用户权限,方法见我的另一篇文章设置RabbitMQ远程ip登录

---------------------本文来自 一块钱硬币2015 的CSDN 博客 ,全文地址请点击:https://blog.csdn.net/u010442302/article/details/73189152?utm_source=copy

上一篇下一篇

猜你喜欢

热点阅读