hadoop config 详解

1.配置文件:
  1. -rw-r--r-- 1 hadoop 4436 Jun 2 17:47 capacity-scheduler.xml
  2. -rw-r--r-- 1 hadoop 61163 Jun 2 17:47 core-default.xml
  3. -rw-r--r-- 1 hadoop 1779 Jun 2 17:47 core-site.xml
  4. -rwxr-xr-x 1 hadoop 4328 Jun 2 17:47 hadoop-env.sh
  5. -rw-r--r-- 1 hadoop 9683 Jun 2 17:47 hadoop-policy.xml
  6. -rw-r--r-- 1 hadoop 81473 Jun 2 17:47 hdfs-default.xml
  7. -rw-r--r-- 1 hadoop 3305 Jun 2 17:47 hdfs-site.xml
  8. -rwxr-xr-x 1 hadoop 1449 Jun 2 17:47 httpfs-env.sh
  9. -rw-r--r-- 1 hadoop 620 Jun 2 17:47 httpfs-site.xml
  10. -rw-r--r-- 1 hadoop 3518 Jun 2 17:47 kms-acls.xml
  11. -rwxr-xr-x 1 hadoop 1527 Jun 2 17:47 kms-env.sh
  12. -rw-r--r-- 1 hadoop 5511 Jun 2 17:47 kms-site.xml
  13. -rw-r--r-- 1 hadoop 76016 Jun 2 17:47 mapred-default.xml
  14. -rwxr-xr-x 1 hadoop 1383 Jun 2 17:47 mapred-env.sh
  15. -rw-r--r-- 1 hadoop 2644 Jun 2 17:47 mapred-site.xml
  16. -rw-r--r-- 1 hadoop 6 Jun 2 17:47 masters
  17. -rw-r--r-- 1 hadoop 26 Jun 2 17:47 slaves
  18. -rw-r--r-- 1 hadoop 63142 Jun 2 17:47 yarn-default.xml
  19. -rwxr-xr-x 1 hadoop 4601 Jun 2 17:47 yarn-env.sh
  20. -rw-r--r-- 1 hadoop 4448 Jun 2 17:47 yarn-site.xml
2.core-site.xml

  1. <configuration>
  2. <!--- global properties -->
  3. <property>
  4. <name>hadoop.tmp.dir</name>
  5. <value>/xwtec/hadoop</value>
  6. <description>A base for other temporary directories.</description>
  7. </property>
  8. <!-- i/o properties -->
  9. <property>
  10. <name>io.file.buffer.size</name>
  11. <value>131072</value>
  12. <description>The size of buffer for use in sequence files.
  13. The size of this buffer should probably be a multiple of hardware
  14. page size (4096 on Intel x86), and it determines how much data is
  15. buffered during read and write operations.</description>
  16. </property>
  17. <!-- file system properties -->
  18. <property>
  19. <name>fs.defaultFS</name>
  20. <value>hdfs://earth:9000</value>
  21. <description>The name of the default file system. A URI whose
  22. scheme and authority determine the FileSystem implementation. The
  23. uri's scheme determines the config property (fs.SCHEME.impl) naming
  24. the FileSystem implementation class. The uri's authority is used to
  25. determine the host, port, etc. for a filesystem.</description>
  26. </property>
  27. </configuration>

3.hdfs-site.xml
  1. <property>
  2. <name>dfs.namenode.name.dir</name>
  3. <value>file:///xwtec/hadoop/dfs/name</value>
  4. <description>Determines where on the local filesystem the DFS name node
  5. should store the name table(fsimage). If this is a comma-delimited list
  6. of directories then the name table is replicated in all of the
  7. directories, for redundancy. </description>
  8. </property>
  9. <property>
  10. <name>dfs.permissions.enabled</name>
  11. <value>false</value>
  12. <description>
  13. If "true", enable permission checking in HDFS.
  14. If "false", permission checking is turned off,
  15. but all other behavior is unchanged.
  16. Switching from one parameter value to the other does not change the mode,
  17. owner or group of files or directories.
  18. </description>
  19. </property>
  20. <property>
  21. <name>dfs.datanode.data.dir</name>
  22. <value>/xwtec/hadoop/dfs/data</value>
  23. <description>Determines where on the local filesystem an DFS data node
  24. should store its blocks. If this is a comma-delimited
  25. list of directories, then data will be stored in all named
  26. directories, typically on different devices. The directories should be tagged
  27. with corresponding storage types ([SSD]/[DISK]/[ARCHIVE]/[RAM_DISK]) for HDFS
  28. storage policies. The default storage type will be DISK if the directory does
  29. not have a storage type tagged explicitly. Directories that do not exist will
  30. be created if local filesystem permission allows.
  31. </description>
  32. <property>
  33. <name>dfs.blocksize</name>
  34. <value>134217728</value>
  35. <description>
  36. The default block size for new files, in bytes.
  37. You can use the following suffix (case insensitive):
  38. k(kilo), m(mega), g(giga), t(tera), p(peta), e(exa) to specify the size (such as 128k, 512m, 1g, etc.),
  39. Or provide complete size in bytes (such as 134217728 for 128 MB).
  40. </description>
  41. </property>
  42. </property>
  43. <property>
  44. <name>dfs.namenode.secondary.http-address</name>
  45. <value>mercury:50090</value>
  46. <description>
  47. The secondary namenode http server address and port.
  48. </description>
  49. </property>
  50. <property>
  51. <name>dfs.namenode.secondary.https-address</name>
  52. <value>mercury:50091</value>
  53. <description>
  54. The secondary namenode HTTPS server address and port.
  55. </description>
  56. </property>
  57. <property>
  58. <name>dfs.replication</name>
  59. <value>2</value>
  60. <description>Default block replication.
  61. The actual number of replications can be specified when the file is created.
  62. The default is used if replication is not specified in create time.
  63. </description>
  64. </property>


