yarn-env.sh 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. # User for YARN daemons
  16. export HADOOP_YARN_USER=${HADOOP_YARN_USER:-yarn}
  17. # resolve links - $0 may be a softlink
  18. export YARN_CONF_DIR="${YARN_CONF_DIR:-$YARN_HOME/conf}"
  19. # some Java parameters
  20. # export JAVA_HOME=/home/y/libexec/jdk1.6.0/
  21. if [ "$JAVA_HOME" != "" ]; then
  22. #echo "run java in $JAVA_HOME"
  23. JAVA_HOME=$JAVA_HOME
  24. fi
  25. if [ "$JAVA_HOME" = "" ]; then
  26. echo "Error: JAVA_HOME is not set."
  27. exit 1
  28. fi
  29. JAVA=$JAVA_HOME/bin/java
  30. JAVA_HEAP_MAX=-Xmx1000m
  31. # check envvars which might override default args
  32. if [ "$YARN_HEAPSIZE" != "" ]; then
  33. #echo "run with heapsize $YARN_HEAPSIZE"
  34. JAVA_HEAP_MAX="-Xmx""$YARN_HEAPSIZE""m"
  35. #echo $JAVA_HEAP_MAX
  36. fi
  37. # so that filenames w/ spaces are handled correctly in loops below
  38. IFS=
  39. # default log directory & file
  40. if [ "$YARN_LOG_DIR" = "" ]; then
  41. YARN_LOG_DIR="$YARN_HOME/logs"
  42. fi
  43. if [ "$YARN_LOGFILE" = "" ]; then
  44. YARN_LOGFILE='yarn.log'
  45. fi
  46. # default policy file for service-level authorization
  47. if [ "$YARN_POLICYFILE" = "" ]; then
  48. YARN_POLICYFILE="hadoop-policy.xml"
  49. fi
  50. # restore ordinary behaviour
  51. unset IFS
  52. YARN_OPTS="$YARN_OPTS -Dhadoop.log.dir=$YARN_LOG_DIR"
  53. YARN_OPTS="$YARN_OPTS -Dyarn.log.dir=$YARN_LOG_DIR"
  54. YARN_OPTS="$YARN_OPTS -Dhadoop.log.file=$YARN_LOGFILE"
  55. YARN_OPTS="$YARN_OPTS -Dyarn.log.file=$YARN_LOGFILE"
  56. YARN_OPTS="$YARN_OPTS -Dyarn.home.dir=$YARN_COMMON_HOME"
  57. YARN_OPTS="$YARN_OPTS -Dyarn.id.str=$YARN_IDENT_STRING"
  58. YARN_OPTS="$YARN_OPTS -Dhadoop.root.logger=${YARN_ROOT_LOGGER:-INFO,console}"
  59. YARN_OPTS="$YARN_OPTS -Dyarn.root.logger=${YARN_ROOT_LOGGER:-INFO,console}"
  60. if [ "x$JAVA_LIBRARY_PATH" != "x" ]; then
  61. YARN_OPTS="$YARN_OPTS -Djava.library.path=$JAVA_LIBRARY_PATH"
  62. fi
  63. YARN_OPTS="$YARN_OPTS -Dyarn.policy.file=$YARN_POLICYFILE"