一:传入hadoop压缩包,解压,改文件名
用Xftp直接传入到install目录下
解压:[root@gky181 install]# tar -zxvf hadoop-3.1.3.tar.gz -C /opt/soft/
改名:
[root@gky181 install]# cd /opt/soft
[root@gky181 soft]# mv hadoop-3.1.3/ hadoop313
二:更改配置文件和设置环境变量
1,更改/opt/soft/hadoop313/etc/hadoop/目录下的6个文件:
workers , core-site.xml , hdfs-site.xml ,yarn-site.xml ,mapred-site.xml , hadoop-env.sh
[root@gky181 soft]# cd /opt/soft/hadoop313/etc/hadoop/
①workers:
[root@gky181 hadoop]# vim workers 加入全部机器
②core-site.xml:
[root@gky181 hadoop]# vim core-site.xml
<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://gky</value>
<description>逻辑名称,必须与hdfs-site.xml中的dfs.nameservices值保持一致</description>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>/opt/soft/hadoop313/tmpdata</value>
<description>namenode上本地的hadoop临时文件夹</description>
</property>
<property>
<name>hadoop.http.staticuser.user</name>
<value>root</value>
<description>默认用户</description>
</property>
<property>
<name>hadoop.proxyuser.root.hosts</name>
<value>*</value>
<description></description>
</property>
<property>
<name>hadoop.proxyuser.root.groups</name>
<value>*</value>
<description></description>
</property>
<property>
<name>io.file.buffer.size</name>
<value>131072</value>
<description>读写文件的buffer大小为:128K</description>
</property>
<property>
<name>ha.zookeeper.quorum</name>
<value>gky181:2181,gky182:2181,gky183:2181</value>
<description></description>
</property>
<property>
<name>ha.zookeeper.session-timeout.ms</name>
<value>10000</value>
<description>hadoop链接zookeeper的超时时长设置为10s</description>
</property>
</configuration>
③hadoop-env.sh
[root@gky181 hadoop]# vim hadoop-env.sh
export JAVA_HOME=/opt/soft/jdk180
export HDFS_NAMENODE_USER=root
export HDFS_DATANODE_USER=root
export HDFS_SECONDARYNAMENODE_USER=root
export HDFS_JOURNALNODE_USER=root
export HDFS_ZKFC_USER=root
export YARN_RESOURCEMANAGER_USER=root
export YARN_NODEMANAGER_USER=root
④hdfs-site.xml
[root@gky181 hadoop]# vim hdfs-site.xml
<configuration>
<property>
<name>dfs.replication</name>
<value>3</value>
<description>Hadoop中每一个block的备份数</description>
</property>
<property>
<name>dfs.namenode.name.dir</name>
<value>/opt/soft/hadoop313/data/dfs/name</value>
<description>namenode上存储hdfs名字空间元数据目录</description>
</proper