HDFS-10361. Support starting StorageContainerManager as a daemon. (Contributed by Arpit Agarwal)

This commit is contained in:
Arpit Agarwal 2016-05-05 15:09:59 -07:00
parent 78bd1b2ab2
commit 63a6a1d732
2 changed files with 17 additions and 4 deletions

View File

@ -52,6 +52,7 @@ function hadoop_usage
hadoop_add_subcommand "oiv_legacy" "apply the offline fsimage viewer to a legacy fsimage"
hadoop_add_subcommand "oz" "command line interface for ozone"
hadoop_add_subcommand "portmap" "run a portmap service"
hadoop_add_subcommand "scm" "run the Storage Container Manager service"
hadoop_add_subcommand "secondarynamenode" "run the DFS secondary namenode"
hadoop_add_subcommand "snapshotDiff" "diff two snapshots of a directory or diff the current directory contents with a snapshot"
hadoop_add_subcommand "storagepolicies" "list/get/set block storage policies"
@ -234,6 +235,12 @@ case ${COMMAND} in
hadoop_debug "Appending HADOOP_PORTMAP_OPTS onto HADOOP_OPTS"
HADOOP_OPTS="${HADOOP_OPTS} ${HADOOP_PORTMAP_OPTS}"
;;
scm)
supportdaemonization="true"
CLASS='org.apache.hadoop.ozone.storage.StorageContainerManager'
hadoop_debug "Appending HADOOP_SCM_OPTS onto HADOOP_OPTS"
HADOOP_OPTS="${HADOOP_OPTS} ${HADOOP_SCM_OPTS}"
;;
secondarynamenode)
supportdaemonization="true"
CLASS='org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode'

View File

@ -34,6 +34,7 @@ import static org.apache.hadoop.ozone.OzoneConfigKeys.DFS_CONTAINER_LOCATION_HAN
import static org.apache.hadoop.ozone.OzoneConfigKeys.DFS_CONTAINER_LOCATION_RPC_ADDRESS_DEFAULT;
import static org.apache.hadoop.ozone.OzoneConfigKeys.DFS_CONTAINER_LOCATION_RPC_ADDRESS_KEY;
import static org.apache.hadoop.ozone.OzoneConfigKeys.DFS_CONTAINER_LOCATION_RPC_BIND_HOST_KEY;
import static org.apache.hadoop.util.ExitUtil.terminate;
import java.io.IOException;
import java.net.InetSocketAddress;
@ -591,9 +592,14 @@ public class StorageContainerManager
public static void main(String[] argv) throws IOException {
StringUtils.startupShutdownMessage(
StorageContainerManager.class, argv, LOG);
try {
StorageContainerManager scm = new StorageContainerManager(
new OzoneConfiguration());
scm.start();
scm.join();
} catch (Throwable t) {
LOG.error("Failed to start the StorageContainerManager.", t);
terminate(1, t);
}
}
}