博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
CentOS安装Hadoop
阅读量:6576 次
发布时间:2019-06-24

本文共 25230 字,大约阅读时间需要 84 分钟。

hot3.png

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

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

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

安装JDK

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

安装Hadoop

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

为hadoop用户配置SSH KEY。 

[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 rsaGenerating 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.interconnectThe 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 ~]$ exitlogout[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.gzResolving mirrors.tuna.tsinghua.edu.cn... 166.111.206.178, 2402:f000:1:416:166:111:206:178Connecting to mirrors.tuna.tsinghua.edu.cn|166.111.206.178|:80... connected.HTTP request sent, awaiting response... 200 OKLength: 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.jarhadoop-2.7.3/include/hadoop-2.7.3/include/hdfs.hhadoop-2.7.3/include/Pipes.hhhadoop-2.7.3/include/TemplateFactory.hhhadoop-2.7.3/include/StringUtils.hhhadoop-2.7.3/include/SerialUtils.hhhadoop-2.7.3/LICENSE.txthadoop-2.7.3/NOTICE.txthadoop-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]# lltotal 132drwxr-xr-x 2 root root  4096 Aug 18 09:49 bindrwxr-xr-x 3 root root  4096 Aug 18 09:49 etcdrwxr-xr-x 2 root root  4096 Aug 18 09:49 includedrwxr-xr-x 3 root root  4096 Aug 18 09:49 libdrwxr-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.txtdrwxr-xr-x 2 root root  4096 Aug 18 09:49 sbindrwxr-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_71export PATH=PATH=$PATH:$JAVA_HOME/binexport HADOOP_HOME=/srv/hadoopexport HADOOP_INSTALL=$HADOOP_HOMEexport HADOOP_MAPRED_HOME=$HADOOP_HOMEexport HADOOP_COMMON_HOME=$HADOOP_HOMEexport HADOOP_HDFS_HOME=$HADOOP_HOMEexport HADOOP_YARN_HOME=$HADOOP_HOMEexport HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/nativeexport 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]# lltotal 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]#
  • 修改core-site.xml
fs.default.name
hdfs://localhost:9000

如:

143643_gZpX_2911530.png

  • 修改hdfs-site.xml

修改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]# lltotal 8drwxr-xr-x 2 root root 4096 Jan 24 14:42 datanodedrwxr-xr-x 2 root root 4096 Jan 24 14:42 namenode[root@dev03 hdfs]#

修改hdfs-site.xml, 如:

dfs.replication
1
dfs.name.dir
file:///srv/hadoop/hadoopdata/hdfs/namenode
dfs.data.dir
file:///srv/hadoop/hadoopdata/hdfs/datanode

 

144504_5dhZ_2911530.png

  • 修改yarn-site.xml

 

yarn.nodemanager.aux-services
mapreduce_shuffle

 

144734_4121_2911530.png

  • 修改hadoop-env.sh

修改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 -format17/01/24 14:52:03 INFO namenode.NameNode: STARTUP_MSG: /************************************************************STARTUP_MSG: Starting NameNodeSTARTUP_MSG:   host = dev03.gzhl.interconnect/127.0.0.1STARTUP_MSG:   args = [-format]STARTUP_MSG:   version = 2.7.3STARTUP_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/*.jarSTARTUP_MSG:   build = https://git-wip-us.apache.org/repos/asf/hadoop.git -r baa91f7c6bc9cb92be5982de4719c1c8af91ccff; compiled by 'root' on 2016-08-18T01:41ZSTARTUP_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 applicableFormatting using clusterid: CID-7f4c2bda-3f6d-4674-a2ec-ae8bee639a0017/01/24 14:52:05 INFO namenode.FSNamesystem: No KeyProvider found.17/01/24 14:52:05 INFO namenode.FSNamesystem: fsLock is fair:true17/01/24 14:52:05 INFO blockmanagement.DatanodeManager: dfs.block.invalidate.limit=100017/01/24 14:52:05 INFO blockmanagement.DatanodeManager: dfs.namenode.datanode.registration.ip-hostname-check=true17/01/24 14:52:05 INFO blockmanagement.BlockManager: dfs.namenode.startup.delay.block.deletion.sec is set to 000:00:00:00.00017/01/24 14:52:05 INFO blockmanagement.BlockManager: The block deletion will start around 2017 Jan 24 14:52:0517/01/24 14:52:05 INFO util.GSet: Computing capacity for map BlocksMap17/01/24 14:52:05 INFO util.GSet: VM type       = 64-bit17/01/24 14:52:05 INFO util.GSet: 2.0% max memory 889 MB = 17.8 MB17/01/24 14:52:05 INFO util.GSet: capacity      = 2^21 = 2097152 entries17/01/24 14:52:05 INFO blockmanagement.BlockManager: dfs.block.access.token.enable=false17/01/24 14:52:05 INFO blockmanagement.BlockManager: defaultReplication         = 117/01/24 14:52:05 INFO blockmanagement.BlockManager: maxReplication             = 51217/01/24 14:52:05 INFO blockmanagement.BlockManager: minReplication             = 117/01/24 14:52:05 INFO blockmanagement.BlockManager: maxReplicationStreams      = 217/01/24 14:52:05 INFO blockmanagement.BlockManager: replicationRecheckInterval = 300017/01/24 14:52:05 INFO blockmanagement.BlockManager: encryptDataTransfer        = false17/01/24 14:52:05 INFO blockmanagement.BlockManager: maxNumBlocksToLog          = 100017/01/24 14:52:05 INFO namenode.FSNamesystem: fsOwner             = root (auth:SIMPLE)17/01/24 14:52:05 INFO namenode.FSNamesystem: supergroup          = supergroup17/01/24 14:52:05 INFO namenode.FSNamesystem: isPermissionEnabled = true17/01/24 14:52:05 INFO namenode.FSNamesystem: HA Enabled: false17/01/24 14:52:05 INFO namenode.FSNamesystem: Append Enabled: true17/01/24 14:52:06 INFO util.GSet: Computing capacity for map INodeMap17/01/24 14:52:06 INFO util.GSet: VM type       = 64-bit17/01/24 14:52:06 INFO util.GSet: 1.0% max memory 889 MB = 8.9 MB17/01/24 14:52:06 INFO util.GSet: capacity      = 2^20 = 1048576 entries17/01/24 14:52:06 INFO namenode.FSDirectory: ACLs enabled? false17/01/24 14:52:06 INFO namenode.FSDirectory: XAttrs enabled? true17/01/24 14:52:06 INFO namenode.FSDirectory: Maximum size of an xattr: 1638417/01/24 14:52:06 INFO namenode.NameNode: Caching file names occuring more than 10 times17/01/24 14:52:06 INFO util.GSet: Computing capacity for map cachedBlocks17/01/24 14:52:06 INFO util.GSet: VM type       = 64-bit17/01/24 14:52:06 INFO util.GSet: 0.25% max memory 889 MB = 2.2 MB17/01/24 14:52:06 INFO util.GSet: capacity      = 2^18 = 262144 entries17/01/24 14:52:06 INFO namenode.FSNamesystem: dfs.namenode.safemode.threshold-pct = 0.999000012874603317/01/24 14:52:06 INFO namenode.FSNamesystem: dfs.namenode.safemode.min.datanodes = 017/01/24 14:52:06 INFO namenode.FSNamesystem: dfs.namenode.safemode.extension     = 3000017/01/24 14:52:06 INFO metrics.TopMetrics: NNTop conf: dfs.namenode.top.window.num.buckets = 1017/01/24 14:52:06 INFO metrics.TopMetrics: NNTop conf: dfs.namenode.top.num.users = 1017/01/24 14:52:06 INFO metrics.TopMetrics: NNTop conf: dfs.namenode.top.windows.minutes = 1,5,2517/01/24 14:52:06 INFO namenode.FSNamesystem: Retry cache on namenode is enabled17/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 millis17/01/24 14:52:06 INFO util.GSet: Computing capacity for map NameNodeRetryCache17/01/24 14:52:06 INFO util.GSet: VM type       = 64-bit17/01/24 14:52:06 INFO util.GSet: 0.029999999329447746% max memory 889 MB = 273.1 KB17/01/24 14:52:06 INFO util.GSet: capacity      = 2^15 = 32768 entries17/01/24 14:52:06 INFO namenode.FSImage: Allocated new BlockPoolId: BP-253312726-127.0.0.1-148524072661517/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 compression17/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 >= 017/01/24 14:52:07 INFO util.ExitUtil: Exiting with status 017/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.sh17/01/24 15:20:40 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicableStarting namenodes on [localhost]root@localhost's password: localhost: starting namenode, logging to /srv/hadoop/logs/hadoop-root-namenode-dev03.gzhl.interconnect.outroot@localhost's password: localhost: starting datanode, logging to /srv/hadoop/logs/hadoop-root-datanode-dev03.gzhl.interconnect.outStarting 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.out17/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.shstarting yarn daemonsresourcemanager 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]# jps13823 NameNode13588 NodeManager21983 Bootstrap13941 DataNode13318 ResourceManager14097 SecondaryNameNode14349 Jps[root@dev03 sbin]#

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

152704_Cgmm_2911530.png

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

155002_78PN_2911530.png

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

转载于:https://my.oschina.net/wangmengjun/blog/830070

你可能感兴趣的文章
Windows Server 2012 Hyper-V、VMware共存解决方案
查看>>
雷观(八):等我有钱了再付费,是一种很扯淡很没有远见的想法
查看>>
RHEL 5服务篇—部署Samba文件共享服务
查看>>
高中生活--第5篇--学英语的故事(四大难题)
查看>>
华为USG防火墙 NAT配置
查看>>
mysql5.6 使用杂记
查看>>
我的友情链接
查看>>
Centos 设置SSH欢迎语
查看>>
[置顶] jquery日历控件推荐,看看老外们的功底
查看>>
[转]微软新一代认证体系MCSE详解
查看>>
C语言特殊语法
查看>>
Spring Security——session管理
查看>>
网线水晶头线序错导致无法共享打印机
查看>>
【项目管理】git和码云的使用
查看>>
整理了几种常用的排序算法,留着自己看看
查看>>
jQuery中的.bind()、.live()和.delegate()之间区别分析
查看>>
我的友情链接
查看>>
ELK—>logstash—>ruby·plugin—>实现精彩的功能(term模板抽取)
查看>>
关于系统TCP连接的过多问题。
查看>>
我的友情链接
查看>>