CentOS6.7安装Hadoop2.7.3

VMware建立虚拟机

配置Java环境

克隆虚拟机

在修改master的hosts,

创新互联建站专注于涟源企业网站建设,成都响应式网站建设,商城网站建设。涟源网站建设公司,为涟源等地区提供建站服务。全流程按需制作网站,专业设计,全程项目跟踪,创新互联建站专业和态度为您提供的服务

192.168.197.132  master-01
192.168.197.133  slave-01
192.168.197.134  slave-02

然后克隆matser,分别命名为slave1,slave2。
现在有三台虚拟机
IP 虚拟机名称 用户
192.168.197.132 master yang
192.168.197.133 slave1 yang
192.168.197.134 slave2 yang

ssh免登陆

(1)centos默认没有启动ssh无密登录,去掉/etc/ssh/sshd_config其中2行的注释,每台服务器都要设置,
#RSAAuthentication yes
#PubkeyAuthentication yes
安装ssh
在master-01的机器上进入 yang用户 的 .ssh 目录
使用 ssh-keygen -t rsa 来生成公钥和私钥(连续回车,不设置密码)
把公钥文件复制到要访问的机器的yang的用户目录下的.ssh 目录
scp ~/.ssh/id_rsa.pub yang@master-01:/home/yang/.ssh/authorized_keys
scp ~/.ssh/id_rsa.pub yang@slave-01:/home/yang/.ssh/authorized_keys
scp ~/.ssh/id_rsa.pub yang@slave-02:/home/yang/.ssh/authorized_keys
检测是否可以不需要密码登陆
ssh localhost
ssh yang@master-01
ssh yang@slave-01
ssh yang@slave-02
这里只有master-01是master,如果有多个namenode,或者rm的话则需要打通所有master到其他剩余节点的免密码登陆。(将master-01的authorized_keys追加到02和03的authorized_keys)

配置安装Hadoop 2.7.3

下载Hadoop-2.7.3

下载Hadoop 2.7.3并解压到/usr/software目录下,在hadoop-2.7.3目录下新建hdfs,hdfs/data,hdfs/name,hdfs/temp目录。

配置core-site.xml


    
        fs.defaultFS
        hdfs://master-01:9000
    
    
        hadoop.tmp.dir
        file:/usr/software/hadoop-2.7.3/tmp
    
    
        io.file.buffer.size
        131702
    

配置mapred-site.xml


    
        mapreduce.framework.name
        yarn
    
    
        mapreduce.jobhistory.address
        master-01:10020
    
    
        mapreduce.jobhistory.webapp.address
        master-01:19888
    

配置yarn-site.xml


  
        yarn.nodemanager.aux-services
        mapreduce_shuffle
    
    
        yarn.nodemanager.auxservices.mapreduce.shuffle.class
        org.apache.hadoop.mapred.ShuffleHandler
    
    
        yarn.resourcemanager.address
        master-01:8032
    
    
        yarn.resourcemanager.scheduler.address
        master-01:8030
    
    
        yarn.resourcemanager.resource-tracker.address
        master-01:8031
    
    
        yarn.resourcemanager.admin.address
        master-01:8033
    
    
        yarn.resourcemanager.webapp.address
        master-01:8088
    
   

设置slaves

修改hadoop-2.7.3/etc/hadoop下的slaves文件,添加我们之前建立好的两个slave

slave-01
slave-02

网上很多地方说需要设置hadoop-env.sh和yarn-env.sh的Java环境,我看了这两个文件的内容,已经帮我们配置好了,所以不用管。

配置完成

然后分别复制master下面的已经配置好的Hadoop-2.7.3到yang@slave-01和yang@slave02的/usr/software目录下。

启动

在Master服务器启动hadoop,从节点会自动启动,进入/usr/software/hadoop-2.7.3目录
(1)初始化,输入命令,bin/hdfs namenode -format
(2)启动sbin/start-dfs.sh,输出如下内容,则成功

Starting namenodes on [master-01]
master-01: starting namenode, logging to /usr/software/hadoop-2.7.3/logs/hadoop-yang-namenode-master-01.out
slave-01: starting datanode, logging to /usr/software/hadoop-2.7.3/logs/hadoop-yang-datanode-slave-01.out
slave-02: starting datanode, logging to /usr/software/hadoop-2.7.3/logs/hadoop-yang-datanode-slave-02.out
Starting secondary namenodes [master-01]
master-01: starting secondarynamenode, logging to /usr/software/hadoop-2.7.3/logs/hadoop-yang-secondarynamenode-master-01.out

