hadoop2.6安装

创建hadoop用户:

[root@localhost  ~]# groupadd hadoop

[root@localhost  ~]# useradd hadoop -g hadoop

设置密码:

[root@localhost  ~]# passwd hadoop

修改主机名称:vi /etc/sysconfig/network

hostname检查主机名称

ssh无密码登陆:

AB两机要实现ssh无密码登陆要使用公钥私钥,在A机生成公钥/私钥对,复制公钥到B机,把B机公钥内容复制到authorized_keys文件中,authorized_keys文件权限为600。

[hadoop@localhost  ~]$ ssh-keygen -t rsa

Generating public/private rsa key pair.

Enter file in which to save the key (/home/hadoop/.ssh/id_rsa): 

Created directory '/home/hadoop/.ssh'.

Enter passphrase (empty for no passphrase): 

Enter same passphrase again: 

Your identification has been saved in /home/hadoop/.ssh/id_rsa.

Your public key has been saved in /home/hadoop/.ssh/id_rsa.pub.

The key fingerprint is:

63:d0:08:56:f0:61:c2:48:60:28:3b:11:69:3d:76:3c [email protected]

The key's randomart image is:

+--[ RSA 2048]----+

|+*oo*o+          |

|*..=.E +         |

|oo. o = .        |

|o      .         |

| .      S        |

|       . .       |

|                 |

|                 |

|                 |

+-----------------+

[hadoop@localhost ~]$ cd .ssh/

[hadoop@localhost .ssh]$ ls -al

total 16

drwx------. 2 hadoop hadoop 4096 Feb  9 05:52 .

drwx------. 5 hadoop hadoop 4096 Feb  9 05:52 ..

-rw-------. 1 hadoop hadoop 1675 Feb  9 05:52 id_rsa

-rw-r--r--. 1 hadoop hadoop  410 Feb  9 05:52 id_rsa.pub

[hadoop@localhost .ssh]$ cat id_rsa.pub >> authorized_keys

复制公钥私钥到另外两台机器:

[hadoop@master ~]$ scp .ssh hadoop@slave1:/home/hadoop

ssh: Could not resolve hostname slave1: Name or service not known

lost connection

出现这个错误的原因是因为不知道slave1映射的IP地址是什么

vi /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

172.16.161.175  master

172.16.161.156  slave1

172.16.161.154  slave2

记得setup关闭防火墙

复制jdk、hadoop安装包到/home/hadoop/application目录下

[hadoop@slave1 application]$ tar -xvf jdk-7u79-linux-x64.tar 

[hadoop@slave1 application]$ mv jdk1.7.0_79 jdk

[hadoop@slave1 application]$ tar -xvf hadoop-2.6.0-cdh5.4.2.tar 

[hadoop@slave1 application]$ mv hadoop-2.6.0-cdh5.4.2 hadoop

vi /etc/profile  添加如下环境变量

export JAVA_HOME=/home/hadoop/application/jdk

export HADOOP_HOME=/home/hadoop/application/hadoop

export PATH=$PATH:$JAVA_HOME/bin:$HADOOP_HOME/bin:$HADOOP_HOME/sbin

[root@master ~]# source /etc/profile

[hadoop@master ~]$ java -version

[hadoop@master ~]$ hadoop version

单机模式

[hadoop@master sbin]$ ./start-all.sh 

This script is Deprecated. Instead use start-dfs.sh and start-yarn.sh

16/02/09 19:08:43 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable

Incorrect configuration: namenode address dfs.namenode.servicerpc-address or dfs.namenode.rpc-address is not configured.

Starting namenodes on []

The authenticity of host 'localhost (::1)' can't be established.

RSA key fingerprint is cd:16:66:84:06:7c:9f:f5:79:af:a4:1a:59:24:c0:aa.

Are you sure you want to continue connecting (yes/no)? yes

