Hive(22):snappy安装

1.压缩包

(1)编译

(2)下载

 2.解压缩

tar -zxvf native-2.7.3-snappy.tar.gz -C /opt/modules/

3.替换hadoop2.7.3的lib

cp /opt/modules/native/* ./native/

4.检查是否支持hadoop下

bin/hadoop checknative

结果:
Native library checking:
hadoop:  true /opt/modules/apache/hadoop-2.7.3/lib/native/libhadoop.so
zlib:    true /opt/modules/apache/hadoop-2.7.3/lib/native/libz.so.1
snappy:  true /opt/modules/apache/hadoop-2.7.3/lib/native/libsnappy.so.1
lz4:     true revision:99
bzip2:   false 
openssl: false Cannot load libcrypto.so (libcrypto.so: cannot open shared object file: No such file or directory)!

5.使用代码配置后,运行mapreduce的wordcount方法

(1)创建目录

bin/hdfs dfs -mkdir -p /user/beifeng/mapreduce/wordcount/input

(2)上传文件

bin/hdfs dfs -put /opt/datas/wc.input /user/beifeng/mapreduce/wordcount/input

(3)wordcount测试

bin/yarn jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.3.jar wordcount /user/beifeng/mapreduce/wordcount/input /user/beifeng/mapreduce/wordcount/output2

(4).重新配置后运行mapreduce
    (a)点击刚刚运行的结果history-Configuration,搜索map.output,获得需要配置的属性

    (b)写代码(放在一行执行!)

bin/yarn jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.3.jar wordcount -Dmapreduce.map.output.compress=true -Dmapreduce.map.output.compress.codec=org.apache.hadoop.io.compress.SnappyCodec /user/beifeng/mapreduce/wordcount/input /user/beifeng/mapreduce/wordcount/output22

6.Hive中配置

(1)

set mapreduce.map.output.compress=true;

(2)

set mapreduce.map.output.compress.codec=org.apache.hadoop.io.compress.SnappyCodec;

(3)测试:然后跑

select count(*) from emp;

猜你喜欢

转载自blog.csdn.net/u010886217/article/details/83928454