您的位置:首页 > 运维架构

Ubuntu搭建hadoop完全式集群

2017-09-08 10:16 330 查看
我们这次搭建的hadoop集群类似下图,只是我们的DateNode只有两个,mater,slave-1 和slave-2三台机器的hadoop配置是一模一样的。



首先到hadoop官网http://mirrors.hust.edu.cn/apache/hadoop/common/下载Linux版本的hadoop压缩包,我这里下载的hadoop版本为2.7.3的。

下载好的hadoop压缩包,在Ubuntu系统上用命令行来解压hadoop压缩包,解压在usr文件夹中:

tar -zxvf hadoop-2.7.3.tar.gz


进入hadoop2.7.3的文件夹的etc/hadoop目录下:

cd /usr/hadoop-2.7.3/etc/hadoop


配置core-site.xml,hdfs-site.xml,mapred-site.xml和yarn-site.xml。

core-site.xml:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://master:9000</value>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>/usr/hadoop-2.7.3/tmp</value>
</property>
</configuration>


hdfs-site.xml:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

<configuration>
<property>
<name>dfs.replication</name>
<value>2</value>
</property>
</configuration>


mapred-site.xml:

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
<property>
<name>mapred.job.tracker</name>
<value>master:9001</value>
</property>
</configuration>


yarn-site.xml:

<?xml version="1.0"?>

<configuration>
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
<property>
<name>yarn.resourcemanager.hostname</name>
<value>master</value>
</property>
</configuration>


配置好hadoop后,需要在etc/hoosts文件配置三台机器的主机名:

192.168.180.137 master
192.168.180.135 slave-1
192.168.180.134 slave-2


在/etc/environment 配置hadoop的环境变量:

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/jdk1.8.0_144/bin:/usr/hadoop-2.7.3/bin:/usr/hadoop-2.7.3/sbin:/usr/hive/bin:/usr/zookeeper-3.4.9/bin:/usr/zookeeper-3.4.9/conf:/usr/hbase-1.3.1/bin:/usr/hbase-1.3.1/lib"


配置好hadoop集群后,现在就开始启动集群,看看集群是否搭建成功。

在master主节点是输入两个条命令:

hadoop namenode -format
start-all.sh


我们在master主节点jps:

2501 NameNode
3578 Jps
2876 ResourceManager
2687 SecondaryNameNode


在slave-1和slave-2节点jps下:

slave-1:
2690 Jps
2370 NodeManager

slave-2:
2992 Jps
2643 NodeManager
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: