feat: add easy-dataset and mongodb-replicaset-single

This commit is contained in:
Sun-ZhenXing
2025-10-22 10:05:17 +08:00
parent 37b52545a2
commit 84e8b85990
15 changed files with 736 additions and 39 deletions
+8 -16
View File
@@ -20,24 +20,16 @@ This service sets up a MongoDB replica set with three members.
docker compose up -d
```
2. Connect to the primary node:
The services will automatically initialize the replica set through the `mongo-init` init container. This container:
- Waits for all MongoDB nodes to be healthy
- Connects to the primary node
- Initializes the replica set with internal container names
- Uses container-based networking for communication
2. Verify the replica set status:
```bash
docker exec -it mongodb-replicaset-mongo1-1 mongosh
```
3. Initialize the replica set. **Remember to replace the host IP with your actual host IP.**
```js
config = {
_id: "rs0",
members: [
{_id: 0, host: "192.168.31.38:27017"},
{_id: 1, host: "192.168.31.38:27018"},
{_id: 2, host: "192.168.31.38:27019"},
]
}
rs.initiate(config)
docker exec -it mongodb-replicaset-mongo1-1 mongosh -u root -p password --authenticationDatabase admin --eval "rs.status()"
```
## Services