Skip to content

Commit 83d186f

Browse files
committed
improve new server rolling
1 parent eaa248a commit 83d186f

File tree

3 files changed

+86
-23
lines changed

3 files changed

+86
-23
lines changed
12 KB
Loading
12 KB
Loading

modules/ROOT/pages/clustering/setup/discovery.adoc

Lines changed: 86 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Neo4j provides several mechanisms for cluster members to discover each other and
1111

1212
[IMPORTANT]
1313
====
14-
From Neo4j 5.22, the current server discovery service has been marked as v1 and a new version v2 has been introduced.
14+
From Neo4j 5.23, a new version v2 has been introduced.
1515
The new version v2 is recommended for new deployments.
1616
1717
From Neo4j 5.23, the current version v1 has been deprecated.
@@ -57,17 +57,19 @@ dbms.cluster.discovery.resolver_type=LIST
5757
5858
server.discovery.advertised_address=server01.example.com:5000
5959
dbms.cluster.discovery.endpoints=server01.example.com:5000,server02.example.com:5000,server03.example.com:5000
60+
6061
dbms.cluster.discovery.version=V1_ONLY
6162
----
6263
======
63-
[role=include-with-discovery-service-v2 label--new-5.22]
64+
[role=include-with-discovery-service-v2 label--new-5.23]
6465
======
6566
[source, parameters]
6667
----
6768
dbms.cluster.discovery.resolver_type=LIST
6869
6970
server.cluster.advertised_address=server01.example.com:6000
7071
dbms.cluster.discovery.v2.endpoints=server01.example.com:6000,server02.example.com:6000,server03.example.com:6000
72+
7173
dbms.cluster.discovery.version=V2_ONLY
7274
----
7375
======
@@ -104,14 +106,15 @@ dbms.cluster.discovery.endpoints=cluster01.example.com:5000
104106
dbms.cluster.discovery.version=V1_ONLY
105107
----
106108
======
107-
[role=include-with-discovery-service-v2 label--new-5.22]
109+
[role=include-with-discovery-service-v2 label--new-5.23]
108110
======
109111
[source, parameters]
110112
----
111113
dbms.cluster.discovery.resolver_type=DNS
112114
113115
server.cluster.advertised_address=server01.example.com:6000
114116
dbms.cluster.discovery.v2.endpoints=cluster01.example.com:6000
117+
115118
dbms.cluster.discovery.version=V2_ONLY
116119
117120
----
@@ -150,14 +153,15 @@ dbms.cluster.discovery.version=V1_ONLY
150153
The SRV record returned by DNS should contain the IP address or hostname, and the *discovery* port for the servers to be discovered.
151154
The configured server uses all the addresses from the SRV record to join or form a cluster.
152155
======
153-
[role=include-with-discovery-service-v2 label--new-5.22]
156+
[role=include-with-discovery-service-v2 label--new-5.23]
154157
======
155158
[source, parameters]
156159
----
157160
dbms.cluster.discovery.resolver_type=SRV
158161
159162
server.cluster.advertised_address=server01.example.com:6000
160163
dbms.cluster.discovery.v2.endpoints=cluster01.example.com:0
164+
161165
dbms.cluster.discovery.version=V2_ONLY
162166
----
163167

@@ -228,7 +232,7 @@ For more information, see <<clustering-discovery-k8s>>.
228232
In-place rolling reduces fault tolerance temporarily because you are restarting a running server.
229233
To keep fault-tolerance, you can introduce a fourth server temporarily.
230234
====
231-
. Ensure that the new settings are added to the configuration as detailed in the preparation section.
235+
. Ensure that the new settings are added to the configuration as detailed in the xref:clustering/setup/discovery.adoc#_preparation[preparation] section.
232236
. Restart server01 with the new setting `dbms.cluster.discovery.version=V1_OVER_V2`.
233237
+
234238
image:discovery-service/in-place-1-v1-over-v2.png[]
@@ -238,14 +242,16 @@ Ensure to restart them sequentially, not in parallel.
238242
+
239243
image:discovery-service/in-place-23-v1-over-v2.png[]
240244

241-
. Using `bolt://`, connect to servers 1, 2, 3, and run the following procedure.
242-
It is important to connect via `bolt://` because otherwise the procedure might be routed and executed not on the intended server.
245+
. Using `bolt://`, connect to the system database of servers 1, 2, 3 and run the following procedure.
243246
+
244247
[source,cypher]
245248
----
246249
CALL dbms.cluster.showParallelDiscoveryState();
247250
----
248251
+
252+
For example this can be done using via `./cypher-shell -a bolt://localhost:7681 -d system`
253+
It is important to connect via `bolt://` because otherwise the procedure might be routed and executed not on the intended server.
254+
+
249255
They should display "Matching" in the `stateComparison`.
250256
If they are not, wait and try again.
251257
+
@@ -267,49 +273,106 @@ Note that `stateComparison` is `N/A` because you do not have v1 to compare state
267273

268274
[[discovery-v1-to-v2-new-server]]
269275
=== New server rolling
276+
. New server rolling will require 3 currently running servers, and 3 new servers.
277+
For all the servers, ensure that new settings are added to the configuration as detailed the xref:clustering/setup/discovery.adoc#_preparation[preparation] section.
278+
+
279+
As an example, for those using the list resolver, the settings for all the servers should include:
280+
+
281+
```
282+
dbms.cluster.discovery.resolver_type=LIST
270283

271-
. Ensure that the new settings are added to the configuration as detailed in the preparation section.
272-
. Start up three new servers with the setting `dbms.cluster.discovery.version=V1_OVER_V2`
284+
dbms.cluster.discovery.endpoints=server01.example.com:5000,server02.example.com:5000,server03.example.com:5000,server04.example.com:5000,server05.example.com:5000,server06.example.com:5000
285+
dbms.cluster.discovery.v2.endpoints=server04.example.com:6000,server05.example.com:6000,server06.example.com:6000
286+
```
287+
. Start up the three new servers with the setting `dbms.cluster.discovery.version=V1_OVER_V2`.
273288
+
274289
image:discovery-service/v1_over_v2.png[]
275-
276-
. Using `bolt://`, connect to servers 4, 5, 6, and run the following procedure.
277-
It is important to connect via `bolt://` because otherwise the procedure might be routed and executed not on the intended server.
290+
+
291+
. Using `bolt://`, connect to the system database of servers 4, 5, 6, and run the following procedure.
292+
This can be done using via `./cypher-shell -a bolt://localhost:7685 -d system` for example.
278293
+
279294
[source,cypher]
280295
----
281296
CALL dbms.cluster.showParallelDiscoveryState();
282297
----
283298
+
284-
The output should display `Matching` in the `stateComparison`.
285-
If they are not, wait and try again.
286-
Once matching, servers 1, 2, and 3 can be shut down.
287-
288-
. Start up another three new servers with the setting `dbms.cluster.discovery.version=V2_OVER_V1`.
299+
The expected result should show `v2ServerCount` to be 3.
300+
A stateComparison which is not matching is fine at this point.
301+
+
302+
[queryresult]
303+
----
304+
+---------------------------------------------------------------------------------------------------------+
305+
| mode | stateComparison | v1ServerCount | v2ServerCount |
306+
+---------------------------------------------------------------------------------------------------------+
307+
| "V1_OVER_V2" | "States are not matching after PT55M36.693S: (score:29)" | "6" | "3" |
308+
+---------------------------------------------------------------------------------------------------------+
309+
----
310+
+
311+
. Deallocate, drop, and shut down servers 1, 2, 3. Run `neo4j-admin unbind` on these three servers.
312+
+
313+
. Start up servers 1, 2, 3 again, this time with the setting `dbms.cluster.discovery.version=V2_OVER_V1`.
289314
+
290315
image:discovery-service/v2_over_v1.png[]
291-
292-
. Perform the same checks as in step 3 and then shut down members 4, 5, and 6.
293316
+
294-
. Finally, roll once more with setting `dbms.cluster.discovery.version=V2_ONLY`
317+
. Using `bolt://`, connect to the system database of servers 1, 2, 3, and run the following procedure.
318+
+
319+
[source,cypher]
320+
----
321+
CALL dbms.cluster.showParallelDiscoveryState();
322+
----
323+
+
324+
The output should display `Matching` in the `stateComparison`.
325+
If they are not, wait and try again till matching.
326+
+
327+
[queryresult]
328+
----
329+
+----------------------------------------------------------------+
330+
| mode | stateComparison | v1ServerCount | v2ServerCount |
331+
+----------------------------------------------------------------+
332+
| "V2_OVER_V1" | "Matching" | "6" | "6" |
333+
+----------------------------------------------------------------+
334+
----
335+
+
336+
. Deallocate, drop, and shut down servers 4, 5, 6. Run `neo4j-admin unbind` on these three servers.
337+
+
338+
. Start up servers 4, 5, 6 again, this time with the setting `dbms.cluster.discovery.version=V2_ONLY`.
295339
+
296340
image:discovery-service/v2_only.png[]
297-
341+
. Deallocate, drop, and shut down servers 1, 2, 3.
342+
+
343+
. Finally, one final check. Using `bolt://`, connect to the system database of servers 4, 5, 6, and run the following procedure.
344+
+
345+
[source,cypher]
346+
----
347+
CALL dbms.cluster.showParallelDiscoveryState();
348+
----
349+
+
350+
One should see the following:
351+
+
352+
[queryresult]
353+
----
354+
+-------------------------------------------------------------+
355+
| mode | stateComparison | v1ServerCount | v2ServerCount |
356+
+-------------------------------------------------------------+
357+
| "V2_ONLY" | "N/A" | "N/A" | "3" |
358+
+-------------------------------------------------------------+
359+
----
298360
[[discovery-v1-to-v2-procedures]]
361+
299362
=== Using procedures
300363

301364
// By using just procedures, the nice thing is that during the user's normal version upgrade, they can also add the new settings required for v2 discovery service.
302365
// Then, when they are ready to migrate to v2, they can use the procedures and then finally, set the version to 'V2' in the neo4j.conf at the very end - which can just sit there till the next restart
303366
// so no lighthouse-specific server restarts are required if all is done correctly.
304367
//Note that the settings detailed above must first be set and the servers restarted to allow the settings to take effect.
305368

306-
. Ensure that the new settings are added to the configuration as detailed in the preparation section.
369+
. Ensure that the new settings are added to the configuration as detailed in the xref:clustering/setup/discovery.adoc#_preparation[preparation] section.
307370
. Using Cypher Shell, connect to server01 using `bolt://`.
308371
It is important to connect via `bolt://` because otherwise the procedure might be routed and executed not on the intended server.
309372
+
310373
[source, shell, role=nocopy noplay]
311374
----
312-
./cypher-shell -a bolt://localhost:7681
375+
./cypher-shell -a bolt://localhost:7681 -d system
313376
----
314377

315378
. Change the active database to `system`:

0 commit comments

Comments
 (0)