bitsofinfo / hazelcast-docker-swarm-discovery-spi

Docker Swarm based discovery strategy SPI for Hazelcast enabled applications
Apache License 2.0
39 stars 33 forks source link

Not forming cluster with docker stack and DNSRR #46

Closed georgeaniljohn closed 5 years ago

georgeaniljohn commented 5 years ago

Seems the hazelcast is not forming a cluster when service deployed in a docker stack using method DNSRR with the help of a docker-compose file. Each node now acts as an individual master.

But working perfectly fine when service deployed outside stack as

docker service create --network sample-net --name sample-node --endpoint-mode dnsrr --restart-condition on-failure --constraint 'node.hostname !=sample-machine-3' --replicas 2 -e "SPRING_DATA_MONGODB_URI=mongodb://10.10.30.31:27017,10.10.30.32:27017,10.10.30.33:27017/sampledb" -e "HZ_MANCENTER_URI=http://10.10.30.33:8080/mancenter" -e "HZ_GROUP=live-sample" -e "JAVA_OPTS=-DserviceName=sample-node -DservicePort=6781 -DpeerServicesCsv=sample-node:6781" sample-registry:5000/sampleimage:latest

bitsofinfo commented 5 years ago

@Cardds can you assist w/ this please?

Cardds commented 5 years ago

@georgeaniljohn Can the stack file be posted, with associated network information & related configuration?

georgeaniljohn commented 5 years ago

@Cardds The network is being created by running the script:

docker network create --driver=overlay sample-net


docker-compose file for the stack:

version: "3.5"

networks: sample-net: external: true

services: mongodb1: hostname: mongodb1 image: "sample-registry:5000/mongodb:latest" deploy: restart_policy: condition: on-failure ports:

Cardds commented 5 years ago

@georgeaniljohn The file posted does not appear to have any reference to specifying the endpoint_mode as dnsrr. See https://docs.docker.com/compose/compose-file/#endpoint_mode for associated docker compose documentation; note there it was only introduced in stack files as of verison 3.3.

georgeaniljohn commented 5 years ago

@Cardds sorry that it was missed out when posting initially and I updated it now. The issue got resolved now after specifying the entire service name along with stack name. eg: -DserviceName=stack-name_sample-node. But thank you for reaching out .