public TServerInstance(String address, long session) { this(AddressUtil.parseAddress(address, false), Long.toHexString(session)); }
public static HostAndPort parseAddress(String address, int defaultPort) { return parseAddress(address, true).withDefaultPort(defaultPort); }
public TServerInstance(Value address, Text session) { this(AddressUtil.parseAddress(new String(address.get(), UTF_8), false), session.toString()); }
public HostAndPort getAddress(Service service) { return AddressUtil.parseAddress(getAddressString(service), false); }
private Set<TServerInstance> parseServers(String servers) { if (servers == null) return null; // parse "host:port[INSTANCE]" Set<TServerInstance> result = new HashSet<>(); if (servers.length() > 0) { for (String part : servers.split(",")) { String parts[] = part.split("\\[", 2); String hostport = parts[0]; String instance = parts[1]; if (instance != null && instance.endsWith("]")) instance = instance.substring(0, instance.length() - 1); result.add(new TServerInstance(AddressUtil.parseAddress(hostport, false), instance)); } } return result; }
TServerInstance find(Map<String,TServerInfo> servers, String tabletServer) { HostAndPort addr; String sessionId = null; if (tabletServer.charAt(tabletServer.length() - 1) == ']') { int index = tabletServer.indexOf('['); if (index == -1) { throw new IllegalArgumentException("Could not parse tabletserver '" + tabletServer + "'"); } addr = AddressUtil.parseAddress(tabletServer.substring(0, index), false); // Strip off the last bracket sessionId = tabletServer.substring(index + 1, tabletServer.length() - 1); } else { addr = AddressUtil.parseAddress(tabletServer, false); } for (Entry<String,TServerInfo> entry : servers.entrySet()) { if (entry.getValue().instance.getLocation().equals(addr)) { // Return the instance if we have no desired session ID, or we match the desired session ID if (sessionId == null || sessionId.equals(entry.getValue().instance.getSession())) return entry.getValue().instance; } } return null; }
/** * Generates a recovery tserver list * * @return Recovery tserver list */ @Path("recovery") @GET public TabletServersRecovery getTserverRecovery() { TabletServersRecovery recoveryList = new TabletServersRecovery(); MasterMonitorInfo mmi = Monitor.getMmi(); if (mmi == null) { throw new WebApplicationException(Status.INTERNAL_SERVER_ERROR); } for (TabletServerStatus server : mmi.tServerInfo) { if (server.logSorts != null) { for (RecoveryStatus recovery : server.logSorts) { String serv = AddressUtil.parseAddress(server.name, false).getHost(); String log = recovery.name; int time = recovery.runtime; double progress = recovery.progress; recoveryList.addRecovery(new TabletServerRecoveryInformation(serv, log, time, progress)); } } } return recoveryList; }
private static void stopTabletServer(final ClientContext context, List<String> servers, final boolean force) throws AccumuloException, AccumuloSecurityException { if (context.getMasterLocations().size() == 0) { log.info("No masters running. Not attempting safe unload of tserver."); return; } final String zTServerRoot = getTServersZkPath(context); final ZooCache zc = context.getZooCache(); 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.executeVoid(context, client -> client.shutdownTabletServer(Tracer.traceInfo(), context.rpcCreds(), finalServer, force)); } } }
: AddressUtil.parseAddress(masters.get(0), false).getHost(); Integer onlineTabletServers = mmi.tServerInfo.size(); Integer totalTabletServers = tservers.size();
@Override public void ping(String tserver) throws AccumuloException { TTransport transport = null; try { transport = ThriftUtil.createTransport(AddressUtil.parseAddress(tserver, false), context); TabletClientService.Client client = ThriftUtil .createClient(new TabletClientService.Client.Factory(), transport); client.getTabletServerStatus(Tracer.traceInfo(), context.rpcCreds()); } catch (TException e) { throw new AccumuloException(e); } finally { if (transport != null) { transport.close(); } } }
public TServerInstance(String address, long session) { this(AddressUtil.parseAddress(address, false), Long.toHexString(session)); }
public static String displayName(String address) { if (address == null) return "--Unknown--"; InetSocketAddress inetAddress = AddressUtil.parseAddress(address, 0); return inetAddress.getHostName() + ":" + inetAddress.getPort(); }
public static HostAndPort parseAddress(String address, int defaultPort) { return parseAddress(address, true).withDefaultPort(defaultPort); } }
public TServerInstance(Value address, Text session) { this(AddressUtil.parseAddress(new String(address.get(), UTF_8), false), session.toString()); }
protected TServerInstance parse(byte[] current) { String str = new String(current, UTF_8); String[] parts = str.split("[|]", 2); InetSocketAddress address = AddressUtil.parseAddress(parts[0], 0); if (parts.length > 1 && parts[1] != null && parts[1].length() > 0) { return new TServerInstance(address, parts[1]); } else { // a 1.2 location specification: DO NOT WANT return null; } }
public HostAndPort getAddress(Service service) { return AddressUtil.parseAddress(getAddressString(service), false); }
private Set<TServerInstance> parseServers(String servers) { if (servers == null) return null; // parse "host:port[INSTANCE]" Set<TServerInstance> result = new HashSet<>(); if (servers.length() > 0) { for (String part : servers.split(",")) { String parts[] = part.split("\\[", 2); String hostport = parts[0]; String instance = parts[1]; if (instance != null && instance.endsWith("]")) instance = instance.substring(0, instance.length() - 1); result.add(new TServerInstance(AddressUtil.parseAddress(hostport, false), instance)); } } return result; }
static public InetSocketAddress parseAddress(String address, Property portDefaultProperty) { final int dfaultPort = ServerConfiguration.getDefaultConfiguration().getPort(portDefaultProperty); return org.apache.accumulo.core.util.AddressUtil.parseAddress(address, dfaultPort); }
@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 TabletClientService.Iface getTabletClient (String tserverAddress) throws TTransportException { com.google.common.net.HostAndPort address = AddressUtil.parseAddress(tserverAddress,false); //${accumulo.VERSION.1.6}return ThriftUtil.getTServerClient( tserverAddress, instance.getConfiguration()); // 1.6 return ThriftUtil.getTServerClient( address, new ClientContext(instance, new Credentials(principal, token), instance.getConfiguration())); // 1.7 }