• 压缩软件Snappy的安装


    1、下载源码,通过编译源码安装

      tar -zxvf  /home/zfll/soft/snappy-1.1.2.tar.gz

        cd snappy-1.1.2

      ./configure

        make

     sudo make install(输入root的密码)
    2、安装hadoop-snappy

       解压 unzip /home/zfll/soft/hadoop-snappy-master.zip

       编译 cd hadoop-snappy-master/ 

             mvn clean package -Dmaven.test.skip=true

    编译后把本地库文件和jar包(编译后可能已经打在一个压缩包里,需要先解压)拷贝到相应的目录

          cd /home/zfll/hadoop-snappy-master/target

          tar -zxvf hadoop-snappy-0.0.1-SNAPSHOT.tar.gz

          cp -r hadoop-snappy-0.0.1-SNAPSHOT/lib/* $HADOOP_HOME/lib

          cp hadoop-snappy-0.0.1-SNAPSHOT.jar $HADOOP_HOME/lib
    Snappy 0.0.1-SNAPSHOT/目录包含本地库和hadoop-snappy-0.0.1-SNAPSHOT.jar包,都需要拷贝到相应的目录。

    3、配置hadoop-env.sh 添加:

           cd  /home/zfll/hadoop/etc/hadoop

           vi  hadoop-env.sh

       export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HADOOP_HOME/lib/native/Linux-amd64-64/:/usr/local/lib/

    4、配置mapred-site.xml 增加

        cd  /home/zfll/hadoop/etc/hadoop

        vi mapred-site.xml

    <property>
          <name>mapred.compress.map.output</name>
          <value>true</value>
     </property>
     <property>
           <name>mapred.map.output.compression.codec</name>
           <value>org.apache.hadoop.io.compress.SnappyCodec</value>
      </property>

       vi  core-site.xml

    <property>
            <name>io.compression.codecs</name>
            <value>org.apache.hadoop.io.compress.GzipCodec,org.apache.hadoop.io.compress.DefaultCodec,org.apache.hadoop.io.compress.BZip2Codec,org.apache.hadoop.io.compress.SnappyCodec</value>
    </property>   

    注意以上文件,每个节点都要修改增加


    6Hbase配置Snappy

       1)cd /home/zfll/hbase/lib

           mkdir -p native/Linux-amd64-64

           cp -r $HADOOP_HOME/lib/native/Linux-amd64-64/*   $HBASE_HOME/lib/native/Linux-amd64-64/

       2)、配置hbase环境变量

           cd  /home/zfll/hbase/conf

           vi  hbase-env.sh

             export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HADOOP_HOME/lib/native/Linux-amd64-64/:/usr/local/lib/

             export HBASE_LIBRARY_PATH=$HBASE_LIBRARY_PATH :$HBASE_HOME/lib/native/Linux-amd64-64/:/usr/local/lib/

           vi hbase-site.xml 保证启动以snappy方式启动    

    <property>  
          <name>hbase.regionserver.codecs</name>  
          <value>snappy</value>  
     </property>

       

    3)、重启hadoophbase

           server1-hadoop-namenode-01stop-dfs.sh stop-yarn.sh

                stop-hbase.sh

                start-dfs.sh start-yarn.sh

                hbase-daemon.sh start master

           server2-hadoop-namenode-02上启动备用进程:

                 yarn-daemon.sh stop resourcemanager

                 yarn-daemon.sh start resourcemanager

                 hbase-daemon.sh start master

           在安装hbase接点上分别启动hbaseregionserver

                 hbase-daemon.sh start regionserver

       4)、验证Hbase配置是否成功(server1-hadoop-namenode-01上操作)

            接下来创建并操作Snappy压缩格式的表

        1hbase shell

        

        2create 'tsnappy', { NAME => 'f', COMPRESSION => 'snappy'}

        3describe 'tsnappy'

        4put 'tsnappy', 'row1', 'f:col1', 'value'

        5scan 'tsnappy'

  • 相关阅读:
    The first appliaction for "Hello World!"
    zone
    learn to study
    深入理解 Angular 2 变化监测和 ngZone
    看看吧
    生命周期钩子
    一个简单的todo
    依赖注入
    @Output()
    @Input
  • 原文地址:https://www.cnblogs.com/atomicbomb/p/6900953.html
Copyright © 2020-2023  润新知