Amend HDFS-2841 to include new file which was omitted from original commit.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/HDFS-1623@1237971 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
846f97312c
commit
9a8f119741
@ -0,0 +1,59 @@
|
|||||||
|
/**
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.apache.hadoop.hdfs.tools;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.apache.hadoop.conf.Configuration;
|
||||||
|
import org.apache.hadoop.fs.CommonConfigurationKeys;
|
||||||
|
import org.apache.hadoop.ha.HAAdmin;
|
||||||
|
import org.apache.hadoop.hdfs.DFSConfigKeys;
|
||||||
|
import org.apache.hadoop.hdfs.HdfsConfiguration;
|
||||||
|
import org.apache.hadoop.util.ToolRunner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class to extend HAAdmin to do a little bit of HDFS-specific configuration.
|
||||||
|
*/
|
||||||
|
public class DFSHAAdmin extends HAAdmin {
|
||||||
|
|
||||||
|
private static final Log LOG =
|
||||||
|
LogFactory.getLog(DFSHAAdmin.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setConf(Configuration conf) {
|
||||||
|
if (conf != null) {
|
||||||
|
// Make a copy so we don't mutate it. Also use an HdfsConfiguration to
|
||||||
|
// force loading of hdfs-site.xml.
|
||||||
|
conf = new HdfsConfiguration(conf);
|
||||||
|
String nameNodePrincipal = conf.get(
|
||||||
|
DFSConfigKeys.DFS_NAMENODE_USER_NAME_KEY, "");
|
||||||
|
if (LOG.isDebugEnabled()) {
|
||||||
|
LOG.debug("Using NN principal: " + nameNodePrincipal);
|
||||||
|
}
|
||||||
|
|
||||||
|
conf.set(CommonConfigurationKeys.HADOOP_SECURITY_SERVICE_USER_NAME_KEY,
|
||||||
|
nameNodePrincipal);
|
||||||
|
}
|
||||||
|
super.setConf(conf);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] argv) throws Exception {
|
||||||
|
int res = ToolRunner.run(new DFSHAAdmin(), argv);
|
||||||
|
System.exit(res);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user