private String getMasterAddress() { try { List<String> locations = instance.getMasterLocations(); if (locations.size() == 0) return null; return locations.get(0); } catch (Exception e) { log.warn("Failed to obtain master host " + e); } return null; }
@Override protected String getTitle(HttpServletRequest req) { List<String> masters = Monitor.getInstance().getMasterLocations(); return "Master Server" + (masters.size() == 0 ? "" : ":" + AddressUtil.parseAddress(masters.get(0), Property.MASTER_CLIENTPORT).getHostName()); }
private HostAndPort getMasterAddress() { try { List<String> locations = context.getInstance().getMasterLocations(); if (locations.size() == 0) return null; return HostAndPort.fromString(locations.get(0)); } catch (Exception e) { log.warn("Failed to obtain master host " + e); } return null; }
private HostAndPort getMasterAddress() { try { List<String> locations = getInstance().getMasterLocations(); if (locations.size() == 0) return null; return HostAndPort.fromString(locations.get(0)); } catch (Exception e) { log.warn("Failed to obtain master host " + e); } return null; }
@Override public void execute(final String[] args) throws KeeperException, InterruptedException { Instance instance = HdfsZooInstance.getInstance(); System.out.println("monitor: " + MonitorUtil.getLocation(instance)); System.out.println("masters: " + instance.getMasterLocations()); System.out.println("zookeepers: " + instance.getZooKeepers()); }
public static void main(String[] args) { Instance instance = HdfsZooInstance.getInstance(); System.out.println("Instance Name: " + instance.getInstanceName()); System.out.println("Instance ID: " + instance.getInstanceID()); System.out.println("ZooKeepers: " + instance.getZooKeepers()); System.out.println("Masters: " + Joiner.on(", ").join(instance.getMasterLocations())); } }
public static void main(String[] args) throws Exception { ZooReaderWriter zrw = ZooReaderWriter.getInstance(); Instance instance = HdfsZooInstance.getInstance(); System.out.println("monitor: " + new String(zrw.getData(ZooUtil.getRoot(instance) + Constants.ZMONITOR_HTTP_ADDR, null), UTF_8)); System.out.println("masters: " + instance.getMasterLocations()); System.out.println("zookeepers: " + instance.getZooKeepers()); } }
public static void main(String[] args) { Instance instance = HdfsZooInstance.getInstance(); System.out.println("Instance Name: " + instance.getInstanceName()); System.out.println("Instance ID: " + instance.getInstanceID()); System.out.println("ZooKeepers: " + instance.getZooKeepers()); System.out.println("Masters: " + StringUtil.join(instance.getMasterLocations(), ", ")); }
@Override protected String getTitle(HttpServletRequest req) { List<String> masters = Monitor.getContext().getInstance().getMasterLocations(); return "Master Server" + (masters.size() == 0 ? "" : ":" + AddressUtil.parseAddress(masters.get(0), false).getHost()); }
public static MasterClientService.Client getConnection(ClientContext context) { checkArgument(context != null, "context is null"); List<String> locations = context.getInstance().getMasterLocations(); if (locations.size() == 0) { log.debug("No masters..."); return null; } HostAndPort master = HostAndPort.fromString(locations.get(0)); if (0 == master.getPort()) return null; try { // Master requests can take a long time: don't ever time out MasterClientService.Client client = ThriftUtil .getClientNoTimeout(new MasterClientService.Client.Factory(), master, context); return client; } catch (TTransportException tte) { Throwable cause = tte.getCause(); if (null != cause && cause instanceof UnknownHostException) { // do not expect to recover from this throw new RuntimeException(tte); } log.debug("Failed to connect to master=" + master + ", will retry... ", tte); return null; } }
public static ReplicationCoordinator.Client getCoordinatorConnection(ClientContext context) { Instance instance = context.getInstance(); List<String> locations = instance.getMasterLocations();
Assert.assertEquals(1, inst.getMasterLocations().size()); String masterAddr = Iterables.getOnlyElement(inst.getMasterLocations());
private static void stopTabletServer(final ClientContext context, List<String> servers, final boolean force) throws AccumuloException, AccumuloSecurityException { if (context.getInstance().getMasterLocations().size() == 0) { log.info("No masters running. Not attempting safe unload of tserver."); return; } final Instance instance = context.getInstance(); final String zTServerRoot = getTServersZkPath(instance); final ZooCache zc = new ZooCacheFactory().getZooCache(instance.getZooKeepers(), instance.getZooKeepersSessionTimeOut()); for (String server : servers) { for (int port : context.getConfiguration().getPort(Property.TSERV_CLIENTPORT)) { HostAndPort address = AddressUtil.parseAddress(server, port); final String finalServer = qualifyWithZooKeeperSessionId(zTServerRoot, zc, address.toString()); log.info("Stopping server " + finalServer); MasterClient.execute(context, new ClientExec<MasterClientService.Client>() { @Override public void execute(MasterClientService.Client client) throws Exception { client.shutdownTabletServer(Tracer.traceInfo(), context.rpcCreds(), finalServer, force); } }); } } }
slaves.add(down.server); List<String> masters = Monitor.getInstance().getMasterLocations();
slaves.add(down.server); List<String> masters = Monitor.getContext().getInstance().getMasterLocations();