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

第一步:安装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
时间: 2024-10-13 21:20:31

在RHEL 6.5上部署Hadoop 2.6伪分布式模式(单机)的相关文章

hadoop 2.4 伪分布式模式

1.core-site.xml 在<configuration></configuration>中插入 <property> <name>fs.default.name</name> <value>hdfs://localhost:9000</value> </property> <property> <name>dfs.replication</name> <valu

伪分布式模式的Hadoop环境搭建

一.本文说明:     本次测试在一台虚拟机系统上进行伪分布式搭建.Hadoop伪分布式模式是在单机上模拟Hadoop分布式,单机上的分布式并不是真正的伪分布式,而是使 用线程模拟分布式.Hadoop本身是无法区分伪分布式和分布式的,两种配置也很相似.唯一不同的地方是伪分布式是在单机器上配置,数据节点和名字节点均 是一个机器. 二.环境说明:      操作系统:Cent Os 6.7      hadoop版本:hadoop-2.7.2      JDK版本:jdk1.8_77     备注:

Hadoop学习笔记_4_实施Hadoop集群 --伪分布式安装

实施Hadoop集群 --伪分布式安装 准备与配置安装环境 安装虚拟机和linux,虚拟机推荐使用vmware,PC可以使用workstation,服务器可以使用ESXi,在管理上比较方便.ESXi还可以通过拷贝镜像文件复制虚拟机,复制后自动修改网卡号和ip,非常快捷.如果只是实验用途,硬盘大约预留20-30G空间. 以Centos为例,分区可以选择默认[如果想要手动分区,请参考博客:http://blog.csdn.net/zjf280441589/article/details/175485

[Nutch]Hadoop多机完全分布式模式主机配置

在上一篇博文中我们有介绍hadoop的单机伪分布式模式的使用,那么现在我们就来看下多机完全分布式模式. 1. 多主机配置 1.1 对多台机器进行主机名设置 用root账户使用如下命令: vim /etc/hostname 分别对三台机器设置为:host1.host2.host3 1.2 配置主机映射 用root账户使用如下命令: vim /etc/hosts 分别配置三台机器: host1: host2: host3: 2. 配置ssh 2.1 产生密钥 使用如下命令: ssh-keygen -

Hadoop 2.x伪分布式环境搭建测试

Hadoop 2.x伪分布式环境搭建测试 标签(空格分隔): hadoop hadoop,spark,kafka交流群:459898801 1,搭建hadoop所需环境 卸载open JDK rpm -qa |grep java rpm -e –nodeps [java] 1.1,在/opt/目录下创建四个目录: modules/ software/ datas/ tools/ 解压hadoop-2.5.0及jdk-7u67-linux-x64.tar.gz至modules目录下. $tar -

虚拟器上部署hadoop常见的一些问题

一.hadoop部署步骤. 1.下载hadoop和Zookeeper的压缩包. 2.部署Zookeeper: ①tar -zxvf zookeeper-3.3.6 ②cd 到Zookeeper的conf目录下 将zoo_sample.cfg 修改为zoo.cfg ③ tickTime=2000(是Zookeeper独立的工作时间单元) dataDir=/Users/tom/zookeeper(存储数据的地址) clientPort=2181(2181是经常的选择,此处是关于用户和Zookeepe

在Ubutun 14.04 Desktop LTS上部署Hadoop 2.7.1(伪分布式)

1.安装Ubutun 14.04 Desktop LTS 下载ISO文件,ubuntu-14.04.1-desktop-amd64.iso. 在Virtualbox或者VmWare中新建虚拟机,将ISO文件设置为启动光盘. 一路下一步,在需要输入用户的地方,输入用户名hduser,直到系统安装完成. 重启虚拟机,使用hduser登录系统.设置root的密码,输入sudo passwd命令: [email protected]:~$ sudo passwd [sudo] password for

hadoop(1.2) 伪分布式部署

1. 部署环境 系统:  CentOS 6.3 JDK和hadoop的下载直接参考分布式安装... 2. 伪分布式环境 不需要配置/etc/hosts 本机也需要免密码ssh登录 ssh localhost 3. 配置修改 1. conf/core-site.xml <configuration> <property> <name>fs.default.name</name> <value>hdfs://localhost:9000</va

[Nutch]Hadoop单机伪分布式模式的使用(deploy)

在上一篇博文我们对Nutch进行了hadoop的配置,那么本文就对nutch的deploy模式的使用进行说明. 1. 配置抓取链接 先进入nutch的deply目录: cd nutch/runtime/deploy 和在local模式一样 ,我们先建立一个urls目录,并将抓取链接放入url.txt文件里面: mkdir urls echo http://www.cnbeta.com > urls/url.txt 将链接文件放入hadoop的分布式文件系统上: hadoop fs -put ur