Example usage for org.apache.hadoop.hdfs DFSUtil getInfoServer

List of usage examples for org.apache.hadoop.hdfs DFSUtil getInfoServer

Introduction

In this page you can find the example usage for org.apache.hadoop.hdfs DFSUtil getInfoServer.

Prototype

public static URI getInfoServer(InetSocketAddress namenodeAddr, Configuration conf, String scheme)
        throws IOException 

Source Link

Document

return server http or https address from the configuration for a given namenode rpc address.

Usage

From source file:com.cloudera.impala.service.JniFrontend.java

License:Apache License

/**
 * Derive the namenode http address from the current file system,
 * either default or as set by "-fs" in the generic options.
 *
 * @return Returns http address or null if failure.
 *//*  w  w  w .  ja v  a2 s.c  om*/
private String getCurrentNameNodeAddress() throws Exception {
    // get the filesystem object to verify it is an HDFS system
    FileSystem fs;
    fs = FileSystem.get(CONF);
    if (!(fs instanceof DistributedFileSystem)) {
        LOG.error("FileSystem is " + fs.getUri());
        return null;
    }
    return DFSUtil.getInfoServer(HAUtil.getAddressOfActive(fs), CONF, false);
}