4. yarn-site.xml
  1. <!-- Resource Manager Configs -->
  2. <property>
  3. <name>yarn.resourcemanager.hostname</name>
  4. <value>earth</value>
  5. <description>The hostname of the RM.</description>
  6. </property>
  7. <property>
  8. <name>yarn.resourcemanager.scheduler.address</name>
  9. <value>${yarn.resourcemanager.hostname}:8030</value>
  10. <description>The address of the scheduler interface.</description>
  11. </property>
  12. <property>
  13. <name>yarn.resourcemanager.resource-tracker.address</name>
  14. <value>${yarn.resourcemanager.hostname}:8031</value>
  15. </property>
  16. <property>
  17. <name>yarn.resourcemanager.address</name>
  18. <value>${yarn.resourcemanager.hostname}:8032</value>
  19. <description>The address of the applications manager interface in the RM.</description>
  20. </property>
  21. <property>
  22. <name>yarn.resourcemanager.admin.address</name>
  23. <value>${yarn.resourcemanager.hostname}:8033</value>
  24. <description>The address of the RM admin interface.</description>
  25. </property>
  26. <property>
  27. <name>yarn.resourcemanager.webapp.address</name>
  28. <value>${yarn.resourcemanager.hostname}:8088</value>
  29. <description>The http address of the RM web application.</description>
  30. </property>
  31. <property>
  32. <name>yarn.resourcemanager.scheduler.class</name>
  33. <value>org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler</value>
  34. <description>The class to use as the resource scheduler.</description>
  35. </property>
  36. <!-- Node Manager Configs -->
  37. <property>
  38. <name>yarn.nodemanager.hostname</name>
  39. <value>0.0.0.0</value>
  40. <description>The hostname of the NM.</description>
  41. </property>
  42. <property>
  43. <name>yarn.nodemanager.local-dirs</name>
  44. <value>${hadoop.tmp.dir}/nm-local-dir</value>
  45. <description>List of directories to store localized files in. An
  46. application's localized file directory will be found in:
  47. ${yarn.nodemanager.local-dirs}/usercache/${user}/appcache/application_${appid}.
  48. Individual containers' work directories, called container_${contid}, will
  49. be subdirectories of this.
  50. </description>
  51. </property>
  52. <property>
  53.     <!-- where's yarn.log.dir?-->
  54. <name>yarn.nodemanager.log-dirs</name>
  55. <value>${yarn.log.dir}/userlogs</value>
  56. <description>
  57. Where to store container logs. An application's localized log directory
  58. will be found in ${yarn.nodemanager.log-dirs}/application_${appid}.
  59. Individual containers' log directories will be below this, in directories
  60. named container_{$contid}. Each container directory will contain the files
  61. stderr, stdin, and syslog generated by that container.
  62. </description>
  63. </property>
  64. <property>
  65. <name>yarn.nodemanager.aux-services</name>
  66. <value>mapreduce_shuffle</value>
  67. <description>A comma separated list of services where service name should only
  68. contain a-zA-Z0-9_ and can not start with numbers</description>
  69. </property>
  70. <property>
  71. <name>yarn.nodemanager.aux-services.mapreduce_shuffle.class</name>
  72. <value>org.apache.hadoop.mapred.ShuffleHandler</value>
  73. </property>
  74. <property>
  75. <description>The minimum allocation for every container request at the RM,
  76. in MBs. Memory requests lower than this will throw a
  77. InvalidResourceRequestException.</description>
  78. <name>yarn.scheduler.minimum-allocation-mb</name>
  79. <value>1024</value>
  80. </property>
  81. <property>
  82. <description>The maximum allocation for every container request at the RM,
  83. in MBs. Memory requests higher than this will throw a
  84. InvalidResourceRequestException.</description>
  85. <name>yarn.scheduler.maximum-allocation-mb</name>
  86. <value>6666</value>
  87. </property>
  88. <property>
  89. <name>yarn.nodemanager.resource.memory-mb</name>
  90. <value>7168</value>
  91. </property>

