forked from stuartwdouglas/modcluster-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
clustering-domain-mode.txt
56 lines (39 loc) · 2.68 KB
/
clustering-domain-mode.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#IMPORTANT: this config is not suitable for production use, as it only uses a single network interface
#for production use the socket bindings used by modcluster (management and advertise) should be only
#exposed to the internal network, not a public IP
#cleanup existing servers that are enabled by default
:stop-servers(blocking=true)
/host=master/server-config=server-one:remove
/host=master/server-config=server-two:remove
/host=master/server-config=server-three:remove
/server-group=main-server-group:remove
/server-group=other-server-group:remove
#add the IP address 192.168.1.4 to the host aliases (replace with your local IP)
/profile=ha/subsystem=undertow/server=default-server/host=default-host:write-attribute(name=alias, value=[192.168.1.4])
#set the mod_cluster security key
/profile=ha/subsystem=modcluster/mod-cluster-config=configuration:write-attribute(name=advertise-security-key, value=mypassword)
#add backend server group
/server-group=backend-servers:add(profile=ha, socket-binding-group=ha-sockets)
#add backend servers, using the ha profile so mod_cluster support is included
/host=master/server-config=backend1:add(group=backend-servers, socket-binding-port-offset=100)
/host=master/server-config=backend2:add(group=backend-servers, socket-binding-port-offset=200)
#start the backend servers
/server-group=backend-servers:start-servers
#add system properties (so we can tell them apart)
/host=master/server-config=backend1/system-property=server.name:add(boot-time=false, value=backend1)
/host=master/server-config=backend2/system-property=server.name:add(boot-time=false, value=backend2)
#Deploy the demo to our backend servers
deploy ~/workspace/modcluster-example/load-balancing-demo/target/clustering-demo.war --server-groups=backend-servers
#now set up the default profile to include the mod_cluster load balancer
/profile=default/subsystem=undertow/configuration=filter/mod-cluster=modcluster:add(management-socket-binding=http, advertise-socket-binding=modcluster, security-key=mypassword)
/profile=default/subsystem=undertow/server=default-server/host=default-host/filter-ref=modcluster:add
/socket-binding-group=standard-sockets/socket-binding=modcluster:add(port=23364, multicast-address=224.0.1.105)
/server-group=load-balancer:add(profile=default, socket-binding-group=standard-sockets)
/host=master/server-config=load-balancer:add(group=load-balancer)
/server-group=load-balancer:start-servers
#now lets add another server
/host=master/server-config=backend3:add(group=backend-servers, socket-binding-port-offset=300)
:start-servers
/host=master/server-config=backend3/system-property=server.name:add(boot-time=false, value=backend3)
#and remove one
/host=master/server=backend1:stop