博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
安装RabbitMQ(一)
阅读量:5948 次
发布时间:2019-06-19

本文共 4646 字,大约阅读时间需要 15 分钟。

hot3.png

 

安装RabbitMQ(一)

安装Erlang 

安装erlang环境用yum安装erlangyum install erlang执行上面语句时报错说找不到包,那得先安装EPEL库yum install epel-release再执行yum install erlang---------------------

下载安装rabbitmq

mq版本连接查询地址:http://www.rabbitmq.com/releases/rabbitmq-server/v3.1.5/

下载安装rabbitmq[root@bogon local]#wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.1.5/rabbitmq-server-3.1.5-1.noarch.rpm[root@bogon local]#yum -y install rabbitmq-server-3.1.5-1.noarch.rpm[root@bogon local]#rabbitmq-server start  //启动  或者这样启动:rabbitmq-server -detachedWarning: PID file not written; -detached was passed.我这里是提示这个,但是rabbitmq服务已经启动成功
Transaction check error:file /usr/bin/epmd from install of erlang-erts-20.0-1.el7.centos.x86_64 conflicts with file from package esl-erlang-20.0-1.x86_64file /usr/bin/erl from install of erlang-erts-20.0-1.el7.centos.x86_64 conflicts with file from package esl-erlang-20.0-1.x86_64file /usr/bin/erlc from install of erlang-erts-20.0-1.el7.centos.x86_64 conflicts with file from package esl-erlang-20.0-1.x86_64file /usr/bin/escript from install of erlang-erts-20.0-1.el7.centos.x86_64 conflicts with file from package esl-erlang-20.0-1.x86_64file /usr/bin/run_erl from install of erlang-erts-20.0-1.el7.centos.x86_64 conflicts with file from package esl-erlang-20.0-1.x86_64file /usr/bin/to_erl from install of erlang-erts-20.0-1.el7.centos.x86_64 conflicts with file from package esl-erlang-20.0-1.x86_64file /usr/bin/dialyzer from install of erlang-dialyzer-20.0-1.el7.centos.x86_64 conflicts with file from package esl-erlang-20.0-1.x86_64file /usr/bin/ct_run from install of erlang-common_test-20.0-1.el7.centos.x86_64 conflicts with file from package esl-erlang-20.0-1.x86_64注意:出现这种情况,运行如下命令[root@bogon local]#yum remove esl-erlang-20.0-1.x86_64 esl-erlang-20.0-1.x86_64 esl-erlang-20.0-1.x86_64 esl-erlang-20.0-1.x86_64 esl-erlang-20.0-1.x86_64 esl-erlang-20.0-1.x86_64 esl-erlang-20.0-1.x86_64 esl-erlang-20.0-1.x86_64

启动成功

16154629_ch7t.png

 

如果启动失败如下处理:

[root@besttone2 rabbitmq]# rabbitmq-server restart

BOOT FAILED
===========

Error description:
   {error,{cannot_log_to_file,"/var/log/rabbitmq/rabbit@xxx2.log",
                              {error,eacces}}}

Log files (may contain more information):
   /var/log/rabbitmq/rabbit@xxx2.log
   /var/log/rabbitmq/rabbit@xxx2-sasl.log

Stack trace:
   [{rabbit,ensure_working_log_handler,5,[{file,"src/rabbit.erl"},{line,873}]},
    {rabbit,ensure_working_log_handlers,0,
            [{file,"src/rabbit.erl"},{line,844}]},
    {rabbit,'-boot/0-fun-0-',0,[{file,"src/rabbit.erl"},{line,281}]},
    {rabbit,start_it,1,[{file,"src/rabbit.erl"},{line,417}]},
    {init,start_em,1,[]},
    {init,do_boot,3,[]}]

{"init terminating in do_boot",{error,{cannot_log_to_file,"/var/log/rabbitmq/rabbit@besttone2.log",{error,eacces}}}}
init terminating in do_boot ()

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

解决措施:

/var/log/rabbitmq/ 这个目录下的两个日志文件的 用户和组 设定成rabbitmq  

