Skip to content

Commit

Permalink
Fixing a big hostname bug that affects HA mode
Browse files Browse the repository at this point in the history
  • Loading branch information
florianleibert committed Oct 23, 2013
1 parent 9db62fc commit 875c9cf
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions bin/chronos-marathon
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ flags=()

#If we're on Amazon, let's use the public hostname so redirect works as expected.
if public_hostname="$( curl -f --timeout 1 http://169.254.169.254/latest/meta-data/public-hostname )"
else
flags+=( --hostname `hostname` )
then
flags+=( --hostname $public_hostname )
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ trait SchedulerConfiguration extends ScallopConf {
lazy val hostname = opt[String]("hostname",
descr = "The advertised hostname stored in ZooKeeper so another standby " +
"host can redirect to this elected leader",
default = Some("localhost"))
default = Some(java.net.InetAddress.getLocalHost().getHostName()))

lazy val leaderMaxIdleTimeMs = opt[Int]("leader_max_idle_time",
descr = "The look-ahead time for scheduling tasks in milliseconds",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class ZookeeperModule(val config: SchedulerConfiguration with HttpConf)
config.zooKeeperCandidatePath),
new Supplier[Array[Byte]] {
def get() = {
"%s:%d".format(config.hostname, config.httpPort()).getBytes
"%s:%d".format(config.hostname(), config.httpPort()).getBytes
}
})
}
Expand Down

0 comments on commit 875c9cf

Please sign in to comment.