会有如下显示:
Welcome to Ubuntu 16.04 LTS (GNU/Linux 4.4.0-21-generic x86_64) * Documentation: https://help.ubuntu.com/ 458 packages can be updated. 171 updates are security updates. The programs included with the Ubuntu system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. The programs included with the Ubuntu system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Last login: Wed Feb 1 00:02:53 2017 from 127.0.0.1 To run a command as administrator (user "root"), use "sudo <command>". See "man sudo_root" for details.这说明已经安装成功,第一次登录会询问是否继续链接,输入yes即可以进入。
实际上,在Hadoop的安装过程中,是否免密码登录是无关紧要的,但是如果不配置免密码登录,每次启动Hadoop都需要输入密码以登录到每台机器的DataNode上,考虑到一般的Hadoop集群动辄数百或者上千台机器,因此一般来说都会配置SSH免密码登录。
master 节点无密码访问 slave1 和 slave2 节点:
运行结果:
Welcome to Ubuntu 16.04 LTS (GNU/Linux 4.4.0-59-generic x86_64) * Documentation: https://help.ubuntu.com/ 312 packages can be updated. 10 updates are security updates. The programs included with the Ubuntu system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. The programs included with the Ubuntu system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Last login: Wed Feb 1 00:03:30 2017 from 192.168.190.131不需要密码,需要密码说明没有配置成功,看看是不是哪步出现了问题。
安装并运行Hadoop介绍Hadoop的安装之前,先介绍一下Hadoop对各个节点的角色定义。
Hadoop分别从三个角度将主机划分为两种角色。第一,最基本的划分为Master和Slave,即主人和奴隶;第二,从HDFS的角度,将主机划分为NameNode和DataNode(在分布式文件系统中,目录的管理很重要,管理目录相当于主任,而NameNode就是目录管理者);第三,从MapReduce角度,将主机划分为JobTracker和TaskTracker(一个Job经常被划分为多个Task,从这个角度不难理解它们之间的关系)。
Hadoop有三种运行方式:单机模式、伪分布与完全分布式。乍看之下,前两种并不能体现云计算的优势,但是它们便于程序的测试与调试,所以还是有意义的。
我的博客中有介绍单机模式和伪分布式方式这里就不赘述,本文主要着重介绍分布式方式配置。
(1)hadoop 用户目录下解压下载的hadoop-2.7.1.tar.gz
使用解压命令: