From fae284d6b9825d6c444976be1684664ef5074396 Mon Sep 17 00:00:00 2001 From: Mariska Hoogenboom Date: Thu, 11 Oct 2018 11:11:19 +0200 Subject: [PATCH] Docs fix for restart issue with orchestrated minio stack (#6606) (#6613) --- docs/orchestration/docker-swarm/README.md | 13 +++++++++++++ .../docker-swarm/docker-compose-secrets.yaml | 16 ++++++++++++++++ .../docker-swarm/docker-compose.yaml | 16 ++++++++++++++++ 3 files changed, 45 insertions(+) diff --git a/docs/orchestration/docker-swarm/README.md b/docs/orchestration/docker-swarm/README.md index 244c53f52..c2da4ac4d 100644 --- a/docs/orchestration/docker-swarm/README.md +++ b/docs/orchestration/docker-swarm/README.md @@ -34,6 +34,19 @@ echo "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" | docker secret create secret_ke ## 4. Deploy distributed Minio services +The example Minio stack uses 4 Docker volumes, which are created automatically by deploying the stack. We have to make sure that the services in the stack are always (re)started on the same node, where the service is deployed the first time. +Otherwise Docker will create a new volume upon restart of the service on another Docker node, which is not in sync with the other volumes and the stack will fail to start healthy. +Before deploying the stack, add labels to the Docker nodes where you want the minio services to run: + +``` +docker node update --label-add minio1=true +docker node update --label-add minio2=true +docker node update --label-add minio3=true +docker node update --label-add minio4=true +``` + +It is possible to run more than one minio service on one Docker Node. Set the labels accordingly. + Download the [Docker Compose file](https://github.com/minio/minio/blob/master/docs/orchestration/docker-swarm/docker-compose-secrets.yaml?raw=true) on your Swarm master. Then execute the command ```shell diff --git a/docs/orchestration/docker-swarm/docker-compose-secrets.yaml b/docs/orchestration/docker-swarm/docker-compose-secrets.yaml index f76db5825..de549a61b 100644 --- a/docs/orchestration/docker-swarm/docker-compose-secrets.yaml +++ b/docs/orchestration/docker-swarm/docker-compose-secrets.yaml @@ -3,6 +3,7 @@ version: '3.1' services: minio1: image: minio/minio:RELEASE.2018-10-06T00-15-16Z + hostname: minio1 volumes: - minio1-data:/export ports: @@ -14,6 +15,9 @@ services: delay: 10s max_attempts: 10 window: 60s + placement: + constraints: + - node.labels.minio1==true command: server http://minio1/export http://minio2/export http://minio3/export http://minio4/export secrets: - secret_key @@ -21,6 +25,7 @@ services: minio2: image: minio/minio:RELEASE.2018-10-06T00-15-16Z + hostname: minio2 volumes: - minio2-data:/export ports: @@ -32,6 +37,9 @@ services: delay: 10s max_attempts: 10 window: 60s + placement: + constraints: + - node.labels.minio2==true command: server http://minio1/export http://minio2/export http://minio3/export http://minio4/export secrets: - secret_key @@ -39,6 +47,7 @@ services: minio3: image: minio/minio:RELEASE.2018-10-06T00-15-16Z + hostname: minio3 volumes: - minio3-data:/export ports: @@ -50,6 +59,9 @@ services: delay: 10s max_attempts: 10 window: 60s + placement: + constraints: + - node.labels.minio3==true command: server http://minio1/export http://minio2/export http://minio3/export http://minio4/export secrets: - secret_key @@ -57,6 +69,7 @@ services: minio4: image: minio/minio:RELEASE.2018-10-06T00-15-16Z + hostname: minio4 volumes: - minio4-data:/export ports: @@ -68,6 +81,9 @@ services: delay: 10s max_attempts: 10 window: 60s + placement: + constraints: + - node.labels.minio4==true command: server http://minio1/export http://minio2/export http://minio3/export http://minio4/export secrets: - secret_key diff --git a/docs/orchestration/docker-swarm/docker-compose.yaml b/docs/orchestration/docker-swarm/docker-compose.yaml index 36ebd829b..72d70a6b3 100644 --- a/docs/orchestration/docker-swarm/docker-compose.yaml +++ b/docs/orchestration/docker-swarm/docker-compose.yaml @@ -3,6 +3,7 @@ version: '3' services: minio1: image: minio/minio:RELEASE.2018-10-06T00-15-16Z + hostname: minio1 volumes: - minio1-data:/export ports: @@ -17,10 +18,14 @@ services: delay: 10s max_attempts: 10 window: 60s + placement: + constraints: + - node.labels.minio1==true command: server http://minio1/export http://minio2/export http://minio3/export http://minio4/export minio2: image: minio/minio:RELEASE.2018-10-06T00-15-16Z + hostname: minio2 volumes: - minio2-data:/export ports: @@ -35,10 +40,14 @@ services: delay: 10s max_attempts: 10 window: 60s + placement: + constraints: + - node.labels.minio2==true command: server http://minio1/export http://minio2/export http://minio3/export http://minio4/export minio3: image: minio/minio:RELEASE.2018-10-06T00-15-16Z + hostname: minio3 volumes: - minio3-data:/export ports: @@ -53,10 +62,14 @@ services: delay: 10s max_attempts: 10 window: 60s + placement: + constraints: + - node.labels.minio3==true command: server http://minio1/export http://minio2/export http://minio3/export http://minio4/export minio4: image: minio/minio:RELEASE.2018-10-06T00-15-16Z + hostname: minio4 volumes: - minio4-data:/export ports: @@ -71,6 +84,9 @@ services: delay: 10s max_attempts: 10 window: 60s + placement: + constraints: + - node.labels.minio4==true command: server http://minio1/export http://minio2/export http://minio3/export http://minio4/export volumes: