美文网首页
CentOS7+hadoop2.6.5单节点配置

CentOS7+hadoop2.6.5单节点配置

作者: SamHxm | 来源:发表于2017-06-04 22:33 被阅读0次

环境目录

[sam@sam01 ~]$ vi .bash_profile
export JAVA_HOME=$HOME/tools/jdk1.7.0_80
export CLASSPATH=$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export HADOOP_HOME=$HOME/tools/hadoop-2.6.5
export HADOOP_CONF_DIR=$HOME/tools/hadoop-2.6.5/etc/hadoop
PATH=$HADOOP_HOME/sbin:$HADOOP_HOME/bin:$JAVA_HOME/bin:$PATH
export PATH

建立HDFS文件存储目录

[sam@sam01 ~]$ mkdir -p /home/sam/tmp/hadoop

ssh免密钥配置

[sam@sam01 hadoop]$ ssh-keygen -t rsa
[sam@sam01 hadoop]$ cd ~/.ssh
[sam@sam01 .ssh]$ cp id_rsa.pub authorized_keys

hadoop-env.sh配置JAVA_HOME

#######[sam@sam01 hadoop]$ vi $HADOOP_HOME/etc/hadoop/hadoop-env.sh

export JAVA_HOME=/home/sam/tools/jdk1.7.0_80

修改hadoop配置文件

[sam@sam01 hadoop]$ vi $HADOOP_HOME/etc/hadoop/core-site.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License. See accompanying LICENSE file.
-->

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

<configuration>
 <property>
     <name>hadoop.tmp.dir</name>
     <value>file:///home/sam/data/hadoop/tmp</value>
     <description>A base for other temporary directories.</description>
 </property>

 <property>
     <name>fs.defaultFS</name>
     <value>hdfs://sam01:9000</value>
 </property>
</configuration>
[sam@sam01 hadoop]$ vi $HADOOP_HOME/etc/hadoop/hdfs-site.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License. See accompanying LICENSE file.
-->

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

<configuration>
  <property>
    <name>dfs.nameservices</name>
    <value>sam-hadoop-cluster</value>
  </property>
  <property>
    <name>dfs.replication</name>
    <value>1</value>
  </property>
  <property>
    <name>dfs.namenode.name.dir</name>
    <value>file:///home/sam/data/hadoop/hdfs/nn</value>
  </property>
  <property>
    <name>dfs.namenode.checkpoint.dir</name>
    <value>file:///home/sam/data/hadoop/hdfs/snn</value>
  </property>
  <property>
    <name>dfs.namenode.checkpoint.edits.dir</name>
    <value>file:///home/sam/data/hadoop/hdfs/snn</value>
  </property>
  <property>
    <name>dfs.datanode.data.dir</name>
    <value>file:///home/sam/data/hadoop/hdfs/dn</value>
  </property>
  <property>
    <name>dfs.permissions</name>
    <value>false</value>
  </property>
</configuration>

格式化目录

[sam@sam01 hadoop]$ $HADOOP_HOME/bin/hdfs namenode -format

启动hdfs

[sam@sam01 hadoop]$ $HADOOP_HOME/sbin/start-dfs.sh
访问http://192.168.1.106:50070
[sam@sam01 hadoop]$ mv $HADOOP_HOME/etc/hadoop/mapred-site.xml.template $HADOOP_HOME/etc/hadoop/mapred-site.xml
[sam@sam01 hadoop]$ vi $HADOOP_HOME/etc/hadoop/mapred-site.xml
<configuration>
    <property>
        <name>mapreduce.framework.name</name>
        <value>yarn</value>
    </property>
</configuration>
[sam@sam01 hadoop]$ vi $HADOOP_HOME/etc/hadoop/yarn-site.xml
<configuration>
  <property>
    <name>yarn.resourcemanager.hostname</name>
    <value>sam01</value>
  </property>
  <!-- 指定reducer获取数据的方式-->
  <property>
    <name>yarn.nodemanager.aux-services</name>
    <value>mapreduce_shuffle</value>
  </property>
  <property>
    <name>yarn.nodemanager.local-dirs</name>
    <value>file:///home/sam/data/hadoop/yarn/nm</value>
  </property>
</configuration>
[sam@sam01 hadoop]$ $HADOOP_HOME/sbin/start-yarn.sh
访问http://192.168.1.106:8088

相关文章

网友评论

      本文标题:CentOS7+hadoop2.6.5单节点配置

      本文链接:https://www.haomeiwen.com/subject/iupbfxtx.html