标签:创建文件夹 hadoop root coding jar game false end name
sudo useradd iwbd
sudo passwd iwbd
配置iwbd用户具有root权限
修改/etc/sudoers文件,找到下面一行(91行),在root下面添加一行,如下所示:
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
iwbd ALL=(ALL) ALL
在/opt目录下创建文件夹
(1)在/opt目录下创建module、software文件夹
sudo mkdir module
sudo mkdir software
(2)修改module、software文件夹的所有者cd
sudo mkdir /opt/module /opt/software
sudo chown iwbd:iwbd /opt/module /opt/software
tar -zxvf hadoop-3.1.3.tar.gz -C /opt/module/
#打开/etc/profile.d/my_env.sh文件
sudo vim /etc/profile.d/my_env.sh
#HADOOP_HOME
export HADOOP_HOME=/opt/module/hadoop-3.1.3
export PATH=$PATH:$HADOOP_HOME/bin
export PATH=$PATH:$HADOOP_HOME/sbin
#让修改后的文件生效
source /etc/profile
cd $HADOOP_HOME/etc/hadoop vim core-site.xml
<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <property> <name>fs.defaultFS</name> <value>hdfs://hadoop102:8020</value> </property> <property> <name>hadoop.tmp.dir</name> <value>/opt/module/hadoop-3.1.3/data</value> </property> <property> <name>hadoop.proxyuser.iwbd.hosts</name> <value>*</value> </property> <property> <name>hadoop.proxyuser.iwbd.groups</name> <value>*</value> </property> <property> <name>hadoop.http.staticuser.user</name> <value>iwuser</value> </property> </configuration>
<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <configuration> <property> <name>dfs.namenode.secondary.http-address</name> <value>hadoop104:9868</value> </property> </configuration>
<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <configuration> <property> <name>yarn.nodemanager.aux-services</name> <value>mapreduce_shuffle</value> </property> <property> <name>yarn.resourcemanager.hostname</name> <value>hadoop103</value> </property> <property> <name>yarn.nodemanager.env-whitelist</name> <value>JAVA_HOME,HADOOP_COMMON_HOME,HADOOP_HDFS_HOME,HADOOP_CONF_DIR,CLASSPATH_PREPEND_DISTCACHE,HADOOP_YARN_HOME,HADOOP_MAPRED_HOME</value> </property> <property> <name>yarn.scheduler.minimum-allocation-mb</name> <value>512</value> </property> <property> <name>yarn.scheduler.maximum-allocation-mb</name> <value>4096</value> </property> <property> <name>yarn.nodemanager.resource.memory-mb</name> <value>4096</value> </property> <property> <name>yarn.nodemanager.pmem-check-enabled</name> <value>false</value> </property> <property> <name>yarn.nodemanager.vmem-check-enabled</name> <value>false</value> </property> </configuration>
<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <configuration> <property> <name>mapreduce.framework.name</name> <value>yarn</value> </property> </configuration>
xsync /opt/module/hadoop-3.1.3/etc/hadoop/
vim /opt/module/hadoop-3.1.3/etc/hadoop/workers #在该文件中增加如下内容: hadoop102 hadoop103 hadoop104
1)如果集群是第一次启动,需要在hadoop102节点格式化NameNode(注意格式化之前,一定要先停止上次启动的所有namenode和datanode进程,然后再删除data和log数据)
hdfs namenode -format
2)启动HDFS
sbin/start-dfs.sh
3)在配置了ResourceManager的节点(hadoop103)启动YARN
sbin/start-yarn.sh
4)Web端查看SecondaryNameNod
(a)浏览器中输入:http://hadoop104:9868/status.html
(b)查看SecondaryNameNode信息
(1)分别启动/停止HDFS组件
hdfs --daemon start/stop namenode/datanode/secondarynamenode
(2)启动/停止YARN
yarn --daemon start/stop resourcemanager/nodemanager
(1)整体启动/停止HDFS
start-dfs.sh/stop-dfs.sh
(2)整体启动/停止YARN
start-yarn.sh/stop-yarn.sh
为了查看程序的历史运行情况,需要配置一下历史服务器。具体配置步骤如下:
<!-- 历史服务器端地址 --> <property> <name>mapreduce.jobhistory.address</name> <value>hadoop102:10020</value> </property> <!-- 历史服务器web端地址 --> <property> <name>mapreduce.jobhistory.webapp.address</name> <value>hadoop102:19888</value> </property>
xsync $HADOOP_HOME/etc/hadoop/mapred-site.xml
mapred --daemon start historyserver
http://hadoop102:19888/jobhistory
日志聚集概念:应用运行完成以后,将程序运行日志信息上传到HDFS系统上。
日志聚集功能好处:可以方便的查看到程序运行详情,方便开发调试。
注意:开启日志聚集功能,需要重新启动NodeManager 、ResourceManager和HistoryManager。
开启日志聚集功能具体步骤如下:
<property> <name>yarn.log-aggregation-enable</name> <value>true</value> </property> <property> <name>yarn.log.server.url</name> <value>http://${yarn.timeline-service.webapp.address}/applicationhistory/logs</value> </property> <property> <name>yarn.log-aggregation.retain-seconds</name> <value>604800</value> </property> <property> <name>yarn.timeline-service.enabled</name> <value>true</value> </property> <property> <name>yarn.timeline-service.hostname</name> <value>${yarn.resourcemanager.hostname}</value> </property> <property> <name>yarn.timeline-service.http-cross-origin.enabled</name> <value>true</value> </property> <property> <name>yarn.resourcemanager.system-metrics-publisher.enabled</name> <value>true</value> </property>
xsync $HADOOP_HOME/etc/hadoop/yarn-site.xml
在103上执行: stop-yarn.sh
在102上执行: mapred --daemon stop historyserver
在103上执行:start-yarn.sh
在103上执行:yarn --daemon start timelineserver
在102上执行:mapred --daemon start historyserver
hdfs dfs -rm -R /user/atguigu/output
hadoop jar $HADOOP_HOME/share/hadoop/mapreduce/hadoop-mapreduce-examples-3.1.3.jar wordcount /user/iwgame/input /user/iwbd/output6.7
http://hadoop102:19888/jobhistory
标签:创建文件夹 hadoop root coding jar game false end name
原文地址:https://www.cnblogs.com/coolid/p/14218066.html