Sets the target column family for the import 設置導入的目標列族奥务。
--hbase-create-table
If specified, create missing HBase tables是否自動創(chuàng)建不存在的HBase表(這就意味著物独,不需要手動提前在HBase中先建立表)
--hbase-row-key <col>
Specifies which input column to use as the row key.In case, if input table contains composite key, then <col> must be in the form of a comma-separated list of composite key attributes. mysql中哪一列的值作為HBase的rowkey,如果rowkey是個組合鍵氯葬,則以逗號分隔挡篓。(注:避免rowkey的重復)
--hbase-table <table-name>
Specifies an HBase table to use as the target instead of HDFS.指定數(shù)據(jù)將要導入到HBase中的哪張表中。
--hbase-bulkload
Enables bulk loading.是否允許bulk形式的導入帚称。
2官研、配置sqoop-env.sh,添加如下內(nèi)容
[victor@node1 conf]$ vim sqoop-env.sh
export HBASE_HOME=/opt/module/hbase-1.2.5
3世杀、在Mysql中新建一個數(shù)據(jù)庫db_library阀参,一張表book
[victor@node1 conf]$ service mysql status
[victor@node1 conf]$ mysql -uroot -p000000
mysql> CREATE DATABASE db_library;
CREATE TABLE db_library.book(
id int(4) PRIMARY KEY NOT NULL AUTO_INCREMENT,
name VARCHAR(255) NOT NULL,
price VARCHAR(255) NOT NULL);
4、向表中插入一些數(shù)據(jù)
mysql> INSERT INTO db_library.book (name, price) VALUES('Lie Sporting', '30');
mysql> INSERT INTO db_library.book (name, price) VALUES('Pride & Prejudice', '70');
mysql> INSERT INTO db_library.book (name, price) VALUES('Fall of Giants', '50');