Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot create sharded cluster from version 5.0 #644

Open
zpatekar opened this issue Oct 9, 2023 · 2 comments
Open

Cannot create sharded cluster from version 5.0 #644

zpatekar opened this issue Oct 9, 2023 · 2 comments

Comments

@zpatekar
Copy link

zpatekar commented Oct 9, 2023

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?

@yosifkit
Copy link
Member

yosifkit commented Oct 9, 2023

I have a PR for this, #600, but wasn't certain if it was good enough.

Related to #509

@zpatekar
Copy link
Author

I see that your PR already has one part solved, and the same issue applies to the shard server initial startup. I would really appreciate these changes going in officially, what would be the best path to take here? Can you update your PR to include the change I proposed above?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants