Centos7安装RabbitMQ
安装erlang
1.配置
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: Failed dependencies: epel-release is needed by erlang-solutions-1.0-1.noarch 缺少依赖: yum install epel-release
内容:
/etc/yum.repos.d/erlang_solutions.repo [erlang-solutions] name=Centos $releasever - $basearch - Erlang Solutions baseurl=https://packages.erlang-solutions.com/rpm/centos/$releasever/$basearch gpgcheck=1 gpgkey=https://packages.erlang-solutions.com/rpm/erlang_solutions.asc enabled=1
2.安装
sudo yum install erlang
或
sudo yum install esl-erlang
3.查看
erl //Erlang/OTP 22 [erts-10.5.5] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:1] [hipe] .....
q().
安装前最好先确认一下源的版本,用阿里云的默认的安装了老版本,不支持最新的MQ
处理方法:
yum remove erlang-erts-R16B-03.18.el7.x86_64 //卸载老版本再进行安装
安装RabbitMQ
1.配置&安装
wget https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.9.5/rabbitmq-server-3.9.5-1.el8.noarch.rpm rpm --import https://www.rabbitmq.com/rabbitmq-release-signing-key.asc yum install rabbitmq-server-3.9.5-1.el8.noarch.rpm
2.启动
/sbin/service rabbitmq-server start
遇到一个问题:Protocol 'inet_tcp': register/listen error: etimedout
防火墙问题: 先关闭防火墙(service iptables stop),就可以启动服务。后面将端口号加入防火墙中,重新打开防火墙。服务正常启动。
iptables -I INPUT -p tcp --dport 5672 -j ACCEPT
iptables -I INPUT -p tcp --dport 15672 -j ACCEPT
3.配置
rabbitmq-plugins enable rabbitmq_management //开启RabbitMQ控制台 rabbitmqctl add_user admin 123456 //创建用户 rabbitmqctl set_permissions -p "/" admin '.*' '.*' '.*' //给用户授权 rabbitmqctl set_user_tags admin administrator //给用户赋予administrator角色
命令:
rabbitmqctl status //查看运行状态 rabbitmqctl stop //关闭服务 rabbitmqctl start_app //启动服务 service rabbitmq-server start //启动服务 rabbitmqctl list_users //列出用户
访问http://ip:15672 RabbitMQ控制台
插件:
yum -y install make gcc gcc-c++ kernel-devel m4 ncurses-devel openssl-devel unixODBC-devel
问题:
1.unable to perform an operation on node 都说是在hosts文件中加入IP和机器名称,弄了好久都启动不了,后来忙了两天回来再弄的时候竟然可以启动了。多次尝试发现service rabbitmq-server start可以正常启动,用rabbitmqctl start_app会报错,不知是什么原因。
2.TCP connection succeeded but Erlang distribution failed 修改host ip+名, sudo cp /var/lib/rabbitmq/.erlang.cookie ~/.erlang.cookie
卸载:
yum list | grep rabbitmq yum -y remove rabbitmq-server.noarch
参考:
https://www.wandouip.com/t5i242551/
https://www.cnblogs.com/ray30th/p/6657087.html