Skip to content

Commit ba6caca

Browse files
Clarify on how to manage Neo4j cluster with ASG on AWS (#2334) (#2359)
1 parent c34bdaa commit ba6caca

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

modules/ROOT/pages/cloud-deployments/neo4j-aws.adoc

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,46 @@ When the CloudFormation template creates a new Neo4j cluster, an Auto Scaling gr
135135
If you add more EC2 instances to your ASG, they will be installed with the same monthly version, ensuring that all Neo4j cluster servers are installed with the same version, regardless of when the EC2 instances were created.
136136

137137

138+
=== Neo4j cluster and Auto Scaling Group
139+
140+
The Neo4j AWS CloudFormation template deploys a cluster into an ASG.
141+
However, managing a Neo4j cluster with ASG requires careful planning.
142+
Starting from the 5.x series, Neo4j’s clustering relies on stable servers identities.
143+
In contrast, ASGs are primarily designed for stateless, interchangeable workloads, which means they can terminate and recreate servers at any time, breaking their identity.
144+
145+
To provide stable servers identities, it is recommended to use a persistent disk, e.g., Amazon Elastic Block Store (EBS).
146+
For more information about EBS volumes, see link:https://docs.aws.amazon.com/ebs/latest/userguide/ebs-volumes.html[Amazon EBS volumes].
147+
Amazon EBS provides block storage resources that can be used with Amazon EC2 instances.
148+
149+
If a server in Neo4j cluster does not remount its original EBS volume, it will either:
150+
151+
* Start with no data (store copy issue).
152+
* Fail to rejoin the cluster correctly.
153+
154+
How to run Neo4j cluster in EC2 instances with ASGs::
155+
+
156+
. Create an EBS volume and tag it.
157+
You can follow the steps outlined in the guide link:https://docs.aws.amazon.com/ebs/latest/userguide/ebs-creating-volume.html[Create an Amazon EBS volume].
158+
+
159+
. Attach the EBS volume to an Amazon EC2 instance in the same Availability Zone.
160+
For more information, see link:https://docs.aws.amazon.com/ebs/latest/userguide/ebs-attaching-volume.html[Attach an Amazon EBS volume to an Amazon EC2 instance].
161+
+
162+
. Ensure stable volume re-attachment.
163+
Use an instance startup script (via EC2 User data or `systemd` service) to:
164+
.. Identify its own logical identity (e.g., via private IP or hostname).
165+
.. Locate the correct EBS volume by tag.
166+
.. Attach the volume to the instance.
167+
.. Mount the volume to `/var/lib/neo4j` or appropriate data directory.
168+
+
169+
. Use rolling updates only.
170+
Set `maxSurge = 0` and `maxUnavailable = 1` in any update mechanism to avoid multiple restarts that could destabilize the cluster.
171+
+
172+
. Avoid auto-healing on cluster members.
173+
ASG health checks should not terminate cluster members automatically.
174+
Use external monitoring (e.g., Prometheus, Neo4j’s health checks) and manual intervention for cluster members.
175+
176+
177+
138178
=== Remove a server from the Neo4j cluster
139179

140180
Rolling updates on Amazon Machine Images (AMIs) often involve rotating the images.

0 commit comments

Comments
 (0)