diff options
author | Andy Schwerin <schwerin@mongodb.com> | 2016-09-30 13:35:53 -0400 |
---|---|---|
committer | Andy Schwerin <schwerin@mongodb.com> | 2016-09-30 13:35:53 -0400 |
commit | 67c441cf094920674fc76668d5b0d225503a9c8a (patch) | |
tree | 219fbecf321cafada6bcbe487eeb52320a0fb32f | |
parent | cb9e5e2f0a8ea4c47747e9eeac1aa4524092ea57 (diff) | |
download | mongo-67c441cf094920674fc76668d5b0d225503a9c8a.tar.gz |
SERVER-25629 Log a warning if it looks like the operator reversed the two haves of the CSRS config string passed to --configdb.
-rw-r--r-- | src/mongo/s/mongos_options.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/mongo/s/mongos_options.cpp b/src/mongo/s/mongos_options.cpp index b2bcedb04ca..1f4a50ad9cd 100644 --- a/src/mongo/s/mongos_options.cpp +++ b/src/mongo/s/mongos_options.cpp @@ -45,9 +45,11 @@ #include "mongo/s/version_mongos.h" #include "mongo/util/log.h" #include "mongo/util/mongoutils/str.h" +#include "mongo/util/net/sock.h" #include "mongo/util/net/ssl_options.h" #include "mongo/util/options_parser/startup_options.h" #include "mongo/util/startup_test.h" +#include "mongo/util/stringutils.h" namespace mongo { @@ -218,11 +220,24 @@ Status storeMongosOptions(const moe::Environment& params) { } 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 = |