yarn-env.sh 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. # Licensed to the Apache Software Foundation (ASF) under one or more
  2. # contributor license agreements. See the NOTICE file distributed with
  3. # this work for additional information regarding copyright ownership.
  4. # The ASF licenses this file to You under the Apache License, Version 2.0
  5. # (the "License"); you may not use this file except in compliance with
  6. # the License. You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. # resolve links - $0 may be a softlink
  16. export YARN_CONF_DIR="${YARN_CONF_DIR:-$YARN_HOME/conf}"
  17. # some Java parameters
  18. # export JAVA_HOME=/home/y/libexec/jdk1.6.0/
  19. if [ "$JAVA_HOME" != "" ]; then
  20. #echo "run java in $JAVA_HOME"
  21. JAVA_HOME=$JAVA_HOME
  22. fi
  23. if [ "$JAVA_HOME" = "" ]; then
  24. echo "Error: JAVA_HOME is not set."
  25. exit 1
  26. fi
  27. JAVA=$JAVA_HOME/bin/java
  28. JAVA_HEAP_MAX=-Xmx1000m
  29. # check envvars which might override default args
  30. if [ "$YARN_HEAPSIZE" != "" ]; then
  31. #echo "run with heapsize $YARN_HEAPSIZE"
  32. JAVA_HEAP_MAX="-Xmx""$YARN_HEAPSIZE""m"
  33. #echo $JAVA_HEAP_MAX
  34. fi
  35. # CLASSPATH initially contains $YARN_CONF_DIR
  36. CLASSPATH="${YARN_CONF_DIR}"
  37. CLASSPATH=${CLASSPATH}:$JAVA_HOME/lib/tools.jar
  38. # so that filenames w/ spaces are handled correctly in loops below
  39. IFS=
  40. # default log directory & file
  41. if [ "$YARN_LOG_DIR" = "" ]; then
  42. YARN_LOG_DIR="$YARN_HOME/logs"
  43. fi
  44. if [ "$YARN_LOGFILE" = "" ]; then
  45. YARN_LOGFILE='yarn.log'
  46. fi
  47. # default policy file for service-level authorization
  48. if [ "$YARN_POLICYFILE" = "" ]; then
  49. YARN_POLICYFILE="hadoop-policy.xml"
  50. fi
  51. # restore ordinary behaviour
  52. unset IFS
  53. YARN_OPTS="$YARN_OPTS -Dhadoop.log.dir=$YARN_LOG_DIR"
  54. YARN_OPTS="$YARN_OPTS -Dyarn.log.dir=$YARN_LOG_DIR"
  55. YARN_OPTS="$YARN_OPTS -Dhadoop.log.file=$YARN_LOGFILE"
  56. YARN_OPTS="$YARN_OPTS -Dyarn.log.file=$YARN_LOGFILE"
  57. YARN_OPTS="$YARN_OPTS -Dyarn.home.dir=$YARN_COMMON_HOME"
  58. YARN_OPTS="$YARN_OPTS -Dyarn.id.str=$YARN_IDENT_STRING"
  59. YARN_OPTS="$YARN_OPTS -Dhadoop.root.logger=${YARN_ROOT_LOGGER:-INFO,console}"
  60. YARN_OPTS="$YARN_OPTS -Dyarn.root.logger=${YARN_ROOT_LOGGER:-INFO,console}"
  61. if [ "x$JAVA_LIBRARY_PATH" != "x" ]; then
  62. YARN_OPTS="$YARN_OPTS -Djava.library.path=$JAVA_LIBRARY_PATH"
  63. fi
  64. YARN_OPTS="$YARN_OPTS -Dyarn.policy.file=$YARN_POLICYFILE"