Search in sources :

Example 1 with ReconfigurationProtocol

use of org.apache.hadoop.hdfs.protocol.ReconfigurationProtocol in project hadoop by apache.

the class DFSAdmin method startReconfigurationDispatch.

int startReconfigurationDispatch(final String nodeType, final String address, final PrintStream out, final PrintStream err) throws IOException {
    if ("namenode".equals(nodeType)) {
        ReconfigurationProtocol reconfProxy = getNameNodeProxy(address);
        reconfProxy.startReconfiguration();
        return 0;
    } else if ("datanode".equals(nodeType)) {
        ClientDatanodeProtocol reconfProxy = getDataNodeProxy(address);
        reconfProxy.startReconfiguration();
        return 0;
    } else {
        System.err.println("Node type " + nodeType + " does not support reconfiguration.");
        return 1;
    }
}
Also used : ReconfigurationProtocol(org.apache.hadoop.hdfs.protocol.ReconfigurationProtocol) ClientDatanodeProtocol(org.apache.hadoop.hdfs.protocol.ClientDatanodeProtocol)

Example 2 with ReconfigurationProtocol

use of org.apache.hadoop.hdfs.protocol.ReconfigurationProtocol in project hadoop by apache.

the class DFSAdmin method getNameNodeProxy.

private ReconfigurationProtocol getNameNodeProxy(String node) throws IOException {
    InetSocketAddress nodeAddr = NetUtils.createSocketAddr(node);
    // Get the current configuration
    Configuration conf = getConf();
    // For namenode proxy the server principal should be NN's one.
    conf.set(CommonConfigurationKeys.HADOOP_SECURITY_SERVICE_USER_NAME_KEY, conf.get(DFSConfigKeys.DFS_NAMENODE_KERBEROS_PRINCIPAL_KEY, ""));
    // Create the client
    ReconfigurationProtocol reconfigProtocol = DFSUtilClient.createReconfigurationProtocolProxy(nodeAddr, getUGI(), conf, NetUtils.getSocketFactory(conf, ReconfigurationProtocol.class));
    return reconfigProtocol;
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) HdfsConfiguration(org.apache.hadoop.hdfs.HdfsConfiguration) InetSocketAddress(java.net.InetSocketAddress) ReconfigurationProtocol(org.apache.hadoop.hdfs.protocol.ReconfigurationProtocol)

Aggregations

ReconfigurationProtocol (org.apache.hadoop.hdfs.protocol.ReconfigurationProtocol)2 InetSocketAddress (java.net.InetSocketAddress)1 Configuration (org.apache.hadoop.conf.Configuration)1 HdfsConfiguration (org.apache.hadoop.hdfs.HdfsConfiguration)1 ClientDatanodeProtocol (org.apache.hadoop.hdfs.protocol.ClientDatanodeProtocol)1