Hadoop部署方式-伪分布式(Pseudo-Distributed Mode)

               Hadoop部署方式-伪分布式(Pseudo-Distributed Mode)

                                          作者:尹正杰

版权声明:原创作品,谢绝转载!否则将追究法律责任。

 

 

 

一.下载相应的jdk和Hadoop安装包

   JDK:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

  Hadoop:http://hadoop.apache.org/releases.html

  注意,Hadoop官方虽然没有windows版本,但是可用通过“visual studio”编译工具将Linux的运行伪分布式迁移到windows中,建议安装2015版本,网上的教程有很多。遗憾的是,这个工具的使用并不是本篇博客的重点。

 

二.安装Java环境

1>.创建软件解压目录并授权给普通用户

[yinzhengjie@yinzhengjie ~]$ ll
total 390268
-rw-rw-r--. 1 yinzhengjie yinzhengjie 214092195 Aug 26 2016 hadoop-2.7.3.tar.gz
-rw-rw-r--. 1 yinzhengjie yinzhengjie 185540433 May 17 2017 jdk-8u131-linux-x64.tar.gz
[yinzhengjie@yinzhengjie ~]$ sudo mkdir /soft
[sudo] password for yinzhengjie: 
[yinzhengjie@yinzhengjie ~]$ sudo chown yinzhengjie:yinzhengjie /soft/
[yinzhengjie@yinzhengjie ~]$ ll /soft/ -d
drwxr-xr-x. 2 yinzhengjie yinzhengjie 6 May 24 02:30 /soft/
[yinzhengjie@yinzhengjie ~]$ 

2>.解压jdk并配置软连接路径

[yinzhengjie@yinzhengjie ~]$ tar zxf jdk-8u131-linux-x64.tar.gz -C /soft/
[yinzhengjie@yinzhengjie ~]$ cd /soft/
[yinzhengjie@yinzhengjie soft]$ ll
total 4
drwxr-xr-x. 8 yinzhengjie yinzhengjie 4096 Mar 15 2017 jdk1.8.0_131
[yinzhengjie@yinzhengjie soft]$ ln -s jdk1.8.0_131/ jdk
[yinzhengjie@yinzhengjie soft]$ ll
total 4
lrwxrwxrwx. 1 yinzhengjie yinzhengjie 13 May 24 02:33 jdk -> jdk1.8.0_131/
drwxr-xr-x. 8 yinzhengjie yinzhengjie 4096 Mar 15 2017 jdk1.8.0_131
[yinzhengjie@yinzhengjie soft]$ 

3>.设置Java环境变量

[yinzhengjie@yinzhengjie soft]$ sudo vi /etc/profile
[yinzhengjie@yinzhengjie soft]$ tail -3 /etc/profile
#Add by yinzhengjie
JAVA_HOME=/soft/jdk/
PATH=$PATH:$JAVA_HOME/bin
[yinzhengjie@yinzhengjie soft]$ . /etc/profile
[yinzhengjie@yinzhengjie soft]$ 
[yinzhengjie@yinzhengjie soft]$ java -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
[yinzhengjie@yinzhengjie soft]$ 

 

三.安装Hadoop

1>.解压jdk并配置软连接路径

[yinzhengjie@yinzhengjie ~]$ ll
total 390268
-rw-rw-r--. 1 yinzhengjie yinzhengjie 214092195 Aug 26 2016 hadoop-2.7.3.tar.gz
-rw-rw-r--. 1 yinzhengjie yinzhengjie 185540433 May 17 2017 jdk-8u131-linux-x64.tar.gz
[yinzhengjie@yinzhengjie ~]$ tar zxf hadoop-2.7.3.tar.gz -C /soft/
[yinzhengjie@yinzhengjie ~]$ ln -s /soft/hadoop-2.7.3/ /soft/hadoop
[yinzhengjie@yinzhengjie ~]$ ll /soft/
total 8
lrwxrwxrwx. 1 yinzhengjie yinzhengjie 19 May 24 02:40 hadoop -> /soft/hadoop-2.7.3/
drwxr-xr-x. 9 yinzhengjie yinzhengjie 4096 Aug 17 2016 hadoop-2.7.3
lrwxrwxrwx. 1 yinzhengjie yinzhengjie 13 May 24 02:33 jdk -> jdk1.8.0_131/
drwxr-xr-x. 8 yinzhengjie yinzhengjie 4096 Mar 15 2017 jdk1.8.0_131
[yinzhengjie@yinzhengjie ~]$ 

2>.设置Hadoop的环境变量

