erlang solutions 地址:https://www.erlang-solutions.com/resources/download.html
安装rabbitMQ之前 我们先得安装erlang 因为rabbitMQ是用erlang语言编写的 所以为了rabbitMQ能完美安装 我们第一步得安装erlang
安装之前呢 我们得先了解到 rabbitMQ与erlang之间 有个版本对应关系 要是这两个版本之间不适配 那么rabbitMQ的安装还是会有问题。
在这里 博客已经选好了各自对应的版本 亲测完美适配
erlang对应版本→→21.1
rabbitMQ对应版本→→3.7.12
rpm -ivh --nodeps esl-erlang_22.1-1_centos_7_amd64.rpm --nosignature
或者
yum install esl-erlang_22.1-1~centos~7_amd64.rpm
配置前先查看erlang的安装路径
whereis erlang
rabbitMQ对应的版本是3.7.12
rabbitMQ下载地址:https://www.rabbitmq.com/download.html
若是打不开,直接用wget命令,在linux下载,如下
wget https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.7.12/rabbitmq-server-3.7.12-1.el7.noarch.rpm
安装命令
rpm -ivh --nodeps rabbitmq-server-3.7.12-1.el7.noarch.rpm --nosignature
配置前先查看rabbitmq的安装路径
whereis rabbitmq
添加web插件
rabbitmq-plugins enable rabbitmq_management
启动命令
rabbitmq-server
我们需要开放15672 和5672端口
firewall-cmd --permanent --add-port=15672/tcp
开放5672端口:
firewall-cmd --permanent --add-port=5672/tcp
重启防火墙
firewall-cmd --reload
rabbitmq-server -detached
出现以下警告信息,暂时互略
Warning: PID file not written; -detached was passed.
查看端口号命令
netstat -tulpn
rabbitmqctl stop
rabbitmqctl add_user admin admin123
rabbitmqctl set_user_tags admin administrator
rabbitmqctl set_permissions -p "/" admin ".*" ".*" ".*"
在网页上打开rabbitmq客户端。用户名为上面创建的admin密码 admin123
rabbitmqctl add_user {username} {password}
rabbitmqctl delete_user {username}
rabbitmqctl change_password {username} {newpassword}
rabbitmqctl set_user_tegs {username} {tag}
rabbitmq用户的4种Tag
超级管理员(administrator)可登录管理控制台,可查看所有的信息,并且可以对用户策略进行操作
监控者(monitoring)可登录管理控制台,同时可查看rabbitmq节点的信息(进程数,内存的使用情况,磁盘的使用情况)。
策略制定者(policymaker)可登录管理控制台,同时可以对policy进行管理,但无法查看节点的相关信息
普通管理者(management)仅可以登录管理控制台,无法看到节点信息。也无法对策略进行管理
rabbitmqctl set permissions -p / user_admin '.*' '.*' '.*'
后面是三个星分别代表配置权限,读权限,写权限
rabbitmqctl status
[root@instance-6uz2q7zs rabbitmq]# rabbitmqctl status
Status of node rabbit@instance-6uz2q7zs ...
Error: unable to perform an operation on node 'rabbit@instance-6uz2q7zs'. 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 http://rabbitmq.com/documentation.html to learn more
* Consult server logs on node rabbit@instance-6uz2q7zs
* If target node is configured to use long node names, don't forget to use --longnames with CLI tools
DIAGNOSTICS
===========
attempted to contact: ['rabbit@instance-6uz2q7zs']
rabbit@instance-6uz2q7zs:
* connected to epmd (port 4369) on instance-6uz2q7zs
* epmd reports: node 'rabbit' not running at all
no other nodes on instance-6uz2q7zs
* suggestion: start the node
Current node details:
* node name: 'rabbitmqcli-13892-rabbit@instance-6uz2q7zs'
* effective user's home directory: /var/lib/rabbitmq
* Erlang cookie hash: lBbeLA0IjgouQorLyLnhDQ==
https://blog.csdn.net/weixin_30892889/article/details/97582664
使用nohup命令
nohup rabbitmq-server &
使用setsid命令
setsid rabbitmq-server &