Last active
April 10, 2024 12:27
-
-
Save emerikaji/d705545ad6d236809221620d8724f6b8 to your computer and use it in GitHub Desktop.
MongoDB replica sets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3" | |
services: | |
mongo.cfg1: | |
container_name: mongo.cfg1 | |
image: mongo | |
networks: | |
- public | |
restart: always | |
volumes: | |
- mongo.cfg.vol1:/data/db | |
- /path/to/keyfile:/data/keyfile | |
entrypoint: [ "/usr/bin/mongod", "--configsvr", "--bind_ip_all", "--replSet", "cfgrs", "--keyFile", "/data/keyfile"] | |
mongo.cfg2: | |
container_name: mongo.cfg2 | |
image: mongo | |
networks: | |
- public | |
restart: always | |
volumes: | |
- mongo.cfg.vol2:/data/db | |
- /path/to/keyfile:/data/keyfile | |
entrypoint: [ "/usr/bin/mongod", "--configsvr", "--bind_ip_all", "--replSet", "cfgrs", "--keyFile", "/data/keyfile"] | |
mongo.cfg3: | |
container_name: mongo.cfg3 | |
image: mongo | |
networks: | |
- public | |
restart: always | |
volumes: | |
- mongo.cfg.vol3:/data/db | |
- /path/to/keyfile:/data/keyfile | |
entrypoint: [ "/usr/bin/mongod", "--configsvr", "--bind_ip_all", "--replSet", "cfgrs", "--keyFile", "/data/keyfile"] | |
mongo.s1: | |
container_name: mongo.s1 | |
image: mongo | |
networks: | |
- public | |
restart: always | |
volumes: | |
- mongo.s.vol1:/data/db | |
- /path/to/keyfile:/data/keyfile | |
entrypoint: [ "/usr/bin/mongod", "--shardsvr", "--bind_ip_all", "--replSet", "srs", "--keyFile", "/data/keyfile"] | |
mongo.s2: | |
container_name: mongo.s2 | |
image: mongo | |
networks: | |
- public | |
restart: always | |
volumes: | |
- mongo.s.vol2:/data/db | |
- /path/to/keyfile:/data/keyfile | |
entrypoint: [ "/usr/bin/mongod", "--shardsvr", "--bind_ip_all", "--replSet", "srs", "--keyFile", "/data/keyfile"] | |
mongo.s3: | |
container_name: mongo.s3 | |
image: mongo | |
networks: | |
- public | |
restart: always | |
volumes: | |
- mongo.s.vol3:/data/db | |
- /path/to/keyfile:/data/keyfile | |
entrypoint: [ "/usr/bin/mongod", "--shardsvr", "--bind_ip_all", "--replSet", "srs", "--keyFile", "/data/keyfile"] | |
volumes: | |
mongo.cfg.vol1: | |
name: "mongo.cfg.vol1" | |
mongo.cfg.vol2: | |
name: "mongo.cfg.vol2" | |
mongo.cfg.vol3: | |
name: "mongo.cfg.vol3" | |
mongo.s.vol1: | |
name: "mongo.s.vol1" | |
mongo.s.vol2: | |
name: "mongo.s.vol2" | |
mongo.s.vol3: | |
name: "mongo.s.vol3" | |
networks: | |
public: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment