Linux service install rabbitmq, add new user and vhost

download link;

Link: https://pan.baidu.com/s/1rha0zqgjtig6-wswKqs48A
Extraction code: vhzu
copy this content and open the Baidu Netdisk mobile phone App, the operation is more convenient!

installation steps

To ensure that the system has been installed jdk1.8 and mysql8.0 version, you need to follow the steps below to install

  1. Before installation, you must turn off the firewall, otherwise you will not be able to log in to the console in the future;
  2. Install erlang: rpm -ivh erlang-18.3-1.el7.centos.x86_64.rpm
  3. Install tcp_wrappers: yum install tcp_wrappers (needed to install socat, you can install socat first to see if it needs to be installed)
  4. Install socat: rpm -ivh socat-1.7.3.2-1.1.el7.x86_64.rpm
  5. 安装rabbitmq-server:rpm -ivh rabbitmq-server-3.6.5-1.noarch.rpm
  6. Modify the configuration file

vim /usr/lib/rabbitmq/lib/rabbitmq_server-3.6.5/ebin/rabbit.app

<<"guest">> in loopback_users, only keep guest

  1. Start rabbitmq-server service

rabbitmq-server start & where & means start in the background

  1. Install lsof: yum install lsof

5672 is the communication port number: lsof -i:5672

  1. Open the management console: rabbitmq-plugins enable rabbitmq_management
  2. Log in to RabbitMQ, the default port number is 15672

Add user and vhost

1、rabbitmqctl add_user mq 123456

2、rabbitmqctl set_user_tags mq adminstrator

3、rabbitmqctl set_permissions -p "/" mq ".*" ".*" ".*"

4、rabbitmqctl add_vhost /host  # 添加 vhost

5. rabbitmqctl set_permissions -p /host mq ".*" ".*" ".*" # vhost set permissions

View permission information of all users

rabbitmqctl list_permissions

View the authority information of the specified user

rabbitmqctl list_user_permissions username

Clear user's permission information

rabbitmqctl clear_permissions username -p vhost_name username

 

Virtual host

Each vhost is essentially a mini version of RabbitMQ server, with its own switch, queue, binding, and its own authority mechanism. The relationship between Vhost and rabbitMQ is like a virtual machine and a physical machine. By providing logical separation between each instance, it is allowed to provide safe and confidential services for different applications.

Query all virtual hosts

rabbitmqctl list_vhosts

Add virtual host

rabbitmqctl add_vhost vhost_name

Delete virtual host

rabbitmqctl delete_vhost vhost_name

User role permissions
1. Super administrator (administrator)
can log in to the management console, can view all information, and can operate on users and policies.
2. The monitoring
can log in to the management console, and at the same time can view the relevant information of the rabbitmq node (number of processes, memory usage, disk usage, etc.)
3. The policymaker
can log in to the management console, and at the same time Manage the policy. But you cannot view the related information of the node (the part marked by the red box in the above figure).
4. Ordinary managers (management)
can only log in to the management console, and cannot see node information and cannot manage policies.

Guess you like

Origin blog.csdn.net/My_SweetXue/article/details/111593645