hadoop环境搭建(四)

hadoop环境搭建(四),第1张

hadoop环境搭建(四) 完全分布式部署

一、配置集群

100

101

102

HDFS

namenode、

datanode

datanode

Secondary namenode(2nn)、datanode

YARN

nodemanager

resourcemanager、nodemanager

nodemanager

二、修改配置:

切换路径:cd /opt/module/hadoop-3.1.3/etc/hadoop/

 (1)配置core-site.xml,在cd /opt/module/hadoop-3.1.3/etc/hadoop/路径下,

vi core-site.xml





    
        fs.defaultFS
        hdfs://hadoop1000:9820



    
        hadoop.data.dir
        /opt/module/hadoop-3.1.3/data
    

(2)配置hdfs-site.xml,在cd /opt/module/hadoop-3.1.3/etc/hadoop/路径下,

vi hdfs-site.xml





  

    dfs.namenode.name.dir
    file://${hadoop.data.dir}/name
  

  
  
    dfs.datanode.data.dir
    file://${hadoop.data.dir}/data
  

  
    
    dfs.namenode.checkpoint.dir
    file://${hadoop.data.dir}/namesecondary
  

  
  
    dfs.client.datanode-restart.timeout
    30
  

  

    dfs.namenode.http-address
    hadoop1000:9870


  
  
    dfs.namenode.secondary.http-address
    hadoop1002:9868
  

(3)配置yarn-site.xml,在cd /opt/module/hadoop-3.1.3/etc/hadoop/路径下,

vi yarn-site.xml





    
        yarn.nodemanager.aux-services
        mapreduce_shuffle
    
    
        yarn.resourcemanager.hostname
        hadoop1001
    
    
        yarn.nodemanager.env-whitelist
        JAVA_HOME,HADOOP_COMMON_HOME,HADOOP_HDFS_HOME,HADOOP_CONF_DIR,CLASSPATH_PREPEND_DISTCACHE,HADOOP_YARN_HOME,HADOOP_MAPRED_HOME
    

三、ssh免密登录

免密登录之前 每次远程访问主机都需要输密码:

1、在每个节点生成公钥和私钥,并拷贝

Hadoop1000   生成公钥和私钥:

[root@hadoop1001] ssh-keygen -t rsa

然后敲(三个回车)

将公钥拷贝到要免密登录的目标机器上

[root@hadoop1000] ssh-copy-id hadoop1000

[root@hadoop1000] ssh-copy-id hadoop1001

[root@hadoop1000] ssh-copy-id hadoop1002

Hadoop1001:生成公钥和私钥

[root@hadoop1001] ssh-keygen -t rsa

然后敲(三个回车)

将公钥拷贝到要免密登录的目标机器上

[root@hadoop1001] ssh-copy-id hadoop1000

[root@hadoop1001] ssh-copy-id hadoop1001

[root@hadoop1001] ssh-copy-id hadoop1002

Hadoop1002:   生成公钥和私钥

[root@hadoop1002] ssh-keygen -t rsa

然后敲(三个回车)

将公钥拷贝到要免密登录的目标机器上

[root@hadoop1002] ssh-copy-id hadoop1000

[root@hadoop1002] ssh-copy-id hadoop1001

[root@hadoop1002] ssh-copy-id hadoop1002

远程访问主机 命令:ssh hadoop1001(设置免密登录后,不用输密码直接进入hadoop1001)

 登出:exit  路径切换到etc:cd ..

 四、复制文件

复制文件到hadoop1001:

scp -r hadoop/ root@hadoop1001:/opt/module/hadoop-3.1.3/etc/

复制文件到hadoop1002:

scp -r hadoop/ root@hadoop1002:/opt/module/hadoop-3.1.3/etc/

 五、格式化namenode (namenode启动不了需要删除data文件和logs)

命令:hdfs namenode -format

六、集群单点启动

Hadoop1000:

hdfs --daemon start namenode

hdfs --daemon start datanode

yarn --daemon start nodemanager

hadoop1001:

yarn --daemon start resourcemanager

hdfs --daemon start datanode

yarn --daemon start nodemanager

hadoop1002:

hdfs --daemon start secondarynamenode

hdfs --daemon start datanode

yarn --daemon start nodemanager

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5654027.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-17
下一篇 2022-12-16

发表评论

登录后才能评论

评论列表(0条)

保存