Detailed explanation of the Linux system installation and configuration process of RabbitMQ

Detailed explanation of RabbitMQ installation and configuration process (Linux version)

1 Introduction:

Information related to this RabbitMQ installation environment:

  • Linux CentOS 7 version
  • erlang-21.3-1.el7.x86_64.rpm
  • rabbitmq-server-3.8.8-1.el7.noarch.rpm

The underlying source code of RabbitMQ is developed based on the erlang language, so installing rabbitMQ requires the erlang language environment.

2. Download the installation program

When the installed versions of erlang and rabbitmq do not correspond, they may not operate normally. The corresponding installation packages of the Linux version of erlang and rabbitmq required for this installation have been compiled in the network disk. The download address is as follows. If the extraction code fails, you can also Please contact in time:

Link: https://pan.baidu.com/s/1NxK78QASAvlM48vkU4FXAw
Extraction code: x6ld

Upload the downloaded compressed package to the /usr/local/software directory through Xftp (if there is no software, you need to create it yourself)

Insert image description here

3. File installation

3.1 Install erlang in rpm mode:

rpm -ivh erlang-21.3-1.el7.x86_64.rpm

Insert image description here

3.2. Install socat dependencies

yum -y install socat

When installing through yum, centos7 may currently be unable to install software online through yum due to source problems: the specific solutions are as follows:

# 1、将yum的源改成阿里云的,直接在命令行输入:
	curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

# 2、运行 yum clean all
	yum clean all

# 3、生成yum缓存
	yum makecache
	
# 4、 可以通过yum repolist来查询yum的状态
	yum repolist

Insert image description here

Insert image description here

Insert image description here

After the yum problem is solved, run yum -y install socat and the installation is successful.

Insert image description here

3.3. Install RabbitMQ

rpm -ivh rabbitmq-server-3.8.8-1.el7.noarch.rpm

Insert image description here

RabbitMQ start and stop commands:

# 添加开机启动 RabbitMQ 服务
chkconfig rabbitmq-server on

# 启动 RabbitMQ 服务
/sbin/service rabbitmq-server start 

# 停止服务(选择执行)
/sbin/service rabbitmq-server stop

# 查看服务状态
/sbin/service rabbitmq-server status

Insert image description here

Before starting RabbtMQ, enable web plug-in management. After enabling it, you can access the rabbitMQ page through http://localhost:15672

# 开启 web 管理插件
rabbitmq-plugins enable rabbitmq_management

Insert image description here

4. Log in to the front-end control interface

Before logging in, make sure that the RabbitMQ service is turned on. You can check it yourself through the above server view and start commands.

Since my Linux is deployed on the Alibaba Cloud server, the access address is Alibaba Cloud's public IP address: port 15672. The default initialization username and password are guest.

In addition, since you are logging in to the Alibaba Cloud server remotely, you need to set up the Alibaba Cloud security group to open port 15672. After opening it, you can log in normally. There will be a permission problem when logging in and you cannot log in:

Insert image description here

5. Add a new user

If the above permission problem occurs during login, you need to create a new user and set the user role and permissions. The specific steps are as follows:

# 创建账号 设置用户名和密码
rabbitmqctl add_user admin 123

# 设置用户角色
rabbitmqctl set_user_tags admin administrator

# 设置用户权限 set_permissions [-p <vhostpath>] <user> <conf> <write> <read>
rabbitmqctl set_permissions -p "/" admin ".*" ".*" ".*"
# 上述命令使得用户 user_admin 具有/vhost1 这个 virtual host 中所有资源的配置、写、读权限

# 当前用户和角色
rabbitmqctl list_users

Insert image description here

6. Log in using the newly created user admin

Insert image description here

Additional commands:


# 关闭应用的命令为
rabbitmqctl stop_app

# 清除的命令为
rabbitmqctl reset

# 重新启动命令为
rabbitmqctl start_app

Guess you like

Origin blog.csdn.net/weixin_43155804/article/details/124910219