Exemplo n.º 1
0
    Status storeMongosOptions(const moe::Environment& params,
                              const std::vector<std::string>& args) {

        Status ret = storeServerOptions(params, args);
        if (!ret.isOK()) {
            return ret;
        }

        if ( params.count( "chunkSize" ) ) {
            int csize = params["chunkSize"].as<int>();

            // validate chunksize before proceeding
            if ( csize == 0 ) {
                return Status(ErrorCodes::BadValue, "error: need a non-zero chunksize");
            }

            if ( !Chunk::setMaxChunkSizeSizeMB( csize ) ) {
                return Status(ErrorCodes::BadValue, "MaxChunkSize invalid");
            }
        }

        if (params.count( "port" ) ) {
            int port = params["port"].as<int>();
            if ( port <= 0 || port > 65535 ) {
                return Status(ErrorCodes::BadValue,
                              "error: port number must be between 1 and 65535");
            }
        }

        if ( params.count( "localThreshold" ) ) {
            serverGlobalParams.defaultLocalThresholdMillis = params["localThreshold"].as<int>();
        }

        if ( params.count( "ipv6" ) ) {
            enableIPv6();
        }

        if ( params.count( "jsonp" ) ) {
            serverGlobalParams.jsonp = true;
        }

        if (params.count("noscripting")) {
            // This option currently has no effect for mongos
        }

        if (params.count("httpinterface")) {
            if (params.count("nohttpinterface")) {
                return Status(ErrorCodes::BadValue,
                              "can't have both --httpinterface and --nohttpinterface");
            }
            serverGlobalParams.isHttpInterfaceEnabled = true;
        }

        if (params.count("noAutoSplit")) {
            warning() << "running with auto-splitting disabled" << endl;
            Chunk::ShouldAutoSplit = false;
        }

        if ( ! params.count( "configdb" ) ) {
            return Status(ErrorCodes::BadValue, "error: no args for --configdb");
        }

        splitStringDelim(params["configdb"].as<std::string>(), &mongosGlobalParams.configdbs, ',');
        if (mongosGlobalParams.configdbs.size() != 1 && mongosGlobalParams.configdbs.size() != 3) {
            return Status(ErrorCodes::BadValue, "need either 1 or 3 configdbs");
        }

        if (mongosGlobalParams.configdbs.size() == 1) {
            warning() << "running with 1 config server should be done only for testing purposes "
                      << "and is not recommended for production" << endl;
        }

        mongosGlobalParams.upgrade = params.count("upgrade");

        return Status::OK();
    }
