赞
踩
在 $HADOOP_HOME/etc/hadoop 文件夹内,修改一下文件:
# 设置JDK路径
export JAVA_HOME=/export/jdk
# 设置JobHistoryServer进程内存为1G
export HADOOP_JOB_HISTORYSERVER_HEAPSIZE=1000
# 设置日志级别为INFO
export HADOOP_MAPRED_ROOT_LOGGER=INFO,RFA
<!-- 针对MR任务,它会将mapreduce作业提交给resourcemanage --> <property> <name>mapreduce.framework.name</name> <value>yarn</value> </property> <!--job运行日志信息访问地址 --> <property> <name>mapreduce.jobhistory.address</name> <value>node1:10020</value> </property> <!-- jobhistory web访问地址 --> <property> <name>mapreduce.jobhistory.webapp.address</name> <value>node1:19888</value> </property> <!-- 历史信息在HDFS记录的目录 --> <property> <name>mapreduce.jobhistory.done-dir</name> <value>/data/mr-history/done</value> </property> <!-- 历史信息在HDFS记录的临时目录 --> <property> <name>mapreduce.jobhistory.intermediate-done-dir</name> <value>/data/mr-history/tmp</value> </property> <!-- MapReduce Home设置为 HADOOP_HOME --> <property> <name>yarn.app.mapreduce.am.env</name> <value>HADOOP_MAPRED_HOME=$HADOOP_HOME</value> </property> <property> <name>mapreduce.map.env</name> <value>HADOOP_MAPRED_HOME=$HADOOP_HOME</value> </property> <property> <name>mapreduce.reduce.env</name> <value>HADOOP_MAPRED_HOME=$HADOOP_HOME</value> </property>
在 $HADOOP_HOME/etc/hadoop 文件夹内,修改
export JAVA_HOME=/export/jdk
export HADOOP_HOME=/export/hadoop
export HADOOP_CONF_DIR=$HADOOP_HOME/etc/hadoop
export HADOOP_LOG_DIR=$HADOOP_HOME/logs
<property> <name>yarn.log.server.url</name> <value>http://node1:19888/jobhistory/logs</value> <description></description> </property> <property> <name>yarn.web-proxy.address</name> <value>node1:8089</value> <description>proxy server hostname and port</description> </property> <property> <name>yarn.log-aggregation-enable</name> <value>true</value> <description>Configuration to enable or disable log aggregation</description> </property> <property> <name>yarn.nodemanager.remote-app-log-dir</name> <value>/tmp/logs</value> <description>Configuration to enable or disable log aggregation</description> </property> <!-- Site specific YARN configuration properties --> <property> <name>yarn.resourcemanager.hostname</name> <value>node1</value> <description></description> </property> <property> <name>yarn.resourcemanager.scheduler.class</name> <value>org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler</value> <description></description> </property> <property> <name>yarn.nodemanager.local-dirs</name> <value>/data/nm-local</value> <description>Comma-separated list of paths on the local filesystem where intermediate data is written.</description> </property> <property> <name>yarn.nodemanager.log-dirs</name> <value>/data/nm-log</value> <description>Comma-separated list of paths on the local filesystem where logs are written.</description> </property> <property> <name>yarn.nodemanager.log.retain-seconds</name> <value>10800</value> <description>Default time (in seconds) to retain log files on the NodeManager Only applicable if log-aggregation is disabled.</description> </property> <property> <name>yarn.nodemanager.aux-services</name> <value>mapreduce_shuffle</value> <description>Shuffle service that needs to be set for Map Reduce applications.</description> </property>
scp mapred-env.sh mapred-site.xml yarn-env.sh yarn-site.xml node2:`pwd`/
scp mapred-env.sh mapred-site.xml yarn-env.sh yarn-site.xml node3:`pwd`/
# 一键启动
$HADOOP_HOME/sbin/start-yarn.sh
# 一键停止
$HADOOP_HOME/sbin/stop-yarn.sh
# 单独启动或停止
$HADOOP_HOME/bin/yarn --daemon start|stop resourcemanager|nodemanager|proxyserver
# 历史服务器启动或停止
$HADOOP_HOME/bin/mapred --daemon start|stop historyserver
打开 http://node1:8088 即可看到YARN集群的监控页面(ResourceManager的WEB UI)
$HADOOP_HOME/share/hadoop/mapreduce/hadoop-mapreduce-examples-3.3.1.jar
hadoop jar 程序文件 java类名 [程序参数] ... [程序参数]
hadoop jar $HADOOP_HOME/share/hadoop/mapreduce/hadoop-mapreduce-examples-3.3.1.jar wordcount hdfs://node1:8020/input/wordcount/ hdfs://node1:8020/output/wc1
注意:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。