4

I'm trying to configure a mongodb single node replica set using docker compose for connecting with elasticsearch using monstache in development. Using the documentation docs. I have the following docker compose file:

  mongo:
    image: mongo
    volumes:
      - ./data/mongo:/data/db
    environment:
      MONGO_INITDB_ROOT_USERNAME: ${MONGO_USERNAME}
      MONGO_INITDB_ROOT_PASSWORD: ${MONGO_PASSWORD}
      MONGO_REPLICA_SET_NAME: rs0
    restart: unless-stopped
    entrypoint: >
      /bin/sh -c '
      echo "rs.initiate()" > /docker-entrypoint-initdb.d/init-replicaset.js;
      /usr/local/bin/docker-entrypoint.sh mongod --replSet rs0 --bind_ip localhost --noauth
      '

But I keep getting errors. In this case:

{"t":{"$date":"2021-10-25T21:19:12.174Z"},"s":"F",  "c":"CONTROL",  "id":20574,   "ctx":"-","msg":"Error during global initialization","attr":{"error":{"code":2,"codeName":"BadValue","errmsg":"auth is not allowed when noauth is specified"}}}

Is there someone more familiar with Mongodb and replica sets that can help me get this running? I feel like I'm close to a working solution.

Ikar Pohorský
  • 4,617
  • 6
  • 39
  • 56
tamis
  • 125
  • 5
  • 1
    @IkarPohorský please do not create new tags without usage guidance, they are likely to be deleted. See here for details: https://stackoverflow.com/help/tag-excerpts. Importantly, the excerpt should include information on *how to use the tag* and not just a definition what "monstache" is. – miken32 Jun 16 '22 at 15:56
  • 1
    Thanks @miken32 for the info, my first tag ofc. Added the excerpt. – Ikar Pohorský Jun 17 '22 at 07:02

0 Answers0