关闭

hadoop 2.6.0单节点-伪分布式模式安装

138人阅读 评论(0) 收藏 举报
分类:
1、系统信息
[root@lsn-linux ~]# cat /etc/issue
CentOS release 6.3 (Final)
Kernel \r on an \m

[root@lsn-linux ~]# uname -a
Linux lsn-linux 2.6.32-279.el6.x86_64 #1 SMP Fri Jun 22 12:19:21 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

[root@lsn hadoop-2.6.0]# hostname
lsn-linux

[root@lsn-linux ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.160.3   lsn-linux


[root@lsn-linux ~]# ll /lib64/libc.so.6 
lrwxrwxrwx. 1 root root 12 Nov 11 22:35 /lib64/libc.so.6 -> libc-2.12.so


2、准备工作

2.1、安装jdk7.0
[root@lsn hadoop-2.6.0]# yum remove java
[root@lsn ~]# rpm -ivh jdk-7u21-linux-x64.rpm 
Preparing...                                                            ########################################### [100%]
   1:jdk                                                                ########################################### [100%]
Unpacking JAR files...
        rt.jar...
        jsse.jar...
        charsets.jar...
        tools.jar...
        localedata.jar...

[root@lsn ~]# java -version
java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)

2.2、/etc/profile配置,增加:

export JAVA_HOME=/usr/java/jdk1.7.0_21
export HADOOP_PREFIX=/hadoop/hadoop-2.6.0
export CLASSPATH=".:$JAVA_HOME/lib:$CLASSPATH"
export PATH="$JAVA_HOME/bin:$PATH:$HADOOP_PREFIX/bin:$PATH"
export HADOOP_PREFIX PATH CLASSPATH


2.3、ssh免密码登陆设置(在root目录完成)
ssh-keygen -t rsa -P ""然后一直回车即可
cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys

2.4、
tar zxf hadoop-2.6.0.tar.gz
文件位置
/hadoop/hadoop-2.6.0


3、配置
/hadoop/hadoop-2.6.0/etc/hadoop

3.1、vi hadoop-env.sh
增加
export JAVA_HOME=/usr/java/jdk1.7.0_21

3.2、vi core-site.xml
  1. <configuration>

  2. <property>
  3. <name>hadoop.tmp.dir</name>
  4. <value>/hadoop/tmp</value>
  5. </property>

  6. <property>
  7. <name>fs.default.name</name>
  8. <value>hdfs://lsn-linux:9000</value>
  9. </property>

  10. </configuration>
复制代码





3.3、vi mapred-site.xml
  1. <configuration>

  2. <property>
  3. <name>mapred.job.tracker</name>
  4. <value>lsn-linux:9001</value>
  5. </property>

  6. </configuration>
复制代码




3.4、vi yarn-site.xml 
  1. <property>
  2. <name>mapreduce.framework.name</name>
  3. <value>yarn</value>
  4. </property>

  5. <property>
  6. <name>yarn.nodemanager.aux-services</name>
  7. <value>mapreduce_shuffle</value>
  8. </property>
复制代码






3.5、 vi hdfs-site.xml
  1. <property>
  2. <name>dfs.replication</name>
  3. <value>1</value>
  4. </property>

  5. <property>
  6. <name>dfs.namenode.name.dir</name>
  7. <value>/hadoop/hadoop-2.6.0/dfs/name</value>
  8. </property>

  9. <property>
  10. <name>dfs.datannode.data.dir</name>
  11. <value>/hadoop/hadoop-2.6.0/dfs/data</value>
  12. </property>
复制代码




4、启动
bin/hadoop namenode -format
sbin/start-all.sh 

5、查看
jps、bin/hadoop dfsadmin -report
  1. [root@lsn hadoop-2.6.0]# jps
  2. 6215 Jps
  3. 6037 ResourceManager
  4. 5623 NameNode
  5. 5743 DataNode
  6. 5898 SecondaryNameNode
  7. 6132 NodeManager
复制代码




  1. [root@lsn hadoop-2.6.0]# bin/hadoop dfsadmin -report
复制代码



DEPRECATED: Use of this script to execute hdfs command is deprecated.
Instead use the hdfs command for it.

14/12/04 19:40:23 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Configured Capacity: 29025366016 (27.03 GB)
Present Capacity: 24784756736 (23.08 GB)
DFS Remaining: 24784707584 (23.08 GB)
DFS Used: 49152 (48 KB)
DFS Used%: 0.00%
Under replicated blocks: 0
Blocks with corrupt replicas: 0
Missing blocks: 0

-------------------------------------------------
Live datanodes (1):

Name: 182.168.8.131:50010 (localhost)
Hostname: localhost
Decommission Status : Normal
Configured Capacity: 29025366016 (27.03 GB)
DFS Used: 49152 (48 KB)
Non DFS Used: 4240609280 (3.95 GB)
DFS Remaining: 24784707584 (23.08 GB)
DFS Used%: 0.00%
DFS Remaining%: 85.39%
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: Thu Dec 04 19:40:21 CST 2014


问题:

[root@lsn-linux hadoop-2.6.0]# hadoop fs -ls /
14/12/09 19:43:06 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
[root@lsn-linux hadoop-2.6.0]# 

原因是hadoop-2.6.0.tar.gz安装包是在32位机器上编译的,64位的机器加载本地库.so文件时出错,不影响使用。
解决:
1、重新编译源码后将新的lib/native替换到集群中原来的lib/native
2、修改hadoop-env.sh ,增加

export HADOOP_OPTS="-Djava.library.path=$HADOOP_PREFIX/lib:$HADOOP_PREFIX/lib/native"



0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:57691次
    • 积分:1244
    • 等级:
    • 排名:千里之外
    • 原创:63篇
    • 转载:37篇
    • 译文:0篇
    • 评论:4条
    最新评论