Support Questions
Find answers, ask questions, and share your expertise

HBASE_HOME for sqoop import




I'm using CDH 5.0.1

i'm trying to import data into hbase using sqoop.
i launch my sqoop line-command:


sudo -u hdfs  sqoop import --connect jdbc:mysql:// --username XXX --password XXX --table test -m 1 --target-dir /user/import  --incremental lastmodified --check-column date --append --hbase-table forHive --column-family infos


During the log, i have this error:
Error during import: HBase jars are not present in classpath, cannot import to HBase!

I set my $HBASE_HOME : export HBASE_HOME=/usr/lib/hbase
after that i change my hbase_home because i use CDH with this string:
export HBASE_HOME=/opt/cloudera/parcels/CDH/lib/hbase
and i also try:
export HBASE_HOME=/opt/cloudera/parcels/CDH/lib/hbase/lib

But in every case i have this error:
 ERROR tool.ImportTool: Error during import: HBase jars are not present in classpath, cannot import to HBase!

What kind of HBASE_HOME must i set?

and is possible use builk-load HBase with sqoop for massive import?



Re: HBASE_HOME for sqoop import

Master Guru
How are you setting your environment exactly? When you use a command like "sudo -u hdfs cmd…" the local environment variables you have set in shell will not transfer through to the sudo-based execution (different shell).

Try logging in as 'hdfs' first, via 'su hdfs' or 'sudo -u hdfs /bin/bash', then export the HBASE_HOME to the parcel or package path and retry your Sqoop command execution.

Also read

Re: HBASE_HOME for sqoop import

New Contributor
I also have the same issue in CDH 5.13, do you have the solution now? thanks.

Re: HBASE_HOME for sqoop import


I have not tested ? but would you consider deploying a  Hbase gateway role on the host you are ruining ? 

Re: HBASE_HOME for sqoop import

New Contributor
HBase service have been added before. After I add /usr/lib/hbase/lib/* in YARN Application Classpath, the error gone, but dispaly a new new error:

2019-01-04 17:31:27,834 [main] INFO org.apache.sqoop.orm.CompilationManager - HADOOP_MAPRED_HOME is /opt/cloudera/parcels/CDH-5.13.0-1.cdh5.13.0.p0.29/lib/hadoop-mapreduce
2019-01-04 17:31:31,952 [main] ERROR org.apache.sqoop.tool.ImportTool - Import failed: Error returned by javac
at org.apache.sqoop.orm.CompilationManager.compile(
at org.apache.sqoop.tool.CodeGenTool.generateORM(
at org.apache.sqoop.tool.ImportTool.importTable(
at org.apache.sqoop.Sqoop.runSqoop(
at org.apache.sqoop.Sqoop.runTool(
at org.apache.sqoop.Sqoop.runTool(
at org.apache.sqoop.Sqoop.main(
at org.apache.oozie.action.hadoop.SqoopMain.runSqoopJob(
at org.apache.oozie.action.hadoop.SqoopMain.main(
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at org.apache.hadoop.mapred.MapTask.runOldMapper(
at org.apache.hadoop.mapred.YarnChild$
at Method)
at org.apache.hadoop.mapred.YarnChild.main(