MAPREDUCE-2736. Resurrecting bin/mapred and bin/mapred-config.sh.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1190128 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b49c95a5d9
commit
caf07897a7
119
hadoop-mapreduce-project/bin/mapred
Executable file
119
hadoop-mapreduce-project/bin/mapred
Executable file
@ -0,0 +1,119 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# 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.
|
||||
|
||||
bin=`which $0`
|
||||
bin=`dirname ${bin}`
|
||||
bin=`cd "$bin"; pwd`
|
||||
|
||||
if [ -e $bin/../libexec/mapred-config.sh ]; then
|
||||
. $bin/../libexec/mapred-config.sh
|
||||
else
|
||||
. "$bin/mapred-config.sh"
|
||||
fi
|
||||
|
||||
function print_usage(){
|
||||
echo "Usage: mapred [--config confdir] COMMAND"
|
||||
echo " where COMMAND is one of:"
|
||||
echo " mradmin run a Map-Reduce admin client"
|
||||
echo " jobtracker run the MapReduce job Tracker node"
|
||||
echo " tasktracker run a MapReduce task Tracker node"
|
||||
echo " pipes run a Pipes job"
|
||||
echo " job manipulate MapReduce jobs"
|
||||
echo " queue get information regarding JobQueues"
|
||||
echo " classpath prints the class path needed for running"
|
||||
echo " mapreduce subcommands"
|
||||
echo " groups get the groups which users belong to"
|
||||
echo ""
|
||||
echo "Most commands print help when invoked w/o parameters."
|
||||
}
|
||||
|
||||
if [ $# = 0 ]; then
|
||||
print_usage
|
||||
exit
|
||||
fi
|
||||
|
||||
COMMAND=$1
|
||||
shift
|
||||
|
||||
if [ "$COMMAND" = "mradmin" ] ; then
|
||||
CLASS=org.apache.hadoop.mapred.tools.MRAdmin
|
||||
HADOOP_OPTS="$HADOOP_OPTS $HADOOP_CLIENT_OPTS"
|
||||
elif [ "$COMMAND" = "jobtracker" ] ; then
|
||||
CLASS=org.apache.hadoop.mapred.JobTracker
|
||||
HADOOP_OPTS="$HADOOP_OPTS $HADOOP_JOBTRACKER_OPTS"
|
||||
elif [ "$COMMAND" = "tasktracker" ] ; then
|
||||
CLASS=org.apache.hadoop.mapred.TaskTracker
|
||||
HADOOP_OPTS="$HADOOP_OPTS $HADOOP_TASKTRACKER_OPTS"
|
||||
elif [ "$COMMAND" = "job" ] ; then
|
||||
CLASS=org.apache.hadoop.mapred.JobClient
|
||||
elif [ "$COMMAND" = "queue" ] ; then
|
||||
CLASS=org.apache.hadoop.mapred.JobQueueClient
|
||||
elif [ "$COMMAND" = "pipes" ] ; then
|
||||
CLASS=org.apache.hadoop.mapred.pipes.Submitter
|
||||
HADOOP_OPTS="$HADOOP_OPTS $HADOOP_CLIENT_OPTS"
|
||||
elif [ "$COMMAND" = "sampler" ] ; then
|
||||
CLASS=org.apache.hadoop.mapred.lib.InputSampler
|
||||
HADOOP_OPTS="$HADOOP_OPTS $HADOOP_CLIENT_OPTS"
|
||||
elif [ "$COMMAND" = "classpath" ] ; then
|
||||
echo -n
|
||||
elif [ "$COMMAND" = "groups" ] ; then
|
||||
CLASS=org.apache.hadoop.mapred.tools.GetGroups
|
||||
HADOOP_OPTS="$HADOOP_OPTS $HADOOP_CLIENT_OPTS"
|
||||
else
|
||||
echo $COMMAND - invalid command
|
||||
print_usage
|
||||
exit
|
||||
fi
|
||||
|
||||
# for developers, add mapred classes to CLASSPATH
|
||||
if [ -d "$HADOOP_MAPRED_HOME/build/classes" ]; then
|
||||
CLASSPATH=${CLASSPATH}:$HADOOP_MAPRED_HOME/build/classes
|
||||
fi
|
||||
if [ -d "$HADOOP_MAPRED_HOME/build/webapps" ]; then
|
||||
CLASSPATH=${CLASSPATH}:$HADOOP_MAPRED_HOME/build
|
||||
fi
|
||||
if [ -d "$HADOOP_MAPRED_HOME/build/test/classes" ]; then
|
||||
CLASSPATH=${CLASSPATH}:$HADOOP_MAPRED_HOME/build/test/classes
|
||||
fi
|
||||
if [ -d "$HADOOP_MAPRED_HOME/build/tools" ]; then
|
||||
CLASSPATH=${CLASSPATH}:$HADOOP_MAPRED_HOME/build/tools
|
||||
fi
|
||||
|
||||
# for releases, add core mapred jar & webapps to CLASSPATH
|
||||
if [ -d "$HADOOP_PREFIX/share/hadoop/mapreduce/webapps" ]; then
|
||||
CLASSPATH=${CLASSPATH}:$HADOOP_PREFIX/share/hadoop/mapreduce
|
||||
fi
|
||||
for f in $HADOOP_MAPRED_HOME/share/hadoop-mapreduce/*.jar; do
|
||||
CLASSPATH=${CLASSPATH}:$f;
|
||||
done
|
||||
|
||||
# add libs to CLASSPATH
|
||||
for f in $HADOOP_MAPRED_HOME/lib/*.jar; do
|
||||
CLASSPATH=${CLASSPATH}:$f;
|
||||
done
|
||||
|
||||
if $cygwin; then
|
||||
CLASSPATH=`cygpath -p -w "$CLASSPATH"`
|
||||
fi
|
||||
|
||||
if [ "$COMMAND" = "classpath" ] ; then
|
||||
echo $CLASSPATH
|
||||
exit
|
||||
fi
|
||||
|
||||
export CLASSPATH
|
||||
exec "$JAVA" $JAVA_HEAP_MAX $HADOOP_OPTS $CLASS "$@"
|
38
hadoop-mapreduce-project/bin/mapred-config.sh
Normal file
38
hadoop-mapreduce-project/bin/mapred-config.sh
Normal file
@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# 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.
|
||||
|
||||
# included in all the mapred scripts with source command
|
||||
# should not be executed directly
|
||||
|
||||
bin=`which "$0"`
|
||||
bin=`dirname "${bin}"`
|
||||
bin=`cd "$bin"; pwd`
|
||||
|
||||
if [ -e "$bin/../libexec/hadoop-config.sh" ]; then
|
||||
. "$bin/../libexec/hadoop-config.sh"
|
||||
elif [ -e "${HADOOP_COMMON_HOME}/libexec/hadoop-config.sh" ]; then
|
||||
. "$HADOOP_COMMON_HOME"/libexec/hadoop-config.sh
|
||||
elif [ -e "${HADOOP_COMMON_HOME}/bin/hadoop-config.sh" ]; then
|
||||
. "$HADOOP_COMMON_HOME"/bin/hadoop-config.sh
|
||||
elif [ -e "${HADOOP_HOME}/bin/hadoop-config.sh" ]; then
|
||||
. "$HADOOP_HOME"/bin/hadoop-config.sh
|
||||
elif [ -e "${HADOOP_MAPRED_HOME}/bin/hadoop-config.sh" ]; then
|
||||
. "$HADOOP_MAPRED_HOME"/bin/hadoop-config.sh
|
||||
else
|
||||
echo "Hadoop common not found."
|
||||
exit
|
||||
fi
|
34
hadoop-mapreduce-project/bin/start-mapred.sh
Executable file
34
hadoop-mapreduce-project/bin/start-mapred.sh
Executable file
@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# 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.
|
||||
|
||||
|
||||
# Start hadoop map reduce daemons. Run this on master node.
|
||||
|
||||
bin=`dirname "${BASH_SOURCE-$0}"`
|
||||
bin=`cd "$bin"; pwd`
|
||||
|
||||
if [ -e $bin/../libexec/mapred-config.sh ]; then
|
||||
. $bin/../libexec/mapred-config.sh
|
||||
else
|
||||
. "$bin/mapred-config.sh"
|
||||
fi
|
||||
|
||||
|
||||
# start mapred daemons
|
||||
# start jobtracker first to minimize connection errors at startup
|
||||
"$HADOOP_PREFIX"/bin/hadoop-daemon.sh --config $HADOOP_CONF_DIR --script "$bin"/mapred start jobtracker
|
||||
"$HADOOP_PREFIX"/bin/hadoop-daemons.sh --config $HADOOP_CONF_DIR --script "$bin"/mapred start tasktracker
|
31
hadoop-mapreduce-project/bin/stop-mapred.sh
Executable file
31
hadoop-mapreduce-project/bin/stop-mapred.sh
Executable file
@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# 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.
|
||||
|
||||
|
||||
# Stop hadoop map reduce daemons. Run this on master node.
|
||||
|
||||
bin=`dirname "${BASH_SOURCE-$0}"`
|
||||
bin=`cd "$bin"; pwd`
|
||||
|
||||
if [ -e $bin/../libexec/mapred-config.sh ]; then
|
||||
. $bin/../libexec/mapred-config.sh
|
||||
else
|
||||
. "$bin/mapred-config.sh"
|
||||
fi
|
||||
|
||||
"$HADOOP_PREFIX"/bin/hadoop-daemon.sh --config $HADOOP_CONF_DIR --script "$bin"/mapred stop jobtracker
|
||||
"$HADOOP_PREFIX"/bin/hadoop-daemons.sh --config $HADOOP_CONF_DIR --script "$bin"/mapred stop tasktracker
|
Loading…
Reference in New Issue
Block a user