[yinzhengjie@yinzhengjie ~]$ sudo vi /etc/profile
[sudo] password for yinzhengjie: 
[yinzhengjie@yinzhengjie ~]$ tail -7 /etc/profile
#Add by yinzhengjie
JAVA_HOME=/soft/jdk/
PATH=$PATH:$JAVA_HOME/bin

#Add HADOOP_HOME
HADOOP_HOME=/soft/hadoop/
PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin
[yinzhengjie@yinzhengjie ~]$ 
[yinzhengjie@yinzhengjie ~]$ source /etc/profile
[yinzhengjie@yinzhengjie ~]$ grep JAVA_HOME /soft/hadoop/etc/hadoop/hadoop-env.sh | grep -v ^#
export JAVA_HOME=/soft/jdk/
[yinzhengjie@yinzhengjie ~]$ 

3>.验证是否安装完毕(注意,提交的目录当前用户需要有权限,因为本地部署不需要启动服务,它用的就是Linux操作系统,如果普通用户把文件直接提交到根的话肯定会报异常的哟!)

[yinzhengjie@yinzhengjie ~]$ ll
total 599344
-rw-rw-r--. 1 yinzhengjie yinzhengjie 214092195 Aug 26 2016 hadoop-2.7.3.tar.gz
-rw-rw-r--. 1 yinzhengjie yinzhengjie 185540433 May 17 2017 jdk-8u131-linux-x64.tar.gz
-rw-r--r--. 1 yinzhengjie yinzhengjie 214092195 May 24 03:24 test
[yinzhengjie@yinzhengjie ~]$ rm -rf test 
[yinzhengjie@yinzhengjie ~]$ 
[yinzhengjie@yinzhengjie ~]$ 
[yinzhengjie@yinzhengjie ~]$ ll
total 390268
-rw-rw-r--. 1 yinzhengjie yinzhengjie 214092195 Aug 26 2016 hadoop-2.7.3.tar.gz
-rw-rw-r--. 1 yinzhengjie yinzhengjie 185540433 May 17 2017 jdk-8u131-linux-x64.tar.gz
[yinzhengjie@yinzhengjie ~]$ 
[yinzhengjie@yinzhengjie ~]$ hdfs dfs -put hadoop-2.7.3.tar.gz /home/yinzhengjie/test
[yinzhengjie@yinzhengjie ~]$ tar zxf test 
[yinzhengjie@yinzhengjie ~]$ ll
total 599348
drwxr-xr-x. 9 yinzhengjie yinzhengjie 4096 Aug 17 2016 hadoop-2.7.3
-rw-rw-r--. 1 yinzhengjie yinzhengjie 214092195 Aug 26 2016 hadoop-2.7.3.tar.gz
-rw-rw-r--. 1 yinzhengjie yinzhengjie 185540433 May 17 2017 jdk-8u131-linux-x64.tar.gz
-rw-r--r--. 1 yinzhengjie yinzhengjie 214092195 May 24 03:24 test
[yinzhengjie@yinzhengjie ~]$ 

 

四.部署hadoop伪分布式

1>.配置三种模式并存,将源文件拷贝三份

[yinzhengjie@yinzhengjie ~]$ cd /soft/hadoop/etc/
[yinzhengjie@yinzhengjie etc]$ cp -r hadoop local
[yinzhengjie@yinzhengjie etc]$ cp -r hadoop pseudo
[yinzhengjie@yinzhengjie etc]$ cp -r hadoop full
[yinzhengjie@yinzhengjie etc]$ ll /soft/hadoop/etc/
total 16
drwxr-xr-x. 2 yinzhengjie yinzhengjie 4096 May 25 00:12 full
drwxr-xr-x. 2 yinzhengjie yinzhengjie 4096 May 24 02:47 hadoop
drwxr-xr-x. 2 yinzhengjie yinzhengjie 4096 May 25 00:12 local
drwxr-xr-x. 2 yinzhengjie yinzhengjie 4096 May 25 00:12 pseudo
[yinzhengjie@yinzhengjie etc]$ 

2>.删除hadoop目录并创建连接文件,让其指向hadoop目录

