Hadoop 3.0 安装部署

版权声明:坚持写出有意义有价值的文章,不做无良的文章搬砖工 https://blog.csdn.net/aa5305123/article/details/84191075

最近在虚拟机上新装了一个单节点的Hadoop,用于日常测试。

下载二进制包,解压。官网 http://hadoop.apache.org

1、 安装ssh,否则Pseudo-Distributed Operation 模式下启动hdfs会失败。

sudo apt-get install ssh

2、打开  etc/hadoop/hadoop-env.sh  配置java home

 export JAVA_HOME=/usr/java/latest

3、配置  etc/hadoop/core-site.xml:

<configuration>
    <property>
        <name>fs.defaultFS</name>
        <value>hdfs://localhost:9000</value>
    </property>
</configuration>

4、配置   etc/hadoop/hdfs-site.xml:

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

这个地方在centos 和unbuntu都有异常,就是启动会,无法访问50070,但是yarn的8088可以访问。这个问题,是hfds-site默认配置没起作用。所以这个地方还需要再配置hdfs-site.xml 添加如下:

<property>
  <name>dfs.http.address</name>
  <value>0.0.0.0:50070</value>
</property>

5、配置 ssh

  $ ssh localhost

如果连接不上ssh,就执行如下命令:
  $ ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
  $ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
  $ chmod 0600 ~/.ssh/authorized_keysg

6、格式化存储目录:

  $ bin/hdfs namenode -format

7、启动hdfs:  

$ sbin/start-dfs.sh

8、查看UI:

http://localhost:50070/

猜你喜欢

转载自blog.csdn.net/aa5305123/article/details/84191075