We welcome your comments and suggestions, please leave a message found an error
Files needed to download:
Baidu Cloud: link: https: //pan.baidu.com/s/1gpZa2NjNxviEnihjS2Viuw extraction code: 39hi copy the contents of this open Baidu network disk phone App, the operation more convenient oh
Blue Cloud played: Download: https: //www.lanzous.com/i54x5da Password: cgb9
Reference Hirofumi:
https://blog.csdn.net/elie_yang/article/details/86657851
https://blog.csdn.net/kq1983/article/details/84112762
https://blog.csdn.net/hxpjava1/article/details/78303097
https://blog.csdn.net/u013256816/article/details/77150922
https://www.cnblogs.com/tx720/p/9943753.html
Foreword
First, be clear about the theme: In Windows build environment rabbitmq clustering and load.
Two servers in this environment to build, IP are as follows:
172.16.100.121
172.16.100.122
In the following description I will 172.16.100.121 referred to as 121 , to 172.16.100.122 called 122
Build rabbitmq cluster
1 , download Erlang program, you can http://www.erlang.org/download.html download.
2 , installation rabbitmq-server-windows , download http://www.rabbitmq.com/server.html .
3 , 121 , 122 two servers must be installed ( the Erlang, RabbitMQ-Server-Windows ) ( default installation can be ) .
4, with 121 at C: \ Users \ Administrator folder .erlang.cookie text replacement off 122 at C: \ Users \ Administrator under file .erlang.cookie text member
5, with 121 at C: \ Windows \ System32 \ config \ systemprofile folder .erlang.cookie text element replaces 122 at C: \ Windows \ System32 \ config \ systemprofile the file .erlang.cookie text member
6, in the 121 opened in RabbitMQ command line operating tool (and in the installation directory under sbin open directory cmd is the same)
Open execute the following command:
# Delete the default user
rabbitmqctl delete_user guest
# Add vhost
rabbitmqctl add_vhost /vhost
# Add User rabbitmqctl add_user {username} {password}
rabbitmqctl add_user admin 123456
# Set the label to a user none management monitoring administrator plurality of use , the partition
#rabbitmqctl set_user_tags {username} {tag ...}
rabbitmqctl set_user_tags admin administrator
# Granting admin users can access virtual host vhost , and has can be configured on all the resources writeable and readable permissions
rabbitmqctl set_permissions -p /vhost admin ".*" ".*" ".*"
# Open the Web version of the console
rabbitmq-plugins.bat enable rabbitmq_management
Restart service RabbitMQ service to take effect.
Enter the IP plus port number used to access the web version of the console
We just added by admin 123456 log
After the landing page that is seen above configuration is successful.
Incidentally record 121 server name rabbit @ Lenovo-LBKXT682
In 122 Repeat server 6 steps.
顺便记录下122服务器的名字 rabbit@LENOVO-LA0X1508
7、在121 RabbitMQ命令行工具中执行:rabbitmqctl stop_app 然后继续执行命令:rabbitmqctl join_cluster rabbit@LENOVO-LA0X1508(填写服务器名,这里我们填写122的服务器名)
8、rabbitmqctl change_cluster_node_type ram;将节点类型修改为ram(默认为disc)
9、rabbitmqctl start_app;开启应用,非节点服务
10、rabbitmqctl cluster_status;查看集群状态,disc:为磁盘节点,ram:为内存节点;
11、再次访问121的网页版控制台可以看到如下信息则表明成功!
RabbitMq+Haproxy负载均衡
首先下载haproxy。
在实际使用过程中haproxy各个版本.cfg文件中是有一定区别的我这里使用的是haproxy-1.8.14这样一个版本,RabbitMq+Haproxy主要也是配置文件中的配置。
配置文件内容如下:
将解压文件放置在121中在其目录下执行haproxy.exe -f haproxy.cfg -d 命令开启haproxy服务。
haproxy服务启动后通过:
http://172.16.100.121:8000/stats 访问haproxy控制台。
URL组成介绍:
到这里搭建过程就完结了,后续使用过程中出现什么问题我将会在下方补充。