Exemplo n.º 2
0
Status storeMongosOptions(const moe::Environment& params, const std::vector<std::string>& args) {
    Status ret = storeServerOptions(params, args);
    if (!ret.isOK()) {
        return ret;
    }

    if (params.count("sharding.chunkSize")) {
        const int maxChunkSizeMB = params["sharding.chunkSize"].as<int>();
        if (maxChunkSizeMB <= 0) {
            return Status(ErrorCodes::BadValue, "error: need a positive chunksize");
        }

        const uint64_t maxChunkSizeBytes = maxChunkSizeMB * 1024 * 1024;

        if (!ChunkSizeSettingsType::checkMaxChunkSizeValid(maxChunkSizeBytes)) {
            return Status(ErrorCodes::BadValue, "MaxChunkSize invalid");
        }

        mongosGlobalParams.maxChunkSizeBytes = maxChunkSizeBytes;
    }

    if (params.count("net.port")) {
        int port = params["net.port"].as<int>();
        if (port <= 0 || port > 65535) {
            return Status(ErrorCodes::BadValue, "error: port number must be between 1 and 65535");
        }
    }

    if (params.count("replication.localPingThresholdMs")) {
        serverGlobalParams.defaultLocalThresholdMillis =
            params["replication.localPingThresholdMs"].as<int>();
    }

    if (params.count("net.http.JSONPEnabled")) {
        serverGlobalParams.jsonp = params["net.http.JSONPEnabled"].as<bool>();
    }

    if (params.count("noscripting")) {
        // This option currently has no effect for mongos
    }

    if (params.count("sharding.autoSplit")) {
        mongosGlobalParams.shouldAutoSplit = params["sharding.autoSplit"].as<bool>();
        if (!mongosGlobalParams.shouldAutoSplit) {
            warning() << "running with auto-splitting disabled";
        }
    }

    if (!params.count("sharding.configDB")) {
        return Status(ErrorCodes::BadValue, "error: no args for --configdb");
    }

    std::string configdbString = params["sharding.configDB"].as<std::string>();

    auto configdbConnectionString = ConnectionString::parse(configdbString);
    if (!configdbConnectionString.isOK()) {
        return configdbConnectionString.getStatus();
    }

    if (configdbConnectionString.getValue().type() != ConnectionString::SET) {
        return Status(ErrorCodes::BadValue,
                      str::stream() << "configdb supports only replica set connection string");
    }

    std::vector<HostAndPort> seedServers;
    for (const auto& host : configdbConnectionString.getValue().getServers()) {
        seedServers.push_back(host);
        if (!seedServers.back().hasPort()) {
            seedServers.back() = HostAndPort{host.host(), ServerGlobalParams::ConfigServerPort};
        }
    }

    mongosGlobalParams.configdbs =
        ConnectionString{configdbConnectionString.getValue().type(),
                         seedServers,
                         configdbConnectionString.getValue().getSetName()};

    if (mongosGlobalParams.configdbs.getServers().size() < 3) {
        warning() << "Running a sharded cluster with fewer than 3 config servers should only be "
                     "done for testing purposes and is not recommended for production.";
    }

    return Status::OK();
}
Exemplo n.º 3
0
Status storeMongosOptions(const moe::Environment& params) {
    Status ret = storeServerOptions(params);
    if (!ret.isOK()) {
        return ret;
    }

    if (params.count("net.port")) {
        int port = params["net.port"].as<int>();
        if (port <= 0 || port > 65535) {
            return Status(ErrorCodes::BadValue, "error: port number must be between 1 and 65535");
        }
    }

    if (params.count("noscripting") || params.count("security.javascriptEnabled")) {
        warning() << "The Javascript enabled/disabled options are not supported for mongos. "
                     "(\"noscripting\" and/or \"security.javascriptEnabled\" are set.)";
    }

    if (!params.count("sharding.configDB")) {
        return Status(ErrorCodes::BadValue, "error: no args for --configdb");
    }

    std::string configdbString = params["sharding.configDB"].as<std::string>();

    auto configdbConnectionString = ConnectionString::parse(configdbString);
    if (!configdbConnectionString.isOK()) {
        return configdbConnectionString.getStatus();
    }

    if (configdbConnectionString.getValue().type() != ConnectionString::SET) {
        return Status(ErrorCodes::BadValue,
                      str::stream() << "configdb supports only replica set connection string");
    }

    std::vector<HostAndPort> seedServers;
    bool resolvedSomeSeedSever = false;
    for (const auto& host : configdbConnectionString.getValue().getServers()) {
        seedServers.push_back(host);
        if (!seedServers.back().hasPort()) {
            seedServers.back() = HostAndPort{host.host(), ServerGlobalParams::ConfigServerPort};
        }
        if (!hostbyname(seedServers.back().host().c_str()).empty()) {
            resolvedSomeSeedSever = true;
        }
    }
    if (!resolvedSomeSeedSever) {
        if (!hostbyname(configdbConnectionString.getValue().getSetName().c_str()).empty()) {
            warning() << "The replica set name \""
                      << escape(configdbConnectionString.getValue().getSetName())
                      << "\" resolves as a host name, but none of the servers in the seed list do. "
                         "Did you reverse the replica set name and the seed list in "
                      << escape(configdbConnectionString.getValue().toString()) << "?";
        }
    }

    mongosGlobalParams.configdbs =
        ConnectionString{configdbConnectionString.getValue().type(),
                         seedServers,
                         configdbConnectionString.getValue().getSetName()};

    if (mongosGlobalParams.configdbs.getServers().size() < 3) {
        warning() << "Running a sharded cluster with fewer than 3 config servers should only be "
                     "done for testing purposes and is not recommended for production.";
    }

    return Status::OK();
}
Exemplo n.º 4
0
    Status storeMongodOptions(const moe::Environment& params,
                              const std::vector<std::string>& args) {

        Status ret = storeServerOptions(params, args);
        if (!ret.isOK()) {
            std::cerr << "Error storing command line: " << ret.toString() << std::endl;
            ::_exit(EXIT_BADOPTIONS);
        }

        if (params.count("dbpath")) {
            storageGlobalParams.dbpath = params["dbpath"].as<string>();
            if (params.count("fork") && storageGlobalParams.dbpath[0] != '/') {
                // we need to change dbpath if we fork since we change
                // cwd to "/"
                // fork only exists on *nix
                // so '/' is safe
                storageGlobalParams.dbpath = serverGlobalParams.cwd + "/" +
                                                 storageGlobalParams.dbpath;
            }
        }
#ifdef _WIN32
        if (storageGlobalParams.dbpath.size() > 1 &&
            storageGlobalParams.dbpath[storageGlobalParams.dbpath.size()-1] == '/') {
            // size() check is for the unlikely possibility of --dbpath "/"
            storageGlobalParams.dbpath =
                storageGlobalParams.dbpath.erase(storageGlobalParams.dbpath.size()-1);
        }
#endif
        if ( params.count("slowms")) {
            serverGlobalParams.slowMS = params["slowms"].as<int>();
        }

        if ( params.count("syncdelay")) {
            storageGlobalParams.syncdelay = params["syncdelay"].as<double>();
        }

        if (params.count("directoryperdb")) {
            storageGlobalParams.directoryperdb = true;
        }
        if (params.count("cpu")) {
            serverGlobalParams.cpu = true;
        }
        if (params.count("noauth")) {
            getGlobalAuthorizationManager()->setAuthEnabled(false);
        }
        if (params.count("auth")) {
            getGlobalAuthorizationManager()->setAuthEnabled(true);
        }
        if (params.count("quota")) {
            storageGlobalParams.quota = true;
        }
        if (params.count("quotaFiles")) {
            storageGlobalParams.quota = true;
            storageGlobalParams.quotaFiles = params["quotaFiles"].as<int>() - 1;
        }
        if ((params.count("nodur") || params.count("nojournal")) &&
            (params.count("dur") || params.count("journal"))) {
            std::cerr << "Can't specify both --journal and --nojournal options." << std::endl;
            ::_exit(EXIT_BADOPTIONS);
        }

        if (params.count("nodur") || params.count("nojournal")) {
            storageGlobalParams.dur = false;
        }

        if (params.count("dur") || params.count("journal")) {
            storageGlobalParams.dur = true;
        }

        if (params.count("durOptions")) {
            storageGlobalParams.durOptions = params["durOptions"].as<int>();
        }
        if( params.count("journalCommitInterval") ) {
            // don't check if dur is false here as many will just use the default, and will default
            // to off on win32.  ie no point making life a little more complex by giving an error on
            // a dev environment.
            storageGlobalParams.journalCommitInterval =
                params["journalCommitInterval"].as<unsigned>();
            if (storageGlobalParams.journalCommitInterval <= 1 ||
                storageGlobalParams.journalCommitInterval > 300) {
                std::cerr << "--journalCommitInterval out of allowed range (0-300ms)" << std::endl;
                ::_exit(EXIT_BADOPTIONS);
            }
        }
        if (params.count("journalOptions")) {
            storageGlobalParams.durOptions = params["journalOptions"].as<int>();
        }
        if (params.count("nohints")) {
            storageGlobalParams.useHints = false;
        }
        if (params.count("nopreallocj")) {
            storageGlobalParams.preallocj = false;
        }
        if (params.count("httpinterface")) {
            if (params.count("nohttpinterface")) {
                std::cerr << "can't have both --httpinterface and --nohttpinterface" << std::endl;
                ::_exit(EXIT_BADOPTIONS);
            }
            serverGlobalParams.isHttpInterfaceEnabled = true;
        }
        // SERVER-10019 Enabling rest/jsonp without --httpinterface should break in the future
        if (params.count("rest")) {
            if (params.count("nohttpinterface")) {
                log() << "** WARNING: Should not specify both --rest and --nohttpinterface" <<
                    startupWarningsLog;
            }
            else if (!params.count("httpinterface")) {
                log() << "** WARNING: --rest is specified without --httpinterface," <<
                    startupWarningsLog;
                log() << "**          enabling http interface" << startupWarningsLog;
                serverGlobalParams.isHttpInterfaceEnabled = true;
            }
            serverGlobalParams.rest = true;
        }
        if (params.count("jsonp")) {
            if (params.count("nohttpinterface")) {
                log() << "** WARNING: Should not specify both --jsonp and --nohttpinterface" <<
                    startupWarningsLog;
            }
            else if (!params.count("httpinterface")) {
                log() << "** WARNING --jsonp is specified without --httpinterface," <<
                    startupWarningsLog;
                log() << "**         enabling http interface" << startupWarningsLog;
                serverGlobalParams.isHttpInterfaceEnabled = true;
            }
            serverGlobalParams.jsonp = true;
        }
        if (params.count("noscripting")) {
            mongodGlobalParams.scriptingEnabled = false;
        }
        if (params.count("noprealloc")) {
            storageGlobalParams.prealloc = false;
            cout << "note: noprealloc may hurt performance in many applications" << endl;
        }
        if (params.count("smallfiles")) {
            storageGlobalParams.smallfiles = true;
        }
        if (params.count("diaglog")) {
            int x = params["diaglog"].as<int>();
            if ( x < 0 || x > 7 ) {
                std::cerr << "can't interpret --diaglog setting" << std::endl;
                ::_exit(EXIT_BADOPTIONS);
            }
            _diaglog.setLevel(x);
        }

        if ((params.count("dur") || params.count("journal")) && params.count("repair")) {
            std::cerr << "Can't specify both --journal and --repair options." << std::endl;
            ::_exit(EXIT_BADOPTIONS);
        }

        if (params.count("repair")) {
            Record::MemoryTrackingEnabled = false;
            mongodGlobalParams.upgrade = 1; // --repair implies --upgrade
            mongodGlobalParams.repair = 1;
            storageGlobalParams.dur = false;
        }
        if (params.count("upgrade")) {
            Record::MemoryTrackingEnabled = false;
            mongodGlobalParams.upgrade = 1;
        }
        if (params.count("notablescan")) {
            storageGlobalParams.noTableScan = true;
        }
        if (params.count("master")) {
            replSettings.master = true;
        }
        if (params.count("slave")) {
            replSettings.slave = SimpleSlave;
        }
        if (params.count("slavedelay")) {
            replSettings.slavedelay = params["slavedelay"].as<int>();
        }
        if (params.count("fastsync")) {
            replSettings.fastsync = true;
        }
        if (params.count("autoresync")) {
            replSettings.autoresync = true;
            if( params.count("replSet") ) {
                std::cerr << "--autoresync is not used with --replSet\nsee "
                    << "http://dochub.mongodb.org/core/resyncingaverystalereplicasetmember"
                    << std::endl;
                ::_exit(EXIT_BADOPTIONS);
            }
        }
        if (params.count("source")) {
            /* specifies what the source in local.sources should be */
            replSettings.source = params["source"].as<string>().c_str();
        }
        if( params.count("pretouch") ) {
            replSettings.pretouch = params["pretouch"].as<int>();
        }
        if (params.count("replSet")) {
            if (params.count("slavedelay")) {
                std::cerr << "--slavedelay cannot be used with --replSet" << std::endl;
                ::_exit(EXIT_BADOPTIONS);
            }
            else if (params.count("only")) {
                std::cerr << "--only cannot be used with --replSet" << std::endl;
                ::_exit(EXIT_BADOPTIONS);
            }
            /* seed list of hosts for the repl set */
            replSettings.replSet = params["replSet"].as<string>().c_str();
        }
        if (params.count("replIndexPrefetch")) {
            replSettings.rsIndexPrefetch = params["replIndexPrefetch"].as<std::string>();
        }
        if (params.count("noIndexBuildRetry")) {
            serverGlobalParams.indexBuildRetry = false;
        }
        if (params.count("only")) {
            replSettings.only = params["only"].as<string>().c_str();
        }
        if( params.count("nssize") ) {
            int x = params["nssize"].as<int>();
            if (x <= 0 || x > (0x7fffffff/1024/1024)) {
                std::cerr << "bad --nssize arg" << std::endl;
                ::_exit(EXIT_BADOPTIONS);
            }
            storageGlobalParams.lenForNewNsFiles = x * 1024 * 1024;
            verify(storageGlobalParams.lenForNewNsFiles > 0);
        }
        if (params.count("oplogSize")) {
            long long x = params["oplogSize"].as<int>();
            if (x <= 0) {
                std::cerr << "bad --oplogSize arg" << std::endl;
                ::_exit(EXIT_BADOPTIONS);
            }
            // note a small size such as x==1 is ok for an arbiter.
            if( x > 1000 && sizeof(void*) == 4 ) {
                StringBuilder sb;
                std::cerr << "--oplogSize of " << x
                    << "MB is too big for 32 bit version. Use 64 bit build instead."
                    << std::endl;
                ::_exit(EXIT_BADOPTIONS);
            }
            replSettings.oplogSize = x * 1024 * 1024;
            verify(replSettings.oplogSize > 0);
        }
        if (params.count("cacheSize")) {
            long x = params["cacheSize"].as<long>();
            if (x <= 0) {
                std::cerr << "bad --cacheSize arg" << std::endl;
                ::_exit(EXIT_BADOPTIONS);
            }
            std::cerr << "--cacheSize option not currently supported" << std::endl;
            ::_exit(EXIT_BADOPTIONS);
        }
        if (!params.count("port")) {
            if( params.count("configsvr") ) {
                serverGlobalParams.port = ServerGlobalParams::ConfigServerPort;
            }
            if( params.count("shardsvr") ) {
                if( params.count("configsvr") ) {
                    std::cerr << "can't do --shardsvr and --configsvr at the same time"
                              << std::endl;
                    ::_exit(EXIT_BADOPTIONS);
                }
                serverGlobalParams.port = ServerGlobalParams::ShardServerPort;
            }
        }
        else {
            if (serverGlobalParams.port <= 0 || serverGlobalParams.port > 65535) {
                std::cerr << "bad --port number" << std::endl;
                ::_exit(EXIT_BADOPTIONS);
            }
        }
        if ( params.count("configsvr" ) ) {
            serverGlobalParams.configsvr = true;
            storageGlobalParams.smallfiles = true; // config server implies small files
            if (replSettings.usingReplSets() || replSettings.master || replSettings.slave) {
                std::cerr << "replication should not be enabled on a config server" << std::endl;
                ::_exit(EXIT_BADOPTIONS);
            }
            if (!params.count("nodur") && !params.count("nojournal"))
                storageGlobalParams.dur = true;
            if (!params.count("dbpath"))
                storageGlobalParams.dbpath = "/data/configdb";
            replSettings.master = true;
            if (!params.count("oplogSize"))
                replSettings.oplogSize = 5 * 1024 * 1024;
        }
        if ( params.count( "profile" ) ) {
            serverGlobalParams.defaultProfile = params["profile"].as<int>();
        }
        if (params.count("ipv6")) {
            enableIPv6();
        }

        if (params.count("noMoveParanoia") && params.count("moveParanoia")) {
            std::cerr << "The moveParanoia and noMoveParanoia flags cannot both be set; "
                << "please use only one of them." << std::endl;
            ::_exit(EXIT_BADOPTIONS);
        }

        if (params.count("noMoveParanoia"))
            serverGlobalParams.moveParanoia = false;

        if (params.count("moveParanoia"))
            serverGlobalParams.moveParanoia = true;

        if (params.count("pairwith") || params.count("arbiter") || params.count("opIdMem")) {
            std::cerr << "****\n"
                << "Replica Pairs have been deprecated. Invalid options: --pairwith, "
                << "--arbiter, and/or --opIdMem\n"
                << "<http://dochub.mongodb.org/core/replicapairs>\n"
                << "****" << std::endl;
            ::_exit(EXIT_BADOPTIONS);
        }

        // needs to be after things like --configsvr parsing, thus here.
        if (params.count("repairpath")) {
            storageGlobalParams.repairpath = params["repairpath"].as<string>();
            if (!storageGlobalParams.repairpath.size()) {
                std::cerr << "repairpath is empty" << std::endl;
                ::_exit(EXIT_BADOPTIONS);
            }

            if (storageGlobalParams.dur &&
                !str::startsWith(storageGlobalParams.repairpath,
                                 storageGlobalParams.dbpath)) {
                std::cerr << "You must use a --repairpath that is a subdirectory of "
                    << "--dbpath when using journaling" << std::endl;
                ::_exit(EXIT_BADOPTIONS);
            }
        }
        else {
            storageGlobalParams.repairpath = storageGlobalParams.dbpath;
        }

        if (replSettings.pretouch)
            log() << "--pretouch " << replSettings.pretouch << endl;

        if (sizeof(void*) == 4 && !(params.count("nodur") || params.count("nojournal") ||
                                    params.count("dur") || params.count("journal"))) {
            // trying to make this stand out more like startup warnings
            log() << endl;
            warning() << "32-bit servers don't have journaling enabled by default. "
                      << "Please use --journal if you want durability." << endl;
            log() << endl;
        }

        return Status::OK();
    }
