一、安装erlang
1.sudo vim /etc/yum.repos.d/rabbitmq-erlang.repo,将如下内容复制粘贴进去后保存:
[rabbitmq-erlang]
name=rabbitmq-erlang
baseurl=https://dl.bintray.com/rabbitmq-erlang/rpm/erlang/21/el/7
gpgcheck=1
gpgkey=https://dl.bintray.com/rabbitmq/Keys/rabbitmq-release-signing-key.asc
repo_gpgcheck=0
enabled=1
2.sudo yum install erlang
二、安装配置RabbitMQ
将rabbitmq-server-3.7.16-1.el7.noarch.rpm拷贝至某一目录后执行:
sudo yum install rabbitmq-server-3.7.16-1.el7.noarch.rpm
开启管理插件:
sudo rabbitmq-plugins enable rabbitmq_management
设置系统启动时作为后台进程启动:
systemctl enable rabbitmq-server 或 sudo chkconfig rabbitmq-server on
启动RabbitMQ服务器:
sudo systemctl start rabbitmq-server 或 sudo service rabbitmq-server stop
检查RabbitMQ服务器的状态:
sudo systemctl status rabbitmq-server 或 sudo service rabbitmq-server start
关闭RabbitMQ服务器:
sudo systemctl start rabbitmq-server 或 sudo service rabbitmq-server status
管理RabbitMQ Web控制台用户
删除默认用户
rabbitmqctl delete_user guest
添加新用户
rabbitmqctl add_user username password
设置用户标签
rabbitmqctl set_user_tags username administrator
赋予用户默认vhost的全部操作权限
rabbitmqctl set_permissions -p / username ".*" ".*" ".*"
修改防火墙规则(运行如下命令或修改/etc/firewalld/zones/public.xml文件):
sudo firewall-cmd --zone=public --permanent --add-port=4369/tcp
sudo firewall-cmd --zone=public --permanent --add-port=25672/tcp
sudo firewall-cmd --zone=public --permanent --add-port=5671-5672/tcp
sudo firewall-cmd --zone=public --permanent --add-port=15672/tcp
sudo firewall-cmd --zone=public --permanent --add-port=61613-61614/tcp
sudo firewall-cmd --zone=public --permanent --add-port=1883/tcp
sudo firewall-cmd --zone=public --permanent --add-port=8883/tcp
重启防火墙:
systemctl restart firewalld
查看防火墙开放端口:
firewall-cmd --zone=public --list-ports或cat /etc/firewalld/zones/public.xml
访问RabbitMQ控制台:
http://IP:15672
编程使用入门:
step1:官网的六个例子
https://www.rabbitmq.com/getstarted.html
step2:《RabbitMQ实战指南》前四章(或者其他快速入门的书籍)
step3:Spring/Spring Boot 整合 RabbitMQ
前面这几个都是一周内可以完成的,后面的怎么深入欢迎交流。