安装环境: Alibaba Cloud Linux
安装erlang命令:
wget https://packages.erlang-solutions.com/erlang-solutions-1.0-1.noarch.rpm rpm -Uvh erlang-solutions-1.0-1.noarch.rpm rpm --import https://packages.erlang-solutions.com/rpm/erlang_solutions.asc
我第三步报错:
error: https://packages.erlang-solutions.com/rpm/erlang_solutions.asc: import read failed(2).
到底怎么回事?求告知
yum install erlang -y
查看erl版本命令:
erl -version
查看具体erl的版本命令:
erl
erlang版本和rabbitmq版本要对应,可以去下面网址查看
RabbitMQ Erlang Version Requirements — RabbitMQ
安装RabbitMQ
下载rpm包, $ wget http://www.rabbitmq.com/releases/rabbitmq-server/v3.8.3/rabbitmq-server-3.8.3-1.e17.noarch.rpm rpm -ivh rabbitmq-server-3.8.3-1.e17.noarch.rpm(这种方式会提示版本需大于R13),加上 -nodeps 就ok了. 或 rpm -ivh --nodeps --force rabbitmq-server-3.3.8.3-1.e17-1.noarch.rpm 下载rabbitmq命令: wget https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.8.3/rabbitmq-server-3.8.3-1.el7.noarch.rpm 如果报wget错,要么没装要么重装wget! 安装rabbitmq命令: yum install -y rabbitmq-server-3.8.3-1.el7.noarch.rpm 我用此命令行不通,求大佬告知!!! rpm -ivh rabbitmq-server-3.8.3-1.e17.noarch.rpm(这种方式会提示版本需大于R13),加上 -nodeps 就ok了.
遇到这种错误,我这里是文件的权限问题,我的解决方案
用lsattr命令查看/etc/passwd的隐藏权限
[~]# lsattr /etc/passwd
----i--------e- /etc/passwd
权限 i 说明设定文件不能被删除、改名、设定链接关系,同时不能写入或新增内容。
用chattr命令对/etc/group去除i权限位:
[ ~]# chattr -i /etc/passwd
[ ~]# useradd -d /home/test -m test
useradd: cannot open /etc/shadow
用同样的方式去除/etc/shadow 权限:
[ ~]# chattr -i /etc/shadow
[ ~]# useradd -d /home/test -m test
[ ~]# cat /etc/passwd|grep test
查看用户,大功告成
有时权限可能是a而不是i,一样要经过以上步骤
启动rabbitmq命令:
rabbitmqctl start_app
开启rabbitmq界面管理命令:
rabbitmq-plugins enable rabbitmq_management
添加新用户命令(第一个admin为账户名,第二个admin为密码):
rabbitmqctl add_user admin admin
给admin用户添加标签命令:
rabbitmqctl set_user_tags admin administrator
给admin用户授权命令:
rabbitmqctl set_permissions -p "/" admin ".*" ".*" ".*"
关闭rabbitmq命令:
rabbitmqctl stop
开启rabbitmq命令:
rabbitmqctl start_app
阿里云服务器需注意开启端口,设置安全组
15672、5672
设置完成,重启阿里云服务器即可
浏览器地址输入 http://阿里云服务器公网ip:15672
输入之前创建的用户名和密码(admin/admin),就可以看到rabbitmq的管理界面了。
ps:
如果想卸载erlang版本就输入:
1
rpm -qa | grep erlang | xargs rpm -e --nodeps
另外我在另外一台服务器按照这个步骤安装的时候,发现执行
1
rabbitmqctl start_app
启动rabbitmq的命令时候,会出现以下异常:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Error: unable to perform an operation on node 'rabbit@iZbp138tf0alwpZ'. Please see diagnostics information and suggestions below.
Most common reasons for this are:
* Target node is unreachable (e.g. due to hostname resolution, TCP connection or firewall issues)
* CLI tool fails to authenticate with the server (e.g. due to CLI tool's Erlang cookie not matching that of the server)
* Target node is not running
In addition to the diagnostics info below:
* See the CLI, clustering and networking guides on https://rabbitmq.com/documentation.html to learn more
* Consult server logs on node rabbit@iZbp138tf0alwpZ
* If target node is configured to use long node names, don't forget to use --longnames with CLI tools
DIAGNOSTICS
===========
attempted to contact: [rabbit@iZbp138tf0alwpZ]
rabbit@iZbp138tf0alwpZ:
* connected to epmd (port 4369) on iZbp138tf0alwpZ
* epmd reports: node 'rabbit' not running at all
no other nodes on iZbp138tf0alwpZ
* suggestion: start the node
Current node details:
* node name: 'rabbitmqcli-1180384-rabbit@iZbp138tf0alwpZ'
* effective user's home directory: /var/lib/rabbitmq
* Erlang cookie hash: PH2aegzBB8pInmMp3ar8Jg==
根据上述信息,翻阅资料,最后执行
1
echo 192.168.1.101 iZbp138tf0alwpZ>>/etc/hosts
192.168.1.101 为服务器IP
iZbp138tf0alwpZ 为服务器主机名,也是上述错误信息rabbit@iZbp138tf0alwpZ中后面一截字符串
意思就是把服务器IP和主机名写入到host文件,这样就可以解析成功。
然后继续执行,重启rabbitmq服务
1
service rabbitmq-server restart
接着上面的 开启rabbitmq界面管理命令 步骤继续执行即可。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)