码迷,mamicode.com
首页 > 其他好文 > 详细

在RHEL 6.5上部署Hadoop 2.6伪分布式模式(单机)

时间:2015-07-12 23:01:42      阅读:329      评论:0      收藏:0      [点我收藏+]

标签:

第一步:安装JAVA 1.7

              此步骤略过,太简单了,可参考这个: http://blog.sina.com.cn/s/blog_6a7cdcd40101b1j6.html

 

第二步:创建Haddop专用用户

            虽然使用root用户也可以部署hadoop,但从系统安全及规范的角度考虑,还是建议大家创建专用的用户(本例中为hadoop,实际中可以是任意用户名),创建用户的命令:

# useradd hadoop
# passwd hadoop

           创建完用户hadoop后,还要使得hadoop用户可以无密码方式登陆服务器,执行下列命令:

# su - hadoop
$ ssh-keygen -t rsa
$ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
$ chmod 0600 ~/.ssh/authorized_keys

           测试用户hadoop是否可以实现无密码登录服务器,执行下列命令(第一次登陆时会提示增加RSA到已知主机列表中,输入“yes”):

$ ssh localhost
Last login: Sun Jul 12 16:22:28 2015 from localhost
$

          

第三步:下载Hadoop 2.6

$ cd ~

$ wget http://apache.dataguru.cn/hadoop/common/hadoop-2.6.0/hadoop-2.6.0.tar.gz
--2015-07-12 16:57:17--  http://apache.dataguru.cn/hadoop/common/hadoop-2.6.0/hadoop-2.6.0.tar.gz
Resolving apache.dataguru.cn...
112.81.51.52
Connecting to apache.dataguru.cn|112.81.51.52|:80

$ tar xzf hadoop-2.6.0.tar.gz

 

第四步: 配置Hadoop为伪分布式模式

4.1 配置环境变量

首先配置用户hadoop会使用到的环境变量。编辑~/.bashrc文件,添加下面内容:

export HADOOP_HOME=/home/hadoop/hadoop-2.6.0
export HADOOP_INSTALL=$HADOOP_HOME
export HADOOP_MAPRED_HOME=$HADOOP_HOME
export HADOOP_COMMON_HOME=$HADOOP_HOME
export HADOOP_HDFS_HOME=$HADOOP_HOME
export YARN_HOME=$HADOOP_HOME
export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native
export PATH=$PATH:$HADOOP_HOME/sbin:$HADOOP_HOME/bin

 

环境变量生效:

source ~/.bashrc

 

编辑文件/home/hadoop/hadoop-2.6.0/etc/hadoop/hadoop-env.sh,设置变量JAVA_HOME,添加如下内容(请根据你的实际JAVA安装目录配置):

JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.45.x86_64

 

4.2 修改Hadoop配置文件

首先进入配置文件目录:

$ cd $HADOOP_HOME/etc/hadoop

 

编辑core-site.xml,添加如下内容:

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

 

编辑hdfs-site.xml,添加如下内容:

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

<property>
  <name>dfs.name.dir</name>
    <value>file:///home/hadoop/hadoopdata/hdfs/namenode</value>
</property>

<property>
  <name>dfs.data.dir</name>
    <value>file:///home/hadoop/hadoopdata/hdfs/datanode</value>
</property>
</configuration>

 

编辑mapred-site.xml ,添加如下内容:

<configuration>
 <property>
  <name>mapreduce.framework.name</name>
   <value>yarn</value>
 </property>
</configuration>

 

编辑yarn-site.xml ,添加如下内容:

<configuration>
 <property>
  <name>yarn.nodemanager.aux-services</name>
    <value>mapreduce_shuffle</value>
 </property>
</configuration>

 

4.3 格式化namenode

$ hdfs namenode –format

 

命令输出:

