安装
1、Windows 安装 ,下载安装 ERLANG https://www.erlang.org/
https://www.erlang.org/downloads 下载 Erlang 依赖
C:\Users\Administrator\AppData\Roaming\RabbitMQ\rabbitmq.config 修改配置
rabbitmq-plugins list #查看插件列表
rabbitmq-plugins enable rabbitmq_management #启用管控台插件
http://192.168.1.200:15672 #通过控制台查看
2、下载安装 Rabbitmq-server.exe https://www.rabbitmq.com/download.html
3、CentOS7 安装
curl -s https://packagecloud.io/install/repositories/rabbitmq/erlang/script.rpm.sh | sudo bash #安装erlang
curl -s https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.rpm.sh | bash #安装rabbitmq
yum install rabbitmq-server
使用 yum 安装
rpm --import https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc
echo -e '[bintray-rabbitmq-server]\nname=bintray-rabbitmq-rpm\nbaseurl=https://dl.bintray.com/rabbitmq/rpm/rabbitmq-server/v3.8.x/el/7/\ngpgcheck=0\nrepo_gpgcheck=0\nenabled=1' >> /etc/yum.repos.d/rabbitmq.repo #设置仓库
wget https://packagecloud.io/rabbitmq/erlang/packages/el/7/erlang-22.3.4.10-1.el7.x86_64.rpm | yum install erlang-22.3.4.10-1.el7.x86_64.rpm
wget https://packagecloud.io/rabbitmq/rabbitmq-server/packages/el/7/rabbitmq-server-3.8.8-1.el7.noarch.rpm | yum install rabbitmq-server-3.8.8-1.el7.noarch.rpm
rabbitmq-server -detached #启动rabbitmq 服务
rabbitmq-plugins enable rabbitmq_management #启用管理插件
#插件运行在 http://localhost:15672/
rabbitmqctl add_user root root
rabbitmqctl set_permissions -p / root ".*" ".*" ".*"
rabbitmqctl set_user_tags root administrator
PHP 中使用
修改 app\provider.php 文件
return [
'rabbitmq' => \app\lib\rabbit\RabbitMQ::class,
]
使用
app('rabbitmq')->xxxx();