我正在使用Ubuntu-12.04,Hadoop-1.0.2,Hive-0.10.0
从 hive 中读取大约一百万条记录的数据时,出现以下查询错误
select * from raw_pos limit 10000;
WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
所以我将Snappy for Hadoop安装在$ HADOOP_HOME / lib文件夹中,该文件夹会生成文件libsnappy.a,libsnappy.la,libsnappy.so,libsnappy.so.1,libsnappy.so.1.1.4
还要在$ HADOOP_HOME / lib /中添加hadoop-lzo-0.4.3.jar并在cor-site.xml,mapred-site.xml中进行如下更改
Core-site.xml:-
<property>
<name>fs.default.name</name>
<value>hdfs://localhost:54310</value>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>/home/hadoop/apache/hadoop-1.0.4/hadoop_temp/</value>
<description>A base for other temporary directories.</description>
</property>
<property>
<name>io.compression.codecs</name>
<value>
org.apache.hadoop.io.compress.SnappyCodec
</value>
mapred-site.xml:-
<property>
<name>mapred.job.tracker</name>
<value>hdfs://localhost:54311</value>
</property>
<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>
但是当我开始hive&do
show databases
时,出现错误:-Failed with exception java.io.IOException:java.io.IOException: Cannot create an instance of InputFormat class org.apache.hadoop.mapred.TextInputFormat as specified in mapredWork!
最佳答案
修改您的core-site.xml,看看是否有帮助:
<property>
<name>io.compression.codecs</name>
<value>com.hadoop.compression.lzo.LzoCodec,com.hadoop.compression.lzo.LzopCodec,org.apache.hadoop.io.compress.SnappyCodec</value>
</property>
<property>
<name>io.compression.codec.lzo.class</name>
<value>com.hadoop.compression.lzo.LzoCodec</value>
</property>