将csv文件导入hbase

yeotifhr  于 2021-06-03  发布在  Hadoop
关注(0)|答案(0)|浏览(314)

我要加满mytable:province in 使用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_CLASSPATH 以及 HBASE_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.

但它没有改变。
请引导我

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题