Skip to content

Cannot create sharded cluster from version 5.0 #644

Description

@zpatekar

Hello,
I'm having issues on upgrading local sharded cluster from version 4.4 to 5.
For example, Dockerfile for config and shard servers looks like this:

FROM mongo:5.0.21
COPY key /key
COPY scripts /scripts
RUN chown -R mongodb /key
RUN chown -R mongodb /scripts

Docker-compose.yml:

  ...
  mongo_config:
    build: ../mongo-cluster/image
    container_name: mongo_config
    command: mongod --port 27017 --configsvr --replSet configserver --keyFile /key/mongodb.key
    env_file:
      - ../mongo-cluster/mongo-credentials.env
    ...

Issue is in docker-entrypoint.sh where the script removes --replSet switch when trying to start un-authenticated mongod version to add root user and password provided in the environment file. The error presented is:
BadValue: Cannot start a configsvr as a standalone server. Please use the option --replset to start the node as a replica set.
It should remove both --configsvr and --shardsvr switches, plus add --dbPath switch because config server uses a different path.
When I try adding this options everything works.
Additions are:

  1. _mongod_hack_ensure_no_arg --configsvr "${mongodHackedArgs[@]}" (line 318)
  2. _mongod_hack_ensure_no_arg --shardsvr "${mongodHackedArgs[@]}" (line 319)
  3. __mongod_hack_ensure_arg_val --dbpath "$(dbPath "$@")" "${mongodHackedArgs[@]}" (line 344)

Is this something that can be added/modified officially?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions