Example usage for org.apache.hadoop.hdfs HAUtil getAddressOfActive

List of usage examples for org.apache.hadoop.hdfs HAUtil getAddressOfActive

Introduction

In this page you can find the example usage for org.apache.hadoop.hdfs HAUtil getAddressOfActive.

Prototype

public static InetSocketAddress getAddressOfActive(FileSystem fs) throws IOException 

Source Link

Document

Get the internet address of the currently-active NN.

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.
 *///from  w  w w .jav  a  2  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);
}