Skip to content

Commit

Permalink
Added logging when master/slaves/frameworks bind to loopback address.
Browse files Browse the repository at this point in the history
  • Loading branch information
vinodkone committed Aug 26, 2014
1 parent 7de2750 commit 1ebe214
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/master/master.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,15 @@ void Master::initialize()
LOG(INFO) << "Master " << info_.id() << " (" << info_.hostname() << ")"
<< " started on " << string(self()).substr(7);

if (stringify(net::IP(ntohl(self().ip))) == "127.0.0.1") {
LOG(WARNING) << "\n**************************************************\n"
<< "Master bound to loopback interface!"
<< " Cannot communicate with remote schedulers or slaves."
<< " You might want to set '--ip' flag to a routable"
<< " IP address.\n"
<< "**************************************************";
}

// NOTE: We enforce a minimum slave re-register timeout because the
// slave bounds its (re-)registration retries based on the minimum.
if (flags.slave_reregister_timeout < MIN_SLAVE_REREGISTER_TIMEOUT) {
Expand Down
10 changes: 10 additions & 0 deletions src/sched/sched.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
#include <stout/flags.hpp>
#include <stout/hashmap.hpp>
#include <stout/lambda.hpp>
#include <stout/net.hpp>
#include <stout/option.hpp>
#include <stout/os.hpp>
#include <stout/stopwatch.hpp>
Expand Down Expand Up @@ -1090,6 +1091,15 @@ void MesosSchedulerDriver::initialize() {
// Initialize libprocess.
process::initialize(schedulerId);

if (stringify(net::IP(ntohl(process::ip()))) == "127.0.0.1") {
LOG(WARNING) << "\n**************************************************\n"
<< "Scheduler driver bound to loopback interface!"
<< " Cannot communicate with remote master(s)."
<< " You might want to set 'LIBPROCESS_IP' environment"
<< " variable to use a routable IP address.\n"
<< "**************************************************";
}

// Initialize logging.
// TODO(benh): Replace whitespace in framework.name() with '_'?
if (flags.initialize_driver_logging) {
Expand Down
10 changes: 10 additions & 0 deletions src/scheduler/scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#include <stout/error.hpp>
#include <stout/flags.hpp>
#include <stout/lambda.hpp>
#include <stout/net.hpp>
#include <stout/nothing.hpp>
#include <stout/option.hpp>
#include <stout/os.hpp>
Expand Down Expand Up @@ -127,6 +128,15 @@ class MesosProcess : public ProtobufProcess<MesosProcess>
// want to use flags to initialize libprocess).
process::initialize();

if (stringify(net::IP(ntohl(self().ip))) == "127.0.0.1") {
LOG(WARNING) << "\n**************************************************\n"
<< "Scheduler driver bound to loopback interface!"
<< " Cannot communicate with remote master(s)."
<< " You might want to set 'LIBPROCESS_IP' environment"
<< " variable to use a routable IP address.\n"
<< "**************************************************";
}

// Initialize logging.
if (flags.initialize_driver_logging) {
logging::initialize("mesos", flags);
Expand Down
9 changes: 9 additions & 0 deletions src/slave/slave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,15 @@ void Slave::initialize()
{
LOG(INFO) << "Slave started on " << string(self()).substr(6);

if (stringify(net::IP(ntohl(self().ip))) == "127.0.0.1") {
LOG(WARNING) << "\n**************************************************\n"
<< "Slave bound to loopback interface!"
<< " Cannot communicate with remote master(s)."
<< " You might want to set '--ip' flag to a routable"
<< " IP address.\n"
<< "**************************************************";
}

#ifdef __linux__
// Move the slave into its own cgroup for each of the specified subsystems.
// NOTE: Any subsystem configuration is inherited from the mesos root cgroup
Expand Down

0 comments on commit 1ebe214

Please sign in to comment.