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
我收到以下错误,请您为此提供解决方案
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!
解决方法:
Sqoop不附带HBase,因此您需要定义指向您的HBase安装的变量$HBASE_HOME,例如:
export HBASE_HOME=/usr/lib/hbase
sqoop import ...