Exemplo n.º 5
0
    Status storeMongosOptions(const moe::Environment& params,
                              const std::vector<std::string>& args) {

        Status ret = storeServerOptions(params, args);
        if (!ret.isOK()) {
            std::cerr << "Error storing command line: " << ret.toString() << std::endl;
            ::_exit(EXIT_BADOPTIONS);
        }

        if ( params.count( "chunkSize" ) ) {
            int csize = params["chunkSize"].as<int>();

            // validate chunksize before proceeding
            if ( csize == 0 ) {
                std::cerr << "error: need a non-zero chunksize" << std::endl;
                ::_exit(EXIT_BADOPTIONS);
            }

            if ( !Chunk::setMaxChunkSizeSizeMB( csize ) ) {
                std::cerr << "MaxChunkSize invalid" << std::endl;
                ::_exit(EXIT_BADOPTIONS);
            }
        }

        if (params.count( "port" ) ) {
            int port = params["port"].as<int>();
            if ( port <= 0 || port > 65535 ) {
                out() << "error: port number must be between 1 and 65535" << endl;
                ::_exit(EXIT_FAILURE);
            }
        }

        if ( params.count( "localThreshold" ) ) {
            serverGlobalParams.defaultLocalThresholdMillis = params["localThreshold"].as<int>();
        }

        if ( params.count( "ipv6" ) ) {
            enableIPv6();
        }

        if ( params.count( "jsonp" ) ) {
            serverGlobalParams.jsonp = true;
        }

        if ( params.count( "test" ) ) {
            ::mongo::logger::globalLogDomain()->setMinimumLoggedSeverity(
                    ::mongo::logger::LogSeverity::Debug(5));
            StartupTest::runTests();
            ::_exit(EXIT_SUCCESS);
        }

        if (params.count("noscripting")) {
            // This option currently has no effect for mongos
        }

        if (params.count("httpinterface")) {
            if (params.count("nohttpinterface")) {
                std::cerr << "can't have both --httpinterface and --nohttpinterface" << std::endl;
                ::_exit(EXIT_BADOPTIONS);
            }
            serverGlobalParams.isHttpInterfaceEnabled = true;
        }

        if (params.count("noAutoSplit")) {
            warning() << "running with auto-splitting disabled" << endl;
            Chunk::ShouldAutoSplit = false;
        }

        if ( ! params.count( "configdb" ) ) {
            std::cerr << "error: no args for --configdb" << std::endl;
            ::_exit(EXIT_BADOPTIONS);
        }

        splitStringDelim(params["configdb"].as<std::string>(), &mongosGlobalParams.configdbs, ',');
        if (mongosGlobalParams.configdbs.size() != 1 && mongosGlobalParams.configdbs.size() != 3) {
            std::cerr << "need either 1 or 3 configdbs" << std::endl;
            ::_exit(EXIT_BADOPTIONS);
        }

        if (mongosGlobalParams.configdbs.size() == 1) {
            warning() << "running with 1 config server should be done only for testing purposes "
                      << "and is not recommended for production" << endl;
        }

        mongosGlobalParams.upgrade = params.count("upgrade");

        return Status::OK();
    }
