You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: examples/features/broker-connection/ha-with-mesh-mirror/readme.md
+21-11Lines changed: 21 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,28 @@
1
-
# High Availability with Star Mirror and Distributed Locks
1
+
# High Availability with Mesh Mirror and Distributed Locks
2
2
3
-
This example demonstrates how to achieve high availability (HA) using star topology mirroring combined with distributed locks from the Lock Coordinator feature. The distributed locks ensure that only one broker accepts client connections at a time, providing automatic failover without split-brain scenarios across three brokers.
3
+
This example demonstrates how to achieve high availability (HA) using mesh topology mirroring combined with distributed locks from the Lock Coordinator feature. The distributed locks ensure that only one broker accepts client connections at a time, providing automatic failover without split-brain scenarios across three brokers.
4
4
5
5
## Overview
6
6
7
7
This example configures three brokers (server0, server1, and server2) that:
8
-
- Mirror all messaging operations to each other using broker connections in a star topology
8
+
- Mirror all messaging operations to each other using broker connections in a mesh topology
9
9
- Share a distributed file-based lock to coordinate which broker accepts client connections
10
10
- Automatically failover client connections when the active broker fails
11
11
- Use lock coordinator on broker connections to ensure mirroring only happens when the broker is active
- Only Server 0 (holding the lock) actively mirrors data to Server 1 and Server 2 (solid blue arrows)
19
+
- Server 1 and Server 2 have passive broker connections (dashed gray arrows - not actively mirroring)
20
+
- When Server 0 fails, Server 1 or Server 2 acquires the lock and becomes active
21
+
- The new active server's connections become active and start mirroring
22
+
13
23
## How It Works
14
24
15
-
### Star Topology Mirroring Configuration
25
+
### Mesh Topology Mirroring Configuration
16
26
17
27
All three brokers are configured with mirroring to the other two brokers using AMQP broker connections. The key feature is using the **lock-coordinator attribute on broker connections**, which ensures that mirroring only happens when the broker holding the lock is active.
18
28
@@ -54,7 +64,7 @@ All three brokers are configured with mirroring to the other two brokers using A
54
64
</broker-connections>
55
65
```
56
66
57
-
This ensures that messages, queues, and other operations are replicated across all three brokers in a star topology.
67
+
This ensures that messages, queues, and other operations are replicated across all three brokers in a mesh topology.
58
68
59
69
### Lock Coordinator for HA
60
70
@@ -64,7 +74,7 @@ The key feature of this example is the use of **distributed locks** to control w
@@ -97,7 +107,7 @@ When the active broker (holding the lock) fails:
97
107
1. The lock is automatically released
98
108
2. One of the backup brokers acquires the lock and starts accepting connections
99
109
3. The client automatically reconnects to the now-active broker
100
-
4. All messages are available due to star mirroring
110
+
4. All messages are available due to mesh mirroring
101
111
102
112
## Setup
103
113
@@ -107,7 +117,7 @@ You have the following options to run this example:
107
117
108
118
### Non-interactive way
109
119
110
-
You can run this example in a non-interactive way, with HAWithStarMirrorExample starting, stopping the servers, and consume messages from your servers during failover.
120
+
You can run this example in a non-interactive way, with HAWithMeshMirrorExample starting, stopping the servers, and consume messages from your servers during failover.
111
121
112
122
```shell
113
123
mvn verify -Pautomated
@@ -206,7 +216,7 @@ To observe the high availability in action:
206
216
207
217
## Example Flow
208
218
209
-
1. All three brokers start with star mirroring configured
219
+
1. All three brokers start with mesh mirroring configured
210
220
2. One broker (typically server0) acquires the distributed lock and accepts client connections
211
221
3. The client connects and sends 30 messages to a queue
212
222
4. Server0 is killed (simulating a failure)
@@ -220,7 +230,7 @@ The lock coordinator supports different lock types (file-based, ZooKeeper). This
220
230
221
231
The `check-period` parameter (in milliseconds) controls how frequently the lock holder verifies it still owns the lock, affecting how quickly failover occurs when a broker crashes.
222
232
223
-
**Important:** This example demonstrates the star topology with lock coordinator on broker connections. Unlike the dual mirror example, the lock-coordinator attribute is specified on the broker connections themselves, ensuring that mirroring only occurs when a broker holds the lock. This prevents multiple brokers from simultaneously trying to mirror to each other when they don't have the client lock.
233
+
**Important:** This example demonstrates the mesh topology with lock coordinator on broker connections. Unlike the dual mirror example, the lock-coordinator attribute is specified on the broker connections themselves, ensuring that mirroring only occurs when a broker holds the lock. This prevents multiple brokers from simultaneously trying to mirror to each other when they don't have the client lock.
224
234
225
235
## Change the configuration to ZooKeeper
226
236
@@ -230,7 +240,7 @@ If you want to try ZooKeeper, you need to change the lock-coordinator configurat
Copy file name to clipboardExpand all lines: examples/features/broker-connection/ha-with-mesh-mirror/src/main/java/org/apache/artemis/jms/example/CreateServers.java
Copy file name to clipboardExpand all lines: examples/features/broker-connection/ha-with-mesh-mirror/src/main/java/org/apache/artemis/jms/example/HAWithMeshMirrorExample.java
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -30,9 +30,9 @@
30
30
importorg.apache.activemq.artemis.utils.FileUtil;
31
31
32
32
/**
33
-
* Example of star topology mirroring with three servers using lock coordinator on broker connections
33
+
* Example of mesh topology mirroring with three servers using lock coordinator on broker connections
0 commit comments