15/07/12 17:32:15 INFO namenode.NameNode: STARTUP_MSG:
/************************************************************
STARTUP_MSG: Starting NameNode
STARTUP_MSG:   host = jboss1.cn.ibm.com/9.125.73.217
STARTUP_MSG:   args = [-format]
STARTUP_MSG:   version = 2.6.0
STARTUP_MSG:   classpath = /home/hadoop/hadoop-2.6.0/etc/hadoop:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/jersey-json-1.9.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/mockito-all-1.8.5.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/activation-1.1.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/commons-math3-3.1.1.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/jettison-1.1.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/curator-framework-2.6.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/commons-beanutils-core-1.8.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/commons-cli-1.2.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/jsp-api-2.1.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/commons-el-1.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/paranamer-2.3.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/jackson-xc-1.9.13.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/hadoop-annotations-2.6.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/xz-1.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/apacheds-kerberos-codec-2.0.0-M15.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/jackson-core-asl-1.9.13.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/hadoop-auth-2.6.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/stax-api-1.0-2.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/jetty-util-6.1.26.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/guava-11.0.2.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/commons-codec-1.4.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/snappy-java-1.0.4.1.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/avro-1.7.4.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/zookeeper-3.4.6.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/log4j-1.2.17.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/httpcore-4.2.5.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/jasper-runtime-5.5.23.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/commons-io-2.4.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/curator-client-2.6.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/curator-recipes-2.6.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/api-util-1.0.0-M20.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/apacheds-i18n-2.0.0-M15.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/protobuf-java-2.5.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/commons-net-3.1.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/netty-3.6.2.Final.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/htrace-core-3.0.4.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/api-asn1-api-1.0.0-M20.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/jasper-compiler-5.5.23.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/xmlenc-0.52.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/commons-collections-3.2.1.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/jets3t-0.9.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/commons-digester-1.8.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/asm-3.2.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/jackson-mapper-asl-1.9.13.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/httpclient-4.2.5.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/jetty-6.1.26.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/jaxb-impl-2.2.3-1.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/jsr305-1.3.9.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/jackson-jaxrs-1.9.13.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/servlet-api-2.5.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/hamcrest-core-1.3.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/jersey-server-1.9.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/junit-4.11.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/jaxb-api-2.2.2.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/slf4j-api-1.7.5.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/commons-beanutils-1.7.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/gson-2.2.4.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/jersey-core-1.9.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/java-xmlbuilder-0.4.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/commons-configuration-1.6.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/commons-httpclient-3.1.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/commons-compress-1.4.1.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/commons-lang-2.6.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/commons-logging-1.1.3.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/lib/jsch-0.1.42.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/hadoop-nfs-2.6.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/hadoop-common-2.6.0-tests.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/common/hadoop-common-2.6.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/hdfs:/home/hadoop/hadoop-2.6.0/share/hadoop/hdfs/lib/xml-apis-1.3.04.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/hdfs/lib/commons-cli-1.2.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/hdfs/lib/jsp-api-2.1.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/hdfs/lib/commons-el-1.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/hdfs/lib/jackson-core-asl-1.9.13.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/hdfs/lib/jetty-util-6.1.26.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/hdfs/lib/guava-11.0.2.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/hdfs/lib/commons-codec-1.4.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/hdfs/lib/log4j-1.2.17.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/hdfs/lib/commons-daemon-1.0.13.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/hdfs/lib/jasper-runtime-5.5.23.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/hdfs/lib/commons-io-2.4.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/hdfs/lib/protobuf-java-2.5.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/hdfs/lib/netty-3.6.2.Final.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/hdfs/lib/htrace-core-3.0.4.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/hdfs/lib/xmlenc-0.52.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/hdfs/lib/asm-3.2.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/hdfs/lib/jackson-mapper-asl-1.9.13.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/hdfs/lib/xercesImpl-2.9.1.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/hdfs/lib/jetty-6.1.26.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/hdfs/lib/jsr305-1.3.9.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/hdfs/lib/servlet-api-2.5.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/hdfs/lib/jersey-server-1.9.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/hdfs/lib/jersey-core-1.9.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/hdfs/lib/commons-lang-2.6.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/hdfs/lib/commons-logging-1.1.3.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/hdfs/hadoop-hdfs-nfs-2.6.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/hdfs/hadoop-hdfs-2.6.0-tests.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/hdfs/hadoop-hdfs-2.6.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/lib/jersey-json-1.9.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/lib/guice-3.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/lib/activation-1.1.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/lib/jettison-1.1.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/lib/commons-cli-1.2.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/lib/leveldbjni-all-1.8.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/lib/jersey-client-1.9.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/lib/jackson-xc-1.9.13.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/lib/xz-1.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/lib/jackson-core-asl-1.9.13.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/lib/stax-api-1.0-2.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/lib/jetty-util-6.1.26.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/lib/guava-11.0.2.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/lib/commons-codec-1.4.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/lib/guice-servlet-3.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/lib/zookeeper-3.4.6.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/lib/log4j-1.2.17.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/lib/commons-io-2.4.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/lib/protobuf-java-2.5.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/lib/netty-3.6.2.Final.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/lib/aopalliance-1.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/lib/commons-collections-3.2.1.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/lib/javax.inject-1.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/lib/asm-3.2.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/lib/jackson-mapper-asl-1.9.13.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/lib/jetty-6.1.26.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/lib/jaxb-impl-2.2.3-1.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/lib/jersey-guice-1.9.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/lib/jsr305-1.3.9.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/lib/jackson-jaxrs-1.9.13.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/lib/jline-0.9.94.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/lib/servlet-api-2.5.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/lib/jersey-server-1.9.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/lib/jaxb-api-2.2.2.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/lib/jersey-core-1.9.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/lib/commons-httpclient-3.1.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/lib/commons-compress-1.4.1.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/lib/commons-lang-2.6.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/lib/commons-logging-1.1.3.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/hadoop-yarn-client-2.6.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/hadoop-yarn-applications-distributedshell-2.6.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/hadoop-yarn-common-2.6.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/hadoop-yarn-api-2.6.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/hadoop-yarn-applications-unmanaged-am-launcher-2.6.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/hadoop-yarn-server-resourcemanager-2.6.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/hadoop-yarn-server-common-2.6.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/hadoop-yarn-server-nodemanager-2.6.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/hadoop-yarn-registry-2.6.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/hadoop-yarn-server-tests-2.6.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/hadoop-yarn-server-web-proxy-2.6.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/yarn/hadoop-yarn-server-applicationhistoryservice-2.6.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/mapreduce/lib/guice-3.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/mapreduce/lib/leveldbjni-all-1.8.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/mapreduce/lib/paranamer-2.3.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/mapreduce/lib/hadoop-annotations-2.6.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/mapreduce/lib/xz-1.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/mapreduce/lib/jackson-core-asl-1.9.13.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/mapreduce/lib/snappy-java-1.0.4.1.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/mapreduce/lib/avro-1.7.4.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/mapreduce/lib/guice-servlet-3.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/mapreduce/lib/log4j-1.2.17.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/mapreduce/lib/commons-io-2.4.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/mapreduce/lib/protobuf-java-2.5.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/mapreduce/lib/netty-3.6.2.Final.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/mapreduce/lib/aopalliance-1.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/mapreduce/lib/javax.inject-1.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/mapreduce/lib/asm-3.2.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/mapreduce/lib/jackson-mapper-asl-1.9.13.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/mapreduce/lib/jersey-guice-1.9.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/mapreduce/lib/hamcrest-core-1.3.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/mapreduce/lib/jersey-server-1.9.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/mapreduce/lib/junit-4.11.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/mapreduce/lib/jersey-core-1.9.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/mapreduce/lib/commons-compress-1.4.1.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/mapreduce/hadoop-mapreduce-client-core-2.6.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/mapreduce/hadoop-mapreduce-client-jobclient-2.6.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/mapreduce/hadoop-mapreduce-client-hs-plugins-2.6.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/mapreduce/hadoop-mapreduce-client-jobclient-2.6.0-tests.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/mapreduce/hadoop-mapreduce-client-app-2.6.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.6.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/mapreduce/hadoop-mapreduce-client-hs-2.6.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/mapreduce/hadoop-mapreduce-client-common-2.6.0.jar:/home/hadoop/hadoop-2.6.0/share/hadoop/mapreduce/hadoop-mapreduce-client-shuffle-2.6.0.jar:/home/hadoop/hadoop-2.6.0/contrib/capacity-scheduler/*.jar
STARTUP_MSG:   build = https://git-wip-us.apache.org/repos/asf/hadoop.git -r e3496499ecb8d220fba99dc5ed4c99c8f9e33bb1; compiled by ‘jenkins‘ on 2014-11-13T21:10Z
STARTUP_MSG:   java = 1.7.0_45
************************************************************/
15/07/12 17:32:15 INFO namenode.NameNode: registered UNIX signal handlers for [TERM, HUP, INT]
15/07/12 17:32:15 INFO namenode.NameNode: createNameNode [-format]
15/07/12 17:32:15 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Formatting using clusterid: CID-a5e15265-eafd-4c09-9867-d6c3688799db
15/07/12 17:32:16 INFO namenode.FSNamesystem: No KeyProvider found.
15/07/12 17:32:16 INFO namenode.FSNamesystem: fsLock is fair:true
15/07/12 17:32:16 INFO blockmanagement.DatanodeManager: dfs.block.invalidate.limit=1000
15/07/12 17:32:16 INFO blockmanagement.DatanodeManager: dfs.namenode.datanode.registration.ip-hostname-check=true
15/07/12 17:32:16 INFO blockmanagement.BlockManager: dfs.namenode.startup.delay.block.deletion.sec is set to 000:00:00:00.000
15/07/12 17:32:16 INFO blockmanagement.BlockManager: The block deletion will start around 2015 Jul 12 17:32:16
15/07/12 17:32:16 INFO util.GSet: Computing capacity for map BlocksMap
15/07/12 17:32:16 INFO util.GSet: VM type       = 64-bit
15/07/12 17:32:16 INFO util.GSet: 2.0% max memory 889 MB = 17.8 MB
15/07/12 17:32:16 INFO util.GSet: capacity      = 2^21 = 2097152 entries
15/07/12 17:32:16 INFO blockmanagement.BlockManager: dfs.block.access.token.enable=false
15/07/12 17:32:16 INFO blockmanagement.BlockManager: defaultReplication         = 1
15/07/12 17:32:16 INFO blockmanagement.BlockManager: maxReplication             = 512
15/07/12 17:32:16 INFO blockmanagement.BlockManager: minReplication             = 1
15/07/12 17:32:16 INFO blockmanagement.BlockManager: maxReplicationStreams      = 2
15/07/12 17:32:16 INFO blockmanagement.BlockManager: shouldCheckForEnoughRacks  = false
15/07/12 17:32:16 INFO blockmanagement.BlockManager: replicationRecheckInterval = 3000
15/07/12 17:32:16 INFO blockmanagement.BlockManager: encryptDataTransfer        = false
15/07/12 17:32:16 INFO blockmanagement.BlockManager: maxNumBlocksToLog          = 1000
15/07/12 17:32:16 INFO namenode.FSNamesystem: fsOwner             = hadoop (auth:SIMPLE)
15/07/12 17:32:16 INFO namenode.FSNamesystem: supergroup          = supergroup
15/07/12 17:32:16 INFO namenode.FSNamesystem: isPermissionEnabled = true
15/07/12 17:32:16 INFO namenode.FSNamesystem: HA Enabled: false
15/07/12 17:32:16 INFO namenode.FSNamesystem: Append Enabled: true
15/07/12 17:32:16 INFO util.GSet: Computing capacity for map INodeMap
15/07/12 17:32:16 INFO util.GSet: VM type       = 64-bit
15/07/12 17:32:16 INFO util.GSet: 1.0% max memory 889 MB = 8.9 MB
15/07/12 17:32:16 INFO util.GSet: capacity      = 2^20 = 1048576 entries
15/07/12 17:32:16 INFO namenode.NameNode: Caching file names occuring more than 10 times
15/07/12 17:32:16 INFO util.GSet: Computing capacity for map cachedBlocks
15/07/12 17:32:16 INFO util.GSet: VM type       = 64-bit
15/07/12 17:32:16 INFO util.GSet: 0.25% max memory 889 MB = 2.2 MB
15/07/12 17:32:16 INFO util.GSet: capacity      = 2^18 = 262144 entries
15/07/12 17:32:16 INFO namenode.FSNamesystem: dfs.namenode.safemode.threshold-pct = 0.9990000128746033
15/07/12 17:32:16 INFO namenode.FSNamesystem: dfs.namenode.safemode.min.datanodes = 0
15/07/12 17:32:16 INFO namenode.FSNamesystem: dfs.namenode.safemode.extension     = 30000
15/07/12 17:32:16 INFO namenode.FSNamesystem: Retry cache on namenode is enabled
15/07/12 17:32:16 INFO namenode.FSNamesystem: Retry cache will use 0.03 of total heap and retry cache entry expiry time is 600000 millis
15/07/12 17:32:16 INFO util.GSet: Computing capacity for map NameNodeRetryCache
15/07/12 17:32:16 INFO util.GSet: VM type       = 64-bit
15/07/12 17:32:16 INFO util.GSet: 0.029999999329447746% max memory 889 MB = 273.1 KB
15/07/12 17:32:16 INFO util.GSet: capacity      = 2^15 = 32768 entries
15/07/12 17:32:16 INFO namenode.NNConf: ACLs enabled? false
15/07/12 17:32:16 INFO namenode.NNConf: XAttrs enabled? true
15/07/12 17:32:16 INFO namenode.NNConf: Maximum size of an xattr: 16384

 

