Shut down the original service

View existing rabitMQ processes

ps aux|grep rabbitmq
Copy the code

Then shut down the corresponding service

systemctl stop rabbitmq-server
Copy the code

Docker shutdown service:

Displays all, including those that are not running

docker ps -a
Copy the code

Stop the container

Docker stop Container IDCopy the code

Or just kill the process

Kill -9 Id of a processCopy the code

Step 1: Start the first node rabbit-1

RABBITMQ_NODE_PORT=5672 RABBITMQ_NODENAME=rabbit-1 rabbitmq-server start &
Copy the code

Command result:

. Omit... Logs: /var/log/rabbitmq/[email protected] /var/log/rabbitmq/rabbit-1@VM-4-11-centos_upgrade.log Config file(s): (none) Starting broker... completed with 3 plugins.Copy the code

Step 2: Start the second node rabbit-2

RABBITMQ_NODE_PORT=5673 RABBITMQ_SERVER_START_ARGS="-rabbitmq_management listener [{port,15673}]" RABBITMQ_NODENAME=rabbit-2 rabbitmq-server start &
Copy the code

Command result:

. Omit... Logs: /var/log/rabbitmq/[email protected] /var/log/rabbitmq/rabbit-1@VM-4-11-centos_upgrade.log Config file(s): (none) Starting broker... completed with 3 plugins.Copy the code

Stop the application

rabbitmqctl -n rabbit-1 stop_app
Copy the code

The purpose is to clear the history on the node (if not, the node cannot be added to the cluster)

rabbitmqctl -n rabbit-1 reset
Copy the code

Start the application

rabbitmqctl -n rabbit-1 start_app
Copy the code

Stop the application

rabbitmqctl -n rabbit-2 stop_app
Copy the code

The purpose is to clear the history on the node (if not, the node cannot be added to the cluster)

rabbitmqctl -n rabbit-2 reset
Copy the code

Add rabbit2 nodes to rabbit1(primary node) cluster

Rabbitmqctl -n rabbit-2 Join_cluster rabbit-1@ Host nameCopy the code

Start the application

rabbitmqctl -n rabbit-2 start_app
Copy the code

Verifying cluster Status

rabbitmqctl cluster_status -n rabbit-1
Copy the code

Content is I according to the video dozen, belong to is study notes come from B station meet crazy god said