CentOS安装Hadoop

前端之家收集整理的这篇文章主要介绍了CentOS安装Hadoop前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

本文记录一下在CentOS 6.7上,安装Hadoop-2.7.3版本的过程。

安装Hadoop主要包含如下几个部分:

  1. 安装JDK
  2. 安装Hadoop
  3. 配置Hadoop
  4. 启动Hadoop
  5. 验证Hadoop

安装JDK

安装JDK可以参考如下博文,这里就不再重复描述。

CentOS上安裝JDK (rpm的方式)

安装Hadoop

  • 创建hadoop账户
[root@dev03 srv]# useradd hadoop
[root@dev03 srv]# passwd hadoop
Changing password for user hadoop.
New password: 
BAD PASSWORD: it is based on a dictionary word
BAD PASSWORD: is too simple
Retype new password: 
passwd: all authentication tokens updated successfully.
[root@dev03 srv]#

为hadoop用户配置SSHKEY

[root@dev03 srv]# su - hadoop
[hadoop@dev03 ~]$

ssh-keygen -t rsa

cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
chmod 0600 ~/.ssh/authorized_keys

[hadoop@dev03 ~]$ 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:
23:27:78:a5:73:a6:3f:b0:1a:b6:87:00:d4:9e:26:67 hadoop@dev03.gzhl.interconnect
The key's randomart image is:
+--[ RSA 2048]----+
|  .              |
| . .             |
|. . .   .        |
|.. E . o         |
| .= . * S        |
|  .  ..O .       |
|   .o..o         |
|   ..oo..        |
|    oo  ..       |
+-----------------+
[hadoop@dev03 ~]$ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
[hadoop@dev03 ~]$ chmod 0600 ~/.ssh/authorized_keys
[hadoop@dev03 ~]$ exit
logout
[root@dev03 srv]#
  • 下载Hadoop安装包

使用wget 命令下载hadoop-2.7.3.tar.gz, 如:

[root@dev03 srv]# wget http://mirrors.tuna.tsinghua.edu.cn/apache/hadoop/common/hadoop-2.7.3/hadoop-2.7.3.tar.gz
--2017-01-24 13:54:44--  http://mirrors.tuna.tsinghua.edu.cn/apache/hadoop/common/hadoop-2.7.3/hadoop-2.7.3.tar.gz
Resolving mirrors.tuna.tsinghua.edu.cn... 166.111.206.178,2402:f000:1:416:166:111:206:178
Connecting to mirrors.tuna.tsinghua.edu.cn|166.111.206.178|:80... connected.
HTTP request sent,awaiting response... 200 OK
Length: 214092195 (204M) [application/octet-stream]
Saving to: “hadoop-2.7.3.tar.gz”

100%[====================================================================================================================================================================================================================================>] 214,092,195 22.0M/s   in 9.6s    

2017-01-24 13:54:53 (21.2 MB/s) - “hadoop-2.7.3.tar.gz” saved [214092195/214092195]

[root@dev03 srv]#
  • 解压hadoop-2.7.3.tar.gz

使用tar -zvxf hadoop-2.7.3.tar.gz解压,并修改解压后的hadoop目录名。

[root@dev03 srv]# tar -zvxf hadoop-2.7.3.tar.gz 

... ... 

hadoop-2.7.3/share/hadoop/tools/lib/asm-3.2.jar
hadoop-2.7.3/include/
hadoop-2.7.3/include/hdfs.h
hadoop-2.7.3/include/Pipes.hh
hadoop-2.7.3/include/TemplateFactory.hh
hadoop-2.7.3/include/StringUtils.hh
hadoop-2.7.3/include/SerialUtils.hh
hadoop-2.7.3/LICENSE.txt
hadoop-2.7.3/NOTICE.txt
hadoop-2.7.3/README.txt
[root@dev03 srv]# mv hadoop-2.7.3 hadoop
[root@dev03 srv]#

进入hadoop目录,可以看到有如下内容

[root@dev03 srv]# cd hadoop
[root@dev03 hadoop-2.7.3]# ll
total 132
drwxr-xr-x 2 root root  4096 Aug 18 09:49 bin
drwxr-xr-x 3 root root  4096 Aug 18 09:49 etc
drwxr-xr-x 2 root root  4096 Aug 18 09:49 include
drwxr-xr-x 3 root root  4096 Aug 18 09:49 lib
drwxr-xr-x 2 root root  4096 Aug 18 09:49 libexec
-rw-r--r-- 1 root root 84854 Aug 18 09:49 LICENSE.txt
-rw-r--r-- 1 root root 14978 Aug 18 09:49 NOTICE.txt
-rw-r--r-- 1 root root  1366 Aug 18 09:49 README.txt
drwxr-xr-x 2 root root  4096 Aug 18 09:49 sbin
drwxr-xr-x 4 root root  4096 Aug 18 09:49 share
[root@dev03 hadoop-2.7.3]#

配置Hadoop环境变量

解压完hadoop之后,需要配置hadoop相关的环境变量,如HADOOP_HOME。

  • 设置环境变量

使用vim /etc/profile打开环境配置文件,在最后添加如下内容,其中JAVA_HOMEHADOOP_HOME的路径由对应的安装目录决定。

export JAVA_HOME=/usr/java/jdk1.7.0_71
export PATH=PATH=$PATH:$JAVA_HOME/bin

export HADOOP_HOME=/srv/hadoop
export HADOOP_INSTALL=$HADOOP_HOME
export HADOOP_MAPRED_HOME=$HADOOP_HOME
export HADOOP_COMMON_HOME=$HADOOP_HOME
export HADOOP_HDFS_HOME=$HADOOP_HOME
export HADOOP_YARN_HOME=$HADOOP_HOME
export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native
export PATH=$PATH:$HADOOP_HOME/sbin:$HADOOP_HOME/bin

使用source /etc/profile命令,使新添加的环境变量生效。

[root@dev03 srv]# vim /etc/profile
[root@dev03 srv]# source /etc/profile
[root@dev03 srv]#

配置好相关的环境变量后,进入到<HADOOP_HOME>/etc/hadoop目录下,修改相关配置文件的信息。<HADOOP_HOME>/etc/hadoop目录下的配置文件如下:

[root@dev03 hadoop]# cd etc/hadoop/
[root@dev03 hadoop]# ll
total 152
-rw-r--r-- 1 root root  4436 Aug 18 09:49 capacity-scheduler.xml
-rw-r--r-- 1 root root  1335 Aug 18 09:49 configuration.xsl
-rw-r--r-- 1 root root   318 Aug 18 09:49 container-executor.cfg
-rw-r--r-- 1 root root   774 Aug 18 09:49 core-site.xml
-rw-r--r-- 1 root root  3589 Aug 18 09:49 hadoop-env.cmd
-rw-r--r-- 1 root root  4224 Aug 18 09:49 hadoop-env.sh
-rw-r--r-- 1 root root  2598 Aug 18 09:49 hadoop-metrics2.properties
-rw-r--r-- 1 root root  2490 Aug 18 09:49 hadoop-metrics.properties
-rw-r--r-- 1 root root  9683 Aug 18 09:49 hadoop-policy.xml
-rw-r--r-- 1 root root   775 Aug 18 09:49 hdfs-site.xml
-rw-r--r-- 1 root root  1449 Aug 18 09:49 httpfs-env.sh
-rw-r--r-- 1 root root  1657 Aug 18 09:49 httpfs-log4j.properties
-rw-r--r-- 1 root root    21 Aug 18 09:49 httpfs-signature.secret
-rw-r--r-- 1 root root   620 Aug 18 09:49 httpfs-site.xml
-rw-r--r-- 1 root root  3518 Aug 18 09:49 kms-acls.xml
-rw-r--r-- 1 root root  1527 Aug 18 09:49 kms-env.sh
-rw-r--r-- 1 root root  1631 Aug 18 09:49 kms-log4j.properties
-rw-r--r-- 1 root root  5511 Aug 18 09:49 kms-site.xml
-rw-r--r-- 1 root root 11237 Aug 18 09:49 log4j.properties
-rw-r--r-- 1 root root   931 Aug 18 09:49 mapred-env.cmd
-rw-r--r-- 1 root root  1383 Aug 18 09:49 mapred-env.sh
-rw-r--r-- 1 root root  4113 Aug 18 09:49 mapred-queues.xml.template
-rw-r--r-- 1 root root   758 Aug 18 09:49 mapred-site.xml.template
-rw-r--r-- 1 root root    10 Aug 18 09:49 slaves
-rw-r--r-- 1 root root  2316 Aug 18 09:49 ssl-client.xml.example
-rw-r--r-- 1 root root  2268 Aug 18 09:49 ssl-server.xml.example
-rw-r--r-- 1 root root  2191 Aug 18 09:49 yarn-env.cmd
-rw-r--r-- 1 root root  4567 Aug 18 09:49 yarn-env.sh
-rw-r--r-- 1 root root   690 Aug 18 09:49 yarn-site.xml
[root@dev03 hadoop]#
<configuration>
<property>
  <name>fs.default.name</name>
    <value>hdfs://localhost:9000</value>
</property>
</configuration>

如:

修改hdfs-site.xml内容之前,先创建namenode和datanode的文件夹,如

<HADOOP_HOME>/hadoopdata/hdfs/namenode

<HADOOP_HOME>/hadoopdata/hdfs/datanode

[root@dev03 hadoop]# mkdir hadoopdata
[root@dev03 hadoop]# cd hadoopdata/
[root@dev03 hadoopdata]# mkdir hdfs
[root@dev03 hadoopdata]# cd hdfs
[root@dev03 hdfs]# mkdir namenode
[root@dev03 hdfs]# mkdir datanode
[root@dev03 hdfs]# ll
total 8
drwxr-xr-x 2 root root 4096 Jan 24 14:42 datanode
drwxr-xr-x 2 root root 4096 Jan 24 14:42 namenode
[root@dev03 hdfs]#

修改hdfs-site.xml, 如:

<!-- Put site-specific property overrides in this file. -->

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

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

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

<!-- Site specific YARN configuration properties -->
<property>
  <name>yarn.nodemanager.aux-services</name>
    <value>mapreduce_shuffle</value>
 </property>
</configuration>

修改hadoop-env.sh中的JAVA_HOME, 与安装的路径匹配,如:

#export JAVA_HOME=${JAVA_HOME}
export JAVA_HOME=/usr/java/jdk1.7.0_71
  • 格式化namenode

可以使用hdfs namenode -format命令格式化namenode。

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

启动hadoop

配置好hadoop的环境变量和文件之后,就可以启动hadoop。

使用start-dfs.shstart-yarn.sh命令启动。

  • start-dfs.sh
[root@dev03 sbin]# start-dfs.sh
17/01/24 15:20:40 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Starting namenodes on [localhost]
root@localhost's password: 
localhost: starting namenode,logging to /srv/hadoop/logs/hadoop-root-namenode-dev03.gzhl.interconnect.out
root@localhost's password: 
localhost: starting datanode,logging to /srv/hadoop/logs/hadoop-root-datanode-dev03.gzhl.interconnect.out
Starting secondary namenodes [0.0.0.0]
root@0.0.0.0's password: 
0.0.0.0: starting secondarynamenode,logging to /srv/hadoop/logs/hadoop-root-secondarynamenode-dev03.gzhl.interconnect.out
17/01/24 15:22:34 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
[root@dev03 sbin]#

使用start-dfs.sh命令启动时,需要输入root@localhost的密码。

  • start-yarn.sh
[root@dev03 sbin]# start-yarn.sh
starting yarn daemons
resourcemanager running as process 13318. Stop it first.
root@localhost's password: 
localhost: nodemanager running as process 13588. Stop it first.
[root@dev03 sbin]#

同样,使用start-yarn.sh命令启动时,需要输入root@localhost的密码。

验证Hadoop

启动后,咱们就可以来验证一下hadoop是否已经启动成功。

使用jps来查看所有启动的服务,从下图可以看出NameNode、NodeManager、SecondaryNameNode等都已经启动。

[root@dev03 sbin]# jps
13823 NameNode
13588 NodeManager
21983 Bootstrap
13941 Datanode
13318 ResourceManager
14097 SecondaryNameNode
14349 Jps
[root@dev03 sbin]#

可以通过http://<安装Hadoop的IP>:50070/在浏览器查看Hadoop信息。

可以通过http://<安装Hadoop的IP>:8088/在浏览器查看所有的应用信息。

至此,可以看出Hadoop基本安装成功。

原文链接:https://www.f2er.com/centos/378916.html

猜你在找的CentOS相关文章