5. mapred-site.xml
  1. <!-- MR YARN Application properties -->
  2. <property>
  3. <name>mapreduce.framework.name</name>
  4. <value>yarn</value>
  5. <description>The runtime framework for executing MapReduce jobs.
  6. Can be one of local, classic or yarn.
  7. </description>
  8. </property>
  9. <!-- jobhistory properties -->
  10. <property>
  11. <name>mapreduce.jobhistory.address</name>
  12. <value>earth:10020</value>
  13. <description>MapReduce JobHistory Server IPC host:port</description>
  14. </property>
  15. <property>
  16. <name>mapreduce.jobhistory.webapp.address</name>
  17. <value>earth:19888</value>
  18. <description>MapReduce JobHistory Server Web UI host:port</description>
  19. </property>
  20. <property>
  21. <name>mapreduce.jobhistory.intermediate-done-dir</name>
  22. <value>${yarn.app.mapreduce.am.staging-dir}/history/done_intermediate</value>
  23. <description></description>
  24. </property>
  25. <property>
  26. <name>mapreduce.jobhistory.done-dir</name>
  27. <value>${yarn.app.mapreduce.am.staging-dir}/history/done</value>
  28. <description></description>
  29. </property>
  30. <property>
  31. <name>mapreduce.job.ubertask.enable</name>
  32. <value>false</value>
  33. <description>Whether to enable the small-jobs "ubertask" optimization,
  34. which runs "sufficiently small" jobs sequentially within a single JVM.
  35. "Small" is defined by the following maxmaps, maxreduces, and maxbytes
  36. settings. Note that configurations for application masters also affect
  37. the "Small" definition - yarn.app.mapreduce.am.resource.mb must be
  38. larger than both mapreduce.map.memory.mb and mapreduce.reduce.memory.mb,
  39. and yarn.app.mapreduce.am.resource.cpu-vcores must be larger than
  40. both mapreduce.map.cpu.vcores and mapreduce.reduce.cpu.vcores to enable
  41. ubertask. Users may override this value.
  42. </description>
  43. </property>
  44. <property>
  45. <name>mapreduce.map.memory.mb</name>
  46. <value>1024</value>
  47. </property>
  48. <property>
  49. <name>mapreduce.reduce.memory.mb</name>
  50. <value>1024</value>
  51. </property>

6.yarn-env.sh
  1. # default log directory & file
  2. if [ "$YARN_LOG_DIR" = "" ]; then
  3. YARN_LOG_DIR="$HADOOP_YARN_HOME/logs"
  4. fi
  5. if [ "$YARN_LOGFILE" = "" ]; then
  6. YARN_LOGFILE='yarn.log'
  7. fi
  8. # default policy file for service-level authorization
  9. if [ "$YARN_POLICYFILE" = "" ]; then
  10. YARN_POLICYFILE="hadoop-policy.xml"
  11. fi
  12. # restore ordinary behaviour
  13. unset IFS
  14. YARN_OPTS="$YARN_OPTS -Dhadoop.log.dir=$YARN_LOG_DIR"
  15. YARN_OPTS="$YARN_OPTS -Dyarn.log.dir=$YARN_LOG_DIR"
  16. YARN_OPTS="$YARN_OPTS -Dhadoop.log.file=$YARN_LOGFILE"
  17. YARN_OPTS="$YARN_OPTS -Dyarn.log.file=$YARN_LOGFILE"
  18. YARN_OPTS="$YARN_OPTS -Dyarn.home.dir=$YARN_COMMON_HOME"
  19. YARN_OPTS="$YARN_OPTS -Dyarn.id.str=$YARN_IDENT_STRING"
  20. YARN_OPTS="$YARN_OPTS -Dhadoop.root.logger=${YARN_ROOT_LOGGER:-INFO,console}"
  21. YARN_OPTS="$YARN_OPTS -Dyarn.root.logger=${YARN_ROOT_LOGGER:-INFO,console}"
  22. if [ "x$JAVA_LIBRARY_PATH" != "x" ]; then
  23. YARN_OPTS="$YARN_OPTS -Djava.library.path=$JAVA_LIBRARY_PATH"
  24. fi
  25. YARN_OPTS="$YARN_OPTS -Dyarn.policy.file=$YARN_POLICYFILE"