(3)sbin/start-yarn.sh,如下则成功

[yang@master-01 hadoop-2.7.3]$ ./sbin/start-yarn.sh 
starting yarn daemons
starting resourcemanager, logging to /usr/software/hadoop-2.7.3/logs/yarn-yang-resourcemanager-master-01.out
slave-02: starting nodemanager, logging to /usr/software/hadoop-2.7.3/logs/yarn-yang-nodemanager-slave-02.out
slave-01: starting nodemanager, logging to /usr/software/hadoop-2.7.3/logs/yarn-yang-nodemanager-slave-01.out

(4)停止的话,输入命令,sbin/stop-dfs.sh,sbin/stop-yarn.sh
(5)输入命令,jps,可以看到相关信息

yang@master-01 hadoop-2.7.3]$ jps
6932 SecondaryNameNode
7384 Jps
6729 NameNode
7118 ResourceManager
[yang@master-01 hadoop-2.7.3]$ ./bin/hdfs dfsadmin -report
Configured Capacity: 75404550144 (70.23 GB)
Present Capacity: 54191501312 (50.47 GB)
DFS Remaining: 54191452160 (50.47 GB)
DFS Used: 49152 (48 KB)
DFS Used%: 0.00%
Under replicated blocks: 0
Blocks with corrupt replicas: 0
Missing blocks: 0
Missing blocks (with replication factor 1): 0

-------------------------------------------------
Live datanodes (2):

Name: 192.168.197.133:50010 (slave-01)
Hostname: slave-01
Decommission Status : Normal
Configured Capacity: 37702275072 (35.11 GB)
DFS Used: 24576 (24 KB)
Non DFS Used: 10606755840 (9.88 GB)
DFS Remaining: 27095494656 (25.23 GB)
DFS Used%: 0.00%
DFS Remaining%: 71.87%
Configured Cache Capacity: 0 (0 B)
Cache Used: 0 (0 B)
Cache Remaining: 0 (0 B)
Cache Used%: 100.00%
Cache Remaining%: 0.00%
Xceivers: 1
Last contact: Tue Sep 27 17:18:44 CST 2016


Name: 192.168.197.134:50010 (slave-02)
Hostname: slave-02
Decommission Status : Normal
Configured Capacity: 37702275072 (35.11 GB)
DFS Used: 24576 (24 KB)
Non DFS Used: 10606292992 (9.88 GB)
DFS Remaining: 27095957504 (25.24 GB)
DFS Used%: 0.00%
DFS Remaining%: 71.87%
Configured Cache Capacity: 0 (0 B)
Cache Used: 0 (0 B)
Cache Remaining: 0 (0 B)
Cache Used%: 100.00%
Cache Remaining%: 0.00%
Xceivers: 1
Last contact: Tue Sep 27 17:18:44 CST 2016

Web访问直接关闭防火墙

(1)浏览器打开http://192.168.197.132:8088/
(2)浏览器打开http://192.168.197.132:50070/
有如下信息:
Configured Capacity: 35.11 GB
DFS Used: 28 KB (0%)
Non DFS Used: 9.88 GB
DFS Remaining: 25.23 GB (71.87%)
Block Pool Used: 28 KB (0%)
DataNodes usages% (Min/Median/Max/stdDev): 0.00% / 0.00% / 0.00% / 0.00%
Live Nodes 1 (Decommissioned: 0)
Dead Nodes 1 (Decommissioned: 0)
Decommissioning Nodes 0
Total Datanode Volume Failures 0 (0 B)
Number of Under-Replicated Blocks 0
Number of Blocks Pending Deletion 0
Block Deletion Start Time 9/27/2016, 5:15:33 PM

总结

我在启动的时候总是出现错误,提示权限问题,后来发现我之前的操作是用root用户,然后hadoop-2.7.3的用户组也是root,yang这个用户根本没有权限,那么问题找到了就修改呗,chrown修改为yang,问题解决。当然配置的过程中出现各种问题,都是参照网上的办法和logs解决了。就不一一指出了,如果大家按照这个配置,还是有些问题,那么请多多百度,google吧。

文章题目:CentOS6.7安装Hadoop2.7.3
本文网址:http://www.shufengxianlan.com/qtweb/news46/16496.html

网站建设、网络推广公司-创新互联,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有等

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联