@@ -446,7 +446,93 @@ working on 2 datacenter (2-DC) architecture.
446446
447447We support deploying Memgraph HA instances as part of the Kubernetes cluster. You can see example configurations [ here] ( /getting-started/install-memgraph/kubernetes#helm-chart-for-memgraph-high-availability-cluster ) .
448448
449- ## Example
449+ ## Docker compose
450+
451+ The following example shows you how to setup Memgraph cluster using docker compose. The cluster will use host's network.
452+
453+ License file ` license.cypherl ` should be in the format:
454+
455+ ```
456+
457+ SET DATABASE SETTING 'organization.name' TO '<YOUR_ORGANIZATION_NAME>';
458+ SET DATABASE SETTING 'enterprise.license' TO '<YOUR_ENTERPRISE_LICENSE>';
459+
460+ ```
461+
462+ You can directly use initialization file ` HA_init.cypherl ` :
463+
464+ ```
465+
466+ ADD COORDINATOR 2 WITH CONFIG {"bolt_server": "localhost:7691", "coordinator_server": "localhost:10112"};
467+ ADD COORDINATOR 3 WITH CONFIG {"bolt_server": "localhost:7692", "coordinator_server": "localhost:10113"};
468+
469+ REGISTER INSTANCE instance_1 WITH CONFIG {"bolt_server": "localhost:7687", "management_server": "localhost:10011", "replication_server": "localhost:10001"};
470+ REGISTER INSTANCE instance_2 WITH CONFIG {"bolt_server": "localhost:7688", "management_server": "localhost:10012", "replication_server": "localhost:10002"};
471+ REGISTER INSTANCE instance_3 WITH CONFIG {"bolt_server": "localhost:7689", "management_server": "localhost:10013", "replication_server": "localhost:10003"};
472+ SET INSTANCE instance_3 TO MAIN;
473+
474+ ```
475+
476+ You can directly use the following ` docker-compose.yml ` to start the cluster using ` docker compose up ` :
477+
478+ ```
479+ services:
480+ coord1:
481+ image: "memgraph/memgraph-mage"
482+ container_name: coord1
483+ volumes:
484+ - ./license.cypherl:/tmp/init/license.cypherl:ro
485+ - ./HA_register.cypherl:/tmp/init/HA_init.cypherl:ro
486+ environment:
487+ - MEMGRAPH_HA_CLUSTER_INIT_QUERIES=/tmp/init/HA_register.cypherl
488+ command: ["--bolt-port=7690", "--init-file=/tmp/init/license.cypherl", "--log-level=TRACE", "--data-directory=/tmp/mg_data_coord1", "--log-file=/tmp/coord1.log", "--coordinator-id=1", "--coordinator-port=10111", "--experimental-enabled=high-availability"]
489+ network_mode: host
490+
491+ coord2:
492+ image: "memgraph/memgraph-mage"
493+ container_name: coord2
494+ volumes:
495+ - ./license.cypherl:/tmp/init/license.cypherl:ro
496+ command: ["--bolt-port=7691", "--init-file=/tmp/init/license.cypherl", "--log-level=TRACE", "--data-directory=/tmp/mg_data_coord2", "--log-file=/tmp/coord2.log", "--coordinator-id=2", "--coordinator-port=10112", "--experimental-enabled=high-availability"]
497+ network_mode: host
498+
499+ coord3:
500+ image: "memgraph/memgraph-mage"
501+ container_name: coord3
502+ volumes:
503+ - ./license.cypherl:/tmp/init/license.cypherl:ro
504+ command: ["--bolt-port=7692", "--init-file=/tmp/init/license.cypherl", "--log-level=TRACE", "--data-directory=/tmp/mg_data_coord3", "--log-file=/tmp/coord3.log", "--coordinator-id=3", "--coordinator-port=10113", "--experimental-enabled=high-availability"]
505+ network_mode: host
506+
507+ instance1:
508+ image: "memgraph/memgraph-mage"
509+ container_name: instance1
510+ volumes:
511+ - ./license.cypherl:/tmp/init/license.cypherl:ro
512+ command: ["--bolt-port=7687", "--init-file=/tmp/init/license.cypherl","--data-recovery-on-startup=true", "--log-level=TRACE", "--data-directory=/tmp/mg_data_instance1", "--log-file=/tmp/instance1.log", "--management-port=10011", "--experimental-enabled=high-availability"]
513+ network_mode: host
514+
515+ instance2:
516+ image: "memgraph/memgraph-mage"
517+ container_name: instance2
518+ volumes:
519+ - ./license.cypherl:/tmp/init/license.cypherl:ro
520+ command: ["--bolt-port=7688", "--init-file=/tmp/init/license.cypherl","--data-recovery-on-startup=true", "--log-level=TRACE", "--data-directory=/tmp/mg_data_instance2", "--log-file=/tmp/instance2.log", "--management-port=10012", "--experimental-enabled=high-availability"]
521+ network_mode: host
522+
523+ instance3:
524+ image: "memgraph/memgraph-mage"
525+ container_name: instance3
526+ volumes:
527+ - ./license.cypherl:/tmp/init/license.cypherl:ro
528+ command: ["--bolt-port=7689", "--init-file=/tmp/init/license.cypherl","--data-recovery-on-startup=true", "--log-level=TRACE", "--data-directory=/tmp/mg_data_instance3", "--log-file=/tmp/instance3.log", "--management-port=10013", "--experimental-enabled=high-availability"]
529+ network_mode: host
530+
531+ ```
532+
533+ Cluster can be shut-down using ` docker compose down ` .
534+
535+ ## Manual Docker setup
450536
451537This example will show how to set up a highly available cluster in Memgraph using three coordinators and 3 data instances.
452538
@@ -471,17 +557,17 @@ docker run --name coord3 -p 7692:7692 -p 7446:7444 memgraph/memgraph-mage --bol
471557
4725584 . Start instance1:
473559``` plaintext
474- 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
560+ 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
475561```
476562
4775635 . Start instance2:
478564``` plaintext
479- 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
565+ 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
480566```
481567
4825686 . Start instance3:
483569``` plaintext
484- 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
570+ 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
485571```
486572
487573### Register instances
0 commit comments