In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
1. IP address planning (configure information to / etc/hosts)
Hostname IP address
RabbitMQ01 192.168.8.131
RabbitMQ02 192.168.8.132
RabbitMQ03 192.168.8.133
RabbitMQ04 192.168.8.134
2. RabbitMQ cluster installation
(1) four nodes run at the same time to download RabbitMQ image
[root@RabbitMQ01~] # docker pull rabbitmq:3-management
(2) four nodes run separately to start the RabbitMQ container
[root@RabbitMQ01~] # docker run-d-- restart=always-- hostname rabbit01-- name rabbit-01-p 25672-p 15672-p 5672-p 5672-p 5671-p 4369-- add-host rabbit02:192.168.8.132-add-host rabbit03:192.168.8.133-- add-host rabbit04:192.168.8.134-e RABBITMQ_ERLANG_COOKIE='rbmqcookie' rabbitmq:3-management
[root@RabbitMQ02~] # docker run-d-- restart=always-- hostname rabbit02-- name rabbit-02-p 25672-p 15672-p 5672-p 5672-p 5671-p 4369-- add-host rabbit01:192.168.8.131-add-host rabbit03:192.168.8.133-- add-host rabbit04:192.168.8.134-e RABBITMQ_ERLANG_COOKIE='rbmqcookie' rabbitmq:3-management
[root@RabbitMQ03~] # docker run-d-- restart=always-- hostname rabbit03-- name rabbit-03-p 25672-p 15672-p 5672-p 5672-p 5671-p 4369-- add-host rabbit01:192.168.8.131-add-host rabbit02:192.168.8.132-- add-host rabbit04:192.168.8.134-e RABBITMQ_ERLANG_COOKIE='rbmqcookie' rabbitmq:3-management
[root@RabbitMQ04~] # docker run-d-- restart=always-- hostname rabbit04-- name rabbit-04-p 25672-p 15672-p 5672-p 5672-p 5671-p 4369-- add-host rabbit01:192.168.8.131-add-host rabbit02:192.168.8.132-- add-host rabbit03:192.168.8.133-e RABBITMQ_ERLANG_COOKIE='rbmqcookie' rabbitmq:3-management
(3) when adding nodes to the cluster service, we set node 03 as the master node of the cluster and the other as child nodes. Pay attention to the configuration of two nodes as ram nodes and the other two as disc nodes. Pay attention to the different commands when executing.
Execute on node 01:
[root@RabbitMQ01~] # docker exec-it rabbit-01 bash
[rabbit@rabbit01] # rabbitmqctl stop_app
[rabbit@rabbit01] # rabbitmqctl reset
[rabbit@rabbit01] # rabbitmqctl join_cluster-- ram rabbit@rabbit03
[rabbit@rabbit01] # rabbitmqctl start_app
[rabbit@rabbit01] # exit
Execute on node 02:
[root@RabbitMQ02~] # docker exec-it rabbit-02 bash
[rabbit@rabbit02] # rabbitmqctl stop_app
[rabbit@rabbit02] # rabbitmqctl reset
[rabbit@rabbit02] # rabbitmqctl join_cluster-- ram rabbit@rabbit03
[rabbit@rabbit02] # rabbitmqctl start_app
[rabbit@rabbit02] # exit
Execute on node 04:
[root@RabbitMQ04~] # docker exec-it rabbit-01 bash
[rabbit@rabbit04] # rabbitmqctl stop_app
[rabbit@rabbit04] # rabbitmqctl reset
[rabbit@rabbit04] # rabbitmqctl join_cluster rabbit@rabbit03
[rabbit@rabbit04] # rabbitmqctl start_app
[rabbit@rabbit04] # exit
Execute on node 03:
[root@RabbitMQ03~] # docker exec-it rabbit-03 bash
[rabbit@rabbit03] # rabbitmqctl stop_app
[rabbit@rabbit03] # rabbitmqctl reset
[rabbit@rabbit03] # rabbitmqctl start_app
[rabbit@rabbit03] # exit
3. Configure and add ha-mode image
Name:HA
Pattern:.
Definition:ha-mode = all
Installation and deployment of RabbitMQ Cluster based on docker in CentOS7.X Environment
Access the main interface after the cluster is started:
Installation and deployment of RabbitMQ Cluster based on docker in CentOS7.X Environment
3. Install and configure nginx to provide high availability
The installation of nginx, which is skipped here, goes directly to the configuration
[root@nginx~] # cd / usr/local/nginx/conf
[root@nginx~conf] # vi nginx.conf
Skip other configurations
Stream {
Upstream rabbitmq {
Server 192.168.8.131:5672 max_fails=2 fail_timeout=5s weight=2
Server 192.168.8.132:5672 max_fails=2 fail_timeout=5s weight=2
Server 192.168.8.133:5672 max_fails=2 fail_timeout=5s weight=2
Server 192.168.8.134:5672 max_fails=2 fail_timeout=5s weight=2
}
Server {
Listen 5678
Proxy_pass rabbitmq
}
}
[root@nginx~conf] # vi rabbitmqstream.conf
Upstream mqweb {
Ip_hash
Server 192.168.8.131:15672
Server 192.168.8.132:15672
Server 192.168.8.133:15672
Server 192.168.8.134:15672
}
Server {
Listen 80
Server_name localhost
Location / {
Proxy_redirect off
Proxy_set_header Host $host
Proxy_set_header X-Real-IP $remote_addr
Proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for
Client_max_body_size 100m
Client_body_buffer_size 256k
Proxy_connect_timeout 60
Proxy_send_timeout 60
Proxy_read_timeout 60
Proxy_buffer_size 256k
Proxy_buffers 8 256k
Proxy_busy_buffers_size 512k
Proxy_temp_file_write_size 512k
}
}
restart the nginx container
[root@nginx~conf] # / usr/local/nginx/sbin/nginx-s reload
[root@nginx~conf] # / usr/local/nginx/sbin/nginx-s stop
[root@nginx~conf] # / usr/local/nginx/sbin/nginx
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.