https://github.com/geekeast/mongo-cluster-compose
Compose mongodb cluster using docker
https://github.com/geekeast/mongo-cluster-compose
docker-compose mongo mongo-replica-set
Last synced: 2 months ago
JSON representation
Compose mongodb cluster using docker
- Host: GitHub
- URL: https://github.com/geekeast/mongo-cluster-compose
- Owner: GeekEast
- Created: 2021-03-29T04:55:57.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-03-31T01:32:35.000Z (over 5 years ago)
- Last Synced: 2025-10-31T06:48:28.494Z (8 months ago)
- Topics: docker-compose, mongo, mongo-replica-set
- Language: JavaScript
- Homepage:
- Size: 20.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Create Mongo Cluster using Docker
### Set Replica Sync Delay
```javascript
// local/mongo/init-cluster.js
// ...
cfg.members[1].slaveDelay = 30; //seconds
// ...
```
### Replica Mode
- **create** stack
```sh
sh stack.sh build
```
- **destroy** stack
```sh
sh stack.sh destroy
```
### Accessing using Node.js
```sh
yarn # install deps
yarn initd # seed data via primary node
yarn index # query using secondary nodes
```
### References
- [Learn Docker](https://github.com/willitscale/learning-docker/tree/master/tutorial-12)
- [Docker boilerplates](https://github.com/drginm/docker-boilerplates/tree/master/mongodb-replicaset)