Hadoop2.6.4安装步骤

来源:互联网 发布:相声知乎 编辑:程序博客网 时间:2024/06/13 11:05

1、下载地址:https://mirrors.tuna.tsinghua.edu.cn/apache/hadoop/common/hadoop-2.6.4/hadoop-2.6.4-src.tar.gz.

2、解压放在      /usr/local/wl/hadoop/hadoop-2.6.4(我的位置)

     2.1、配置环境变量vi /etc/profile

            export HADOOP_HOME=/usr/local/wl/hadoop/hadoop-2.6.4

            export PATH=$HADOOP_HOME/bin:$PATH

3、进入/usr/local/wl/hadoop/hadoop-2.6.4/etc/hadoop位置编辑下面几个文件

 创建文件夹:/usr/local/wl/hadoop/tmp/dfs/data、/usr/local/wl/hadoop/tmp/dfs/name、

               /usr/local/wl/hadoop/filesyste

 3.1 、core-site.xml

 <?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
    
    <property>
        <name>hadoop.tmp.dir</name>
        <value>file:/usr/local/wl/hadoop/tmp</value>
        <description>Abase for other temporary directories.</description>
    </property>

    <property>
        <name>fs.defaultFS</name>
        <value>hdfs://10.141.42.209:9000</value>
    </property>
    
    <property>  
        <name>hadoop.tmp.dir</name>  
        <value>/usr/local/wl/hadoop/filesystem/tmp</value>  
        <description> temporary directories.</description>  
    </property>  

    <property>  
        <name>dfs.name.dir</name>  
        <value> /usr/local/wl/hadoop/filesystem/name</value>
        <description>where on the local filesystem the DFS name node should store the name table</description>  
    </property>  

    <property>  
        <name>dfs.data.dir</name>  
        <value>/usr/local/wl/hadoop/filesystem/data</value>  
        <description>where on the local filesystem an DFS data node should store its blocks.</description>  
    </property>  

</configuration>

    3.2 、hdfs-site.xml

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

<configuration>
    <property>
        <name>dfs.replication</name>
        <value>1</value>
    </property>

    <property>
        <name>dfs.namenode.name.dir</name>
        <value>file:/usr/local/wl/hadoop/tmp/dfs/name</value>
    </property>

    <property>
    <name>dfs.datanode.data.dir</name>
    <value>file:/usr/local/wl/hadoop/tmp/dfs/data</value>
    </property>
    
    <property>
        <name>dfs.permissions.enabled</name>
        <value>false</value>
    </property>

</configuration>

  3.3 、mapred-site.xml.template

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
    <property>
        <name>mapred.job.tracker</name>
        <value>10.141.42.209:9001</value>
    </property>
</configuration>
     3.4、修改hadoop-env.sh



4、运行Hadoop

     4.1、初始化HDFS(cd  /usr/local/wl/hadoop/hadoop-2.6.4)

             bin/hdfs namenode -format

     4.2、开启NameNode 和DataNode守护进程

             sbin/start-dfs.sh

     4.3、查看web ui

      在浏览器中输入:    http://123.206.26.35:50070

       (http://123.206.16.33:50090/status.html)

5、命令(http://hadoop.apache.org/docs/r1.0.4/cn/hdfs_shell.html)

     进入:  /usr/local/wl/hadoop/hadoop-2.6.4/bin

     5.1、常见命令

     hadoop fs -mkdir /test

     hadoop fs -ls /

     hadoop fs -put  /usr/local/wl/hadoop/a.txt    /test

     hadoop fs -cat  /test/a.txt

     hadoop fs -rmr /test

     hadoop fs -rm /test/a.txt

   





0 0
原创粉丝点击