/** * Get an RPC proxy for each NN in an HA nameservice. Used when a given RPC * call should be made on every NN in an HA nameservice, not just the active. * * @param conf configuration * @param nsId the nameservice to get all of the proxies for. * @return a list of RPC proxies for each NN in the nameservice. * @throws IOException in the event of error. */ public static List<ClientProtocol> getProxiesForAllNameNodesInNameservice( Configuration conf, String nsId) throws IOException { List<ProxyAndInfo<ClientProtocol>> proxies = getProxiesForAllNameNodesInNameservice(conf, nsId, ClientProtocol.class); List<ClientProtocol> namenodes = new ArrayList<ClientProtocol>( proxies.size()); for (ProxyAndInfo<ClientProtocol> proxy : proxies) { namenodes.add(proxy.getProxy()); } return namenodes; }
String nsId = dfsUri.getHost(); List<ProxyAndInfo<ClientProtocol>> proxies = HAUtil.getProxiesForAllNameNodesInNameservice(dfsConf, nsId, ClientProtocol.class); List<IOException> exceptions = new ArrayList<>();
HAUtil.getProxiesForAllNameNodesInNameservice(dfsConf, nsId); if (!HAUtil.isAtLeastOneActive(namenodes)) { throw new IOException("Cannot finalize with no NameNode active"); HAUtil.getProxiesForAllNameNodesInNameservice(dfsConf, nsId, ClientProtocol.class); List<IOException> exceptions = new ArrayList<>();
String nsId = dfsUri.getHost(); List<ProxyAndInfo<ClientProtocol>> proxies = HAUtil.getProxiesForAllNameNodesInNameservice(dfsConf, nsId, ClientProtocol.class); List<IOException> exceptions = new ArrayList<>();
String nsId = dfsUri.getHost(); List<ProxyAndInfo<ClientProtocol>> proxies = HAUtil.getProxiesForAllNameNodesInNameservice(dfsConf, nsId, ClientProtocol.class); List<IOException> exceptions = new ArrayList<>();
HAUtil.getProxiesForAllNameNodesInNameservice(dfsConf, nsId, ClientProtocol.class); List<IOException> exceptions = new ArrayList<>();
String nsId = dfsUri.getHost(); List<ProxyAndInfo<ClientProtocol>> proxies = HAUtil.getProxiesForAllNameNodesInNameservice(dfsConf, nsId, ClientProtocol.class); List<IOException> exceptions = new ArrayList<>();
HAUtil.getProxiesForAllNameNodesInNameservice(conf, nsId, RefreshCallQueueProtocol.class); List<IOException> exceptions = new ArrayList<>();
String nsId = dfsUri.getHost(); List<ProxyAndInfo<ClientProtocol>> proxies = HAUtil.getProxiesForAllNameNodesInNameservice( dfsConf, nsId, ClientProtocol.class); for (ProxyAndInfo<ClientProtocol> proxy : proxies) {
HAUtil.getProxiesForAllNameNodesInNameservice(conf, nsId, RefreshUserMappingsProtocol.class); List<IOException> exceptions = new ArrayList<>();
HAUtil.getProxiesForAllNameNodesInNameservice(conf, nsId, RefreshAuthorizationPolicyProtocol.class); List<IOException> exceptions = new ArrayList<>();
HAUtil.getProxiesForAllNameNodesInNameservice(conf, nsId, RefreshUserMappingsProtocol.class); List<IOException> exceptions = new ArrayList<>();
/** * Get an RPC proxy for each NN in an HA nameservice. Used when a given RPC * call should be made on every NN in an HA nameservice, not just the active. * * @param conf configuration * @param nsId the nameservice to get all of the proxies for. * @return a list of RPC proxies for each NN in the nameservice. * @throws IOException in the event of error. */ public static List<ClientProtocol> getProxiesForAllNameNodesInNameservice( Configuration conf, String nsId) throws IOException { List<ProxyAndInfo<ClientProtocol>> proxies = getProxiesForAllNameNodesInNameservice(conf, nsId, ClientProtocol.class); List<ClientProtocol> namenodes = new ArrayList<ClientProtocol>( proxies.size()); for (ProxyAndInfo<ClientProtocol> proxy : proxies) { namenodes.add(proxy.getProxy()); } return namenodes; }
/** * Get an RPC proxy for each NN in an HA nameservice. Used when a given RPC * call should be made on every NN in an HA nameservice, not just the active. * * @param conf configuration * @param nsId the nameservice to get all of the proxies for. * @return a list of RPC proxies for each NN in the nameservice. * @throws IOException in the event of error. */ public static List<ClientProtocol> getProxiesForAllNameNodesInNameservice( Configuration conf, String nsId) throws IOException { List<ProxyAndInfo<ClientProtocol>> proxies = getProxiesForAllNameNodesInNameservice(conf, nsId, ClientProtocol.class); List<ClientProtocol> namenodes = new ArrayList<ClientProtocol>( proxies.size()); for (ProxyAndInfo<ClientProtocol> proxy : proxies) { namenodes.add(proxy.getProxy()); } return namenodes; }
HAUtil.getProxiesForAllNameNodesInNameservice(dfsConf, nsId); if (!HAUtil.isAtLeastOneActive(namenodes)) { throw new IOException("Cannot finalize with no NameNode active"); HAUtil.getProxiesForAllNameNodesInNameservice(dfsConf, nsId, ClientProtocol.class); for (ProxyAndInfo<ClientProtocol> proxy : proxies) {
/** * Command to ask the namenode to save the namespace. * Usage: hdfs dfsadmin -saveNamespace * @exception IOException * @see org.apache.hadoop.hdfs.protocol.ClientProtocol#saveNamespace() */ public int saveNamespace() throws IOException { int exitCode = -1; DistributedFileSystem dfs = getDFS(); Configuration dfsConf = dfs.getConf(); URI dfsUri = dfs.getUri(); boolean isHaEnabled = HAUtil.isLogicalUri(dfsConf, dfsUri); if (isHaEnabled) { String nsId = dfsUri.getHost(); List<ProxyAndInfo<ClientProtocol>> proxies = HAUtil.getProxiesForAllNameNodesInNameservice(dfsConf, nsId, ClientProtocol.class); for (ProxyAndInfo<ClientProtocol> proxy : proxies) { proxy.getProxy().saveNamespace(); System.out.println("Save namespace successful for " + proxy.getAddress()); } } else { dfs.saveNamespace(); System.out.println("Save namespace successful"); } exitCode = 0; return exitCode; }
/** * Command to ask the namenode to reread the hosts and excluded hosts * file. * Usage: hdfs dfsadmin -refreshNodes * @exception IOException */ public int refreshNodes() throws IOException { int exitCode = -1; DistributedFileSystem dfs = getDFS(); Configuration dfsConf = dfs.getConf(); URI dfsUri = dfs.getUri(); boolean isHaEnabled = HAUtil.isLogicalUri(dfsConf, dfsUri); if (isHaEnabled) { String nsId = dfsUri.getHost(); List<ProxyAndInfo<ClientProtocol>> proxies = HAUtil.getProxiesForAllNameNodesInNameservice(dfsConf, nsId, ClientProtocol.class); for (ProxyAndInfo<ClientProtocol> proxy: proxies) { proxy.getProxy().refreshNodes(); System.out.println("Refresh nodes successful for " + proxy.getAddress()); } } else { dfs.refreshNodes(); System.out.println("Refresh nodes successful"); } exitCode = 0; return exitCode; }
String nsId = dfsUri.getHost(); List<ProxyAndInfo<ClientProtocol>> proxies = HAUtil.getProxiesForAllNameNodesInNameservice(dfsConf, nsId, ClientProtocol.class); for (ProxyAndInfo<ClientProtocol> proxy : proxies) {
String nsId = dfsUri.getHost(); List<ProxyAndInfo<ClientProtocol>> proxies = HAUtil.getProxiesForAllNameNodesInNameservice(dfsConf, nsId, ClientProtocol.class); for (ProxyAndInfo<ClientProtocol> proxy : proxies) {
HAUtil.getProxiesForAllNameNodesInNameservice(conf, HATestUtil.getLogicalHostname(cluster));