localhost: Warning: Permanently added 'localhost' (RSA) to the list of known hosts.

localhost: Error: JAVA_HOME is not set and could not be found.

localhost: Error: JAVA_HOME is not set and could not be found.

Starting secondary namenodes [0.0.0.0]

The authenticity of host '0.0.0.0 (0.0.0.0)' can't be established.

RSA key fingerprint is cd:16:66:84:06:7c:9f:f5:79:af:a4:1a:59:24:c0:aa.

Are you sure you want to continue connecting (yes/no)? 

0.0.0.0: Warning: Permanently added '0.0.0.0' (RSA) to the list of known hosts.

0.0.0.0: Error: JAVA_HOME is not set and could not be found.

16/02/09 19:11:45 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable

starting yarn daemons

starting resourcemanager, logging to /home/hadoop/application/hadoop/logs/yarn-hadoop-resourcemanager-master.out

localhost: Error: JAVA_HOME is not set and could not be found.

[hadoop@master sbin]$ jps

5247 Jps

4957 ResourceManager

[hadoop@master sbin]$ cd /home/hadoop/application/hadoop/logs

[hadoop@master logs]$ ls -al

total 44

drwxrwxr-x.  2 hadoop hadoop  4096 Feb  9 19:11 .

drwxr-xr-x. 15 hadoop hadoop  4096 Feb  9 19:11 ..

-rw-rw-r--.  1 hadoop hadoop 32403 Feb  9 19:11 yarn-hadoop-resourcemanager-master.log

-rw-rw-r--.  1 hadoop hadoop   701 Feb  9 19:11 yarn-hadoop-resourcemanager-master.out

[hadoop@master logs]$ stop-all.sh 

This script is Deprecated. Instead use stop-dfs.sh and stop-yarn.sh

16/02/09 19:14:08 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable

Incorrect configuration: namenode address dfs.namenode.servicerpc-address or dfs.namenode.rpc-address is not configured.

Stopping namenodes on []

localhost: Error: JAVA_HOME is not set and could not be found.

localhost: Error: JAVA_HOME is not set and could not be found.

Stopping secondary namenodes [0.0.0.0]

0.0.0.0: Error: JAVA_HOME is not set and could not be found.

16/02/09 19:14:13 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable

stopping yarn daemons

stopping resourcemanager

localhost: Error: JAVA_HOME is not set and could not be found.

no proxyserver to stop

etc/hadoop/core-site.xml:

<configuration>

    <property>

        <name>fs.defaultFS</name>

        <value>hdfs://localhost:9000</value>

    </property>

</configuration>

etc/hadoop/hdfs-site.xml:

<configuration>

    <property>

        <name>dfs.replication</name>

        <value>1</value>

    </property>

</configuration>

[hadoop@master ~]$ hdfs namenode -format

16/02/09 20:16:37 INFO namenode.NameNode: STARTUP_MSG: 

/************************************************************

STARTUP_MSG: Starting NameNode

STARTUP_MSG:   host = master/172.16.161.175

STARTUP_MSG:   args = [-format]

STARTUP_MSG:   version = 2.6.0-cdh5.4.2

STARTUP_MSG:   classpath = /home/hadoop/application/hadoop/etc/hadoop:/home/hadoop/application/hadoop/share/hadoop/common/lib/netty-3.6.2.Final.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/protobuf-java-2.5.0.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/api-asn1-api-1.0.0-M20.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/htrace-core-3.0.4.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/jersey-core-1.9.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/paranamer-2.3.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/commons-beanutils-core-1.8.0.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/hadoop-auth-2.6.0-cdh5.4.2.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/mockito-all-1.8.5.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/log4j-1.2.17.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/commons-io-2.4.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/jersey-json-1.9.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/jetty-util-6.1.26.cloudera.4.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/commons-configuration-1.6.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/commons-logging-1.1.3.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/activation-1.1.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/junit-4.11.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/commons-digester-1.8.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/commons-beanutils-1.7.0.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/jaxb-impl-2.2.3-1.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/hadoop-annotations-2.6.0-cdh5.4.2.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/commons-httpclient-3.1.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/curator-recipes-2.7.1.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/guava-11.0.2.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/zookeeper-3.4.5-cdh5.4.2.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/jettison-1.1.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/jsr305-3.0.0.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/jasper-runtime-5.5.23.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/stax-api-1.0-2.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/jackson-core-asl-1.8.8.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/jackson-mapper-asl-1.8.8.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/curator-client-2.7.1.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/commons-net-3.1.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/jaxb-api-2.2.2.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/snappy-java-1.0.4.1.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/gson-2.2.4.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/avro-1.7.6-cdh5.4.2.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/java-xmlbuilder-0.4.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/jsp-api-2.1.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/jsch-0.1.42.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/xmlenc-0.52.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/commons-lang-2.6.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/commons-codec-1.4.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/jetty-6.1.26.cloudera.4.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/logredactor-1.0.2.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/servlet-api-2.5.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/asm-3.2.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/jersey-server-1.9.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/slf4j-api-1.7.5.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/commons-el-1.0.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/commons-cli-1.2.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/hamcrest-core-1.3.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/jets3t-0.9.0.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/apacheds-kerberos-codec-2.0.0-M15.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/commons-compress-1.4.1.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/api-util-1.0.0-M20.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/jackson-xc-1.8.8.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/commons-math3-3.1.1.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/httpclient-4.2.5.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/commons-collections-3.2.1.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/httpcore-4.2.5.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/xz-1.0.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/curator-framework-2.7.1.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/jasper-compiler-5.5.23.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/jackson-jaxrs-1.8.8.jar:/home/hadoop/application/hadoop/share/hadoop/common/lib/apacheds-i18n-2.0.0-M15.jar:/home/hadoop/application/hadoop/share/hadoop/common/hadoop-common-2.6.0-cdh5.4.2-tests.jar:/home/hadoop/application/hadoop/share/hadoop/common/hadoop-common-2.6.0-cdh5.4.2.jar:/home/hadoop/application/hadoop/share/hadoop/common/hadoop-nfs-2.6.0-cdh5.4.2.jar:/home/hadoop/application/hadoop/share/hadoop/hdfs:/home/hadoop/application/hadoop/share/hadoop/hdfs/lib/netty-3.6.2.Final.jar:/home/hadoop/application/hadoop/share/hadoop/hdfs/lib/protobuf-java-2.5.0.jar:/home/hadoop/application/hadoop/share/hadoop/hdfs/lib/htrace-core-3.0.4.jar:/home/hadoop/application/hadoop/share/hadoop/hdfs/lib/jersey-core-1.9.jar:/home/hadoop/application/hadoop/share/hadoop/hdfs/lib/log4j-1.2.17.jar:/home/hadoop/application/hadoop/share/hadoop/hdfs/lib/commons-io-2.4.jar:/home/hadoop/application/hadoop/share/hadoop/hdfs/lib/jetty-util-6.1.26.cloudera.4.jar:/home/hadoop/application/hadoop/share/hadoop/hdfs/lib/commons-daemon-1.0.13.jar:/home/hadoop/application/hadoop/share/hadoop/hdfs/lib/commons-logging-1.1.3.jar:/home/hadoop/application/hadoop/share/hadoop/hdfs/lib/leveldbjni-all-1.8.jar:/home/hadoop/application/hadoop/share/hadoop/hdfs/lib/guava-11.0.2.jar:/home/hadoop/application/hadoop/share/hadoop/hdfs/lib/jsr305-3.0.0.jar:/home/hadoop/application/hadoop/share/hadoop/hdfs/lib/jasper-runtime-5.5.23.jar:/home/hadoop/application/hadoop/share/hadoop/hdfs/lib/jackson-core-asl-1.8.8.jar:/home/hadoop/application/hadoop/share/hadoop/hdfs/lib/jackson-mapper-asl-1.8.8.jar:/home/hadoop/application/hadoop/share/hadoop/hdfs/lib/jsp-api-2.1.jar:/home/hadoop/application/hadoop/share/hadoop/hdfs/lib/xmlenc-0.52.jar:/home/hadoop/application/hadoop/share/hadoop/hdfs/lib/commons-lang-2.6.jar:/home/hadoop/application/hadoop/share/hadoop/hdfs/lib/commons-codec-1.4.jar:/home/hadoop/application/hadoop/share/hadoop/hdfs/lib/jetty-6.1.26.cloudera.4.jar:/home/hadoop/application/hadoop/share/hadoop/hdfs/lib/servlet-api-2.5.jar:/home/hadoop/application/hadoop/share/hadoop/hdfs/lib/asm-3.2.jar:/home/hadoop/application/hadoop/share/hadoop/hdfs/lib/jersey-server-1.9.jar:/home/hadoop/application/hadoop/share/hadoop/hdfs/lib/commons-el-1.0.jar:/home/hadoop/application/hadoop/share/hadoop/hdfs/lib/commons-cli-1.2.jar:/home/hadoop/application/hadoop/share/hadoop/hdfs/hadoop-hdfs-nfs-2.6.0-cdh5.4.2.jar:/home/hadoop/application/hadoop/share/hadoop/hdfs/hadoop-hdfs-2.6.0-cdh5.4.2.jar:/home/hadoop/application/hadoop/share/hadoop/hdfs/hadoop-hdfs-2.6.0-cdh5.4.2-tests.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/lib/protobuf-java-2.5.0.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/lib/jersey-core-1.9.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/lib/log4j-1.2.17.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/lib/commons-io-2.4.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/lib/jersey-json-1.9.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/lib/jetty-util-6.1.26.cloudera.4.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/lib/commons-logging-1.1.3.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/lib/activation-1.1.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/lib/leveldbjni-all-1.8.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/lib/jaxb-impl-2.2.3-1.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/lib/commons-httpclient-3.1.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/lib/jersey-guice-1.9.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/lib/guice-servlet-3.0.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/lib/guava-11.0.2.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/lib/guice-3.0.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/lib/zookeeper-3.4.5-cdh5.4.2.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/lib/jettison-1.1.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/lib/jsr305-3.0.0.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/lib/stax-api-1.0-2.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/lib/jline-2.11.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/lib/jackson-core-asl-1.8.8.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/lib/jackson-mapper-asl-1.8.8.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/lib/jaxb-api-2.2.2.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/lib/commons-lang-2.6.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/lib/commons-codec-1.4.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/lib/jetty-6.1.26.cloudera.4.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/lib/servlet-api-2.5.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/lib/asm-3.2.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/lib/jersey-server-1.9.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/lib/commons-cli-1.2.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/lib/commons-compress-1.4.1.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/lib/jersey-client-1.9.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/lib/jackson-xc-1.8.8.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/lib/javax.inject-1.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/lib/commons-collections-3.2.1.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/lib/xz-1.0.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/lib/jackson-jaxrs-1.8.8.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/lib/aopalliance-1.0.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/hadoop-yarn-applications-distributedshell-2.6.0-cdh5.4.2.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/hadoop-yarn-api-2.6.0-cdh5.4.2.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/hadoop-yarn-applications-unmanaged-am-launcher-2.6.0-cdh5.4.2.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/hadoop-yarn-server-nodemanager-2.6.0-cdh5.4.2.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/hadoop-yarn-server-resourcemanager-2.6.0-cdh5.4.2.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/hadoop-yarn-server-tests-2.6.0-cdh5.4.2.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/hadoop-yarn-registry-2.6.0-cdh5.4.2.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/hadoop-yarn-client-2.6.0-cdh5.4.2.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/hadoop-yarn-server-common-2.6.0-cdh5.4.2.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/hadoop-yarn-server-web-proxy-2.6.0-cdh5.4.2.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/hadoop-yarn-common-2.6.0-cdh5.4.2.jar:/home/hadoop/application/hadoop/share/hadoop/yarn/hadoop-yarn-server-applicationhistoryservice-2.6.0-cdh5.4.2.jar:/home/hadoop/application/hadoop/share/hadoop/mapreduce/lib/netty-3.6.2.Final.jar:/home/hadoop/application/hadoop/share/hadoop/mapreduce/lib/protobuf-java-2.5.0.jar:/home/hadoop/application/hadoop/share/hadoop/mapreduce/lib/jersey-core-1.9.jar:/home/hadoop/application/hadoop/share/hadoop/mapreduce/lib/paranamer-2.3.jar:/home/hadoop/application/hadoop/share/hadoop/mapreduce/lib/log4j-1.2.17.jar:/home/hadoop/application/hadoop/share/hadoop/mapreduce/lib/commons-io-2.4.jar:/home/hadoop/application/hadoop/share/hadoop/mapreduce/lib/junit-4.11.jar:/home/hadoop/application/hadoop/share/hadoop/mapreduce/lib/leveldbjni-all-1.8.jar:/home/hadoop/application/hadoop/share/hadoop/mapreduce/lib/hadoop-annotations-2.6.0-cdh5.4.2.jar:/home/hadoop/application/hadoop/share/hadoop/mapreduce/lib/jersey-guice-1.9.jar:/home/hadoop/application/hadoop/share/hadoop/mapreduce/lib/guice-servlet-3.0.jar:/home/hadoop/application/hadoop/share/hadoop/mapreduce/lib/guice-3.0.jar:/home/hadoop/application/hadoop/share/hadoop/mapreduce/lib/jackson-core-asl-1.8.8.jar:/home/hadoop/application/hadoop/share/hadoop/mapreduce/lib/jackson-mapper-asl-1.8.8.jar:/home/hadoop/application/hadoop/share/hadoop/mapreduce/lib/snappy-java-1.0.4.1.jar:/home/hadoop/application/hadoop/share/hadoop/mapreduce/lib/avro-1.7.6-cdh5.4.2.jar:/home/hadoop/application/hadoop/share/hadoop/mapreduce/lib/asm-3.2.jar:/home/hadoop/application/hadoop/share/hadoop/mapreduce/lib/jersey-server-1.9.jar:/home/hadoop/application/hadoop/share/hadoop/mapreduce/lib/hamcrest-core-1.3.jar:/home/hadoop/application/hadoop/share/hadoop/mapreduce/lib/commons-compress-1.4.1.jar:/home/hadoop/application/hadoop/share/hadoop/mapreduce/lib/javax.inject-1.jar:/home/hadoop/application/hadoop/share/hadoop/mapreduce/lib/xz-1.0.jar:/home/hadoop/application/hadoop/share/hadoop/mapreduce/lib/aopalliance-1.0.jar:/home/hadoop/application/hadoop/share/hadoop/mapreduce/hadoop-mapreduce-client-hs-2.6.0-cdh5.4.2.jar:/home/hadoop/application/hadoop/share/hadoop/mapreduce/hadoop-mapreduce-client-core-2.6.0-cdh5.4.2.jar:/home/hadoop/application/hadoop/share/hadoop/mapreduce/hadoop-mapreduce-client-nativetask-2.6.0-cdh5.4.2.jar:/home/hadoop/application/hadoop/share/hadoop/mapreduce/hadoop-mapreduce-client-common-2.6.0-cdh5.4.2.jar:/home/hadoop/application/hadoop/share/hadoop/mapreduce/hadoop-mapreduce-client-shuffle-2.6.0-cdh5.4.2.jar:/home/hadoop/application/hadoop/share/hadoop/mapreduce/hadoop-mapreduce-client-hs-plugins-2.6.0-cdh5.4.2.jar:/home/hadoop/application/hadoop/share/hadoop/mapreduce/hadoop-mapreduce-client-jobclient-2.6.0-cdh5.4.2-tests.jar:/home/hadoop/application/hadoop/share/hadoop/mapreduce/hadoop-mapreduce-client-jobclient-2.6.0-cdh5.4.2.jar:/home/hadoop/application/hadoop/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.6.0-cdh5.4.2.jar:/home/hadoop/application/hadoop/share/hadoop/mapreduce/hadoop-mapreduce-client-app-2.6.0-cdh5.4.2.jar:/home/hadoop/application/hadoop/contrib/capacity-scheduler/*.jar

STARTUP_MSG:   build = http://github.com/cloudera/hadoop -r 15b703c8725733b7b2813d2325659eb7d57e7a3f; compiled by 'jenkins' on 2015-05-19T23:57Z

STARTUP_MSG:   java = 1.7.0_79

************************************************************/

16/02/09 20:16:37 INFO namenode.NameNode: registered UNIX signal handlers for [TERM, HUP, INT]

16/02/09 20:16:37 INFO namenode.NameNode: createNameNode [-format]

16/02/09 20:16:38 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable

Formatting using clusterid: CID-8f62bb31-9df1-417b-8db1-990dbf943680

16/02/09 20:16:39 INFO namenode.FSNamesystem: No KeyProvider found.

16/02/09 20:16:39 INFO namenode.FSNamesystem: fsLock is fair:true

16/02/09 20:16:39 INFO blockmanagement.DatanodeManager: dfs.block.invalidate.limit=1000

16/02/09 20:16:39 INFO blockmanagement.DatanodeManager: dfs.namenode.datanode.registration.ip-hostname-check=true

16/02/09 20:16:39 INFO blockmanagement.BlockManager: dfs.namenode.startup.delay.block.deletion.sec is set to 000:00:00:00.000

16/02/09 20:16:39 INFO blockmanagement.BlockManager: The block deletion will start around 2016 Feb 09 20:16:39

16/02/09 20:16:39 INFO util.GSet: Computing capacity for map BlocksMap

16/02/09 20:16:39 INFO util.GSet: VM type       = 64-bit

16/02/09 20:16:39 INFO util.GSet: 2.0% max memory 966.7 MB = 19.3 MB

16/02/09 20:16:39 INFO util.GSet: capacity      = 2^21 = 2097152 entries

16/02/09 20:16:39 INFO blockmanagement.BlockManager: dfs.block.access.token.enable=false

16/02/09 20:16:39 INFO blockmanagement.BlockManager: defaultReplication         = 1

16/02/09 20:16:39 INFO blockmanagement.BlockManager: maxReplication             = 512

16/02/09 20:16:39 INFO blockmanagement.BlockManager: minReplication             = 1

16/02/09 20:16:39 INFO blockmanagement.BlockManager: maxReplicationStreams      = 2

16/02/09 20:16:39 INFO blockmanagement.BlockManager: shouldCheckForEnoughRacks  = false

16/02/09 20:16:39 INFO blockmanagement.BlockManager: replicationRecheckInterval = 3000

16/02/09 20:16:39 INFO blockmanagement.BlockManager: encryptDataTransfer        = false

16/02/09 20:16:39 INFO blockmanagement.BlockManager: maxNumBlocksToLog          = 1000

16/02/09 20:16:39 INFO namenode.FSNamesystem: fsOwner             = hadoop (auth:SIMPLE)

16/02/09 20:16:39 INFO namenode.FSNamesystem: supergroup          = supergroup

16/02/09 20:16:39 INFO namenode.FSNamesystem: isPermissionEnabled = true

16/02/09 20:16:39 INFO namenode.FSNamesystem: HA Enabled: false

16/02/09 20:16:39 INFO namenode.FSNamesystem: Append Enabled: true

16/02/09 20:16:39 INFO util.GSet: Computing capacity for map INodeMap

16/02/09 20:16:39 INFO util.GSet: VM type       = 64-bit

16/02/09 20:16:39 INFO util.GSet: 1.0% max memory 966.7 MB = 9.7 MB

16/02/09 20:16:39 INFO util.GSet: capacity      = 2^20 = 1048576 entries

16/02/09 20:16:39 INFO namenode.NameNode: Caching file names occuring more than 10 times

16/02/09 20:16:39 INFO util.GSet: Computing capacity for map cachedBlocks

16/02/09 20:16:39 INFO util.GSet: VM type       = 64-bit

16/02/09 20:16:39 INFO util.GSet: 0.25% max memory 966.7 MB = 2.4 MB

16/02/09 20:16:39 INFO util.GSet: capacity      = 2^18 = 262144 entries

16/02/09 20:16:40 INFO namenode.FSNamesystem: dfs.namenode.safemode.threshold-pct = 0.9990000128746033

16/02/09 20:16:40 INFO namenode.FSNamesystem: dfs.namenode.safemode.min.datanodes = 0

