HDFS-3939. NN RPC address cleanup. Contributed by Eli Collins
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1387278 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ea6a36e2e7
commit
a8e4bb81b2
|
@ -233,6 +233,8 @@ Release 2.0.3-alpha - Unreleased
|
||||||
HDFS-3925. Prettify PipelineAck#toString() for printing to a log
|
HDFS-3925. Prettify PipelineAck#toString() for printing to a log
|
||||||
(Andrew Wang via todd)
|
(Andrew Wang via todd)
|
||||||
|
|
||||||
|
HDFS-3939. NN RPC address cleanup. (eli)
|
||||||
|
|
||||||
OPTIMIZATIONS
|
OPTIMIZATIONS
|
||||||
|
|
||||||
BUG FIXES
|
BUG FIXES
|
||||||
|
|
|
@ -71,7 +71,7 @@ public class FileChecksumServlets {
|
||||||
String tokenString = ugi.getTokens().iterator().next().encodeToUrlString();
|
String tokenString = ugi.getTokens().iterator().next().encodeToUrlString();
|
||||||
dtParam = JspHelper.getDelegationTokenUrlParam(tokenString);
|
dtParam = JspHelper.getDelegationTokenUrlParam(tokenString);
|
||||||
}
|
}
|
||||||
String addr = NetUtils.getHostPortString(nn.getNameNodeAddress());
|
String addr = nn.getNameNodeAddressHostPortString();
|
||||||
String addrParam = JspHelper.getUrlParam(JspHelper.NAMENODE_ADDRESS, addr);
|
String addrParam = JspHelper.getUrlParam(JspHelper.NAMENODE_ADDRESS, addr);
|
||||||
|
|
||||||
return new URL(scheme, hostname, port,
|
return new URL(scheme, hostname, port,
|
||||||
|
|
|
@ -34,7 +34,6 @@ import org.apache.hadoop.hdfs.protocol.DatanodeInfo;
|
||||||
import org.apache.hadoop.hdfs.protocol.HdfsFileStatus;
|
import org.apache.hadoop.hdfs.protocol.HdfsFileStatus;
|
||||||
import org.apache.hadoop.hdfs.protocol.LocatedBlocks;
|
import org.apache.hadoop.hdfs.protocol.LocatedBlocks;
|
||||||
import org.apache.hadoop.hdfs.server.common.JspHelper;
|
import org.apache.hadoop.hdfs.server.common.JspHelper;
|
||||||
import org.apache.hadoop.net.NetUtils;
|
|
||||||
import org.apache.hadoop.security.UserGroupInformation;
|
import org.apache.hadoop.security.UserGroupInformation;
|
||||||
import org.apache.hadoop.util.ServletUtil;
|
import org.apache.hadoop.util.ServletUtil;
|
||||||
|
|
||||||
|
@ -74,7 +73,7 @@ public class FileDataServlet extends DfsServlet {
|
||||||
// Add namenode address to the url params
|
// Add namenode address to the url params
|
||||||
NameNode nn = NameNodeHttpServer.getNameNodeFromContext(
|
NameNode nn = NameNodeHttpServer.getNameNodeFromContext(
|
||||||
getServletContext());
|
getServletContext());
|
||||||
String addr = NetUtils.getHostPortString(nn.getNameNodeAddress());
|
String addr = nn.getNameNodeAddressHostPortString();
|
||||||
String addrParam = JspHelper.getUrlParam(JspHelper.NAMENODE_ADDRESS, addr);
|
String addrParam = JspHelper.getUrlParam(JspHelper.NAMENODE_ADDRESS, addr);
|
||||||
|
|
||||||
return new URL(scheme, hostname, port,
|
return new URL(scheme, hostname, port,
|
||||||
|
|
|
@ -35,7 +35,6 @@ import org.apache.hadoop.ha.HAServiceProtocol.StateChangeRequestInfo;
|
||||||
import org.apache.hadoop.ha.HAServiceStatus;
|
import org.apache.hadoop.ha.HAServiceStatus;
|
||||||
import org.apache.hadoop.ha.HealthCheckFailedException;
|
import org.apache.hadoop.ha.HealthCheckFailedException;
|
||||||
import org.apache.hadoop.ha.ServiceFailedException;
|
import org.apache.hadoop.ha.ServiceFailedException;
|
||||||
import org.apache.hadoop.fs.CommonConfigurationKeys;
|
|
||||||
import org.apache.hadoop.fs.FileSystem;
|
import org.apache.hadoop.fs.FileSystem;
|
||||||
import org.apache.hadoop.fs.Trash;
|
import org.apache.hadoop.fs.Trash;
|
||||||
import static org.apache.hadoop.hdfs.DFSConfigKeys.*;
|
import static org.apache.hadoop.hdfs.DFSConfigKeys.*;
|
||||||
|
@ -489,9 +488,9 @@ public class NameNode {
|
||||||
LOG.warn("ServicePlugin " + p + " could not be started", t);
|
LOG.warn("ServicePlugin " + p + " could not be started", t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOG.info(getRole() + " up at: " + rpcServer.getRpcAddress());
|
LOG.info(getRole() + " RPC up at: " + rpcServer.getRpcAddress());
|
||||||
if (rpcServer.getServiceRpcAddress() != null) {
|
if (rpcServer.getServiceRpcAddress() != null) {
|
||||||
LOG.info(getRole() + " service server is up at: "
|
LOG.info(getRole() + " service RPC up at: "
|
||||||
+ rpcServer.getServiceRpcAddress());
|
+ rpcServer.getServiceRpcAddress());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -617,7 +616,7 @@ public class NameNode {
|
||||||
*/
|
*/
|
||||||
public void join() {
|
public void join() {
|
||||||
try {
|
try {
|
||||||
this.rpcServer.join();
|
rpcServer.join();
|
||||||
} catch (InterruptedException ie) {
|
} catch (InterruptedException ie) {
|
||||||
LOG.info("Caught interrupted exception ", ie);
|
LOG.info("Caught interrupted exception ", ie);
|
||||||
}
|
}
|
||||||
|
@ -665,27 +664,31 @@ public class NameNode {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the address on which the NameNodes is listening to.
|
* @return NameNode RPC address
|
||||||
* @return namenode rpc address
|
|
||||||
*/
|
*/
|
||||||
public InetSocketAddress getNameNodeAddress() {
|
public InetSocketAddress getNameNodeAddress() {
|
||||||
return rpcServer.getRpcAddress();
|
return rpcServer.getRpcAddress();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns namenode service rpc address, if set. Otherwise returns
|
* @return NameNode RPC address in "host:port" string form
|
||||||
* namenode rpc address.
|
|
||||||
* @return namenode service rpc address used by datanodes
|
|
||||||
*/
|
*/
|
||||||
public InetSocketAddress getServiceRpcAddress() {
|
public String getNameNodeAddressHostPortString() {
|
||||||
return rpcServer.getServiceRpcAddress() != null ? rpcServer.getServiceRpcAddress() : rpcServer.getRpcAddress();
|
return NetUtils.getHostPortString(rpcServer.getRpcAddress());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the address of the NameNodes http server,
|
* @return NameNode service RPC address if configured, the
|
||||||
* which is used to access the name-node web UI.
|
* NameNode RPC address otherwise
|
||||||
*
|
*/
|
||||||
* @return the http address.
|
public InetSocketAddress getServiceRpcAddress() {
|
||||||
|
final InetSocketAddress serviceAddr = rpcServer.getServiceRpcAddress();
|
||||||
|
return serviceAddr == null ? rpcServer.getRpcAddress() : serviceAddr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return NameNode HTTP address, used by the Web UI, image transfer,
|
||||||
|
* and HTTP-based file system clients like Hftp and WebHDFS
|
||||||
*/
|
*/
|
||||||
public InetSocketAddress getHttpAddress() {
|
public InetSocketAddress getHttpAddress() {
|
||||||
return httpServer.getHttpAddress();
|
return httpServer.getHttpAddress();
|
||||||
|
@ -1159,10 +1162,12 @@ public class NameNode {
|
||||||
NAMESERVICE_SPECIFIC_KEYS);
|
NAMESERVICE_SPECIFIC_KEYS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the RPC address is set use it to (re-)configure the default FS
|
||||||
if (conf.get(DFS_NAMENODE_RPC_ADDRESS_KEY) != null) {
|
if (conf.get(DFS_NAMENODE_RPC_ADDRESS_KEY) != null) {
|
||||||
URI defaultUri = URI.create(HdfsConstants.HDFS_URI_SCHEME + "://"
|
URI defaultUri = URI.create(HdfsConstants.HDFS_URI_SCHEME + "://"
|
||||||
+ conf.get(DFS_NAMENODE_RPC_ADDRESS_KEY));
|
+ conf.get(DFS_NAMENODE_RPC_ADDRESS_KEY));
|
||||||
conf.set(FS_DEFAULT_NAME_KEY, defaultUri.toString());
|
conf.set(FS_DEFAULT_NAME_KEY, defaultUri.toString());
|
||||||
|
LOG.info("Setting " + FS_DEFAULT_NAME_KEY + " to " + defaultUri.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1184,8 +1189,9 @@ public class NameNode {
|
||||||
try {
|
try {
|
||||||
StringUtils.startupShutdownMessage(NameNode.class, argv, LOG);
|
StringUtils.startupShutdownMessage(NameNode.class, argv, LOG);
|
||||||
NameNode namenode = createNameNode(argv, null);
|
NameNode namenode = createNameNode(argv, null);
|
||||||
if (namenode != null)
|
if (namenode != null) {
|
||||||
namenode.join();
|
namenode.join();
|
||||||
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
LOG.fatal("Exception in namenode join", e);
|
LOG.fatal("Exception in namenode join", e);
|
||||||
terminate(1, e);
|
terminate(1, e);
|
||||||
|
|
|
@ -49,12 +49,9 @@ public class NameNodeHttpServer {
|
||||||
private final Configuration conf;
|
private final Configuration conf;
|
||||||
private final NameNode nn;
|
private final NameNode nn;
|
||||||
|
|
||||||
private final Log LOG = NameNode.LOG;
|
|
||||||
private InetSocketAddress httpAddress;
|
private InetSocketAddress httpAddress;
|
||||||
|
|
||||||
private InetSocketAddress bindAddress;
|
private InetSocketAddress bindAddress;
|
||||||
|
|
||||||
|
|
||||||
public static final String NAMENODE_ADDRESS_ATTRIBUTE_KEY = "name.node.address";
|
public static final String NAMENODE_ADDRESS_ATTRIBUTE_KEY = "name.node.address";
|
||||||
public static final String FSIMAGE_ATTRIBUTE_KEY = "name.system.image";
|
public static final String FSIMAGE_ATTRIBUTE_KEY = "name.system.image";
|
||||||
protected static final String NAMENODE_ATTRIBUTE_KEY = "name.node";
|
protected static final String NAMENODE_ATTRIBUTE_KEY = "name.node";
|
||||||
|
@ -68,12 +65,6 @@ public class NameNodeHttpServer {
|
||||||
this.bindAddress = bindAddress;
|
this.bindAddress = bindAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getDefaultServerPrincipal() throws IOException {
|
|
||||||
return SecurityUtil.getServerPrincipal(
|
|
||||||
conf.get(DFSConfigKeys.DFS_NAMENODE_USER_NAME_KEY),
|
|
||||||
nn.getNameNodeAddress().getHostName());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void start() throws IOException {
|
public void start() throws IOException {
|
||||||
final String infoHost = bindAddress.getHostName();
|
final String infoHost = bindAddress.getHostName();
|
||||||
int infoPort = bindAddress.getPort();
|
int infoPort = bindAddress.getPort();
|
||||||
|
|
|
@ -159,10 +159,11 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
||||||
int handlerCount =
|
int handlerCount =
|
||||||
conf.getInt(DFS_NAMENODE_HANDLER_COUNT_KEY,
|
conf.getInt(DFS_NAMENODE_HANDLER_COUNT_KEY,
|
||||||
DFS_NAMENODE_HANDLER_COUNT_DEFAULT);
|
DFS_NAMENODE_HANDLER_COUNT_DEFAULT);
|
||||||
InetSocketAddress socAddr = nn.getRpcServerAddress(conf);
|
|
||||||
RPC.setProtocolEngine(conf, ClientNamenodeProtocolPB.class,
|
RPC.setProtocolEngine(conf, ClientNamenodeProtocolPB.class,
|
||||||
ProtobufRpcEngine.class);
|
ProtobufRpcEngine.class);
|
||||||
ClientNamenodeProtocolServerSideTranslatorPB
|
|
||||||
|
ClientNamenodeProtocolServerSideTranslatorPB
|
||||||
clientProtocolServerTranslator =
|
clientProtocolServerTranslator =
|
||||||
new ClientNamenodeProtocolServerSideTranslatorPB(this);
|
new ClientNamenodeProtocolServerSideTranslatorPB(this);
|
||||||
BlockingService clientNNPbService = ClientNamenodeProtocol.
|
BlockingService clientNNPbService = ClientNamenodeProtocol.
|
||||||
|
@ -199,22 +200,24 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
||||||
.newReflectiveBlockingService(haServiceProtocolXlator);
|
.newReflectiveBlockingService(haServiceProtocolXlator);
|
||||||
|
|
||||||
WritableRpcEngine.ensureInitialized();
|
WritableRpcEngine.ensureInitialized();
|
||||||
|
|
||||||
InetSocketAddress dnSocketAddr = nn.getServiceRpcServerAddress(conf);
|
InetSocketAddress serviceRpcAddr = nn.getServiceRpcServerAddress(conf);
|
||||||
if (dnSocketAddr != null) {
|
if (serviceRpcAddr != null) {
|
||||||
int serviceHandlerCount =
|
int serviceHandlerCount =
|
||||||
conf.getInt(DFS_NAMENODE_SERVICE_HANDLER_COUNT_KEY,
|
conf.getInt(DFS_NAMENODE_SERVICE_HANDLER_COUNT_KEY,
|
||||||
DFS_NAMENODE_SERVICE_HANDLER_COUNT_DEFAULT);
|
DFS_NAMENODE_SERVICE_HANDLER_COUNT_DEFAULT);
|
||||||
// Add all the RPC protocols that the namenode implements
|
serviceRpcServer = new RPC.Builder(conf)
|
||||||
this.serviceRpcServer = new RPC.Builder(conf)
|
|
||||||
.setProtocol(
|
.setProtocol(
|
||||||
org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolPB.class)
|
org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolPB.class)
|
||||||
.setInstance(clientNNPbService)
|
.setInstance(clientNNPbService)
|
||||||
.setBindAddress(dnSocketAddr.getHostName())
|
.setBindAddress(serviceRpcAddr.getHostName())
|
||||||
.setPort(dnSocketAddr.getPort()).setNumHandlers(serviceHandlerCount)
|
.setPort(serviceRpcAddr.getPort())
|
||||||
|
.setNumHandlers(serviceHandlerCount)
|
||||||
.setVerbose(false)
|
.setVerbose(false)
|
||||||
.setSecretManager(namesystem.getDelegationTokenSecretManager())
|
.setSecretManager(namesystem.getDelegationTokenSecretManager())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
// Add all the RPC protocols that the namenode implements
|
||||||
DFSUtil.addPBProtocol(conf, HAServiceProtocolPB.class, haPbService,
|
DFSUtil.addPBProtocol(conf, HAServiceProtocolPB.class, haPbService,
|
||||||
serviceRpcServer);
|
serviceRpcServer);
|
||||||
DFSUtil.addPBProtocol(conf, NamenodeProtocolPB.class, NNPbService,
|
DFSUtil.addPBProtocol(conf, NamenodeProtocolPB.class, NNPbService,
|
||||||
|
@ -228,20 +231,26 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
||||||
DFSUtil.addPBProtocol(conf, GetUserMappingsProtocolPB.class,
|
DFSUtil.addPBProtocol(conf, GetUserMappingsProtocolPB.class,
|
||||||
getUserMappingService, serviceRpcServer);
|
getUserMappingService, serviceRpcServer);
|
||||||
|
|
||||||
this.serviceRPCAddress = this.serviceRpcServer.getListenerAddress();
|
serviceRPCAddress = serviceRpcServer.getListenerAddress();
|
||||||
nn.setRpcServiceServerAddress(conf, serviceRPCAddress);
|
nn.setRpcServiceServerAddress(conf, serviceRPCAddress);
|
||||||
} else {
|
} else {
|
||||||
serviceRpcServer = null;
|
serviceRpcServer = null;
|
||||||
serviceRPCAddress = null;
|
serviceRPCAddress = null;
|
||||||
}
|
}
|
||||||
// Add all the RPC protocols that the namenode implements
|
|
||||||
this.clientRpcServer = new RPC.Builder(conf)
|
InetSocketAddress rpcAddr = nn.getRpcServerAddress(conf);
|
||||||
|
clientRpcServer = new RPC.Builder(conf)
|
||||||
.setProtocol(
|
.setProtocol(
|
||||||
org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolPB.class)
|
org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolPB.class)
|
||||||
.setInstance(clientNNPbService).setBindAddress(socAddr.getHostName())
|
.setInstance(clientNNPbService)
|
||||||
.setPort(socAddr.getPort()).setNumHandlers(handlerCount)
|
.setBindAddress(rpcAddr.getHostName())
|
||||||
|
.setPort(rpcAddr.getPort())
|
||||||
|
.setNumHandlers(handlerCount)
|
||||||
.setVerbose(false)
|
.setVerbose(false)
|
||||||
.setSecretManager(namesystem.getDelegationTokenSecretManager()).build();
|
.setSecretManager(namesystem.getDelegationTokenSecretManager())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
// Add all the RPC protocols that the namenode implements
|
||||||
DFSUtil.addPBProtocol(conf, HAServiceProtocolPB.class, haPbService,
|
DFSUtil.addPBProtocol(conf, HAServiceProtocolPB.class, haPbService,
|
||||||
clientRpcServer);
|
clientRpcServer);
|
||||||
DFSUtil.addPBProtocol(conf, NamenodeProtocolPB.class, NNPbService,
|
DFSUtil.addPBProtocol(conf, NamenodeProtocolPB.class, NNPbService,
|
||||||
|
@ -259,44 +268,51 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
||||||
if (serviceAuthEnabled =
|
if (serviceAuthEnabled =
|
||||||
conf.getBoolean(
|
conf.getBoolean(
|
||||||
CommonConfigurationKeys.HADOOP_SECURITY_AUTHORIZATION, false)) {
|
CommonConfigurationKeys.HADOOP_SECURITY_AUTHORIZATION, false)) {
|
||||||
this.clientRpcServer.refreshServiceAcl(conf, new HDFSPolicyProvider());
|
clientRpcServer.refreshServiceAcl(conf, new HDFSPolicyProvider());
|
||||||
if (this.serviceRpcServer != null) {
|
if (serviceRpcServer != null) {
|
||||||
this.serviceRpcServer.refreshServiceAcl(conf, new HDFSPolicyProvider());
|
serviceRpcServer.refreshServiceAcl(conf, new HDFSPolicyProvider());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// The rpc-server port can be ephemeral... ensure we have the correct info
|
// The rpc-server port can be ephemeral... ensure we have the correct info
|
||||||
this.clientRpcAddress = this.clientRpcServer.getListenerAddress();
|
clientRpcAddress = clientRpcServer.getListenerAddress();
|
||||||
nn.setRpcServerAddress(conf, clientRpcAddress);
|
nn.setRpcServerAddress(conf, clientRpcAddress);
|
||||||
|
|
||||||
this.minimumDataNodeVersion = conf.get(
|
minimumDataNodeVersion = conf.get(
|
||||||
DFSConfigKeys.DFS_NAMENODE_MIN_SUPPORTED_DATANODE_VERSION_KEY,
|
DFSConfigKeys.DFS_NAMENODE_MIN_SUPPORTED_DATANODE_VERSION_KEY,
|
||||||
DFSConfigKeys.DFS_NAMENODE_MIN_SUPPORTED_DATANODE_VERSION_DEFAULT);
|
DFSConfigKeys.DFS_NAMENODE_MIN_SUPPORTED_DATANODE_VERSION_DEFAULT);
|
||||||
|
|
||||||
// Set terse exception whose stack trace won't be logged
|
// Set terse exception whose stack trace won't be logged
|
||||||
this.clientRpcServer.addTerseExceptions(SafeModeException.class);
|
clientRpcServer.addTerseExceptions(SafeModeException.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Actually start serving requests.
|
* Start client and service RPC servers.
|
||||||
*/
|
*/
|
||||||
void start() {
|
void start() {
|
||||||
clientRpcServer.start(); //start RPC server
|
clientRpcServer.start();
|
||||||
if (serviceRpcServer != null) {
|
if (serviceRpcServer != null) {
|
||||||
serviceRpcServer.start();
|
serviceRpcServer.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wait until the RPC server has shut down.
|
* Wait until the client RPC server has shutdown.
|
||||||
*/
|
*/
|
||||||
void join() throws InterruptedException {
|
void join() throws InterruptedException {
|
||||||
this.clientRpcServer.join();
|
clientRpcServer.join();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stop client and service RPC servers.
|
||||||
|
*/
|
||||||
void stop() {
|
void stop() {
|
||||||
if(clientRpcServer != null) clientRpcServer.stop();
|
if (clientRpcServer != null) {
|
||||||
if(serviceRpcServer != null) serviceRpcServer.stop();
|
clientRpcServer.stop();
|
||||||
|
}
|
||||||
|
if (serviceRpcServer != null) {
|
||||||
|
serviceRpcServer.stop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
InetSocketAddress getServiceRpcAddress() {
|
InetSocketAddress getServiceRpcAddress() {
|
||||||
|
@ -333,8 +349,9 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
||||||
namesystem.checkOperation(OperationCategory.UNCHECKED);
|
namesystem.checkOperation(OperationCategory.UNCHECKED);
|
||||||
verifyRequest(registration);
|
verifyRequest(registration);
|
||||||
LOG.info("Error report from " + registration + ": " + msg);
|
LOG.info("Error report from " + registration + ": " + msg);
|
||||||
if(errorCode == FATAL)
|
if (errorCode == FATAL) {
|
||||||
namesystem.releaseBackupNode(registration);
|
namesystem.releaseBackupNode(registration);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override // NamenodeProtocol
|
@Override // NamenodeProtocol
|
||||||
|
|
|
@ -51,7 +51,6 @@ import org.apache.hadoop.hdfs.server.common.Storage.StorageDirectory;
|
||||||
import org.apache.hadoop.hdfs.server.protocol.NamenodeProtocols;
|
import org.apache.hadoop.hdfs.server.protocol.NamenodeProtocols;
|
||||||
import org.apache.hadoop.http.HttpConfig;
|
import org.apache.hadoop.http.HttpConfig;
|
||||||
import org.apache.hadoop.io.Text;
|
import org.apache.hadoop.io.Text;
|
||||||
import org.apache.hadoop.net.NetUtils;
|
|
||||||
import org.apache.hadoop.net.NodeBase;
|
import org.apache.hadoop.net.NodeBase;
|
||||||
import org.apache.hadoop.security.UserGroupInformation;
|
import org.apache.hadoop.security.UserGroupInformation;
|
||||||
import org.apache.hadoop.security.token.Token;
|
import org.apache.hadoop.security.token.Token;
|
||||||
|
@ -395,7 +394,7 @@ class NamenodeJspHelper {
|
||||||
nodeToRedirect = nn.getHttpAddress().getHostName();
|
nodeToRedirect = nn.getHttpAddress().getHostName();
|
||||||
redirectPort = nn.getHttpAddress().getPort();
|
redirectPort = nn.getHttpAddress().getPort();
|
||||||
}
|
}
|
||||||
String addr = NetUtils.getHostPortString(nn.getNameNodeAddress());
|
String addr = nn.getNameNodeAddressHostPortString();
|
||||||
String fqdn = InetAddress.getByName(nodeToRedirect).getCanonicalHostName();
|
String fqdn = InetAddress.getByName(nodeToRedirect).getCanonicalHostName();
|
||||||
redirectLocation = HttpConfig.getSchemePrefix() + fqdn + ":" + redirectPort
|
redirectLocation = HttpConfig.getSchemePrefix() + fqdn + ":" + redirectPort
|
||||||
+ "/browseDirectory.jsp?namenodeInfoPort="
|
+ "/browseDirectory.jsp?namenodeInfoPort="
|
||||||
|
@ -566,8 +565,9 @@ class NamenodeJspHelper {
|
||||||
final List<DatanodeDescriptor> dead = new ArrayList<DatanodeDescriptor>();
|
final List<DatanodeDescriptor> dead = new ArrayList<DatanodeDescriptor>();
|
||||||
dm.fetchDatanodes(live, dead, true);
|
dm.fetchDatanodes(live, dead, true);
|
||||||
|
|
||||||
InetSocketAddress nnSocketAddress = (InetSocketAddress) context
|
InetSocketAddress nnSocketAddress =
|
||||||
.getAttribute(NameNodeHttpServer.NAMENODE_ADDRESS_ATTRIBUTE_KEY);
|
(InetSocketAddress)context.getAttribute(
|
||||||
|
NameNodeHttpServer.NAMENODE_ADDRESS_ATTRIBUTE_KEY);
|
||||||
String nnaddr = nnSocketAddress.getAddress().getHostAddress() + ":"
|
String nnaddr = nnSocketAddress.getAddress().getHostAddress() + ":"
|
||||||
+ nnSocketAddress.getPort();
|
+ nnSocketAddress.getPort();
|
||||||
|
|
||||||
|
|
|
@ -34,8 +34,7 @@
|
||||||
HAServiceState nnHAState = nn.getServiceState();
|
HAServiceState nnHAState = nn.getServiceState();
|
||||||
boolean isActive = (nnHAState == HAServiceState.ACTIVE);
|
boolean isActive = (nnHAState == HAServiceState.ACTIVE);
|
||||||
String namenodeRole = nn.getRole().toString();
|
String namenodeRole = nn.getRole().toString();
|
||||||
String namenodeLabel = nn.getNameNodeAddress().getHostName() + ":"
|
String namenodeLabel = nn.getNameNodeAddressHostPortString();
|
||||||
+ nn.getNameNodeAddress().getPort();
|
|
||||||
Collection<FSNamesystem.CorruptFileBlockInfo> corruptFileBlocks =
|
Collection<FSNamesystem.CorruptFileBlockInfo> corruptFileBlocks =
|
||||||
fsn.listCorruptFileBlocks("/", null);
|
fsn.listCorruptFileBlocks("/", null);
|
||||||
int corruptFileCount = corruptFileBlocks.size();
|
int corruptFileCount = corruptFileBlocks.size();
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
boolean isActive = (nnHAState == HAServiceState.ACTIVE);
|
boolean isActive = (nnHAState == HAServiceState.ACTIVE);
|
||||||
String namenodeRole = nn.getRole().toString();
|
String namenodeRole = nn.getRole().toString();
|
||||||
String namenodeState = nnHAState.toString();
|
String namenodeState = nnHAState.toString();
|
||||||
String namenodeLabel = nn.getNameNodeAddress().getHostName() + ":" + nn.getNameNodeAddress().getPort();
|
String namenodeLabel = nn.getNameNodeAddressHostPortString();
|
||||||
%>
|
%>
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
|
|
@ -33,7 +33,7 @@ String namenodeRole = nn.getRole().toString();
|
||||||
FSNamesystem fsn = nn.getNamesystem();
|
FSNamesystem fsn = nn.getNamesystem();
|
||||||
HAServiceState nnHAState = nn.getServiceState();
|
HAServiceState nnHAState = nn.getServiceState();
|
||||||
boolean isActive = (nnHAState == HAServiceState.ACTIVE);
|
boolean isActive = (nnHAState == HAServiceState.ACTIVE);
|
||||||
String namenodeLabel = nn.getNameNodeAddress().getHostName() + ":" + nn.getNameNodeAddress().getPort();
|
String namenodeLabel = nn.getNameNodeAddressHostPortString();
|
||||||
%>
|
%>
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
|
|
@ -857,8 +857,8 @@ public class MiniDFSCluster {
|
||||||
// After the NN has started, set back the bound ports into
|
// After the NN has started, set back the bound ports into
|
||||||
// the conf
|
// the conf
|
||||||
conf.set(DFSUtil.addKeySuffixes(
|
conf.set(DFSUtil.addKeySuffixes(
|
||||||
DFS_NAMENODE_RPC_ADDRESS_KEY, nameserviceId, nnId), NetUtils
|
DFS_NAMENODE_RPC_ADDRESS_KEY, nameserviceId, nnId),
|
||||||
.getHostPortString(nn.getNameNodeAddress()));
|
nn.getNameNodeAddressHostPortString());
|
||||||
conf.set(DFSUtil.addKeySuffixes(
|
conf.set(DFSUtil.addKeySuffixes(
|
||||||
DFS_NAMENODE_HTTP_ADDRESS_KEY, nameserviceId, nnId), NetUtils
|
DFS_NAMENODE_HTTP_ADDRESS_KEY, nameserviceId, nnId), NetUtils
|
||||||
.getHostPortString(nn.getHttpAddress()));
|
.getHostPortString(nn.getHttpAddress()));
|
||||||
|
@ -880,8 +880,8 @@ public class MiniDFSCluster {
|
||||||
* @return URI of the given namenode in MiniDFSCluster
|
* @return URI of the given namenode in MiniDFSCluster
|
||||||
*/
|
*/
|
||||||
public URI getURI(int nnIndex) {
|
public URI getURI(int nnIndex) {
|
||||||
InetSocketAddress addr = nameNodes[nnIndex].nameNode.getNameNodeAddress();
|
String hostPort =
|
||||||
String hostPort = NetUtils.getHostPortString(addr);
|
nameNodes[nnIndex].nameNode.getNameNodeAddressHostPortString();
|
||||||
URI uri = null;
|
URI uri = null;
|
||||||
try {
|
try {
|
||||||
uri = new URI("hdfs://" + hostPort);
|
uri = new URI("hdfs://" + hostPort);
|
||||||
|
|
Loading…
Reference in New Issue