diff options
author | Marcos José Grillo Ramirez <marcos.grillo@mongodb.com> | 2021-07-28 16:53:03 +0200 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-07-28 15:54:42 +0000 |
commit | fc65780c5ea59878053440d23f67c543dc91fc71 (patch) | |
tree | 7ed4758a5660132eba536159c0142648399f819e /src/mongo/db/mongod_options.cpp | |
parent | 6d6c24544f12cb6d7164868098f9cf182053f9db (diff) | |
download | mongo-fc65780c5ea59878053440d23f67c543dc91fc71.tar.gz |
SERVER-27383 Disalow starting shards and config servers as standalone
... or without the queryableBackupMode flag
Diffstat (limited to 'src/mongo/db/mongod_options.cpp')
-rw-r--r-- | src/mongo/db/mongod_options.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mongo/db/mongod_options.cpp b/src/mongo/db/mongod_options.cpp index 881f83c1abc..12e369d5e11 100644 --- a/src/mongo/db/mongod_options.cpp +++ b/src/mongo/db/mongod_options.cpp @@ -603,6 +603,14 @@ Status storeMongodOptions(const moe::Environment& params) { } if (params.count("sharding.clusterRole")) { auto clusterRoleParam = params["sharding.clusterRole"].as<std::string>(); + // Force to set up the node as a replica set, unless we're using queryable backup mode. + if (!params.count("storage.queryableBackupMode") && !params.count("replication.replSet") && + !params.count("replication.replSetName")) { + return Status(ErrorCodes::BadValue, + str::stream() << "Cannot start a " << clusterRoleParam + << " as a standalone server. Please use the option " + "--replset to start the node as a replica set."); + } if (clusterRoleParam == "configsvr") { serverGlobalParams.clusterRole = ClusterRole::ConfigServer; // Config server requires majority read concern. |