Skip to content

Commit 0f1eb20

Browse files
Add improvements for HA docs (#984)
* change port numbers for more obvious differences * change all other ports * fix nuraft log
1 parent e61e422 commit 0f1eb20

File tree

1 file changed

+40
-40
lines changed

1 file changed

+40
-40
lines changed

pages/clustering/high-availability.mdx

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ These two flags are tied to the high availability feature, enable the coordinato
9292
docker run --name instance1 -p 7687:7687 -p 7444:7444 memgraph/memgraph-mage
9393
--data-recovery-on-startup=true \
9494
--replication-restore-state-on-startup=true \
95-
--management-port=10011 \
95+
--management-port=13011 \
9696
--bolt-port=7687 \
9797
--experimental-enabled=high-availability
9898
```
@@ -106,7 +106,7 @@ docker run --name coord1 -p 7690:7687 -p 7445:7444 memgraph/memgraph-mage
106106
--coordinator-id=1
107107
--experimental-enabled=high-availability
108108
--coordinator-hostname=localhost
109-
--management-port=10121
109+
--management-port=12121
110110
```
111111

112112
Coordinator IDs serve as identifiers, the coordinator port is used for synchronization and log replication between coordinators and management port is used to get health state of cluster from leader coordinator.
@@ -139,7 +139,7 @@ Here are the environment variables you need to use to set data instance using on
139139

140140
```
141141
export MEMGRAPH_EXPERIMENTAL_ENABLED=high-availability
142-
export MEMGRAPH_MANAGEMENT_PORT=10011
142+
export MEMGRAPH_MANAGEMENT_PORT=13011
143143
export MEMGRAPH_BOLT_PORT=7692
144144
```
145145

@@ -156,7 +156,7 @@ export MEMGRAPH_BOLT_PORT=7692
156156
export MEMGRAPH_HA_DURABILITY=true
157157
export MEMGRAPH_NURAFT_LOG_FILE="<path-to-log-file>"
158158
export MEMGRAPH_COORDINATOR_HOSTNAME="localhost"
159-
export MEMGRAPH_MANAGEMENT_PORT=10121
159+
export MEMGRAPH_MANAGEMENT_PORT=12121
160160
```
161161

162162
When using any of these environment variables, flags for `--bolt-port`, `--coordinator-port`, `--coordinator-id`,`--coordinator-hostname` and `--experimental-enabled` will be ignored.
@@ -207,8 +207,8 @@ If you are running `ADD COORDINATOR` Cypher queries on coordinator with --coordi
207207
coordinators you need to use two `ADD COORDINATOR` queries:
208208

209209
```
210-
ADD COORDINATOR 2 WITH CONFIG {"bolt_server": "127.0.0.1:7691", "coordinator_server": "127.0.0.1:10112"};
211-
ADD COORDINATOR 3 WITH CONFIG {"bolt_server": "127.0.0.1:7692", "coordinator_server": "127.0.0.1:10113"};
210+
ADD COORDINATOR 2 WITH CONFIG {"bolt_server": "127.0.0.1:7691", "coordinator_server": "127.0.0.1:10112", "management_server": "127.0.0.1:12112"};
211+
ADD COORDINATOR 3 WITH CONFIG {"bolt_server": "127.0.0.1:7692", "coordinator_server": "127.0.0.1:10113", "management_server": "127.0.0.1:12113"};
212212
```
213213

214214
</Callout>
@@ -560,12 +560,12 @@ You can directly use initialization file `HA_register.cypher`:
560560

561561
```
562562
563-
ADD COORDINATOR 2 WITH CONFIG {"bolt_server": "coord2:7691", "coordinator_server": "coord2:10112", "management_server": "coord2:10122"};
564-
ADD COORDINATOR 3 WITH CONFIG {"bolt_server": "coord3:7692", "coordinator_server": "coord3:10113", "management_server": "coord3:10123"};
563+
ADD COORDINATOR 2 WITH CONFIG {"bolt_server": "coord2:7691", "coordinator_server": "coord2:10112", "management_server": "coord2:12122"};
564+
ADD COORDINATOR 3 WITH CONFIG {"bolt_server": "coord3:7692", "coordinator_server": "coord3:10113", "management_server": "coord3:12123"};
565565
566-
REGISTER INSTANCE instance_1 WITH CONFIG {"bolt_server": "instance1:7687", "management_server": "instance1:10011", "replication_server": "instance1:10001"};
567-
REGISTER INSTANCE instance_2 WITH CONFIG {"bolt_server": "instance2:7688", "management_server": "instance2:10012", "replication_server": "instance2:10002"};
568-
REGISTER INSTANCE instance_3 WITH CONFIG {"bolt_server": "instance3:7689", "management_server": "instance3:10013", "replication_server": "instance3:10003"};
566+
REGISTER INSTANCE instance_1 WITH CONFIG {"bolt_server": "instance1:7687", "management_server": "instance1:13011", "replication_server": "instance1:10001"};
567+
REGISTER INSTANCE instance_2 WITH CONFIG {"bolt_server": "instance2:7688", "management_server": "instance2:13012", "replication_server": "instance2:10002"};
568+
REGISTER INSTANCE instance_3 WITH CONFIG {"bolt_server": "instance3:7689", "management_server": "instance3:13013", "replication_server": "instance3:10003"};
569569
SET INSTANCE instance_3 TO MAIN;
570570
571571
```
@@ -591,7 +591,7 @@ services:
591591
- ./HA_register.cypher:/tmp/init/HA_register.cypher:ro
592592
environment:
593593
- MEMGRAPH_HA_CLUSTER_INIT_QUERIES=/tmp/init/HA_register.cypher
594-
command: [ "--init-file=/tmp/init/license.cypher", "--log-level=TRACE", "--data-directory=/tmp/mg_data_coord1", "--log-file=/tmp/coord1.log", "--also-log-to-stderr", "--coordinator-id=1", "--coordinator-port=10111", "--management-port=10121", "--coordinator-hostname=coord1", "--experimental-enabled=high-availability"]
594+
command: [ "--init-file=/tmp/init/license.cypher", "--log-level=TRACE", "--data-directory=/tmp/mg_data_coord1", "--log-file=/tmp/coord1.log", "--also-log-to-stderr", "--coordinator-id=1", "--coordinator-port=10111", "--management-port=12121", "--coordinator-hostname=coord1", "--experimental-enabled=high-availability"]
595595
networks:
596596
memgraph_ha:
597597
ipv4_address: 172.21.0.4
@@ -601,7 +601,7 @@ services:
601601
container_name: coord2
602602
volumes:
603603
- ./license.cypher:/tmp/init/license.cypher:ro
604-
command: [ "--init-file=/tmp/init/license.cypher", "--log-level=TRACE", "--data-directory=/tmp/mg_data_coord2", "--log-file=/tmp/coord2.log", "--also-log-to-stderr", "--coordinator-id=2", "--coordinator-port=10112", "--management-port=10122", "--coordinator-hostname=coord2", "--experimental-enabled=high-availability"]
604+
command: [ "--init-file=/tmp/init/license.cypher", "--log-level=TRACE", "--data-directory=/tmp/mg_data_coord2", "--log-file=/tmp/coord2.log", "--also-log-to-stderr", "--coordinator-id=2", "--coordinator-port=10112", "--management-port=12122", "--coordinator-hostname=coord2", "--experimental-enabled=high-availability"]
605605
networks:
606606
memgraph_ha:
607607
ipv4_address: 172.21.0.2
@@ -611,7 +611,7 @@ services:
611611
container_name: coord3
612612
volumes:
613613
- ./license.cypher:/tmp/init/license.cypher:ro
614-
command: [ "--init-file=/tmp/init/license.cypher", "--log-level=TRACE", "--data-directory=/tmp/mg_data_coord3", "--log-file=/tmp/coord3.log", "--also-log-to-stderr", "--coordinator-id=3", "--coordinator-port=10113", "--management-port=10123", "--coordinator-hostname=coord3", "--experimental-enabled=high-availability"]
614+
command: [ "--init-file=/tmp/init/license.cypher", "--log-level=TRACE", "--data-directory=/tmp/mg_data_coord3", "--log-file=/tmp/coord3.log", "--also-log-to-stderr", "--coordinator-id=3", "--coordinator-port=10113", "--management-port=12123", "--coordinator-hostname=coord3", "--experimental-enabled=high-availability"]
615615
616616
networks:
617617
memgraph_ha:
@@ -622,7 +622,7 @@ services:
622622
container_name: instance1
623623
volumes:
624624
- ./license.cypher:/tmp/init/license.cypher:ro
625-
command: ["--init-file=/tmp/init/license.cypher","--data-recovery-on-startup=true", "--log-level=TRACE", "--data-directory=/tmp/mg_data_instance1", "--log-file=/tmp/instance1.log", "--also-log-to-stderr", "--management-port=10011", "--experimental-enabled=high-availability"]
625+
command: ["--init-file=/tmp/init/license.cypher","--data-recovery-on-startup=true", "--log-level=TRACE", "--data-directory=/tmp/mg_data_instance1", "--log-file=/tmp/instance1.log", "--also-log-to-stderr", "--management-port=13011", "--experimental-enabled=high-availability"]
626626
networks:
627627
memgraph_ha:
628628
ipv4_address: 172.21.0.6
@@ -632,7 +632,7 @@ services:
632632
container_name: instance2
633633
volumes:
634634
- ./license.cypher:/tmp/init/license.cypher:ro
635-
command: ["--init-file=/tmp/init/license.cypher","--data-recovery-on-startup=true", "--log-level=TRACE", "--data-directory=/tmp/mg_data_instance2", "--log-file=/tmp/instance2.log", "--also-log-to-stderr", "--management-port=10012", "--experimental-enabled=high-availability"]
635+
command: ["--init-file=/tmp/init/license.cypher","--data-recovery-on-startup=true", "--log-level=TRACE", "--data-directory=/tmp/mg_data_instance2", "--log-file=/tmp/instance2.log", "--also-log-to-stderr", "--management-port=13012", "--experimental-enabled=high-availability"]
636636
networks:
637637
memgraph_ha:
638638
ipv4_address: 172.21.0.7
@@ -642,7 +642,7 @@ services:
642642
container_name: instance3
643643
volumes:
644644
- ./license.cypher:/tmp/init/license.cypher:ro
645-
command: ["--init-file=/tmp/init/license.cypher","--data-recovery-on-startup=true", "--log-level=TRACE", "--data-directory=/tmp/mg_data_instance3", "--log-file=/tmp/instance3.log", "--also-log-to-stderr", "--management-port=10013", "--experimental-enabled=high-availability"]
645+
command: ["--init-file=/tmp/init/license.cypher","--data-recovery-on-startup=true", "--log-level=TRACE", "--data-directory=/tmp/mg_data_instance3", "--log-file=/tmp/instance3.log", "--also-log-to-stderr", "--management-port=13013", "--experimental-enabled=high-availability"]
646646
networks:
647647
memgraph_ha:
648648
ipv4_address: 172.21.0.8
@@ -661,32 +661,32 @@ This example will show how to set up a highly available cluster in Memgraph usin
661661

662662
1. Start coordinator1:
663663
```plaintext
664-
docker run --name coord1 -p 7690:7690 -p 7444:7444 memgraph/memgraph-mage --bolt-port=7690 --log-level=TRACE --data-directory=/tmp/mg_data_coord3 --log-file=/tmp/coord1.log --also-log-to-stderr --coordinator-id=1 --coordinator-port=10111 --management-port=10121 --experimental-enabled=high-availability --coordinator-hostname=localhost
664+
docker run --name coord1 -p 7690:7690 -p 7444:7444 memgraph/memgraph-mage --bolt-port=7690 --log-level=TRACE --data-directory=/tmp/mg_data_coord3 --log-file=/tmp/coord1.log --also-log-to-stderr --coordinator-id=1 --coordinator-port=10111 --management-port=12121 --experimental-enabled=high-availability --coordinator-hostname=localhost --nuraft-log-file=/tmp/nuraft/coord1.log
665665
```
666666

667667
2. Start coordinator2:
668668
```plaintext
669-
docker run --name coord2 -p 7691:7691 -p 7445:7444 memgraph/memgraph-mage --bolt-port=7691 --log-level=TRACE --data-directory=/tmp/mg_data_coord2 --log-file=/tmp/coord2.log --nuraft-log-file=/tmp/nuraft/coord2.log --also-log-to-stderr --coordinator-id=2 --coordinator-port=10112 --management-port=10122 --experimental-enabled=high-availability --coordinator-hostname=localhost
669+
docker run --name coord2 -p 7691:7691 -p 7445:7444 memgraph/memgraph-mage --bolt-port=7691 --log-level=TRACE --data-directory=/tmp/mg_data_coord2 --log-file=/tmp/coord2.log --also-log-to-stderr --coordinator-id=2 --coordinator-port=10112 --management-port=12122 --experimental-enabled=high-availability --coordinator-hostname=localhost --nuraft-log-file=/tmp/nuraft/coord2.log
670670
```
671671

672672
3. Start coordinator3:
673673
```plaintext
674-
docker run --name coord3 -p 7692:7692 -p 7446:7444 memgraph/memgraph-mage --bolt-port=7692 --log-level=TRACE --data-directory=/tmp/mg_data_coord3 --log-file=/tmp/coord3.log --nuraft-log-file=/tmp/nuraft/coord1.log --also-log-to-stderr --coordinator-id=3 --coordinator-port=10113 --management-port=10123 --experimental-enabled=high-availability --coordinator-hostname=localhost
674+
docker run --name coord3 -p 7692:7692 -p 7446:7444 memgraph/memgraph-mage --bolt-port=7692 --log-level=TRACE --data-directory=/tmp/mg_data_coord3 --log-file=/tmp/coord3.log --also-log-to-stderr --coordinator-id=3 --coordinator-port=10113 --management-port=12123 --experimental-enabled=high-availability --coordinator-hostname=localhost --nuraft-log-file=/tmp/nuraft/coord3.log
675675
```
676676

677677
4. Start instance1:
678678
```plaintext
679-
docker run --name instance1 -p 7687:7687 -p 7447:7444 memgraph/memgraph-mage --bolt-port=7687 --log-level=TRACE --data-directory=/tmp/mg_data_instance1 --log-file=/tmp/instance1.log --also-log-to-stderr --management-port=10011 --experimental-enabled=high-availability --data-recovery-on-startup=true
679+
docker run --name instance1 -p 7687:7687 -p 7447:7444 memgraph/memgraph-mage --bolt-port=7687 --log-level=TRACE --data-directory=/tmp/mg_data_instance1 --log-file=/tmp/instance1.log --also-log-to-stderr --management-port=13011 --experimental-enabled=high-availability --data-recovery-on-startup=true
680680
```
681681

682682
5. Start instance2:
683683
```plaintext
684-
docker run --name instance2 -p 7688:7688 -p 7448:7444 memgraph/memgraph-mage --bolt-port=7688 --log-level=TRACE --data-directory=/tmp/mg_data_instance2 --log-file=/tmp/instance2.log --also-log-to-stderr --management-port=10012 --experimental-enabled=high-availability --data-recovery-on-startup=true
684+
docker run --name instance2 -p 7688:7688 -p 7448:7444 memgraph/memgraph-mage --bolt-port=7688 --log-level=TRACE --data-directory=/tmp/mg_data_instance2 --log-file=/tmp/instance2.log --also-log-to-stderr --management-port=13012 --experimental-enabled=high-availability --data-recovery-on-startup=true
685685
```
686686

687687
6. Start instance3:
688688
```plaintext
689-
docker run --name instance3 -p 7689:7689 -p 7449:7444 memgraph/memgraph-mage --bolt-port=7689 --log-level=TRACE --data-directory=/tmp/mg_data_instance3 --log-file=/tmp/instance3.log --also-log-to-stderr --management-port=10013 --experimental-enabled=high-availability --data-recovery-on-startup=true
689+
docker run --name instance3 -p 7689:7689 -p 7449:7444 memgraph/memgraph-mage --bolt-port=7689 --log-level=TRACE --data-directory=/tmp/mg_data_instance3 --log-file=/tmp/instance3.log --also-log-to-stderr --management-port=13013 --experimental-enabled=high-availability --data-recovery-on-startup=true
690690
```
691691

692692
### Register instances
@@ -698,8 +698,8 @@ mgconsole --port=7690
698698
2. Connect the other two coordinator instances to the cluster.
699699

700700
```plaintext
701-
ADD COORDINATOR 2 WITH CONFIG {"bolt_server": "localhost:7691", "coordinator_server": "localhost:10112", "management_server": "localhost:10122"};
702-
ADD COORDINATOR 3 WITH CONFIG {"bolt_server": "localhost:7692", "coordinator_server": "localhost:10113", "management_server": "localhost:10123"};
701+
ADD COORDINATOR 2 WITH CONFIG {"bolt_server": "localhost:7691", "coordinator_server": "localhost:10112", "management_server": "localhost:12122"};
702+
ADD COORDINATOR 3 WITH CONFIG {"bolt_server": "localhost:7692", "coordinator_server": "localhost:10113", "management_server": "localhost:12123"};
703703
```
704704

705705
3. Register 3 data instances as part of the cluster:
@@ -711,9 +711,9 @@ Replace `<ip_address>` with the container's IP address. This is necessary for Do
711711
</Callout>
712712

713713
```plaintext
714-
REGISTER INSTANCE instance_1 WITH CONFIG {"bolt_server": "localhost:7687", "management_server": "localhost:10011", "replication_server": "localhost:10001"};
715-
REGISTER INSTANCE instance_2 WITH CONFIG {"bolt_server": "localhost:7688", "management_server": "localhost:10012", "replication_server": "localhost:10002"};
716-
REGISTER INSTANCE instance_3 WITH CONFIG {"bolt_server": "localhost:7689", "management_server": "localhost:10013", "replication_server": "localhost:10003"};
714+
REGISTER INSTANCE instance_1 WITH CONFIG {"bolt_server": "localhost:7687", "management_server": "localhost:13011", "replication_server": "localhost:10001"};
715+
REGISTER INSTANCE instance_2 WITH CONFIG {"bolt_server": "localhost:7688", "management_server": "localhost:13012", "replication_server": "localhost:10002"};
716+
REGISTER INSTANCE instance_3 WITH CONFIG {"bolt_server": "localhost:7689", "management_server": "localhost:13013", "replication_server": "localhost:10003"};
717717
```
718718

719719
4. Set instance_3 as MAIN:
@@ -726,12 +726,12 @@ SET INSTANCE instance_3 TO MAIN;
726726

727727
| name | bolt_server | coordinator_server | management_server | health | role | last_succ_resp_ms |
728728
| ------------- | -------------- | ------------------ | ----------------- | ------ | -------- | ---------------- |
729-
| coordinator_1 | localhost:7690 | localhost:10111 | localhost:10121 | up | leader | 0 |
730-
| coordinator_2 | localhost:7691 | localhost:10112 | localhost:10122 | up | follower | 16 |
731-
| coordinator_3 | localhost:7692 | localhost:10113 | localhost:10123 | up | follower | 25 |
732-
| instance_1 | localhost:7687 | "" | localhost:10011 | up | replica | 39 |
733-
| instance_2 | localhost:7688 | "" | localhost:10012 | up | replica | 21 |
734-
| instance_3 | localhost:7689 | "" | localhost:10013 | up | main | 91 |
729+
| coordinator_1 | localhost:7690 | localhost:10111 | localhost:12121 | up | leader | 0 |
730+
| coordinator_2 | localhost:7691 | localhost:10112 | localhost:12122 | up | follower | 16 |
731+
| coordinator_3 | localhost:7692 | localhost:10113 | localhost:12123 | up | follower | 25 |
732+
| instance_1 | localhost:7687 | "" | localhost:13011 | up | replica | 39 |
733+
| instance_2 | localhost:7688 | "" | localhost:13012 | up | replica | 21 |
734+
| instance_3 | localhost:7689 | "" | localhost:13013 | up | main | 91 |
735735

736736
### Check automatic failover
737737

@@ -740,11 +740,11 @@ that and automatically promote the first alive REPLICA to become the new MAIN. T
740740

741741
| name | bolt_server | coordinator_server | management_server | health | role | last_succ_resp_ms |
742742
| ------------- | -------------- | ------------------ | ----------------- | ------ | -------- | ------------------|
743-
| coordinator_1 | localhost:7690 | localhost:10111 | localhost:10121 | up | leader | 0 |
744-
| coordinator_2 | localhost:7691 | localhost:10112 | localhost:10122 | up | follower | 34 |
745-
| coordinator_3 | localhost:7692 | localhost:10113 | localhost:10123 | up | follower | 28 |
746-
| instance_1 | localhost:7687 | "" | localhost:10011 | up | main | 61 |
747-
| instance_2 | localhost:7688 | "" | localhost:10012 | up | replica | 74 |
748-
| instance_3 | localhost:7689 | "" | localhost:10013 | down | unknown | 71222 |
743+
| coordinator_1 | localhost:7690 | localhost:10111 | localhost:12121 | up | leader | 0 |
744+
| coordinator_2 | localhost:7691 | localhost:10112 | localhost:12122 | up | follower | 34 |
745+
| coordinator_3 | localhost:7692 | localhost:10113 | localhost:12123 | up | follower | 28 |
746+
| instance_1 | localhost:7687 | "" | localhost:13011 | up | main | 61 |
747+
| instance_2 | localhost:7688 | "" | localhost:13012 | up | replica | 74 |
748+
| instance_3 | localhost:7689 | "" | localhost:13013 | down | unknown | 71222 |
749749

750750
</Steps>

0 commit comments

Comments
 (0)