HDFS-2820. Add a simple sanity check for HA config. Contributed by Todd Lipcon.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/HDFS-1623@1235013 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e42bbfbca2
commit
c10853a6b9
|
@ -121,3 +121,5 @@ HDFS-2367. Enable the configuration of multiple HA cluster addresses. (atm)
|
||||||
HDFS-2812. When becoming active, the NN should treat all leases as freshly renewed. (todd)
|
HDFS-2812. When becoming active, the NN should treat all leases as freshly renewed. (todd)
|
||||||
|
|
||||||
HDFS-2737. Automatically trigger log rolls periodically on the active NN. (todd and atm)
|
HDFS-2737. Automatically trigger log rolls periodically on the active NN. (todd and atm)
|
||||||
|
|
||||||
|
HDFS-2820. Add a simple sanity check for HA config (todd)
|
||||||
|
|
|
@ -570,6 +570,12 @@ public class DFSUtil {
|
||||||
return b.toString();
|
return b.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String nnAddressesAsString(Configuration conf) {
|
||||||
|
Map<String, Map<String, InetSocketAddress>> addresses =
|
||||||
|
getHaNnRpcAddresses(conf);
|
||||||
|
return addressMapToString(addresses);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represent one of the NameNodes configured in the cluster.
|
* Represent one of the NameNodes configured in the cluster.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -753,6 +753,17 @@ public class FSNamesystem implements Namesystem, FSClusterStats,
|
||||||
this.haEnabled = HAUtil.isHAEnabled(conf, nameserviceId);
|
this.haEnabled = HAUtil.isHAEnabled(conf, nameserviceId);
|
||||||
this.persistBlocks |= haEnabled && HAUtil.usesSharedEditsDir(conf);
|
this.persistBlocks |= haEnabled && HAUtil.usesSharedEditsDir(conf);
|
||||||
|
|
||||||
|
// Sanity check the HA-related config.
|
||||||
|
if (nameserviceId != null) {
|
||||||
|
LOG.info("Determined nameservice ID: " + nameserviceId);
|
||||||
|
}
|
||||||
|
LOG.info("HA Enabled: " + haEnabled);
|
||||||
|
if (!haEnabled && HAUtil.usesSharedEditsDir(conf)) {
|
||||||
|
LOG.warn("Configured NNs:\n" + DFSUtil.nnAddressesAsString(conf));
|
||||||
|
throw new IOException("Invalid configuration: a shared edits dir " +
|
||||||
|
"must not be specified if HA is not enabled.");
|
||||||
|
}
|
||||||
|
|
||||||
short filePermission = (short)conf.getInt(DFS_NAMENODE_UPGRADE_PERMISSION_KEY,
|
short filePermission = (short)conf.getInt(DFS_NAMENODE_UPGRADE_PERMISSION_KEY,
|
||||||
DFS_NAMENODE_UPGRADE_PERMISSION_DEFAULT);
|
DFS_NAMENODE_UPGRADE_PERMISSION_DEFAULT);
|
||||||
this.defaultPermission = PermissionStatus.createImmutable(
|
this.defaultPermission = PermissionStatus.createImmutable(
|
||||||
|
|
Loading…
Reference in New Issue