如何从mysql导入表到hbase?

时间:2022-11-12 04:14:09
use testhadoop;

CREATE TABLE employee(
  empid INT(2),
  empname varchar(20),
  salray int (6)
);

INSERT INTO employee VALUES
  (1,'emp1',15000),
  (1,'emp1',15000),
  (2,'emp2',12200),
  (3,'emp3',99999),
  (4,'emp4',17687),
  (5,'emp5',45788);**strong text**

cd $SQOOP_HOME
bin/sqoop import --connect jdbc:mysql://localhost/testhadoop --username root -P --table employee --hbase-table employeeHBase \
--column-family info --hbase-row-key empid --hbase-create-table -m 1

I am getting the following error, can you please provide solution for this

我收到以下错误,你能提供解决方案吗

13/12/05 17:40:47 INFO manager.MySQLManager: Setting zero DATETIME behavior to convertToNull (mysql)
13/12/05 17:40:47 ERROR tool.ImportTool: Error during import: HBase jars are not present in classpath, cannot import to HBase!

1 个解决方案

#1


3  

Sqoop do not ships with HBase and as a result you need to define variable $HBASE_HOME pointing to your installation of HBase, for example:

Sqoop不附带HBase,因此您需要定义变量$HBASE_HOME指向您的HBase安装,例如:

export HBASE_HOME=/usr/lib/hbase
sqoop import ...

#1


3  

Sqoop do not ships with HBase and as a result you need to define variable $HBASE_HOME pointing to your installation of HBase, for example:

Sqoop不附带HBase,因此您需要定义变量$HBASE_HOME指向您的HBase安装,例如:

export HBASE_HOME=/usr/lib/hbase
sqoop import ...