hdfs user
This commit is contained in:
parent
ed92f0a3dd
commit
28788aba95
|
@ -164,6 +164,7 @@ public class MDStoreController extends AbstractDnetController {
|
|||
public Map<String, Object> info() {
|
||||
final Map<String, Object> info = new LinkedHashMap<>();
|
||||
info.put("number_of_mdstores", databaseUtils.countMdStores());
|
||||
info.put("hadoop_user", hdfsClient.getHadoopUser());
|
||||
info.put("hadoop_cluster", hdfsClient.getHadoopCluster());
|
||||
info.put("hdfs_base_path", databaseUtils.getHdfsBasePath());
|
||||
info.put("expired_versions", databaseUtils.listExpiredVersions());
|
||||
|
|
|
@ -18,11 +18,16 @@ public class HdfsClient {
|
|||
@Value("${dhp.mdstore-manager.hadoop.cluster}")
|
||||
private String hadoopCluster;
|
||||
|
||||
@Value("${dhp.mdstore-manager.hadoop.user}")
|
||||
private String hadoopUser;
|
||||
|
||||
private static final Log log = LogFactory.getLog(HdfsClient.class);
|
||||
|
||||
public void deletePath(final String path) throws MDStoreManagerException {
|
||||
final Configuration conf = new Configuration();
|
||||
|
||||
System.setProperty("HADOOP_USER_NAME", hadoopUser);
|
||||
|
||||
if (hadoopCluster.equalsIgnoreCase("OCEAN")) {
|
||||
conf.addResource(getClass().getResourceAsStream("/hadoop/OCEAN/core-site.xml"));
|
||||
conf.addResource(getClass().getResourceAsStream("/hadoop/OCEAN/ocean-hadoop-conf.xml"));
|
||||
|
@ -36,7 +41,7 @@ public class HdfsClient {
|
|||
|
||||
try (final FileSystem fs = FileSystem.get(conf)) {
|
||||
fs.delete(new Path(path), true);
|
||||
log.info("HDFS Pathe deleted: " + path);
|
||||
log.info("HDFS Path deleted: " + path);
|
||||
} catch (IllegalArgumentException | IOException e) {
|
||||
log.error("Eror deleting path: " + path, e);
|
||||
throw new MDStoreManagerException("Eror deleting path: " + path, e);
|
||||
|
@ -50,4 +55,12 @@ public class HdfsClient {
|
|||
public void setHadoopCluster(final String hadoopCluster) {
|
||||
this.hadoopCluster = hadoopCluster;
|
||||
}
|
||||
|
||||
public String getHadoopUser() {
|
||||
return hadoopUser;
|
||||
}
|
||||
|
||||
public void setHadoopUser(final String hadoopUser) {
|
||||
this.hadoopUser = hadoopUser;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,3 +24,4 @@ logging.level.io.swagger.models.parameters.AbstractSerializableParameter = error
|
|||
# Hadoop
|
||||
dhp.mdstore-manager.hadoop.cluster = GARR
|
||||
dhp.mdstore-manager.hdfs.base-path = /tmp/mdstoremanager_dev
|
||||
dhp.mdstore-manager.hadoop.user = dnet.dev
|
||||
|
|
Loading…
Reference in New Issue