Skip to content

Troubleshooting

Azita Abdollahi edited this page Apr 15, 2025 · 1 revision

Troubleshooting

Common issues and solutions.


❗ MongoServerError: already initialized

This error means the replica set is already configured. You can verify with:

rs.status()

🔄 No Primary Elected

Ensure all nodes are reachable over the network

Check logs: docker logs mongodbX

❌ Healthcheck fails

Wait a bit longer for all services to initialize

Inspect logs:
docker logs mongodb1

🔧 Helpful Commands

Replica Set Status

docker exec -it mongodb1 mongosh --eval "rs.status()"

Replica Set Configuration

docker exec -it mongodb1 mongosh --eval "rs.conf()"

MongoDB Shell

docker exec -it mongodb1 mongosh -u root -p yourpass

Clone this wiki locally