16/02/09 20:16:40 INFO namenode.FSNamesystem: dfs.namenode.safemode.extension     = 30000

16/02/09 20:16:40 INFO metrics.TopMetrics: NNTop conf: dfs.namenode.top.window.num.buckets = 10

16/02/09 20:16:40 INFO metrics.TopMetrics: NNTop conf: dfs.namenode.top.num.users = 10

16/02/09 20:16:40 INFO metrics.TopMetrics: NNTop conf: dfs.namenode.top.windows.minutes = 1,5,25

16/02/09 20:16:40 INFO namenode.FSNamesystem: Retry cache on namenode is enabled

16/02/09 20:16:40 INFO namenode.FSNamesystem: Retry cache will use 0.03 of total heap and retry cache entry expiry time is 600000 millis

16/02/09 20:16:40 INFO util.GSet: Computing capacity for map NameNodeRetryCache

16/02/09 20:16:40 INFO util.GSet: VM type       = 64-bit

16/02/09 20:16:40 INFO util.GSet: 0.029999999329447746% max memory 966.7 MB = 297.0 KB

16/02/09 20:16:40 INFO util.GSet: capacity      = 2^15 = 32768 entries

16/02/09 20:16:40 INFO namenode.NNConf: ACLs enabled? false

16/02/09 20:16:40 INFO namenode.NNConf: XAttrs enabled? true

16/02/09 20:16:40 INFO namenode.NNConf: Maximum size of an xattr: 16384

16/02/09 20:16:40 INFO namenode.FSImage: Allocated new BlockPoolId: BP-500819271-172.16.161.175-1455077800109

16/02/09 20:16:40 INFO common.Storage: Storage directory /tmp/hadoop-hadoop/dfs/name has been successfully formatted.

16/02/09 20:16:40 INFO namenode.NNStorageRetentionManager: Going to retain 1 images with txid >= 0

16/02/09 20:16:40 INFO util.ExitUtil: Exiting with status 0

16/02/09 20:16:40 INFO namenode.NameNode: SHUTDOWN_MSG: 

