RabbitMq常用命令

下载地址:https://dl.bintray.com/rabbitmq-erlang/rpm/erlang
下载地址 : https://github.com/rabbitmq/rabbitmq-server/releases
wget http://repo.iotti.biz/CentOS/7/x86_64/socat-1.7.3.2-5.el7.lux.x86_64.rpm
网址 https://blog.csdn.net/weixin_43381041/article/details/108983185

  

sudo vi /etc/yum.repos.d/rabbitmq_erlang.repo
## 在文件中
# In /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
## 保存
## 执行以下命令
#设置用户名密码
 sudo rabbitmqctl add_user admin exiangsui@2020
yum clean all
yum makecache
## 以上两个可以跳过
 
sudo yum install erlang
# 安装完成后
sudo  rpm -ivh rabbitmq-server-3.7.13-1.el7.noarch.rpm 
#启动 rabbitmq
sudo rabbitmq-server -detached

  

$ sudo chkconfig rabbitmq-server on  # 添加开机启动RabbitMQ服务
$ sudo /sbin/service rabbitmq-server start # 启动服务
$ sudo /sbin/service rabbitmq-server status  # 查看服务状态
$ sudo /sbin/service rabbitmq-server stop   # 停止服务
 
# 查看当前所有用户
$ sudo rabbitmqctl list_users
 
# 查看默认guest用户的权限
$ sudo rabbitmqctl list_user_permissions guest
 
# 由于RabbitMQ默认的账号用户名和密码都是guest。为了安全起见, 先删掉默认用户
$ sudo rabbitmqctl delete_user guest
 
# 添加新用户
$ sudo rabbitmqctl add_user username password
 
# 设置用户tag
$ sudo rabbitmqctl set_user_tags username administrator
 
# 赋予用户默认vhost的全部操作权限
$ sudo rabbitmqctl set_permissions -p / username ".*" ".*" ".*"
 
# 查看用户的权限
$ sudo rabbitmqctl list_user_permissions username


#启动服务
systemctl start rabbitmq-server.service
 
#设置开机启动
systemctl enable rabbitmq-server.service
 
#停止开机启动
systemctl disable rabbitmq-server.service
 
#重新启动服务
systemctl restart rabbitmq-server.service
 
#查看服务当前状态
systemctl status rabbitmq-server.service
 
#查看所有已启动服务
systemctl list-units --type=service

  

上一篇:如何在windows下安装rabbitmq,一看就会


下一篇:RabbitMQ 安装-CentOS8