第五步: 启动Hadoop集群

$ cd $HADOOP_HOME/sbin/
$ start-dfs.sh

输出:

15/07/12 17:38:26 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Starting namenodes on [localhost]
localhost: starting namenode, logging to /home/hadoop/hadoop-2.6.0/logs/hadoop-hadoop-namenode-jboss1.out
localhost: starting datanode, logging to /home/hadoop/hadoop-2.6.0/logs/hadoop-hadoop-datanode-jboss1.out
Starting secondary namenodes [0.0.0.0]
0.0.0.0: starting secondarynamenode, logging to /home/hadoop/hadoop-2.6.0/logs/hadoop-hadoop-secondarynamenode-jboss1.out
15/07/12 17:38:44 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable

 

运行start-yarn.sh脚本:

$ start-yarn.sh

输出:

starting yarn daemons
starting resourcemanager, logging to /home/hadoop/hadoop-2.6.0/logs/yarn-hadoop-resourcemanager-jboss1.out
localhost: starting nodemanager, logging to /home/hadoop/hadoop-2.6.0/logs/yarn-hadoop-nodemanager-jboss1.out

 

第六步: 通过浏览器访问Hadoop服务

缺省配置下,Hadoop Namenode在50070端口启动,所以在浏览器地址栏中输入:

http://9.125.73.217:50070

技术分享

 

接下来访问8088端口查看集群及应用信息:

http://9.125.73.217:8088/
技术分享

 

访问50090端口,查看Secondary namenode信息:

http://9.125.73.217:50090

技术分享

 

访问50075端口,查看Datanode信息:

http://9.125.73.217:50075/

技术分享

 

第七步:测试单节点Hadoop

7.1 创建HDFS目录

$ bin/hdfs dfs -mkdir /user
$ bin/hdfs dfs -mkdir /user/hadoop

7.2 拷贝本地文件(/var/log/Xorg.0.log)到HDFS

$ hdfs dfs -put /var/log/Xorg.0.log  logs

7.3 查看HDFS上拷贝自本地的logs文件

http://9.125.73.217:50070/explorer.html#/user/hadoop
技术分享

7.4 从HDFS文件系统拷贝文件到本地文件系统

$  hdfs dfs -get Xorg.0.log /tmp/xorg.ll

在RHEL 6.5上部署Hadoop 2.6伪分布式模式(单机)

标签:

原文地址:http://www.cnblogs.com/fm365/p/4641572.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!