将csv文件导入hbase

时间:2013-08-25 09:48:50

标签: java csv hadoop hbase

我想填写mytable:使用csv文件在hbase中输出。为此,我使用了以下命令:

bin/hbase org.apache.hadoop.hbase.mapreduce.importtsv -Dimport.columns=
HBASE_ROW_KEY,ProvinceINFO:ID, ProvinceINFO:Name Province /usr/data/province.csv

但它给了我这个错误:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/hbase
/mapreduce
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.hbase.mapreduce
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: org.apache.hadoop.hbase.mapreduce. Program will exit.

所以,为了解决这个问题,我做了以下几点:

将hbase.site.xml复制到hadoop / conf

将所有hbase jar文件和zookeeper.jar以及guava.jar复制到hadoop / lib

并设置HADOOP_CLASSPATHHBASE_pATH,如下所示:

export HADOOP_CLASSPATH=/Desktop/hbase/lib/hbase-client-0.95.0-hadoop2.jar:/Desktop  
/hbase/lib/hbase-common-0.95.0-hadoop2.jar:/Desktop/hbase/lib/hbase-common-0.95.0-
hadoop2-tests.jar:/Desktop/hbase/lib/hbase-examples-0.95.0-hadoop2.jar:/Desktop/hbase
/lib/hbase-hadoop2-compat-0.95.0-hadoop2.jar:/Desktop/hbase/lib/hbase-hadoop-compat-
0.95.0-hadoop2.jar:/Desktop/hbase/lib/hbase-it-0.95.0-hadoop2.jar:/Desktop/hbase
/lib/hbase-it-0.95.0-hadoop2-tests.jar:/Desktop/hbase/lib/hbase-prefix-tree-0.95.0-
hadoop2.jar:/Desktop/hbase/lib/hbase-protocol-0.95.0-hadoop2.jar:$/Desktop/hbase
/lib/hbase-server-0.95.0-hadoop2.jar:$/Desktop/hbase/lib/hbase-server-0.95.0-hadoop2-
tests.jar:/Desktop/hbase/lib/guava-12.0.1.jar:/Desktop/hbase/conf:/Desktop/hbase
/lib/zookeeper-3.4.5.

但它没有改变。

请指导我

0 个答案:

没有答案