一、安装rabbitmq所需的依赖包
yum install build-essential openssl openssl-devel unixODBC unixODBC-devel make gcc gcc- c++ kernel-devel m4 ncurses-devel tk tc xz
安装参考 https://www.rabbitmq.com/install-rpm.html#package-dependencies 在 /etc/yum.repos.d 创建 rabbitmq.repo
vim /etc/yum.repos.d/rabbitmq.repo
##
## Zero dependency Erlang
##
[rabbitmq_erlang]
name=rabbitmq_erlang
baseurl=https://packagecloud.io/rabbitmq/erlang/el/7/$basearch
repo_gpgcheck=1
gpgcheck=1
enabled=1
# PackageCloud's repository key and RabbitMQ package signing key
gpgkey=https://packagecloud.io/rabbitmq/erlang/gpgkey
https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
[rabbitmq_erlang-source]
name=rabbitmq_erlang-source
baseurl=https://packagecloud.io/rabbitmq/erlang/el/7/SRPMS
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/rabbitmq/erlang/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
##
## RabbitMQ server
##
[rabbitmq_server]
name=rabbitmq_server
baseurl=https://packagecloud.io/rabbitmq/rabbitmq-server/el/7/$basearch
repo_gpgcheck=1
gpgcheck=1
enabled=1
# PackageCloud's repository key and RabbitMQ package signing key
gpgkey=https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey
https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
[rabbitmq_server-source]
name=rabbitmq_server-source
baseurl=https://packagecloud.io/rabbitmq/rabbitmq-server/el/7/SRPMS
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
更新Yum包
yum update -y
安装 yum install socat logrotate -y yum install erlang rabbitmq-server -y
启动服务
rabbitmq-server start &
执行管控台插件
rabbitmq-plugins enable rabbitmq_management
创建用户
rabbitmqctl add_user admin admin123
设置权限
rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"
rabbitmqctl set_user_tags admin administrator
普通操作命令
# 查看服务状态
rabbtimqctl status
查看用户列表
rabbitmqctl list_users
# 创建用户
rabbitmqctl add_user admin admin123
#设置rabbitmq 用户角色
rabbitmqctl set_user_tags admin administrator
#为 用户设置权限(rabbitmqctl set_permissions -p <虚拟机> <用户名> ".*" ".*" ".*")
rabbitmqctl set_permissions -p / smlz ".*" ".*" ".*"
#l列出用户权限
rabbitmqctl list_user_permissions admin
#清除用户权限(rabbitmqctl clear_permissions -p <虚拟机> <用户名>)
rabbitmqctl clear_permissions -p / admin
#删除用户
rabbitmqctl delete_user admin
#修改密码(rabbitmqctl change_password 用户名 新密码)
rabbitmqctl change_password admin admin321
# 增加一个虚拟主机
rabbitmqctl add_vhost /adminvhost
# 查看虚拟机
rabbitmqctl list_vhosts
#删除虚拟机
rabbitmqctl delete_vhost /adminvhost
|