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.
(cherry picked from commit 500e946729e1b85fdc0ce8475d8ce118ba886f46)
This commit is contained in:
parent
d38f2090fa
commit
e7b56cf93c
@ -163,7 +163,7 @@ public NodeFencer getFencer() {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "NameNode at " + addr;
|
||||
return "NameNode at " + (lifelineAddr != null ? lifelineAddr : addr);
|
||||
}
|
||||
|
||||
public String getNameServiceId() {
|
||||
|
@ -1182,6 +1182,11 @@ private void createNameNode(int nnIndex, Configuration hdfsConf,
|
||||
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 @@
|
||||
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 @@ private void doNNHealthCheckTest() throws IOException {
|
||||
|
||||
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…
x
Reference in New Issue
Block a user