yarn-config.sh 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. # included in all the hadoop scripts with source command
  16. # should not be executable directly
  17. # also should not be passed any arguments, since we need original $*
  18. # resolve links - $0 may be a softlink
  19. this="$0"
  20. while [ -h "$this" ]; do
  21. ls=`ls -ld "$this"`
  22. link=`expr "$ls" : '.*-> \(.*\)$'`
  23. if expr "$link" : '.*/.*' > /dev/null; then
  24. this="$link"
  25. else
  26. this=`dirname "$this"`/"$link"
  27. fi
  28. done
  29. # convert relative path to absolute path
  30. bin=`dirname "$this"`
  31. script=`basename "$this"`
  32. bin=`cd "$bin"; pwd`
  33. this="$bin/$script"
  34. # the root of the Hadoop installation
  35. export YARN_HOME=`dirname "$this"`/..
  36. # Same glibc bug that discovered in Hadoop.
  37. # Without this you can see very large vmem settings on containers.
  38. export MALLOC_ARENA_MAX=${MALLOC_ARENA_MAX:-4}
  39. #check to see if the conf dir is given as an optional argument
  40. if [ $# -gt 1 ]
  41. then
  42. if [ "--config" = "$1" ]
  43. then
  44. shift
  45. confdir=$1
  46. shift
  47. YARN_CONF_DIR=$confdir
  48. fi
  49. fi
  50. # Allow alternate conf dir location.
  51. YARN_CONF_DIR="${YARN_CONF_DIR:-$YARN_HOME/conf}"
  52. #check to see it is specified whether to use the slaves or the
  53. # masters file
  54. if [ $# -gt 1 ]
  55. then
  56. if [ "--hosts" = "$1" ]
  57. then
  58. shift
  59. slavesfile=$1
  60. shift
  61. export YARN_SLAVES="${YARN_CONF_DIR}/$slavesfile"
  62. fi
  63. fi