Exemplo n.º 6
0
Status storeMongosOptions(const moe::Environment& params, const std::vector<std::string>& args) {
    Status ret = storeServerOptions(params, args);
    if (!ret.isOK()) {
        return ret;
    }

    if (params.count("sharding.chunkSize")) {
        int csize = params["sharding.chunkSize"].as<int>();

        // validate chunksize before proceeding
        if (csize == 0) {
            return Status(ErrorCodes::BadValue, "error: need a non-zero chunksize");
        }

        if (!Chunk::setMaxChunkSizeSizeMB(csize)) {
            return Status(ErrorCodes::BadValue, "MaxChunkSize invalid");
        }
    }

    if (params.count("net.port")) {
        int port = params["net.port"].as<int>();
        if (port <= 0 || port > 65535) {
            return Status(ErrorCodes::BadValue, "error: port number must be between 1 and 65535");
        }
    }

    if (params.count("replication.localPingThresholdMs")) {
        serverGlobalParams.defaultLocalThresholdMillis =
            params["replication.localPingThresholdMs"].as<int>();
    }

    if (params.count("net.http.JSONPEnabled")) {
        serverGlobalParams.jsonp = params["net.http.JSONPEnabled"].as<bool>();
    }

    if (params.count("noscripting")) {
        // This option currently has no effect for mongos
    }

    if (params.count("sharding.autoSplit")) {
        Chunk::ShouldAutoSplit = params["sharding.autoSplit"].as<bool>();
        if (Chunk::ShouldAutoSplit == false) {
            warning() << "running with auto-splitting disabled";
        }
    }

    if (!params.count("sharding.configDB")) {
        return Status(ErrorCodes::BadValue, "error: no args for --configdb");
    }

    {
        std::string configdbString = params["sharding.configDB"].as<std::string>();

        auto configdbConnectionString = ConnectionString::parse(configdbString);
        if (!configdbConnectionString.isOK()) {
            return Status(ErrorCodes::BadValue,
                          str::stream() << "Invalid configdb connection string: "
                                        << configdbConnectionString.getStatus().toString());
        }

        mongosGlobalParams.configdbs = configdbConnectionString.getValue();
    }

    std::vector<HostAndPort> configServers = mongosGlobalParams.configdbs.getServers();

    if (mongosGlobalParams.configdbs.type() != ConnectionString::SYNC &&
        mongosGlobalParams.configdbs.type() != ConnectionString::SET) {
        return Status(
            ErrorCodes::BadValue,
            "Must have either 3 node legacy config servers, or a replica set config server");
    }

    if (configServers.size() < 3) {
        warning() << "running with less than 3 config servers should be done only for testing "
                     "purposes and is not recommended for production";
    }

    return Status::OK();
}