Hadoop3.1.2伪分布式配置

2019-03-31  本文已影响0人  aduo

1 配置jiava环境

rpm -qa|grep java
which java

2 配置hadoop四大模块:common,hdfs,yarn,mapreduce

<configuration>
    <property>
        <name>fs.defaultFS</name>
        <value>hdfs://localhost:8020</value>
    </property>
  #configure temp directory
    <property>
        <name>hadoop.tmp.dir</name>
        <value>/opt/module/hadoop-3.1.2/data/tmp</value>
    </property>
</configuration>
    <property>
        <name>dfs.replication</name>
        <value>1</value>
    </property>

3 启动文件系统

bin/hdfs namenode -format
sbin/start-dfs.sh
jps #查看启动的进程
9809 SecondaryNameNode
3752 DataNode
4171 Jps
3647 NameNode

netstat -ntlp 查看进程占用的端口

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:9864            0.0.0.0:*               LISTEN      3752/java
tcp        0      0 0.0.0.0:9866            0.0.0.0:*               LISTEN      3752/java
tcp        0      0 0.0.0.0:9867            0.0.0.0:*               LISTEN      3752/java
tcp        0      0 0.0.0.0:9868            0.0.0.0:*               LISTEN      3922/java
tcp        0      0 0.0.0.0:9870            0.0.0.0:*               LISTEN      3647/java
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      -
tcp        0      0 192.168.1.8:8020        0.0.0.0:*               LISTEN      3647/java
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      -
tcp        0      0 127.0.0.1:33530         0.0.0.0:*               LISTEN      3752/java
$ bin/hdfs dfs -mkdir /user
$ bin/hdfs dfs -mkdir /user/<username>
$ bin/hdfs dfs -put etc/hadoop input
$ bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.9.2.jar grep input output 'dfs[a-z.]+'

-获取, 查看日志

$ bin/hdfs dfs -get output output
$ cat output/*

4 启动yarn

    <property>
        <name>yarn.nodemanager.aux-services</name>
        <value>mapreduce_shuffle</value>
    </property>
    <property>
        <name>yarn.nodemanager.env-whitelist</name>
        <value>JAVA_HOME,HADOOP_COMMON_HOME,HADOOP_HDFS_HOME,HADOOP_CONF_DIR,CLASSPATH_PREPEND_DISTCACHE,HADOOP_YARN_HOME,HADOOP_MAPRED_HOME</value>
    </property>
    <property>
        <name>mapreduce.framework.name</name>
        <value>yarn</value>
    </property>
    <property>
        <name>mapreduce.application.classpath</name>
        <value>$HADOOP_MAPRED_HOME/share/hadoop/mapreduce/*:$HADOOP_MAPRED_HOME/share/hadoop/mapreduce/lib/*</value>
    </property>
sbin/start-yarn.sh
jps #查看进程
3922 SecondaryNameNode
6276 Jps
3752 DataNode
6056 ResourceManager
3647 NameNode
6191 NodeManager
sudo ln -s /opt/module/jdk1.8.0_162/bin/java /bin/java
sbin/stop-dfs.sh
sbin/stop-yarn.sh

5 配置

    <property>
        <name>fs.defaultFS</name>
        <value>hdfs://hadoop-yarn.cloudyhadoop.com:8020</value>
    </property>
<property>
  <name>dfs.namenode.secondary.http-address</name>
  <value>0.0.0.0:9868</value>
  <description>
    The secondary namenode http server address and port.
  </description>
</property>
  <property>
    <description>The hostname of the RM.</description>
    <name>yarn.resourcemanager.hostname</name>
    <value>0.0.0.0</value>
  </property>    
  <property>
    <description>The hostname of the NM.</description>
    <name>yarn.nodemanager.hostname</name>
    <value>0.0.0.0</value>
  </property>
  <name>mapreduce.jobhistory.admin.address</name>
  <value>0.0.0.0:10033</value>
  <description>The address of the History server admin interface.</description>
</property>
上一篇下一篇

猜你喜欢

热点阅读