前述:
这篇文档是建立在三台虚拟机相互ping通,防火墙关闭,hosts文件修改,SSH 免密码登录,主机名修改等的基础上开始的。
一.传入文件
1.创建安装目录
mkdir /usr/local/soft

2.打开xftp,找到对应目录,将所需安装包传入进去



查看安装包:cd /usr/local/soft

二.安装JAVA
1.查看是否已安装jdk: java -version

2.未安装,解压java安装包: tar -zxvf jdk-8u181-linux-x64.tar.gz
(每个人安装包可能不一样,自己参考)


3.给jdk重命名,并查看当前位置:mv jdk1.8.0_181 java

4.配置jdk环境:vim /etc/profile.d/jdk.sh


export JAVA_HOME=/usr/local/soft/java
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/rt.jar
5.更新环境变量并检验:source /etc/profile

三.安装Hadoop
1.解压hadoop安装包:tar -zxvf hadoop-3.1.1.tar.gz

2.查看并重命名:mv hadoop-3.1.1 hadoop

3.配置 hadoop 配置文件
3.1修改 core-site.xml 配置文件:vim hadoop/etc/hadoop/core-site.xml


<property>
<name>fs.defaultFS</name>
<value>hdfs://master:9000</value>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>file:/usr/local/soft/hadoop/tmp</value>
<description>Abase for other temporary directories.</description>
</property>
<property>
<name>fs.trash.interval</name>
<value>1440</value>
</property>
3.2修改 hdfs-site.xml 配置文件:vim hadoop/etc/hadoop/hdfs-site.xml


<property>
<name>dfs.namenode.secondary.http-address</name>
<value>node1:50090</value>
</property>
<property>
<name>dfs.replication</name>
<value>3</value>
</property>
<property>
<name>dfs.namenode.name.dir</name>
<value>file:/usr/local/soft/hadoop/tmp/dfs/name</value>
</property>
<property>
<name>dfs.datanode.data.dir</name>
<value>file:/usr/local/soft/hadoop/tmp/dfs/data</value>
</property>
对node2: scp /etc/profile.d/jdk.sh root@node2:/etc/profile.d/
scp /etc/profile.d/hadoop.sh root@node2:/etc/profile.d/

4.在三台虚拟机上都要执行
source /etc/profile
source /usr/local/soft/hadoop/etc/hadoop/hadoop-env.sh

(只显示一台)
5.格式化 HDFS 文件系统:hdfs namenode -format(只在master上)

五.启动集群
cd /usr/local/soft/hadoop/sbin/
./start-all.sh

启动后在三台虚拟机上分别输入jps
结果如下:



windows下谷歌浏览器检验:
http://192.168.204.120:8088/cluster(输入自己的master的ip地址)

http://192.168.204.120:9870

Hadoop测试(MapReduce 执行计算测试):


hadoop jar/usr/local/soft/hadoop/share/hadoop/mapreduce/hadoop-mapreduce-examples-3.1.1.jar wordcount /input /output

查看运行结果:



以上hadoop配置完成。
总结
以上所述是小编给大家介绍的centos6.8下hadoop3.1.1完全分布式安装指南,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对社区网站的支持!
如果你觉得本文对你有帮助,欢迎转载,烦请注明出处,谢谢! |