hdfs-config.sh 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #!/usr/bin/env bash
  2. # Licensed to the Apache Software Foundation (ASF) under one or more
  3. # contributor license agreements. See the NOTICE file distributed with
  4. # this work for additional information regarding copyright ownership.
  5. # The ASF licenses this file to You under the Apache License, Version 2.0
  6. # (the "License"); you may not use this file except in compliance with
  7. # the License. You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. # included in all the hdfs scripts with source command
  17. # should not be executed directly
  18. function hadoop_subproject_init
  19. {
  20. if [[ -z "${HADOOP_HDFS_ENV_PROCESSED}" ]]; then
  21. if [[ -e "${HADOOP_CONF_DIR}/hdfs-env.sh" ]]; then
  22. . "${HADOOP_CONF_DIR}/hdfs-env.sh"
  23. export HADOOP_HDFS_ENV_PROCESSED=true
  24. fi
  25. fi
  26. # at some point in time, someone thought it would be a good idea to
  27. # create separate vars for every subproject. *sigh*
  28. # let's perform some overrides and setup some defaults for bw compat
  29. # this way the common hadoop var's == subproject vars and can be
  30. # used interchangeable from here on out
  31. # ...
  32. # this should get deprecated at some point.
  33. HADOOP_LOG_DIR="${HADOOP_HDFS_LOG_DIR:-$HADOOP_LOG_DIR}"
  34. HADOOP_HDFS_LOG_DIR="${HADOOP_LOG_DIR}"
  35. HADOOP_LOGFILE="${HADOOP_HDFS_LOGFILE:-$HADOOP_LOGFILE}"
  36. HADOOP_HDFS_LOGFILE="${HADOOP_LOGFILE}"
  37. HADOOP_NICENESS=${HADOOP_HDFS_NICENESS:-$HADOOP_NICENESS}
  38. HADOOP_HDFS_NICENESS="${HADOOP_NICENESS}"
  39. HADOOP_STOP_TIMEOUT=${HADOOP_HDFS_STOP_TIMEOUT:-$HADOOP_STOP_TIMEOUT}
  40. HADOOP_HDFS_STOP_TIMEOUT="${HADOOP_STOP_TIMEOUT}"
  41. HADOOP_PID_DIR="${HADOOP_HDFS_PID_DIR:-$HADOOP_PID_DIR}"
  42. HADOOP_HDFS_PID_DIR="${HADOOP_PID_DIR}"
  43. HADOOP_ROOT_LOGGER=${HADOOP_HDFS_ROOT_LOGGER:-$HADOOP_ROOT_LOGGER}
  44. HADOOP_HDFS_ROOT_LOGGER="${HADOOP_ROOT_LOGGER}"
  45. HADOOP_HDFS_HOME="${HADOOP_HDFS_HOME:-$HADOOP_PREFIX}"
  46. HADOOP_IDENT_STRING="${HADOOP_HDFS_IDENT_STRING:-$HADOOP_IDENT_STRING}"
  47. HADOOP_HDFS_IDENT_STRING="${HADOOP_IDENT_STRING}"
  48. # turn on the defaults
  49. export HADOOP_NAMENODE_OPTS=${HADOOP_NAMENODE_OPTS:-"-Dhadoop.security.logger=INFO,RFAS -Dhdfs.audit.logger=INFO,NullAppender"}
  50. export HADOOP_SECONDARYNAMENODE_OPTS=${HADOOP_SECONDARYNAMENODE_OPTS:-"-Dhadoop.security.logger=INFO,RFAS -Dhdfs.audit.logger=INFO,NullAppender"}
  51. export HADOOP_DATANODE_OPTS=${HADOOP_DATANODE_OPTS:-"-Dhadoop.security.logger=ERROR,RFAS"}
  52. export HADOOP_DN_SECURE_EXTRA_OPTS=${HADOOP_DN_SECURE_EXTRA_OPTS:-"-jvm server"}
  53. export HADOOP_NFS3_SECURE_EXTRA_OPTS=${HADOOP_NFS3_SECURE_EXTRA_OPTS:-"-jvm server"}
  54. export HADOOP_PORTMAP_OPTS=${HADOOP_PORTMAP_OPTS:-"-Xmx512m"}
  55. }
  56. if [[ -z "${HADOOP_LIBEXEC_DIR}" ]]; then
  57. _hd_this="${BASH_SOURCE-$0}"
  58. HADOOP_LIBEXEC_DIR=$(cd -P -- "$(dirname -- "${_hd_this}")" >/dev/null && pwd -P)
  59. fi
  60. if [[ -n "${HADOOP_COMMON_HOME}" ]] &&
  61. [[ -e "${HADOOP_COMMON_HOME}/libexec/hadoop-config.sh" ]]; then
  62. . "${HADOOP_COMMON_HOME}/libexec/hadoop-config.sh"
  63. elif [[ -e "${HADOOP_LIBEXEC_DIR}/hadoop-config.sh" ]]; then
  64. . "${HADOOP_LIBEXEC_DIR}/hadoop-config.sh"
  65. elif [ -e "${HADOOP_PREFIX}/libexec/hadoop-config.sh" ]; then
  66. . "${HADOOP_PREFIX}/libexec/hadoop-config.sh"
  67. else
  68. echo "ERROR: Hadoop common not found." 2>&1
  69. exit 1
  70. fi