千家信息网

安装单机模式Hadoop-2.6.3(1)

发表于:2025-01-24 作者:千家信息网编辑
千家信息网最后更新 2025年01月24日,jdk下载地址http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html 添加hadoop用
千家信息网最后更新 2025年01月24日安装单机模式Hadoop-2.6.3(1)
 jdk下载地址http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html 添加hadoop用户[root@centos67 ~]# useradd hadoop[root@centos67 ~]# passwd hadoop[root@centos67 ~]# ssh-keygen #生成密钥[root@centos67 ~]# ssh-copy-id -i ~/.ssh/id_rsa.pub hadoop@127.0.0.1将主机名写入hosts文件中[root@centos67 ~]# echo "127.0.0.1 `hostname`" >> /etc/hosts下载jdk-8u71-linux-x64.tar.gz[root@centos67 ~]# tar xf jdk-8u71-linux-x64.tar.gz -C /usr/local/[root@centos67 ~]# cd /usr/local/[root@centos67 local]# mv jdk1.8.0_71 java[root@centos67 ~]# vim /etc/profile.d/java.sh#!/bin/bashexport JAVA_HOME=/usr/local/java    #这里是你对应的jdk目录export CLASSPATH=.:$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/libexport PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin[root@centos67 ~]# bash /etc/profile.d/java.sh测试jdk是否安装成功[root@centos67 ~]# java -versionjava version "1.8.0_71"Java(TM) SE Runtime Environment (build 1.8.0_71-b15)Java HotSpot(TM) 64-Bit Server VM (build 25.71-b15, mixed mode)hadoop下载地址http://www.apache.org/dyn/closer.cgi/hadoop/common/hadoop-2.6.3/hadoop-2.6.3.tar.gz 下载hadoop-2.6.3.tar.gz[root@centos67 ~]# tar xf hadoop-2.6.3.tar.gz -C /usr/local/[root@centos67 ~]# cd /usr/local/[root@centos67 local]# mv hadoop-2.6.3 hadoop[root@centos67 ~]# vim /etc/profile.d/hadoop.sh#!/bin/bashexport HADOOP_HOME=/usr/local/hadoopexport PATH=$PATH:$HADOOP_HOME/bin[root@centos67 ~]# bash /etc/profile.d/hadoop.sh测试hadoop是否安装成功[root@centos67 ~]# hadoop versionHadoop 2.6.3Subversion https://git-wip-us.apache.org/repos/asf/hadoop.git -r cc865b490b9a6260e9611a5b8633cab885b3d247Compiled by jenkins on 2015-12-18T01:19ZCompiled with protoc 2.5.0From source with checksum 722f77f825e326e13a86ff62b34adaThis command was run using /usr/local/hadoop/share/hadoop/common/hadoop-common-2.6.3.jar下面开始正式的配置hadoop涉及到的文件有:/usr/local/hadoop/etc/hadoop/hadoop-env.shyarn-env.shyarn-site.xmlcore-site.xmlhdfs-site.xmlmapred-site.xml修改hadoop-env.sh配置文件[root@centos67 ~]# cd /usr/local/hadoop/etc/hadoop[root@centos67 ~]# vim hadoop-env.sh#添加以下内容export JAVA_HOME=/usr/local/javaexport HADOOP_PREFIX=/usr/local/hadoop修改yarn-env.sh配置文件,将以下内容替换[root@centos67 ~]# sed -i 's@^JAVA_HOME=$JAVA_HOME@JAVA_HOME=/usr/local/java@' yarn-env.sh修改core-site.xml配置文件,配置hdfs的访问地址和端口[root@centos67 ~]# vim core-site.xml     fs.default.name    hdfs://centos67:9000    hdfs的访问地址    hadoop.tmp.dir    /home/hadoop/tmp/    hdfs的临时目录修改hdfs-site.xml配置文件,备份方式默认为3,我的是单机模式,所以改为1了[root@centos67 ~]# mkdir -p /home/hadoop/hdfs/{name,data}[root@centos67 ~]# chown -R hadoop:hadoop /home/hadoop/hdfs [root@centos67 ~]# vim hdfs-site.xml    dfs.name.dir    file:/home/hadoop/hdfs/name    dfs.data.dir    file:/home/hadoop/hdfs/data    dfs.replication    1修改hadoop配置文件MapReduce的配置文件mapred-site.xml,[root@centos67 ~]# vim mapred-site.xml        mapreduce.framework.name        yarn修改hadoop配置文件yarn-site.xml[root@centos67 ~]# vim yarn-site.xml        yarn.nodemanager.aux-services        mapreduce_shuffle        yarn.resourcemanager.webapp.address        ${yarn.resourcemanager.hostname}:8099至此,hadoop可以格式化并启动了。[root@centos67 ~]# hadoop namenode -format[root@centos67 ~]# /usr/local/hadoop/sbin/start-dfs.sh[root@centos67 ~]# jps1472 DataNode1660 SecondaryNameNode2159 Jps1375 NameNode有这么几个进程,说明已经成功启动了[root@centos67 ~]# /usr/local/hadoop/sbin/start-yarn.sh1472 DataNode2294 NodeManager2392 Jps1660 SecondaryNameNode2205 ResourceManager1375 NameNode查看是否有9000端口[root@centos67 ~]# netstat -lnpt | grep 9000网页访问http://localhost:50070


0