Problems and solutions when importing Sqoop data into HBase

  1. run bin/sqoop import --connect jdbc:mysql://ip:port/database --username *** --password ****--hbase-bulkload --hbase-create-table --column-family info --hbase-row-key username --hbase-table detects --table detects Imports the detects table in Mysql to the detects table in Hbase, prompting an error that users Class could not be found

Solution: Put the detects.jar package in the /tmp/sqoop-hadoop/compile folder to the sqoop installation directory lib. Just execute it again. It did work again.

 2. Use importtsv to import file data into Hbase, x run ${HADOOP_HOME}/bin/hadoop jar ${HBASE_HOME}/lib/hbase-server-1.2.6.jar, prompt:


Solution: The error message indicates that the jar package of hbase cannot be found in hadoop. Just add the path of hbase to the hadoop path and you will be fine. HADOOP_CLASSPATH=`${HBASE_HOME}/bin/hbase classpath` ${HADOOP_HOME}/bin/hadoop jar ${HBASE_HOME}/lib/hbase-server-1.2.6.jar;

Finally, you can use the command to import the file data into hbase, for example: HADOOP_CLASSPATH=`${HBASE_HOME}/bin/hbase classpath` ${HADOOP_HOME}/bin/hadoop jar ${HBASE_HOME}/lib/hbase-server-1.2.6 .jar importtsv -Dimporttsv.columns=HBASE_ROW_KEY,info:name,info:age -Dimporttsv.separator=, user /hbase_user -Dimporttsv.bulk.output=/hbase_user Import use data into hbase user, prompt Bad lines =0 It means that the import is successful.

ps: The error message shown in the figure below can be ignored and will not affect the operation.


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325895301&siteId=291194637