docker installation using RabbitMQ
i Install docker
Check the kernel
1
2
3
4
5
6uname -r
``
2. If it is lower than 3.10, run the upgrade command
``shell
yum updateInstall the required packages. Execute the following command
1
yum install -y yum-utils device-mapper-persistent-data lvm2
Set up the yum source (choose one), we recommend AliCloud, it’s faster!
1
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
Check all the docker versions in the repository, choose one and install it, if you don’t want to choose one, just install it by default.
1
2yum list docker-ce --showduplicates | sort -r
yum install docker-ceStart docker and make it bootable.
1
2systemctl start docker
systemctl enable dockerCheck the docker version number
1
docker version
II Installing RabbitMQ
Install rabbitmq using docker.
Default installation username guest password guest
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15docker run -dit --restart=always --name rabbitmq -p 15672:15672 -p 5672:5672 rabbitmq:3.9.2-management
``
Installation with username and password
``python
docker run -d --hostname my-rabbitmq --name rabbitmq -e RABBITMQ_DEFAULT_USER=username -e RABBITMQ_DEFAULT_PASS=password -p 15672:15672 -p 5672. 5672 rabbitmq:3.9.2-management
-d: Run the container in the background.
--name: Specify the container name.
-p: Specify the port on which the service is running (5672: application access port; 15672: console web port number).
-v: Map a directory or file.
--hostname: hostname (an important caveat of RabbitMQ is that it stores data based on so-called "node names", which are hostnames by default).
--e: Specify environment variables (RABBITMQ_DEFAULT_VHOST: default VM name; RABBITMQ_DEFAULT_USER: default username; RABBITMQ_DEFAULT_PASS: password for default username).Autostart at boot
1
2docker update --restart=always rabbitmq
docker container update --restart=always rabbitmqRun the existing image
1
docker start rabbitmq
Create a guest user by default.
1
2
3
4
5
6
7user: guest password: guest
5. rabbitmqctl user command usage
When you use the rabbitmqctl user command you are prompted with the following:
```shell
rabbitmqctl: command not foundThen it is because rabbitmqctl is not soft-connected, and you need to go to rabbitmqctl’s sbin directory to execute the rabbitmqctl command to be useful. Assuming I want to change the password for the admin user, I need to find the rabbitmqctl’s sbin directory and switch to it in order to execute the command. If you don’t know where the directory is, you can find it with the find command:
1
find / -name "rabbitmqctl*"
Create a soft connection
ln -s /var/lib/docker/overlay2/85480b72a306464a9b1c728d388ef6dca490ca2df29bee3b99c6634bb475dd96/diff/opt/rabbitmq/sbin/rabbitmqctl / usr/bin/rabbitmqctl