[yinzhengjie@yinzhengjie etc]$ ll /soft/hadoop/etc/
total 16
drwxr-xr-x. 2 yinzhengjie yinzhengjie 4096 May 25 00:12 full
drwxr-xr-x. 2 yinzhengjie yinzhengjie 4096 May 24 02:47 hadoop
drwxr-xr-x. 2 yinzhengjie yinzhengjie 4096 May 25 00:12 local
drwxr-xr-x. 2 yinzhengjie yinzhengjie 4096 May 25 00:12 pseudo
[yinzhengjie@yinzhengjie etc]$ 
[yinzhengjie@yinzhengjie etc]$ 
[yinzhengjie@yinzhengjie etc]$ rm -rf hadoop/
[yinzhengjie@yinzhengjie etc]$ ln -s pseudo/ hadoop
[yinzhengjie@yinzhengjie etc]$ ll
total 12
drwxr-xr-x. 2 yinzhengjie yinzhengjie 4096 May 25 00:12 full
lrwxrwxrwx. 1 yinzhengjie yinzhengjie 7 May 25 00:13 hadoop -> pseudo/
drwxr-xr-x. 2 yinzhengjie yinzhengjie 4096 May 25 00:12 local
drwxr-xr-x. 2 yinzhengjie yinzhengjie 4096 May 25 00:12 pseudo
[yinzhengjie@yinzhengjie etc]$ 

3>.修改Hadoop的配置文件

[yinzhengjie@yinzhengjie etc]$ cd /soft/hadoop/etc/hadoop/
[yinzhengjie@yinzhengjie hadoop]$ 
[yinzhengjie@yinzhengjie hadoop]$ more core-site.xml 
<?xml version="1.0"?>
<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://localhost/</value>
</property>
</configuration>


<!--

core-site.xml: 
用于定义系统级别的参数,如HDFS URL、Hadoop的临时目录以及用
于rack-aware集群中的配置文件的配置等,此中的参数定义会覆
盖core-default.xml文件中的默认配置。

-->
[yinzhengjie@yinzhengjie hadoop]$ more hdfs-site.xml 
<?xml version="1.0"?>
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
</configuration>

<!--
hdfs-site.xml: 
HDFS的相关设定,如文件副本的个数、块大小及是否使用强制权限
等,此中的参数定义会覆盖hdfs-default.xml文件中的默认配置.

-->
[yinzhengjie@yinzhengjie hadoop]$ 
[yinzhengjie@yinzhengjie hadoop]$ more mapred-site.xml
<?xml version="1.0"?>
<configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
</configuration>

<!--
mapred-site.xml:
HDFS的相关设定,如reduce任务的默认个数、任务所能够使用内存
的默认上下限等,此中的参数定义会覆盖mapred-default.xml文件中的默认配置.
-->

[yinzhengjie@yinzhengjie hadoop]$ more yarn-site.xml 
<?xml version="1.0"?>
<configuration>
<property>
<name>yarn.resourcemanager.hostname</name>
<value>localhost</value>
</property>
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
</configuration>

<!--
yarn-site.xml:
主要用于配置调度器级别的参数.

-->
[yinzhengjie@yinzhengjie hadoop]$ 

 

五.配置ssh免密登录

1>.在本地上生成公私秘钥对

[yinzhengjie@yinzhengjie ~]$ ssh-keygen -t rsa -P ‘’ -f ~/.ssh/id_rsa
Generating public/private rsa key pair.
Created directory '/home/yinzhengjie/.ssh'.
Your identification has been saved in /home/yinzhengjie/.ssh/id_rsa.
Your public key has been saved in /home/yinzhengjie/.ssh/id_rsa.pub.
The key fingerprint is:
26:f0:d6:95:d0:67:4d:4f:9c:c2:ae:03:8b:af:cf:76 yinzhengjie@yinzhengjie
The key's randomart image is:
+--[ RSA 2048]----+
| .. .o..o|
| ...oo.+.|
| . oo. . .|
| o . o . |
| + S o . |
| . + . o |
| . . |
| .o E |
| .+o. |
+-----------------+
[yinzhengjie@yinzhengjie ~]$ 

2>.使用ssh-copy-id命令分配公钥(需要输入当前用户密码)

[yinzhengjie@yinzhengjie ~]$ ssh-copy-id yinzhengjie@localhost
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
yinzhengjie@localhost's password: 

Number of key(s) added: 1

Now try logging into the machine, with: "ssh 'yinzhengjie@localhost'"
and check to make sure that only the key(s) you wanted were added.

[yinzhengjie@yinzhengjie ~]$

3>.测试ssh连接

[yinzhengjie@yinzhengjie ~]$ cd /soft/
[yinzhengjie@yinzhengjie soft]$ ssh yinzhengjie@localhost
Last login: Fri May 25 00:50:51 2018 from localhost
[yinzhengjie@yinzhengjie ~]$ who
yinzhengjie pts/0 2018-05-25 00:52 (localhost)
yinzhengjie pts/1 2018-05-25 00:30 (172.30.100.1)
[yinzhengjie@yinzhengjie ~]$ exit
logout
Connection to localhost closed.
[yinzhengjie@yinzhengjie soft]$ who
yinzhengjie pts/1 2018-05-25 00:30 (172.30.100.1)
[yinzhengjie@yinzhengjie soft]$ 

 

六.格式化hdfs文件系统

18/05/25 00:59:58 INFO namenode.NameNode: STARTUP_MSG: 
/************************************************************
STARTUP_MSG: Starting NameNode
STARTUP_MSG: host = yinzhengjie/211.98.71.195
STARTUP_MSG: args = [-format]
STARTUP_MSG: version = 2.7.3
STARTUP_MSG: classpath = /soft/hadoop-2.7.3/etc/hadoop:/soft/hadoop-2.7.3/share/hadoop/common/lib/jaxb-impl-2.2.3-1.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/jaxb-api-2.2.2.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/stax-api-1.0-2.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/activation-1.1.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/jackson-core-asl-1.9.13.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/jackson-mapper-asl-1.9.13.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/jackson-jaxrs-1.9.13.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/jackson-xc-1.9.13.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/jersey-server-1.9.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/asm-3.2.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/log4j-1.2.17.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/jets3t-0.9.0.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/httpclient-4.2.5.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/httpcore-4.2.5.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/java-xmlbuilder-0.4.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/commons-lang-2.6.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/commons-configuration-1.6.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/commons-digester-1.8.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/commons-beanutils-1.7.0.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/commons-beanutils-core-1.8.0.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/slf4j-api-1.7.10.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/avro-1.7.4.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/paranamer-2.3.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/snappy-java-1.0.4.1.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/commons-compress-1.4.1.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/xz-1.0.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/protobuf-java-2.5.0.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/gson-2.2.4.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/hadoop-auth-2.7.3.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/apacheds-kerberos-codec-2.0.0-M15.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/apacheds-i18n-2.0.0-M15.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/api-asn1-api-1.0.0-M20.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/api-util-1.0.0-M20.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/zookeeper-3.4.6.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/netty-3.6.2.Final.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/curator-framework-2.7.1.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/curator-client-2.7.1.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/jsch-0.1.42.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/curator-recipes-2.7.1.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/htrace-core-3.1.0-incubating.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/junit-4.11.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/hamcrest-core-1.3.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/mockito-all-1.8.5.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/hadoop-annotations-2.7.3.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/guava-11.0.2.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/jsr305-3.0.0.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/commons-cli-1.2.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/commons-math3-3.1.1.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/xmlenc-0.52.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/commons-httpclient-3.1.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/commons-logging-1.1.3.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/commons-codec-1.4.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/commons-io-2.4.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/commons-net-3.1.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/commons-collections-3.2.2.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/servlet-api-2.5.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/jetty-6.1.26.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/jetty-util-6.1.26.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/jsp-api-2.1.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/jersey-core-1.9.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/jersey-json-1.9.jar:/soft/hadoop-2.7.3/share/hadoop/common/lib/jettison-1.1.jar:/soft/hadoop-2.7.3/share/hadoop/common/hadoop-common-2.7.3.jar:/soft/hadoop-2.7.3/share/hadoop/common/hadoop-common-2.7.3-tests.jar:/soft/hadoop-2.7.3/share/hadoop/common/hadoop-nfs-2.7.3.jar:/soft/hadoop-2.7.3/share/hadoop/hdfs:/soft/hadoop-2.7.3/share/hadoop/hdfs/lib/commons-codec-1.4.jar:/soft/hadoop-2.7.3/share/hadoop/hdfs/lib/log4j-1.2.17.jar:/soft/hadoop-2.7.3/share/hadoop/hdfs/lib/commons-logging-1.1.3.jar:/soft/hadoop-2.7.3/share/hadoop/hdfs/lib/netty-3.6.2.Final.jar:/soft/hadoop-2.7.3/share/hadoop/hdfs/lib/guava-11.0.2.jar:/soft/hadoop-2.7.3/share/hadoop/hdfs/lib/jsr305-3.0.0.jar:/soft/hadoop-2.7.3/share/hadoop/hdfs/lib/commons-cli-1.2.jar:/soft/hadoop-2.7.3/share/hadoop/hdfs/lib/xmlenc-0.52.jar:/soft/hadoop-2.7.3/share/hadoop/hdfs/lib/commons-io-2.4.jar:/soft/hadoop-2.7.3/share/hadoop/hdfs/lib/servlet-api-2.5.jar:/soft/hadoop-2.7.3/share/hadoop/hdfs/lib/jetty-6.1.26.jar:/soft/hadoop-2.7.3/share/hadoop/hdfs/lib/jetty-util-6.1.26.jar:/soft/hadoop-2.7.3/share/hadoop/hdfs/lib/jersey-core-1.9.jar:/soft/hadoop-2.7.3/share/hadoop/hdfs/lib/jackson-core-asl-1.9.13.jar:/soft/hadoop-2.7.3/share/hadoop/hdfs/lib/jackson-mapper-asl-1.9.13.jar:/soft/hadoop-2.7.3/share/hadoop/hdfs/lib/jersey-server-1.9.jar:/soft/hadoop-2.7.3/share/hadoop/hdfs/lib/asm-3.2.jar:/soft/hadoop-2.7.3/share/hadoop/hdfs/lib/commons-lang-2.6.jar:/soft/hadoop-2.7.3/share/hadoop/hdfs/lib/protobuf-java-2.5.0.jar:/soft/hadoop-2.7.3/share/hadoop/hdfs/lib/htrace-core-3.1.0-incubating.jar:/soft/hadoop-2.7.3/share/hadoop/hdfs/lib/commons-daemon-1.0.13.jar:/soft/hadoop-2.7.3/share/hadoop/hdfs/lib/netty-all-4.0.23.Final.jar:/soft/hadoop-2.7.3/share/hadoop/hdfs/lib/xercesImpl-2.9.1.jar:/soft/hadoop-2.7.3/share/hadoop/hdfs/lib/xml-apis-1.3.04.jar:/soft/hadoop-2.7.3/share/hadoop/hdfs/lib/leveldbjni-all-1.8.jar:/soft/hadoop-2.7.3/share/hadoop/hdfs/hadoop-hdfs-2.7.3.jar:/soft/hadoop-2.7.3/share/hadoop/hdfs/hadoop-hdfs-2.7.3-tests.jar:/soft/hadoop-2.7.3/share/hadoop/hdfs/hadoop-hdfs-nfs-2.7.3.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/lib/zookeeper-3.4.6-tests.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/lib/commons-lang-2.6.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/lib/guava-11.0.2.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/lib/jsr305-3.0.0.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/lib/commons-logging-1.1.3.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/lib/protobuf-java-2.5.0.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/lib/commons-cli-1.2.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/lib/log4j-1.2.17.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/lib/jaxb-api-2.2.2.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/lib/stax-api-1.0-2.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/lib/activation-1.1.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/lib/commons-compress-1.4.1.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/lib/xz-1.0.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/lib/servlet-api-2.5.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/lib/commons-codec-1.4.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/lib/jetty-util-6.1.26.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/lib/jersey-core-1.9.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/lib/jersey-client-1.9.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/lib/jackson-core-asl-1.9.13.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/lib/jackson-mapper-asl-1.9.13.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/lib/jackson-jaxrs-1.9.13.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/lib/jackson-xc-1.9.13.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/lib/guice-servlet-3.0.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/lib/guice-3.0.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/lib/javax.inject-1.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/lib/aopalliance-1.0.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/lib/commons-io-2.4.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/lib/jersey-server-1.9.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/lib/asm-3.2.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/lib/jersey-json-1.9.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/lib/jettison-1.1.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/lib/jaxb-impl-2.2.3-1.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/lib/jersey-guice-1.9.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/lib/zookeeper-3.4.6.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/lib/netty-3.6.2.Final.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/lib/leveldbjni-all-1.8.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/lib/commons-collections-3.2.2.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/lib/jetty-6.1.26.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/hadoop-yarn-api-2.7.3.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/hadoop-yarn-common-2.7.3.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/hadoop-yarn-server-common-2.7.3.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/hadoop-yarn-server-nodemanager-2.7.3.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/hadoop-yarn-server-web-proxy-2.7.3.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/hadoop-yarn-server-applicationhistoryservice-2.7.3.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/hadoop-yarn-server-resourcemanager-2.7.3.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/hadoop-yarn-server-tests-2.7.3.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/hadoop-yarn-client-2.7.3.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/hadoop-yarn-server-sharedcachemanager-2.7.3.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/hadoop-yarn-applications-distributedshell-2.7.3.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/hadoop-yarn-applications-unmanaged-am-launcher-2.7.3.jar:/soft/hadoop-2.7.3/share/hadoop/yarn/hadoop-yarn-registry-2.7.3.jar:/soft/hadoop-2.7.3/share/hadoop/mapreduce/lib/protobuf-java-2.5.0.jar:/soft/hadoop-2.7.3/share/hadoop/mapreduce/lib/avro-1.7.4.jar:/soft/hadoop-2.7.3/share/hadoop/mapreduce/lib/jackson-core-asl-1.9.13.jar:/soft/hadoop-2.7.3/share/hadoop/mapreduce/lib/jackson-mapper-asl-1.9.13.jar:/soft/hadoop-2.7.3/share/hadoop/mapreduce/lib/paranamer-2.3.jar:/soft/hadoop-2.7.3/share/hadoop/mapreduce/lib/snappy-java-1.0.4.1.jar:/soft/hadoop-2.7.3/share/hadoop/mapreduce/lib/commons-compress-1.4.1.jar:/soft/hadoop-2.7.3/share/hadoop/mapreduce/lib/xz-1.0.jar:/soft/hadoop-2.7.3/share/hadoop/mapreduce/lib/hadoop-annotations-2.7.3.jar:/soft/hadoop-2.7.3/share/hadoop/mapreduce/lib/commons-io-2.4.jar:/soft/hadoop-2.7.3/share/hadoop/mapreduce/lib/jersey-core-1.9.jar:/soft/hadoop-2.7.3/share/hadoop/mapreduce/lib/jersey-server-1.9.jar:/soft/hadoop-2.7.3/share/hadoop/mapreduce/lib/asm-3.2.jar:/soft/hadoop-2.7.3/share/hadoop/mapreduce/lib/log4j-1.2.17.jar:/soft/hadoop-2.7.3/share/hadoop/mapreduce/lib/netty-3.6.2.Final.jar:/soft/hadoop-2.7.3/share/hadoop/mapreduce/lib/leveldbjni-all-1.8.jar:/soft/hadoop-2.7.3/share/hadoop/mapreduce/lib/guice-3.0.jar:/soft/hadoop-2.7.3/share/hadoop/mapreduce/lib/javax.inject-1.jar:/soft/hadoop-2.7.3/share/hadoop/mapreduce/lib/aopalliance-1.0.jar:/soft/hadoop-2.7.3/share/hadoop/mapreduce/lib/jersey-guice-1.9.jar:/soft/hadoop-2.7.3/share/hadoop/mapreduce/lib/guice-servlet-3.0.jar:/soft/hadoop-2.7.3/share/hadoop/mapreduce/lib/junit-4.11.jar:/soft/hadoop-2.7.3/share/hadoop/mapreduce/lib/hamcrest-core-1.3.jar:/soft/hadoop-2.7.3/share/hadoop/mapreduce/hadoop-mapreduce-client-core-2.7.3.jar:/soft/hadoop-2.7.3/share/hadoop/mapreduce/hadoop-mapreduce-client-common-2.7.3.jar:/soft/hadoop-2.7.3/share/hadoop/mapreduce/hadoop-mapreduce-client-shuffle-2.7.3.jar:/soft/hadoop-2.7.3/share/hadoop/mapreduce/hadoop-mapreduce-client-app-2.7.3.jar:/soft/hadoop-2.7.3/share/hadoop/mapreduce/hadoop-mapreduce-client-hs-2.7.3.jar:/soft/hadoop-2.7.3/share/hadoop/mapreduce/hadoop-mapreduce-client-jobclient-2.7.3.jar:/soft/hadoop-2.7.3/share/hadoop/mapreduce/hadoop-mapreduce-client-hs-plugins-2.7.3.jar:/soft/hadoop-2.7.3/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.3.jar:/soft/hadoop-2.7.3/share/hadoop/mapreduce/hadoop-mapreduce-client-jobclient-2.7.3-tests.jar:/contrib/capacity-scheduler/*.jar
STARTUP_MSG: build = https://git-wip-us.apache.org/repos/asf/hadoop.git -r baa91f7c6bc9cb92be5982de4719c1c8af91ccff; compiled by 'root' on 2016-08-18T01:41Z
STARTUP_MSG: java = 1.8.0_131
************************************************************/
18/05/25 00:59:58 INFO namenode.NameNode: registered UNIX signal handlers for [TERM, HUP, INT]
18/05/25 00:59:58 INFO namenode.NameNode: createNameNode [-format]
Formatting using clusterid: CID-d8968c48-7cec-4e7f-9876-ac533756fd3f
18/05/25 00:59:59 INFO namenode.FSNamesystem: No KeyProvider found.
18/05/25 00:59:59 INFO namenode.FSNamesystem: fsLock is fair:true
18/05/25 00:59:59 INFO blockmanagement.DatanodeManager: dfs.block.invalidate.limit=1000
18/05/25 00:59:59 INFO blockmanagement.DatanodeManager: dfs.namenode.datanode.registration.ip-hostname-check=true
18/05/25 00:59:59 INFO blockmanagement.BlockManager: dfs.namenode.startup.delay.block.deletion.sec is set to 000:00:00:00.000
18/05/25 00:59:59 INFO blockmanagement.BlockManager: The block deletion will start around 2018 May 25 00:59:59
18/05/25 00:59:59 INFO util.GSet: Computing capacity for map BlocksMap
18/05/25 00:59:59 INFO util.GSet: VM type = 64-bit
18/05/25 00:59:59 INFO util.GSet: 2.0% max memory 889 MB = 17.8 MB
18/05/25 00:59:59 INFO util.GSet: capacity = 2^21 = 2097152 entries
18/05/25 00:59:59 INFO blockmanagement.BlockManager: dfs.block.access.token.enable=false
18/05/25 00:59:59 INFO blockmanagement.BlockManager: defaultReplication = 1
18/05/25 00:59:59 INFO blockmanagement.BlockManager: maxReplication = 512
18/05/25 00:59:59 INFO blockmanagement.BlockManager: minReplication = 1
18/05/25 00:59:59 INFO blockmanagement.BlockManager: maxReplicationStreams = 2
18/05/25 00:59:59 INFO blockmanagement.BlockManager: replicationRecheckInterval = 3000
18/05/25 00:59:59 INFO blockmanagement.BlockManager: encryptDataTransfer = false
18/05/25 00:59:59 INFO blockmanagement.BlockManager: maxNumBlocksToLog = 1000
18/05/25 00:59:59 INFO namenode.FSNamesystem: fsOwner = yinzhengjie (auth:SIMPLE)
18/05/25 00:59:59 INFO namenode.FSNamesystem: supergroup = supergroup
18/05/25 00:59:59 INFO namenode.FSNamesystem: isPermissionEnabled = true
18/05/25 00:59:59 INFO namenode.FSNamesystem: HA Enabled: false
18/05/25 00:59:59 INFO namenode.FSNamesystem: Append Enabled: true
18/05/25 01:00:00 INFO util.GSet: Computing capacity for map INodeMap
18/05/25 01:00:00 INFO util.GSet: VM type = 64-bit
18/05/25 01:00:00 INFO util.GSet: 1.0% max memory 889 MB = 8.9 MB
18/05/25 01:00:00 INFO util.GSet: capacity = 2^20 = 1048576 entries
18/05/25 01:00:00 INFO namenode.FSDirectory: ACLs enabled? false
18/05/25 01:00:00 INFO namenode.FSDirectory: XAttrs enabled? true
18/05/25 01:00:00 INFO namenode.FSDirectory: Maximum size of an xattr: 16384
18/05/25 01:00:00 INFO namenode.NameNode: Caching file names occuring more than 10 times
18/05/25 01:00:00 INFO util.GSet: Computing capacity for map cachedBlocks
18/05/25 01:00:00 INFO util.GSet: VM type = 64-bit
18/05/25 01:00:00 INFO util.GSet: 0.25% max memory 889 MB = 2.2 MB
18/05/25 01:00:00 INFO util.GSet: capacity = 2^18 = 262144 entries
18/05/25 01:00:00 INFO namenode.FSNamesystem: dfs.namenode.safemode.threshold-pct = 0.9990000128746033
18/05/25 01:00:00 INFO namenode.FSNamesystem: dfs.namenode.safemode.min.datanodes = 0
18/05/25 01:00:00 INFO namenode.FSNamesystem: dfs.namenode.safemode.extension = 30000
18/05/25 01:00:00 INFO metrics.TopMetrics: NNTop conf: dfs.namenode.top.window.num.buckets = 10
18/05/25 01:00:00 INFO metrics.TopMetrics: NNTop conf: dfs.namenode.top.num.users = 10
18/05/25 01:00:00 INFO metrics.TopMetrics: NNTop conf: dfs.namenode.top.windows.minutes = 1,5,25
18/05/25 01:00:00 INFO namenode.FSNamesystem: Retry cache on namenode is enabled
18/05/25 01:00:00 INFO namenode.FSNamesystem: Retry cache will use 0.03 of total heap and retry cache entry expiry time is 600000 millis
18/05/25 01:00:00 INFO util.GSet: Computing capacity for map NameNodeRetryCache
18/05/25 01:00:00 INFO util.GSet: VM type = 64-bit
18/05/25 01:00:00 INFO util.GSet: 0.029999999329447746% max memory 889 MB = 273.1 KB
18/05/25 01:00:00 INFO util.GSet: capacity = 2^15 = 32768 entries
18/05/25 01:00:00 INFO namenode.FSImage: Allocated new BlockPoolId: BP-455760353-211.98.71.195-1527235200324
18/05/25 01:00:00 INFO common.Storage: Storage directory /tmp/hadoop-yinzhengjie/dfs/name has been successfully formatted.
18/05/25 01:00:00 INFO namenode.FSImageFormatProtobuf: Saving image file /tmp/hadoop-yinzhengjie/dfs/name/current/fsimage.ckpt_0000000000000000000 using no compression
18/05/25 01:00:00 INFO namenode.FSImageFormatProtobuf: Image file /tmp/hadoop-yinzhengjie/dfs/name/current/fsimage.ckpt_0000000000000000000 of size 357 bytes saved in 0 seconds.
18/05/25 01:00:00 INFO namenode.NNStorageRetentionManager: Going to retain 1 images with txid >= 0
18/05/25 01:00:00 INFO util.ExitUtil: Exiting with status 0
18/05/25 01:00:00 INFO namenode.NameNode: SHUTDOWN_MSG: 
/************************************************************
SHUTDOWN_MSG: Shutting down NameNode at yinzhengjie/211.98.71.195
************************************************************/
[yinzhengjie@yinzhengjie ~]$ echo $?
0
[yinzhengjie@yinzhengjie ~]$ 
[yinzhengjie@yinzhengjie ~]$ hdfs namenode -format

 