chmod -R rabbitmq:rabbitmq /var/log/rabbitmq/

--------------------- 
作者:小学肄业 
来源:CSDN 
原文:https://blog.csdn.net/xiaoxueyiye/article/details/78720886 
版权声明:本文为博主原创文章,转载请附上博文链接!

图片.png

 

复制一个新的窗口

安装插件

[root@bogon ~]#rabbitmq-plugins enable rabbitmq_management

创建用户

[root@bogon ~]#rabbitmqctl  list_users    //查看用户列表[root@bogon ~]#rabbitmqctl  add_user  admin admin  // 创建用户[root@bogon ~]#rabbitmqctl  set_user_tags  admin administrator   //  设置角色

在浏览器中输入: http://服务器地址:15672

 

16154629_CzOl.png

图片.png

查看rabbitmq安装在那里:

  1. whereis rabbitmq

  2. whereis erlang

 

查询yum安装的相关包:

yum list | grep erlang

卸载 MQ:

rpm -q -a | grep MQSeries

卸载erlang相关的包:

yum remove erlang-asn1.x86_64  

使用rabbitctl添加用户

第一、添加mq用户并设置密码

root@live-mq-01:~ # rabbitmqctl add_user mq 123456

1

root@live-mq-01:~ # rabbitmqctl add_user mq 123456

第二、添加mq用户为administrator角色

root@live-mq-01:~ # rabbitmqctl set_user_tags mq administrator

1

root@live-mq-01:~ # rabbitmqctl set_user_tags mq administrator

第三、设置mq用户的权限,指定允许访问的vhost以及write/read

root@live-mq-01:~ # rabbitmqctl set_permissions -p "/" mq ".*" ".*" ".*"Setting permissions for user "live" in vhost "/" ......done.

1

2

3

root@live-mq-01:~ # rabbitmqctl set_permissions -p "/" mq ".*" ".*" ".*"

Setting permissions for user "live" in vhost "/" ...

...done.

第四、查看vhost(/)允许哪些用户访问

root@live-mq-01:~ # rabbitmqctl list_permissions -p /Listing permissions in vhost "/" ...mq .* .* .*...done.

1

2

3

4

root@live-mq-01:~ # rabbitmqctl list_permissions -p /

Listing permissions in vhost "/" ...

mq .* .* .*

...done.

第五、配置允许远程访问的用户,rabbitmq的guest用户默认不允许远程主机访问。

root@live-mq-01:~ # cat /etc/rabbitmq/rabbitmq.config [ {rabbit, [{tcp_listeners, [5672]}, {loopback_users, ["mq"]}]}].

1

2

3

4

root@live-mq-01:~ # cat /etc/rabbitmq/rabbitmq.config

[                                                                                                                                  

{rabbit, [{tcp_listeners, [5672]}, {loopback_users, ["mq"]}]}

].

 

 

转载于:https://my.oschina.net/u/2364025/blog/2877294

你可能感兴趣的文章
调整数组使奇数全部都位于偶数前面
查看>>
clamav 完整查杀 linux 病毒实战
查看>>
我的友情链接
查看>>
EIGRP的Metric计算以及负载均衡
查看>>
org-capture 配置
查看>>
linux下lvs搭建负载均衡集群
查看>>
JMS 实例讲解
查看>>
求教:如何成为一个优秀的项目经理人
查看>>
shell 脚本--备份、还原mysql数据库
查看>>
JS脚本静态变量调用方法
查看>>
linux中cacti和nagios整合
查看>>
新调查结果表明:NoSQL采用呈上升趋势
查看>>
ASP.NET MVC测试方法与实战技巧
查看>>
Mysql慢查询
查看>>
传统线程机制之定时器的应用(TIMER,TIMERTASK)
查看>>
org.apache.hadoop.hive.contrib.serde2.RegexSerDe not found
查看>>
citrix客户端的配置和访问(六)
查看>>
Linux下搭建Ionic框架
查看>>
移动支付的基本要素
查看>>
云计算:大数据时代的系统工程(二)
查看>>