/************************************************************

SHUTDOWN_MSG: Shutting down NameNode at master/172.16.161.175

[hadoop@master ~]$ start-dfs.sh 

16/02/09 20:20:14 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable

Starting namenodes on [localhost]

localhost: Error: JAVA_HOME is not set and could not be found.

localhost: Error: JAVA_HOME is not set and could not be found.

Starting secondary namenodes [0.0.0.0]

0.0.0.0: Error: JAVA_HOME is not set and could not be found.

16/02/09 20:20:19 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable

修改hadoop-env.sh,将jdk的相对路径改为绝对路径

#export JAVA_HOME=${JAVA_HOME}

export JAVA_HOME=/home/hadoop/application/hadoop/jdk

[hadoop@master hadoop]$ start-dfs.sh 

16/02/09 20:43: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/application/hadoop/logs/hadoop-hadoop-namenode-master.out

localhost: starting datanode, logging to /home/hadoop/application/hadoop/logs/hadoop-hadoop-datanode-master.out

Starting secondary namenodes [0.0.0.0]

0.0.0.0: starting secondarynamenode, logging to /home/hadoop/application/hadoop/logs/hadoop-hadoop-secondarynamenode-master.out

16/02/09 20:43:46 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable

[hadoop@master hadoop]$ jps

9043 SecondaryNameNode

9146 Jps

8774 NameNode

8871 DataNode

The following instructions are to run a MapReduce job locally. If you want to execute a job on YARN, see YARN on Single Node.

  1. Format the filesystem:  $ bin/hdfs namenode -format

  2. Start NameNode daemon and DataNode daemon:  $ sbin/start-dfs.sh
    The hadoop daemon log output is written to the $HADOOP_LOG_DIR directory (defaults to $HADOOP_HOME/logs).

  3. Browse the web interface for the NameNode; by default it is available at:

    • NameNode - http://localhost:50070/

  4. Make the HDFS directories required to execute MapReduce jobs:  $ bin/hdfs dfs -mkdir /user

  5.   $ bin/hdfs dfs -mkdir /user/<username>

  6. Copy the input files into the distributed filesystem:  $ bin/hdfs dfs -put etc/hadoop input

  7. Run some of the examples provided:  $ bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.6.3.jar grep input output 'dfs[a-z.]+'

  8. Examine the output files:Copy the output files from the distributed filesystem to the local filesystem and examine them:  $ bin/hdfs dfs -get output output

  9.   $ cat output/*
    orView the output files on the distributed filesystem:  $ bin/hdfs dfs -cat output/*

  10. When you're done, stop the daemons with:  $ sbin/stop-dfs.sh

YARN on Single Node

You can run a MapReduce job on YARN in a pseudo-distributed mode by setting a few parameters and running ResourceManager daemon and NodeManager daemon in addition.

The following instructions assume that 1. ~ 4. steps of the above instructions are already executed.

  1. Configure parameters as follows:etc/hadoop/mapred-site.xml:<configuration>

  2.     <property>

  3.         <name>mapreduce.framework.name</name>

  4.         <value>yarn</value>

  5.     </property>

  6. </configuration>
    etc/hadoop/yarn-site.xml:<configuration>

  7.     <property>

  8.         <name>yarn.nodemanager.aux-services</name>

  9.         <value>mapreduce_shuffle</value>

  10.     </property>

  11. </configuration>

  12. Start ResourceManager daemon and NodeManager daemon:  $ sbin/start-yarn.sh

  13. Browse the web interface for the ResourceManager; by default it is available at:

    • ResourceManager - http://localhost:8088/

  14. Run a MapReduce job.

  15. When you're done, stop the daemons with:  $ sbin/stop-yarn.sh
    [hadoop@master hadoop]$ vi yarn-env.sh 


  16. # some Java parameters# export JAVA_HOME=/home/y/libexec/jdk1.6.0/export JAVA_HOME=/home/hadoop/application/jdkif [ "$JAVA_HOME" != "" ]; then  #echo "run java in $JAVA_HOME"  JAVA_HOME=$JAVA_HOMEfi[hadoop@master etc]$ scp -r hadoop hadoop@slave2:/home/hadoop/application/hadoop/etc/hadoop[hadoop@master hadoop]$ cat slaves slave1slave2[hadoop@master etc]$ start-dfs.sh 文件系统的基本操作[hadoop@master etc]$ hadoop fs -help















你可能感兴趣的:(hadoop2.6安装)