Skip to content

Instantly share code, notes, and snippets.

@xirius
Last active March 8, 2024 10:11
Show Gist options
  • Save xirius/59d135cc7f960f8b9eb76ae08aa9733a to your computer and use it in GitHub Desktop.
Save xirius/59d135cc7f960f8b9eb76ae08aa9733a to your computer and use it in GitHub Desktop.
SeaweedFS Cluster - Swarm stack on 3 nodes
version: "3.7"
services:
master1:
image: chrislusf/seaweedfs:latest
hostname: master1
ports:
- 9333:9333
networks:
- seaweed-net
volumes:
- seaweed-master-vol:/data
command: "master -ip=master1 -port=9333 -peers=master1:9333,master2:9334,master3:9335 -defaultReplication=002"
deploy:
restart_policy:
condition: any
delay: 5s
placement:
constraints:
- node.hostname == server01
master2:
image: chrislusf/seaweedfs:latest
hostname: master2
ports:
- 9334:9333
networks:
- seaweed-net
volumes:
- seaweed-master-vol:/data
command: "master -ip=master2 -port=9333 -peers=master1:9333,master2:9333,master3:9335 -defaultReplication=002"
deploy:
restart_policy:
condition: any
delay: 5s
placement:
constraints:
- node.hostname == server02
master3:
image: chrislusf/seaweedfs:latest
hostname: master3
ports:
- 9335:9333
networks:
- seaweed-net
volumes:
- seaweed-master-vol:/data
command: "master -ip=master3 -port=9333 -peers=master1:9333,master2:9334,master3:9333 -defaultReplication=002"
deploy:
restart_policy:
condition: any
delay: 5s
placement:
constraints:
- node.hostname == server03
volume1:
image: chrislusf/seaweedfs:latest
hostname: volume1
ports:
- 8080:8080
networks:
- seaweed-net
volumes:
- seaweed-storage-vol:/data
command: '-v=2 volume -ip=volume1 -port=8080 -max=5 -mserver="master1:9333,master2:9334,master3:9335" -dataCenter=dc1 -rack=rack1'
deploy:
restart_policy:
condition: any
delay: 5s
placement:
constraints:
- node.hostname == server01
volume2:
image: chrislusf/seaweedfs:latest
hostname: volume2
ports:
- 8081:8080
networks:
- seaweed-net
volumes:
- seaweed-storage-vol:/data
command: '-v=2 volume -ip=volume2 -port=8080 -max=5 -mserver="master1:9333,master2:9334,master3:9335" -dataCenter=dc1 -rack=rack1'
deploy:
restart_policy:
condition: any
delay: 5s
placement:
constraints:
- node.hostname == server02
volume3:
image: chrislusf/seaweedfs:latest
hostname: volume3
ports:
- 8082:8080
networks:
- seaweed-net
volumes:
- seaweed-storage-vol:/data
command: '-v=2 volume -ip=volume3 -port=8080 -max=5 -mserver="master1:9333,master2:9334,master3:9335" -dataCenter=dc1 -rack=rack1'
deploy:
restart_policy:
condition: any
delay: 5s
placement:
constraints:
- node.hostname == server03
filer1:
image: chrislusf/seaweedfs:latest
hostname: filer1
ports:
- 8881:8888
networks:
- seaweed-net
volumes:
- seaweed-filer-vol:/data
command: '-v=4 filer -master="master1:9333,master2:9334,master3:9335"'
deploy:
restart_policy:
condition: any
delay: 5s
placement:
constraints:
- node.hostname == server01
filer2:
image: chrislusf/seaweedfs:latest
hostname: filer2
ports:
- 8882:8888
networks:
- seaweed-net
volumes:
- seaweed-filer-vol:/data
command: '-v=4 filer -master="master1:9333,master2:9334,master3:9335"'
deploy:
restart_policy:
condition: any
delay: 5s
placement:
constraints:
- node.hostname == server02
filer3:
image: chrislusf/seaweedfs:latest
hostname: filer3
ports:
- 8883:8888
networks:
- seaweed-net
volumes:
- seaweed-filer-vol:/data
command: '-v=4 filer -master="master1:9333,master2:9334,master3:9335"'
deploy:
restart_policy:
condition: any
delay: 5s
placement:
constraints:
- node.hostname == server03
networks:
seaweed-net:
external: true
name: seaweed-net
volumes:
# "driver: local" is implied on all the nodes:
# docker volume create --driver local --opt type=none --opt o=bind --opt device=/path/to/seaweed/master seaweed-master-vol
# docker volume create --driver local --opt type=none --opt o=bind --opt device=/path/to/seaweed/storage seaweed-storage-vol
# docker volume create --driver local --opt type=none --opt o=bind --opt device=/path/to/seaweed/filer seaweed-filer-vol
seaweed-master-vol:
name: seaweed-master-vol
seaweed-storage-vol:
name: seaweed-storage-vol
seaweed-filer-vol:
name: seaweed-filer-vol
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment