|NO.Z.00004|——————————|Deployment|——|Hadoop&PB级离线数仓.v04|——|Hadoop.v04|集群组件部署|
一、集群配置
### --- Hadoop集群配置 = HDFS集群配置 + MapReduce集群配置 + Yarn集群配置
~~~ # HDFS集群配置
~~~ 将JDK路径明确配置给HDFS(修改hadoop-env.sh)
~~~ 指定NameNode节点以及数据存储目录(修改core-site.xml)
~~~ 指定SecondaryNameNode节点(修改hdfs-site.xml)
~~~ 指定DataNode从节点(修改etc/hadoop/slaves文件,每个节点配置信息占一行)
### --- MapReduce集群配置
~~~ 将JDK路径明确配置给MapReduce(修改mapred-env.sh)
~~~ 指定MapReduce计算框架运行Yarn资源调度框架(修改mapred-site.xml)
### --- Yarn集群配置
~~~ 将JDK路径明确配置给Yarn(修改yarn-env.sh)
~~~ 指定ResourceManager老大节点所在计算机节点(修改yarn-site.xml)
~~~ 指定NodeManager节点(会通过slaves文件内容确定)
二、集群配置具体步骤:HDFS集群配置
### --- HDFS集群配置
[root@hadoop01 ~]# cd /opt/yanqi/servers/hadoop-2.9.2/etc/hadoop
~~~ # 配置:hadoop-env.sh:将JDK路径明确配置给HDFS
[root@hadoop01 ~]# vim /opt/yanqi/servers/hadoop-2.9.2/etc/hadoop/hadoop-env.sh
export JAVA_HOME=/opt/yanqi/servers/jdk1.8.0_231
~~~ # 指定NameNode节点以及数据存储目录(修改core-site.xml)
[root@hadoop01 ~]# vim /opt/yanqi/servers/hadoop-2.9.2/etc/hadoop/core-site.xml
<configuration> # 添加如下内容
<!-- 指定HDFS中NameNode的地址 -->
<property>
<name>fs.defaultFS</name>
<value>hdfs://hadoop01:9000</value>
</property>
<!-- 指定Hadoop运行时产生文件的存储目录 -->
<property>
<name>hadoop.tmp.dir</name>
<value>/opt/yanqi/servers/hadoop-2.9.2/data/tmp</value>
</property>
</configuration> # 添加如上内容
~~~ # core-site.xml的默认配置:
https://hadoop.apache.org/docs/r2.9.2/hadoop-project-dist/hadoop-common/coredefault.xml
### --- 指定secondarynamenode节点(修改hdfs-site.xml)
[root@hadoop01 ~]# vim /opt/yanqi/servers/hadoop-2.9.2/etc/hadoop/hdfs-site.xml
<configuration> # 添加如下内容
<!-- 指定Hadoop辅助名称节点主机配置 -->
<property>
<name>dfs.namenode.secondary.http-address</name>
<value>hadoop02:50090</value>
</property>
<!--副本数量 -->
<property>
<name>dfs.replication</name>
<value>5</value>
</property>
</configuration> # 添加如上内容
~~~ # 官方默认配置
https://hadoop.apache.org/docs/r2.9.2/hadoop-project-dist/hadoop-hdfs/hdfsdefault.xml
### --- 指定datanode从节点(修改slaves文件,每个节点配置信息占一行)
~~~ 注意:该文件中添加的内容结尾不允许有空格,文件中不允许有空行。
[root@hadoop01 ~]# vim /opt/yanqi/servers/hadoop-2.9.2/etc/hadoop/slaves
hadoop01
hadoop02
hadoop03
hadoop04
hadoop05
三、集群配置具体步骤:MapReduce集群配置
### --- 指定MapReduce使用的jdk路径(修改mapred-env.sh)
[root@hadoop01 ~]# vim /opt/yanqi/servers/hadoop-2.9.2/etc/hadoop/mapred-env.sh
export JAVA_HOME=/opt/yanqi/servers/jdk1.8.0_231
### --- 指定MapReduce计算框架运行Yarn资源调度框架(修改mapred-site.xml)
[root@hadoop01 ~]# mv /opt/yanqi/servers/hadoop-2.9.2/etc/hadoop/mapred-site.xml.template \
> /opt/yanqi/servers/hadoop-2.9.2/etc/hadoop/mapred-site.xml
[root@hadoop01 ~]# vim /opt/yanqi/servers/hadoop-2.9.2/etc/hadoop/mapred-site.xml
<configuration> # 添加如下内容
<!-- 指定MR运行在Yarn上 -->
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
</configuration> # 添加如上内容
### --- mapred-site.xml默认配置
https://hadoop.apache.org/docs/r2.9.2/hadoop-mapreduce-client/hadoop-mapreduceclient-core/mapred-default.xml
四、集群配置具体步骤:Yarn集群配置
### --- 指定JDK路径
[root@hadoop01 ~]# vim /opt/yanqi/servers/hadoop-2.9.2/etc/hadoop/yarn-env.sh
export JAVA_HOME=/opt/yanqi/servers/jdk1.8.0_231
### --- 指定ResourceMnager的master节点信息(修改yarn-site.xml)
[root@hadoop01 ~]# vim /opt/yanqi/servers/hadoop-2.9.2/etc/hadoop/yarn-site.xml
<configuration> # 添加如下内容
<!-- Site specific YARN configuration properties -->
<!-- 指定YARN的ResourceManager的地址 -->
<property>
<name>yarn.resourcemanager.hostname</name>
<value>hadoop01</value>
</property>
<!-- Reducer获取数据的方式 -->
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
</configuration> # 添加如上内容
### --- yarn-site.xml的默认配置
https://hadoop.apache.org/docs/r2.9.2/hadoop-yarn/hadoop-yarn-common/yarndefault.xml
### --- 指定NodeManager节点(slaves文件已修改)
[root@hadoop01 ~]# vim /opt/yanqi/servers/hadoop-2.9.2/etc/hadoop/slaves
hadoop01
hadoop02
hadoop03
hadoop04
hadoop05
### --- 注意:
~~~ Hadoop安装目录所属用户和所属用户组信息,默认是501 dialout,
~~~ 而我们操作Hadoop集群的用户使用的是虚拟机的root用户,
五、为所有目录授予可执行权限
### --- 所以为了避免出现信息混乱,修改Hadoop安装目录所属用户和用户组!!
[root@hadoop01 ~]# chown -R root:root /opt/yanqi/servers/hadoop-2.9.2
Walter Savage Landor:strove with none,for none was worth my strife.Nature I loved and, next to Nature, Art:I warm’d both hands before the fire of life.It sinks, and I am ready to depart
——W.S.Landor
版权声明:本文为yanqi_vip原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。