HDFS-10438. When NameNode HA is configured to use the lifeline RPC server, it should log the address of that server. Contributed by Chris Nauroth.
This commit is contained in:
parent
bcde1562d2
commit
500e946729
|
@ -163,7 +163,7 @@ public class NNHAServiceTarget extends HAServiceTarget {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "NameNode at " + addr;
|
||||
return "NameNode at " + (lifelineAddr != null ? lifelineAddr : addr);
|
||||
}
|
||||
|
||||
public String getNameServiceId() {
|
||||
|
|
|
@ -1273,6 +1273,11 @@ public class MiniDFSCluster {
|
|||
hdfsConf.set(DFSUtil.addKeySuffixes(DFS_NAMENODE_HTTPS_ADDRESS_KEY,
|
||||
nameserviceId, nnId), NetUtils.getHostPortString(nn.getHttpsAddress()));
|
||||
}
|
||||
if (hdfsConf.get(DFS_NAMENODE_LIFELINE_RPC_ADDRESS_KEY) != null) {
|
||||
hdfsConf.set(DFSUtil.addKeySuffixes(DFS_NAMENODE_LIFELINE_RPC_ADDRESS_KEY,
|
||||
nameserviceId, nnId),
|
||||
hdfsConf.get(DFS_NAMENODE_LIFELINE_RPC_ADDRESS_KEY));
|
||||
}
|
||||
copyKeys(hdfsConf, conf, nameserviceId, nnId);
|
||||
DFSUtil.setGenericConf(hdfsConf, nameserviceId, nnId,
|
||||
DFS_NAMENODE_HTTP_ADDRESS_KEY);
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.apache.hadoop.hdfs.server.namenode.ha;
|
|||
import static org.apache.hadoop.fs.CommonConfigurationKeys.HA_HM_RPC_TIMEOUT_DEFAULT;
|
||||
import static org.apache.hadoop.fs.CommonConfigurationKeys.HA_HM_RPC_TIMEOUT_KEY;
|
||||
import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_NAMENODE_LIFELINE_RPC_ADDRESS_KEY;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -85,6 +85,16 @@ public class TestNNHealthCheck {
|
|||
|
||||
NNHAServiceTarget haTarget = new NNHAServiceTarget(conf,
|
||||
DFSUtil.getNamenodeNameServiceId(conf), "nn1");
|
||||
final String expectedTargetString;
|
||||
if (conf.get(DFS_NAMENODE_LIFELINE_RPC_ADDRESS_KEY + "." +
|
||||
DFSUtil.getNamenodeNameServiceId(conf) + ".nn1") != null) {
|
||||
expectedTargetString = haTarget.getHealthMonitorAddress().toString();
|
||||
} else {
|
||||
expectedTargetString = haTarget.getAddress().toString();
|
||||
}
|
||||
assertTrue("Expected haTarget " + haTarget + " containing " +
|
||||
expectedTargetString,
|
||||
haTarget.toString().contains(expectedTargetString));
|
||||
HAServiceProtocol rpc = haTarget.getHealthMonitorProxy(conf, conf.getInt(
|
||||
HA_HM_RPC_TIMEOUT_KEY, HA_HM_RPC_TIMEOUT_DEFAULT));
|
||||
|
||||
|
|
Loading…
Reference in New Issue