Skip to content

Troubleshooting & FAQ

Grigory Efimov edited this page May 16, 2024 · 1 revision

mongo replica set error

if you have mongo replica set error like this:

test> rs.status()
MongoServerError: Our replica set config is invalid or we are not a member of it

please run command:

docker compose exec mongo-1 mongosh --port 27001 --eval 'rs.reconfig({_id: rs.conf()._id, members: [{ _id: 0, host: "mongo-1:27001" }]}, {force: true});'

MongoDB requires a CPU with AVX support

If you encounter an error when starting MongoDB that says:

MongoDB 5.0+ requires a CPU with AVX support, and your current system does not appear to have that!

Then you can use MongoDB version 4.x. To do this, you need to perform the following steps:

  1. set mongo version in .env.override file:
    MONGO_VERSION=4.4.29
    
  2. set healthcheck for mongo container in docker-compose.override.yml file:
    services:
      mongo-1:
        healthcheck:
          test: echo "rs.initiate({_id:'${MONGO_REPLICA_SET}',members:[{_id:0,host:\"mongo-1:${MONGO_1_PORT}\"}]}).ok || rs.status().ok" | mongo --port ${MONGO_1_PORT} --quiet
    
  3. restart compose:
    make restart
    
Clone this wiki locally