summaryrefslogtreecommitdiff
path: root/src/mongo/db/mongod_options.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/mongod_options.cpp')
-rw-r--r--src/mongo/db/mongod_options.cpp342
1 files changed, 177 insertions, 165 deletions
diff --git a/src/mongo/db/mongod_options.cpp b/src/mongo/db/mongod_options.cpp
index 59ceb56e187..32f88c57d51 100644
--- a/src/mongo/db/mongod_options.cpp
+++ b/src/mongo/db/mongod_options.cpp
@@ -45,9 +45,9 @@
#include "mongo/db/server_options.h"
#include "mongo/db/server_options_helpers.h"
#include "mongo/db/storage/mmap_v1/mmap_v1_options.h"
-#include "mongo/s/catalog/catalog_manager.h"
#include "mongo/logger/console_appender.h"
#include "mongo/logger/message_event_utf8_encoder.h"
+#include "mongo/s/catalog/catalog_manager.h"
#include "mongo/util/log.h"
#include "mongo/util/mongoutils/str.h"
#include "mongo/util/net/ssl_options.h"
@@ -106,13 +106,13 @@ Status addMongodOptions(moe::OptionSection* options) {
// Way to enable or disable auth in JSON Config
general_options
.addOptionChaining(
- "security.authorization",
- "",
- moe::String,
- "How the database behaves with respect to authorization of clients. "
- "Options are \"disabled\", which means that authorization checks are not "
- "performed, and \"enabled\" which means that a client cannot perform actions it is "
- "not authorized to do.")
+ "security.authorization",
+ "",
+ moe::String,
+ "How the database behaves with respect to authorization of clients. "
+ "Options are \"disabled\", which means that authorization checks are not "
+ "performed, and \"enabled\" which means that a client cannot perform actions it is "
+ "not authorized to do.")
.setSources(moe::SourceYAMLConfig)
.format("(:?disabled)|(:?enabled)", "(disabled/enabled)");
@@ -137,35 +137,35 @@ Status addMongodOptions(moe::OptionSection* options) {
// Diagnostic Options
- general_options.addOptionChaining("diaglog",
- "diaglog",
- moe::Int,
- "DEPRECATED: 0=off 1=W 2=R 3=both 7=W+some reads")
+ general_options
+ .addOptionChaining(
+ "diaglog", "diaglog", moe::Int, "DEPRECATED: 0=off 1=W 2=R 3=both 7=W+some reads")
.hidden()
.setSources(moe::SourceAllLegacy);
- general_options.addOptionChaining("operationProfiling.slowOpThresholdMs",
- "slowms",
- moe::Int,
- "value of slow for profile and console log")
+ general_options
+ .addOptionChaining("operationProfiling.slowOpThresholdMs",
+ "slowms",
+ moe::Int,
+ "value of slow for profile and console log")
.setDefault(moe::Value(100));
general_options.addOptionChaining("profile", "profile", moe::Int, "0=off 1=slow, 2=all")
.setSources(moe::SourceAllLegacy);
- general_options.addOptionChaining(
- "operationProfiling.mode", "", moe::String, "(off/slowOp/all)")
+ general_options
+ .addOptionChaining("operationProfiling.mode", "", moe::String, "(off/slowOp/all)")
.setSources(moe::SourceYAMLConfig)
.format("(:?off)|(:?slowOp)|(:?all)", "(off/slowOp/all)");
- general_options.addOptionChaining(
- "cpu", "cpu", moe::Switch, "periodically show cpu and iowait utilization")
+ general_options
+ .addOptionChaining(
+ "cpu", "cpu", moe::Switch, "periodically show cpu and iowait utilization")
.setSources(moe::SourceAllLegacy);
- general_options.addOptionChaining("sysinfo",
- "sysinfo",
- moe::Switch,
- "print some diagnostic system information")
+ general_options
+ .addOptionChaining(
+ "sysinfo", "sysinfo", moe::Switch, "print some diagnostic system information")
.setSources(moe::SourceAllLegacy);
// Storage Options
@@ -201,55 +201,59 @@ Status addMongodOptions(moe::OptionSection* options) {
moe::Switch,
"each database will be stored in a separate directory");
- storage_options.addOptionChaining(
- "storage.queryableBackupMode",
- "queryableBackupMode",
- moe::Switch,
- "enable read-only mode - if true the server will not accept writes.")
+ storage_options
+ .addOptionChaining("storage.queryableBackupMode",
+ "queryableBackupMode",
+ moe::Switch,
+ "enable read-only mode - if true the server will not accept writes.")
.setSources(moe::SourceAll)
.hidden();
- general_options.addOptionChaining(
- "noIndexBuildRetry",
- "noIndexBuildRetry",
- moe::Switch,
- "don't retry any index builds that were interrupted by shutdown")
+ general_options
+ .addOptionChaining("noIndexBuildRetry",
+ "noIndexBuildRetry",
+ moe::Switch,
+ "don't retry any index builds that were interrupted by shutdown")
.setSources(moe::SourceAllLegacy);
- general_options.addOptionChaining(
- "storage.indexBuildRetry",
- "",
- moe::Bool,
- "don't retry any index builds that were interrupted by shutdown")
+ general_options
+ .addOptionChaining("storage.indexBuildRetry",
+ "",
+ moe::Bool,
+ "don't retry any index builds that were interrupted by shutdown")
.setSources(moe::SourceYAMLConfig);
- storage_options.addOptionChaining(
- "noprealloc",
- "noprealloc",
- moe::Switch,
- "disable data file preallocation - will often hurt performance")
+ storage_options
+ .addOptionChaining("noprealloc",
+ "noprealloc",
+ moe::Switch,
+ "disable data file preallocation - will often hurt performance")
.setSources(moe::SourceAllLegacy);
- storage_options.addOptionChaining(
- "storage.mmapv1.preallocDataFiles",
- "",
- moe::Bool,
- "disable data file preallocation - will often hurt performance",
- "storage.preallocDataFiles").setSources(moe::SourceYAMLConfig);
-
- storage_options.addOptionChaining("storage.mmapv1.nsSize",
- "nssize",
- moe::Int,
- ".ns file size (in MB) for new databases",
- "storage.nsSize").setDefault(moe::Value(16));
+ storage_options
+ .addOptionChaining("storage.mmapv1.preallocDataFiles",
+ "",
+ moe::Bool,
+ "disable data file preallocation - will often hurt performance",
+ "storage.preallocDataFiles")
+ .setSources(moe::SourceYAMLConfig);
- storage_options.addOptionChaining(
- "storage.mmapv1.quota.enforced",
- "quota",
- moe::Switch,
- "limits each database to a certain number of files (8 default)",
- "storage.quota.enforced").incompatibleWith("keyFile");
+ storage_options
+ .addOptionChaining("storage.mmapv1.nsSize",
+ "nssize",
+ moe::Int,
+ ".ns file size (in MB) for new databases",
+ "storage.nsSize")
+ .setDefault(moe::Value(16));
+
+ storage_options
+ .addOptionChaining("storage.mmapv1.quota.enforced",
+ "quota",
+ moe::Switch,
+ "limits each database to a certain number of files (8 default)",
+ "storage.quota.enforced")
+ .incompatibleWith("keyFile");
storage_options.addOptionChaining("storage.mmapv1.quota.maxFilesPerDB",
"quotaFiles",
@@ -263,10 +267,11 @@ Status addMongodOptions(moe::OptionSection* options) {
"use a smaller default file size",
"storage.smallFiles");
- storage_options.addOptionChaining("storage.syncPeriodSecs",
- "syncdelay",
- moe::Double,
- "seconds between disk syncs (0=never, but not recommended)")
+ storage_options
+ .addOptionChaining("storage.syncPeriodSecs",
+ "syncdelay",
+ moe::Double,
+ "seconds between disk syncs (0=never, but not recommended)")
.setDefault(moe::Value(60.0));
// Upgrade and repair are disallowed in JSON configs since they trigger very heavyweight
@@ -284,18 +289,19 @@ Status addMongodOptions(moe::OptionSection* options) {
// Javascript Options
- general_options.addOptionChaining(
- "noscripting", "noscripting", moe::Switch, "disable scripting engine")
+ general_options
+ .addOptionChaining("noscripting", "noscripting", moe::Switch, "disable scripting engine")
.setSources(moe::SourceAllLegacy);
- general_options.addOptionChaining(
- "security.javascriptEnabled", "", moe::Bool, "Enable javascript execution")
+ general_options
+ .addOptionChaining(
+ "security.javascriptEnabled", "", moe::Bool, "Enable javascript execution")
.setSources(moe::SourceYAMLConfig);
// Query Options
- general_options.addOptionChaining(
- "notablescan", "notablescan", moe::Switch, "do not allow table scans")
+ general_options
+ .addOptionChaining("notablescan", "notablescan", moe::Switch, "do not allow table scans")
.setSources(moe::SourceAllLegacy);
// Journaling Options
@@ -304,10 +310,11 @@ Status addMongodOptions(moe::OptionSection* options) {
storage_options.addOptionChaining("journal", "journal", moe::Switch, "enable journaling")
.setSources(moe::SourceAllLegacy);
- storage_options.addOptionChaining("nojournal",
- "nojournal",
- moe::Switch,
- "disable journaling (journaling is on by default for 64 bit)")
+ storage_options
+ .addOptionChaining("nojournal",
+ "nojournal",
+ moe::Switch,
+ "disable journaling (journaling is on by default for 64 bit)")
.setSources(moe::SourceAllLegacy);
storage_options.addOptionChaining("dur", "dur", moe::Switch, "enable journaling")
@@ -323,14 +330,16 @@ Status addMongodOptions(moe::OptionSection* options) {
.setSources(moe::SourceYAMLConfig);
// Two ways to set durability diagnostic options. durOptions is deprecated
- storage_options.addOptionChaining("storage.mmapv1.journal.debugFlags",
- "journalOptions",
- moe::Int,
- "journal diagnostic options",
- "storage.journal.debugFlags").incompatibleWith("durOptions");
-
- storage_options.addOptionChaining(
- "durOptions", "durOptions", moe::Int, "durability diagnostic options")
+ storage_options
+ .addOptionChaining("storage.mmapv1.journal.debugFlags",
+ "journalOptions",
+ moe::Int,
+ "journal diagnostic options",
+ "storage.journal.debugFlags")
+ .incompatibleWith("durOptions");
+
+ storage_options
+ .addOptionChaining("durOptions", "durOptions", moe::Int, "durability diagnostic options")
.hidden()
.setSources(moe::SourceAllLegacy)
.incompatibleWith("storage.mmapv1.journal.debugFlags");
@@ -342,10 +351,9 @@ Status addMongodOptions(moe::OptionSection* options) {
"storage.mmapv1.journal.commitIntervalMs");
// Deprecated option that we don't want people to use for performance reasons
- storage_options.addOptionChaining("nopreallocj",
- "nopreallocj",
- moe::Switch,
- "don't preallocate journal files")
+ storage_options
+ .addOptionChaining(
+ "nopreallocj", "nopreallocj", moe::Switch, "don't preallocate journal files")
.hidden()
.setSources(moe::SourceAllLegacy);
@@ -367,33 +375,33 @@ Status addMongodOptions(moe::OptionSection* options) {
.incompatibleWith("replication.replSetName")
.setSources(moe::SourceAllLegacy);
- ms_options.addOptionChaining(
- "source", "source", moe::String, "when slave: specify master as <server:port>")
+ ms_options
+ .addOptionChaining(
+ "source", "source", moe::String, "when slave: specify master as <server:port>")
.incompatibleWith("replication.replSet")
.incompatibleWith("replication.replSetName")
.setSources(moe::SourceAllLegacy);
- ms_options.addOptionChaining("only",
- "only",
- moe::String,
- "when slave: specify a single database to replicate")
+ ms_options
+ .addOptionChaining(
+ "only", "only", moe::String, "when slave: specify a single database to replicate")
.incompatibleWith("replication.replSet")
.incompatibleWith("replication.replSetName")
.setSources(moe::SourceAllLegacy);
- ms_options.addOptionChaining(
- "slavedelay",
- "slavedelay",
- moe::Int,
- "specify delay (in seconds) to be used when applying master ops to slave")
+ ms_options
+ .addOptionChaining(
+ "slavedelay",
+ "slavedelay",
+ moe::Int,
+ "specify delay (in seconds) to be used when applying master ops to slave")
.incompatibleWith("replication.replSet")
.incompatibleWith("replication.replSetName")
.setSources(moe::SourceAllLegacy);
- ms_options.addOptionChaining("autoresync",
- "autoresync",
- moe::Switch,
- "automatically resync if slave data is stale")
+ ms_options
+ .addOptionChaining(
+ "autoresync", "autoresync", moe::Switch, "automatically resync if slave data is stale")
.incompatibleWith("replication.replSet")
.incompatibleWith("replication.replSetName")
.setSources(moe::SourceAllLegacy);
@@ -407,21 +415,22 @@ Status addMongodOptions(moe::OptionSection* options) {
"size to use (in MB) for replication op log. default is 5% of disk space "
"(i.e. large is good)");
- rs_options.addOptionChaining("replication.replSet",
- "replSet",
- moe::String,
- "arg is <setname>[/<optionalseedhostlist>]")
+ rs_options
+ .addOptionChaining("replication.replSet",
+ "replSet",
+ moe::String,
+ "arg is <setname>[/<optionalseedhostlist>]")
.setSources(moe::SourceAllLegacy);
rs_options.addOptionChaining("replication.replSetName", "", moe::String, "arg is <setname>")
.setSources(moe::SourceYAMLConfig)
.format("[^/]+", "[replica set name with no \"/\"]");
- rs_options.addOptionChaining(
- "replication.secondaryIndexPrefetch",
- "replIndexPrefetch",
- moe::String,
- "specify index prefetching behavior (if secondary) [none|_id_only|all]")
+ rs_options
+ .addOptionChaining("replication.secondaryIndexPrefetch",
+ "replIndexPrefetch",
+ moe::String,
+ "specify index prefetching behavior (if secondary) [none|_id_only|all]")
.format("(:?none)|(:?_id_only)|(:?all)", "(none/_id_only/all)");
rs_options.addOptionChaining("replication.enableMajorityReadConcern",
@@ -431,73 +440,73 @@ Status addMongodOptions(moe::OptionSection* options) {
// Sharding Options
- sharding_options.addOptionChaining(
- "configsvr",
- "configsvr",
- moe::Switch,
- "declare this is a config db of a cluster; default port 27019; "
- "default dir /data/configdb")
+ sharding_options
+ .addOptionChaining("configsvr",
+ "configsvr",
+ moe::Switch,
+ "declare this is a config db of a cluster; default port 27019; "
+ "default dir /data/configdb")
.setSources(moe::SourceAllLegacy)
.incompatibleWith("shardsvr")
.incompatibleWith("nojournal");
- sharding_options.addOptionChaining(
- "shardsvr",
- "shardsvr",
- moe::Switch,
- "declare this is a shard db of a cluster; default port 27018")
+ sharding_options
+ .addOptionChaining("shardsvr",
+ "shardsvr",
+ moe::Switch,
+ "declare this is a shard db of a cluster; default port 27018")
.setSources(moe::SourceAllLegacy)
.incompatibleWith("configsvr");
sharding_options
.addOptionChaining(
- "sharding.clusterRole",
- "",
- moe::String,
- "Choose what role this mongod has in a sharded cluster. Possible values are:\n"
- " \"configsvr\": Start this node as a config server. Starts on port 27019 by "
- "default."
- " \"shardsvr\": Start this node as a shard server. Starts on port 27018 by "
- "default.")
+ "sharding.clusterRole",
+ "",
+ moe::String,
+ "Choose what role this mongod has in a sharded cluster. Possible values are:\n"
+ " \"configsvr\": Start this node as a config server. Starts on port 27019 by "
+ "default."
+ " \"shardsvr\": Start this node as a shard server. Starts on port 27018 by "
+ "default.")
.setSources(moe::SourceYAMLConfig)
.format("(:?configsvr)|(:?shardsvr)", "(configsvr/shardsvr)");
sharding_options
.addOptionChaining(
- "sharding._overrideShardIdentity",
- "",
- moe::String,
- "overrides the shardIdentity document settings stored in the local storage with "
- "a MongoDB Extended JSON document in string format")
+ "sharding._overrideShardIdentity",
+ "",
+ moe::String,
+ "overrides the shardIdentity document settings stored in the local storage with "
+ "a MongoDB Extended JSON document in string format")
.setSources(moe::SourceYAMLConfig)
.incompatibleWith("configsvr")
.requires("storage.queryableBackupMode");
- sharding_options.addOptionChaining(
- "noMoveParanoia",
- "noMoveParanoia",
- moe::Switch,
- "turn off paranoid saving of data for the moveChunk command; default")
+ sharding_options
+ .addOptionChaining("noMoveParanoia",
+ "noMoveParanoia",
+ moe::Switch,
+ "turn off paranoid saving of data for the moveChunk command; default")
.hidden()
.setSources(moe::SourceAllLegacy)
.incompatibleWith("moveParanoia");
- sharding_options.addOptionChaining(
- "moveParanoia",
- "moveParanoia",
- moe::Switch,
- "turn on paranoid saving of data during the moveChunk command "
- "(used for internal system diagnostics)")
+ sharding_options
+ .addOptionChaining("moveParanoia",
+ "moveParanoia",
+ moe::Switch,
+ "turn on paranoid saving of data during the moveChunk command "
+ "(used for internal system diagnostics)")
.hidden()
.setSources(moe::SourceAllLegacy)
.incompatibleWith("noMoveParanoia");
- sharding_options.addOptionChaining(
- "sharding.archiveMovedChunks",
- "",
- moe::Bool,
- "config file option to turn on paranoid saving of data during the "
- "moveChunk command (used for internal system diagnostics)")
+ sharding_options
+ .addOptionChaining("sharding.archiveMovedChunks",
+ "",
+ moe::Bool,
+ "config file option to turn on paranoid saving of data during the "
+ "moveChunk command (used for internal system diagnostics)")
.hidden()
.setSources(moe::SourceYAMLConfig);
@@ -517,18 +526,20 @@ Status addMongodOptions(moe::OptionSection* options) {
// The following are legacy options that are disallowed in the JSON config file
- options->addOptionChaining(
- "fastsync",
- "fastsync",
- moe::Switch,
- "indicate that this instance is starting from a dbpath snapshot of the repl peer")
+ options
+ ->addOptionChaining(
+ "fastsync",
+ "fastsync",
+ moe::Switch,
+ "indicate that this instance is starting from a dbpath snapshot of the repl peer")
.hidden()
.setSources(moe::SourceAllLegacy);
- options->addOptionChaining("pretouch",
- "pretouch",
- moe::Int,
- "n pretouch threads for applying master/slave operations")
+ options
+ ->addOptionChaining("pretouch",
+ "pretouch",
+ moe::Int,
+ "n pretouch threads for applying master/slave operations")
.hidden()
.setSources(moe::SourceAllLegacy);
@@ -541,8 +552,8 @@ Status addMongodOptions(moe::OptionSection* options) {
.positional(1, 3)
.setSources(moe::SourceAllLegacy);
- options->addOptionChaining(
- "cacheSize", "cacheSize", moe::Long, "cache size (in MB) for rec store")
+ options
+ ->addOptionChaining("cacheSize", "cacheSize", moe::Long, "cache size (in MB) for rec store")
.hidden()
.setSources(moe::SourceAllLegacy);
@@ -1203,7 +1214,8 @@ Status storeMongodOptions(const moe::Environment& params, const std::vector<std:
if (x <= 0) {
return Status(ErrorCodes::BadValue,
str::stream() << "bad --oplogSize, arg must be greater than 0,"
- "found: " << x);
+ "found: "
+ << x);
}
// note a small size such as x==1 is ok for an arbiter.
if (x > 1000 && sizeof(void*) == 4) {