欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Hadoop-伪分布式搭建

程序员文章站 2022-07-14 15:18:35
...

伪分布式就是单节点的

第一步:配置相关的文件

编辑hdfs-site.xml

[aaa@qq.com ~]$ cd /opt/module/hadoop-2.7.7/
[aaa@qq.com hadoop-2.7.7]$ 
[aaa@qq.com hadoop-2.7.7]$ vi etc/hadoop/hdfs-site.xml 
[aaa@qq.com hadoop-2.7.7]$ 

增加内容如下:

<configuration>
<!--指定DFS中NameNode的地址-->
    <property>
        <name>fs.defaultFS</name>
  	 <value>hdfs://hadoop101:9000</value>
    </property>
<!--指定Hadoop运行时产生文件的存储目录-->
    <property>
        <name>hadoop.tmp.dir</name>
        <value>/opt/module/hadoop-2.7.7/data/tmp</value>
    </property>
</configuration>

配置core-site.xml

[aaa@qq.com hadoop-2.7.7]$ vi etc/hadoop/core-site.xml

加入以下内容:

<configuration>
<!--指定HDFS副本的数量,默认是三个,因为现在只有1个节点-->
    <property>
        <name>dfs.replication</name>
        <value>1</value>
    </property>
</configuration>

第二步:启动

1、格式化

[aaa@qq.com hadoop-2.7.7]$ hdfs namenode -format

运行格式化命令时一定要注意:
hdfs://hadoop101:9000中的hadoop101能ping通,不然就会一直卡着。
Hadoop-伪分布式搭建Hadoop-伪分布式搭建
和我下面这个出现的结果一样就算格式化成功了
Hadoop-伪分布式搭建

2、启动namenode和datanode

[aaa@qq.com hadoop-2.7.7]$ hadoop-daemon.sh start namenode
starting namenode, logging to /opt/module/hadoop-2.7.7/logs/hadoop-zhenghui-namenode-hadoop101.out
[aaa@qq.com hadoop-2.7.7]$ 
[aaa@qq.com hadoop-2.7.7]$ jps
10582 NameNode
10620 Jps
[aaa@qq.com hadoop-2.7.7]$ 
[aaa@qq.com hadoop-2.7.7]$ 
[aaa@qq.com hadoop-2.7.7]$ hadoop-daemon.sh start datanode
starting datanode, logging to /opt/module/hadoop-2.7.7/logs/hadoop-zhenghui-datanode-hadoop101.out

[aaa@qq.com hadoop-2.7.7]$ 
[aaa@qq.com hadoop-2.7.7]$ 
[aaa@qq.com hadoop-2.7.7]$ jps
10582 NameNode
10726 Jps
10649 DataNode
[aaa@qq.com hadoop-2.7.7]$ 

测试

访问:
http://192.168.1.101:50070/
Hadoop-伪分布式搭建
Hadoop-伪分布式搭建