Search code examples
azuredockerneo4jazure-container-service

Neo4j HA model don't work in docker


I'm trying to run Neo4j in HA mode using Azure Container Service + Docker. To run mode is required HA 3 instances within the same network.

I create a network with the command:

docker network create --driver = bridge cluster

But when trying to associate instances of this network I got the following error:

docker: Error response from daemon: network cluster not found.

I've tried with the network ID and does not work.

I'm following this tutorial: https://neo4j.com/developer/docker-3.x/ but without success. Something tip?

ps .: Running in sigle mode works.

Commands and result I get.

jefersonanjos@swarm-master-21858A81-0:~/neo4j/data$ docker network create --driver=bridge cluster
result: d9fb3dd121ded5bfe01765ce4d276b75ad4e66ef1f2bd62b858a2cea86ccc1ec

jefersonanjos@swarm-master-21858A81-0:~/neo4j/data$ docker run --name=instance1 --detach --publish=7474:7474 --publish=7687:7687 --net=cluster --hostname=instance1 \ --env=NEO4J_dbms_mode=HA --env=NEO4J_ha_serverId=1 \ --env=NEO4J_ha_host_coordination=instance1:5001 --env=NEO4J_ha_host_data=instance1:6001 \ --env=NEO4J_ha_initialHosts=instance1:5001,instance2:5001,instance3:5001 \ neo4j:enterprise result: b57ca9a895535b07ef97d956a780b9687e7384b33f389e2470e0ed743c79ef11

jefersonanjos@swarm-master-21858A81-0:~/neo4j/data$ docker run --name=instance2 --detach --publish 7475:7474 --publish=7688:7687 --net=cluster --hostname=instance2 \ --env=NEO4J_dbms_mode=HA --env=NEO4J_ha_serverId=2 \ --env=NEO4J_ha_host_coordination=instance2:5001 --env=NEO4J_ha_host_data=instance2:6001 \ --env=NEO4J_ha_initialHosts=instance1:5001,instance2:5001,instance3:5001 \ neo4j:enterprise docker: Error response from daemon: network cluster not found. See 'docker run --help'.

jefersonanjos@swarm-master-21858A81-0:~/neo4j/data$ docker run --name=instance3 --detach --publish 7476:7474 --publish=7689:7687 --net=cluster --hostname=instance3 \ --env=NEO4J_dbms_mode=HA --env=NEO4J_ha_serverId=3 \ --env=NEO4J_ha_host_coordination=instance3:5001 --env=NEO4J_ha_host_data=instance3:6001 \ --env=NEO4J_ha_initialHosts=instance1:5001,instance2:5001,instance3:5001 \ neo4j:enterprise 08c4c5156dc8bb589f4c876de3a2bf0170450ae640606d505e1851da94220d7e


Solution

  • The problem in azure with docker was because I'm doing the test with a cluster of machines.

    So the command: docker network create --driver = bridge cluster does not serve for this purpose.

    We can must use the --driver = overlay to function as multi-host.

    Mor info: https://docs.docker.com/engine/userguide/networking/get-started-overlay/