Hadoop2.7.1分布式安装配置过程
本篇内容介绍了“Hadoop2.7.1分布式安装配置过程”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!
目前创新互联公司已为近千家的企业提供了网站建设、域名、雅安服务器托管、网站运营、企业网站设计、茶陵网站维护等服务,公司将坚持客户导向、应用为本的策略,正道将秉承"和谐、参与、激情"的文化,与客户和合作伙伴齐心协力一起成长,共同发展。
环境说明
VirtualBox5(三台),CentOS7,Hadoop2.7.1
1、基础安装及配置
先完成Hadoop2.7.1分布式安装-准备篇
注意:Hadoop-2.5.1开始终于不用再编译64位的libhadoop.so.1.0.0了,再早版本的hadoop自带的是32位的,如需64位需要自省编译,具体见Hadoop2.4.1分布式安装。
2、下载并解压hadoop2.7.1压缩包
从apache hadoop官网下载并解压hadoop压缩包到本地目录/home/wukong/local/hadoop-2.7.1/
在打算做namenode的机器上,wget或其他方式下载hadoop的压缩包,并解压到本地指定目录。下载解压命令参考Linux常用命令。
3、需要做的各种配置
共有七个文件,位于/home/wukong/local/hadoop-2.7.1/etc/hadoop,以下分别描述:
hadoop-env.sh
# 必配 # The java implementation to use. export JAVA_HOME=/opt/jdk1.7.0_79 # 选配。考虑是虚拟机,所以少配一点 # The maximum amount of heap to use, in MB. Default is 1000. export HADOOP_HEAPSIZE=500 export HADOOP_NAMENODE_INIT_HEAPSIZE="100"
yarn-env.sh
# some Java parameters export JAVA_HOME=/opt/jdk1.7.0_79 if [ "$JAVA_HOME" != "" ]; then #echo "run java in $JAVA_HOME" JAVA_HOME=$JAVA_HOME fi if [ "$JAVA_HOME" = "" ]; then echo "Error: JAVA_HOME is not set." exit 1 fi JAVA=$JAVA_HOME/bin/java JAVA_HEAP_MAX=-Xmx600m # 默认的heap_max是1000m,我的虚拟机没这么大内存,所以改小了
slaves
#写入你slave的节点。如果是多个就每行一个,写入host名 bd02 bd03
core-site.xml
fs.defaultFS hdfs://bd01:9000 io.file.buffer.size 131072 hadoop.tmp.dir file:/home/wukong/local/hdp-data/tmp Abase for other temporary directories. hadoop.proxyuser.hduser.hosts * hadoop.proxyuser.hduser.groups *
其中hdp-data目录是原来没有的,需要自行创建
hdfs-site.xml
dfs.namenode.secondary.http-address bd01:9001 dfs.namenode.name.dir file:/home/wukong/local/hdp-data/name dfs.datanode.data.dir file:/home/wukong/a_usr/hdp-data/data dfs.replication 3 dfs.webhdfs.enabled true
mapred-site.xml
mapreduce.framework.name yarn mapreduce.jobhistory.address bd01:10020 mapreduce.jobhistory.webapp.address bd01.19888
yarn-site.xml
yarn.nodemanager.aux-services mapreduce_shuffle yarn.nodemanager.aux-services.mapreduce.shuffle.class org.apache.hadoop.mapred.ShuffleHandler yarn.resourcemanager.address bd01:8032 yarn.resourcemanager.scheduler.address bd01:8030 yarn.resourcemanager.resource-tracker.address bd01:8031 yarn.resourcemanager.admin.address bd01:8033 yarn.resourcemanager.webapp.address bd01:8088
4、复制hadoop到所有节点
远程拷贝的方法见Linux常用命令
5、格式化HDFS
[wukong@bd01 hadoop-2.7.1]$ hdfs namenode -format
当执行完毕,没有抛异常,并且看到这一句时,就是成功了
15/07/31 10:51:09 INFO common.Storage: Storage directory /home/wukong/local/hdp-data/name has been successfully formatted.
6、启动DFS
[wukong@bd01 ~]$ start-dfs.sh Starting namenodes on [bd01] bd01: starting namenode, logging to /home/wukong/local/hadoop-2.7.1/logs/hadoop-wukong-namenode-bd01.out bd02: starting datanode, logging to /home/wukong/local/hadoop-2.7.1/logs/hadoop-wukong-datanode-bd02.out bd03: starting datanode, logging to /home/wukong/local/hadoop-2.7.1/logs/hadoop-wukong-datanode-bd03.out Starting secondary namenodes [bd01] bd01: starting secondarynamenode, logging to /home/wukong/local/hadoop-2.7.1/logs/hadoop-wukong-secondarynamenode-bd01.out [wukong@bd01 ~]
通过jps和日志看是否启动成功。jps查看机器启动的进程情况。正常情况下master上应该有namenode和sencondarynamenode。slave上有datanode。
[wukong@bd01 hadoop]$ jps 5224 Jps 5074 SecondaryNameNode 4923 NameNode [wukong@bd02 ~]$ jps 2307 Jps 2206 DataNode [wukong@bd03 ~]$ jps 2298 Jps 2198 DataNode
7、启动YARN
[wukong@bd01 ~]$ start-yarn.sh starting yarn daemons starting resourcemanager, logging to /home/wukong/local/hadoop-2.7.1/logs/yarn-wukong-resourcemanager-bd01.out bd03: starting nodemanager, logging to /home/wukong/local/hadoop-2.7.1/logs/yarn-wukong-nodemanager-bd03.out bd02: starting nodemanager, logging to /home/wukong/local/hadoop-2.7.1/logs/yarn-wukong-nodemanager-bd02.out [wukong@bd01 ~]$
通过jps和日志验证启动是否成功
[wukong@bd01 ~]$ jps 5830 ResourceManager 6106 Jps 5074 SecondaryNameNode 4923 NameNode [wukong@bd01 ~]$ [wukong@bd02 ~]$ jps 4615 Jps 2206 DataNode 4502 NodeManager [wukong@bd02 ~]$ [wukong@bd03 ~]$ jps 4608 Jps 4495 NodeManager 2198 DataNode [wukong@bd03 ~]$
8、可能遇到的问题
8.1、启动DFS时报JAVA_HOME没找到
[wukong@bd01 ~]$ start-dfs.sh Starting namenodes on [bd01] The authenticity of host 'bd01 (192.168.1.21)' can't be established. ECDSA key fingerprint is af:96:74:e1:41:ec:af:ec:d8:8e:df:cd:99:61:33:0d. Are you sure you want to continue connecting (yes/no)? yes bd01: Warning: Permanently added 'bd01,192.168.1.21' (ECDSA) to the list of known hosts. bd01: Error: JAVA_HOME is not set and could not be found. bd03: Error: JAVA_HOME is not set and could not be found. bd02: Error: JAVA_HOME is not set and could not be found. Starting secondary namenodes [bd01] bd01: Error: JAVA_HOME is not set and could not be found. [wukong@bd01 some_log]$ java -version java version "1.7.0_79" Java(TM) SE Runtime Environment (build 1.7.0_79-b15) Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode) [wukong@bd01 ~]
8.2、配置hadoop相关的环境变量
# .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # 把hadoop可执行文件和脚本的路径都配进来 PATH=$PATH:$HOME/local/hadoop-2.7.1/bin:$HOME/local/hadoop-2.7.1/sbin export PATH ~ ~ ~ ".bash_profile" 16L, 267C
“Hadoop2.7.1分布式安装配置过程”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注创新互联网站,小编将为大家输出更多高质量的实用文章!
当前文章:Hadoop2.7.1分布式安装配置过程
转载注明:http://pwwzsj.com/article/gdoehi.html