七.启动hadoop进程(首次启动需要交互式输入确认信息,输入yes即可!)

[yinzhengjie@yinzhengjie ~]$ start-all.sh 
This script is Deprecated. Instead use start-dfs.sh and start-yarn.sh
Starting namenodes on [localhost]
localhost: starting namenode, logging to /soft/hadoop-2.7.3/logs/hadoop-yinzhengjie-namenode-yinzhengjie.out
localhost: starting datanode, logging to /soft/hadoop-2.7.3/logs/hadoop-yinzhengjie-datanode-yinzhengjie.out
Starting secondary namenodes [0.0.0.0]
The authenticity of host '0.0.0.0 (0.0.0.0)' can't be established.
ECDSA key fingerprint is 0e:97:8d:75:d8:2f:93:54:07:31:45:6a:53:e4:f8:35.
Are you sure you want to continue connecting (yes/no)? yes
0.0.0.0: Warning: Permanently added '0.0.0.0' (ECDSA) to the list of known hosts.
0.0.0.0: starting secondarynamenode, logging to /soft/hadoop-2.7.3/logs/hadoop-yinzhengjie-secondarynamenode-yinzhengjie.out
starting yarn daemons
starting resourcemanager, logging to /soft/hadoop-2.7.3/logs/yarn-yinzhengjie-resourcemanager-yinzhengjie.out
localhost: starting nodemanager, logging to /soft/hadoop-2.7.3/logs/yarn-yinzhengjie-nodemanager-yinzhengjie.out
[yinzhengjie@yinzhengjie ~]$ 
[yinzhengjie@yinzhengjie ~]$ echo $?
0
[yinzhengjie@yinzhengjie ~]$ 

 

