Updated Branches: refs/heads/1.5.1-SNAPSHOT a55f5d3f0 -> a480f6395
ACCUMULO-2065 Using the hostname for the system running the monitor instead of what was passed via --address. The only downside here is if DNS is not set up. However, if DNS is not set up, you're likely running on a single box, at which point localhost is all you need anyways. Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/a480f639 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/a480f639 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/a480f639 Branch: refs/heads/1.5.1-SNAPSHOT Commit: a480f63958cee884091fa1f0ad3c542fec5c385a Parents: a55f5d3 Author: Josh Elser <els...@apache.org> Authored: Thu Dec 19 14:05:24 2013 -0500 Committer: Josh Elser <els...@apache.org> Committed: Thu Dec 19 14:05:24 2013 -0500 ---------------------------------------------------------------------- .../main/java/org/apache/accumulo/server/monitor/Monitor.java | 6 ++++++ 1 file changed, 6 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/a480f639/server/src/main/java/org/apache/accumulo/server/monitor/Monitor.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/accumulo/server/monitor/Monitor.java b/server/src/main/java/org/apache/accumulo/server/monitor/Monitor.java index c373610..3836916 100644 --- a/server/src/main/java/org/apache/accumulo/server/monitor/Monitor.java +++ b/server/src/main/java/org/apache/accumulo/server/monitor/Monitor.java @@ -16,6 +16,7 @@ */ package org.apache.accumulo.server.monitor; +import java.net.InetAddress; import java.net.InetSocketAddress; import java.util.ArrayList; import java.util.Collections; @@ -481,7 +482,12 @@ public class Monitor { server.addServlet(ShellServlet.class, "/shell"); server.start(); + try { + hostname = InetAddress.getLocalHost().getHostName(); + + log.debug("Using " + hostname + " to advertise monitor location in ZooKeeper"); + String monitorAddress = org.apache.accumulo.core.util.AddressUtil.toString(new InetSocketAddress(hostname, server.getPort())); ZooReaderWriter.getInstance().putPersistentData(ZooUtil.getRoot(instance) + Constants.ZMONITOR, monitorAddress.getBytes(), NodeExistsPolicy.OVERWRITE);