7.hadoop-env.xml
  1. # Set Hadoop-specific environment variables here.
  2. # The only required environment variable is JAVA_HOME. All others are
  3. # optional. When running a distributed configuration it is best to
  4. # set JAVA_HOME in this file, so that it is correctly defined on
  5. # remote nodes.
  6. # The java implementation to use.
  7. JAVA_HOME=/opt/jdk1.7.0_79
  8. export JAVA_HOME=${JAVA_HOME}
  9. # The jsvc implementation to use. Jsvc is required to run secure datanodes
  10. # that bind to privileged ports to provide authentication of data transfer
  11. # protocol. Jsvc is not required if SASL is configured for authentication of
  12. # data transfer protocol using non-privileged ports.
  13. #export JSVC_HOME=${JSVC_HOME}
  14. export HADOOP_CONF_DIR=${HADOOP_CONF_DIR:-"/etc/hadoop"}

  15. # Extra Java CLASSPATH elements. Automatically insert capacity-scheduler.
  16. for f in $HADOOP_HOME/contrib/capacity-scheduler/*.jar; do
  17. if [ "$HADOOP_CLASSPATH" ]; then
  18. export HADOOP_CLASSPATH=$HADOOP_CLASSPATH:$f
  19. else
  20. export HADOOP_CLASSPATH=$f
  21. fi
  22. done
  23. # The maximum amount of heap to use, in MB. Default is 1000.
  24. #export HADOOP_HEAPSIZE=
  25. #export HADOOP_NAMENODE_INIT_HEAPSIZE=""
  26. # Extra Java runtime options. Empty by default.
  27. export HADOOP_OPTS="$HADOOP_OPTS -Djava.net.preferIPv4Stack=true"
  28. export HADOOP_OPTS="$HADOOP_OPTS -Djava.library.path=/opt/hadoop/lib/native"
  29. # Command specific options appended to HADOOP_OPTS when specified
  30. export HADOOP_NAMENODE_OPTS="-Dhadoop.security.logger=${HADOOP_SECURITY_LOGGER:-INFO,RFAS} -Dhdfs.audit.logger=${HDFS_AUDIT_LOGGER:-INFO,NullAppender} $HADOOP_NAMENODE_OPTS"
  31. export HADOOP_DATANODE_OPTS="-Dhadoop.security.logger=ERROR,RFAS $HADOOP_DATANODE_OPTS"
  32. export HADOOP_SECONDARYNAMENODE_OPTS="-Dhadoop.security.logger=${HADOOP_SECURITY_LOGGER:-INFO,RFAS} -Dhdfs.audit.logger=${HDFS_AUDIT_LOGGER:-INFO,NullAppender} $HADOOP_SECONDARYNAMENODE_OPTS"
  33. export HADOOP_NFS3_OPTS="$HADOOP_NFS3_OPTS"
  34. export HADOOP_PORTMAP_OPTS="-Xmx512m $HADOOP_PORTMAP_OPTS"
  35. # The following applies to multiple commands (fs, dfs, fsck, distcp etc)
  36. export HADOOP_CLIENT_OPTS="-Xmx512m $HADOOP_CLIENT_OPTS"
  37. #HADOOP_JAVA_PLATFORM_OPTS="-XX:-UsePerfData $HADOOP_JAVA_PLATFORM_OPTS"
  38. # On secure datanodes, user to run the datanode as after dropping privileges.
  39. # This **MUST** be uncommented to enable secure HDFS if using privileged ports
  40. # to provide authentication of data transfer protocol. This **MUST NOT** be
  41. # defined if SASL is configured for authentication of data transfer protocol
  42. # using non-privileged ports.
  43. export HADOOP_SECURE_DN_USER=${HADOOP_SECURE_DN_USER}
  44. # Where log files are stored. $HADOOP_HOME/logs by default.
  45. #export HADOOP_LOG_DIR=${HADOOP_LOG_DIR}/$USER
  46. # Where log files are stored in the secure data environment.
  47. export HADOOP_SECURE_DN_LOG_DIR=${HADOOP_LOG_DIR}/${HADOOP_HDFS_USER}
  48. ###
  49. # HDFS Mover specific parameters
  50. ###
  51. # Specify the JVM options to be used when starting the HDFS Mover.
  52. # These options will be appended to the options specified as HADOOP_OPTS
  53. # and therefore may override any similar flags set in HADOOP_OPTS
  54. #
  55. # export HADOOP_MOVER_OPTS=""
  56. ###
  57. # Advanced Users Only!
  58. ###
  59. # The directory where pid files are stored. /tmp by default.
  60. # NOTE: this should be set to a directory that can only be written to by
  61. # the user that will run the hadoop daemons. Otherwise there is the
  62. # potential for a symlink attack.
  63. export HADOOP_PID_DIR=${HADOOP_PID_DIR}
  64. export HADOOP_SECURE_DN_PID_DIR=${HADOOP_PID_DIR}
  65. # A string representing this instance of hadoop. $USER by default.
  66. export HADOOP_IDENT_STRING=$USER





posted @ 2016-07-07 15:33  iAthena  阅读(1100)  评论(0编辑  收藏  举报