八.验证安装是否成功

1>.查看服务端进程是否都正常启动

[yinzhengjie@yinzhengjie ~]$ jps
10561 SecondaryNameNode
10712 ResourceManager
10377 DataNode
10811 NodeManager
10253 NameNode
11102 Jps
[yinzhengjie@yinzhengjie ~]$ 

2>.关闭服务端防火墙

[yinzhengjie@yinzhengjie ~]$ systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2018-05-25 00:06:04 PDT; 58min ago
Main PID: 761 (firewalld)
CGroup: /system.slice/firewalld.service
└─761 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid
[yinzhengjie@yinzhengjie ~]$ systemctl stop firewalld
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to manage system services or units.
Authenticating as: root
Password: 
==== AUTHENTICATION COMPLETE ===
[yinzhengjie@yinzhengjie ~]$ systemctl disable firewalld
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-unit-files ===
Authentication is required to manage system service or unit files.
Authenticating as: root
Password: 
==== AUTHENTICATION COMPLETE ===
[yinzhengjie@yinzhengjie ~]$ systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
[yinzhengjie@yinzhengjie ~]$

3>.客户端检查是否可用正常访问Hadoop的UI界面

 

 

 

posted @ 2018-05-18 23:20  尹正杰  阅读(1908)  评论(0编辑  收藏  举报