我已将sqoop表导入到HBase,如下所示:
sqoop import --connect jdbc:mysql://${mysql-server-address}/test -username root -password admin --table Student --hbase-create-table --hbase-table student --column-family i
下一步,我也试图让自由格式查询工作,但是,我尝试的sqoop命令无法按预期工作,没有任何内容从源表导入到目标HBase表。
sqoop import --connect jdbc:mysql://${mysql-server-address}/test -username root -password admin --query 'SELECT id, name from Student where $CONDITIONS' --split-by Student.id --hbase-create-table --hbase-table student --column-family i
第二个sqoop命令中是否有任何遗漏?该文件在HBase导入方面非常有限。
如果有帮助,这里是来自命令2的日志:
13/08/06 21:15:43 INFO db.DataDrivenDBInputFormat: BoundingValsQuery: SELECT MIN(t1.id), MAX(t1.id) FROM (SELECT * from Student where (1 = 1) ) AS t1
13/08/06 21:15:46 INFO mapred.JobClient: Running job: job_201308061021_0025
13/08/06 21:15:47 INFO mapred.JobClient: map 0% reduce 0%
13/08/06 21:19:08 INFO mapred.JobClient: map 75% reduce 0%
13/08/06 21:19:09 INFO mapred.JobClient: map 100% reduce 0%
13/08/06 21:19:12 INFO mapred.JobClient: Job complete: job_201308061021_0025
13/08/06 21:19:12 INFO mapred.JobClient: Counters: 17
13/08/06 21:19:12 INFO mapred.JobClient: Job Counters
13/08/06 21:19:12 INFO mapred.JobClient: SLOTS_MILLIS_MAPS=212866
13/08/06 21:19:12 INFO mapred.JobClient: Total time spent by all reduces waiting after reserving slots (ms)=0
13/08/06 21:19:13 INFO mapred.JobClient: Total time spent by all maps waiting after reserving slots (ms)=0
13/08/06 21:19:13 INFO mapred.JobClient: Launched map tasks=4
13/08/06 21:19:13 INFO mapred.JobClient: SLOTS_MILLIS_REDUCES=0
13/08/06 21:19:13 INFO mapred.JobClient: File Output Format Counters
13/08/06 21:19:13 INFO mapred.JobClient: Bytes Written=0
13/08/06 21:19:13 INFO mapred.JobClient: FileSystemCounters
13/08/06 21:19:13 INFO mapred.JobClient: HDFS_BYTES_READ=441
13/08/06 21:19:13 INFO mapred.JobClient: FILE_BYTES_WRITTEN=362752
13/08/06 21:19:13 INFO mapred.JobClient: File Input Format Counters
13/08/06 21:19:13 INFO mapred.JobClient: Bytes Read=0
13/08/06 21:19:13 INFO mapred.JobClient: Map-Reduce Framework
13/08/06 21:19:13 INFO mapred.JobClient: Map input records=4
13/08/06 21:19:13 INFO mapred.JobClient: Physical memory (bytes) snapshot=428892160
13/08/06 21:19:13 INFO mapred.JobClient: Spilled Records=0
13/08/06 21:19:13 INFO mapred.JobClient: CPU time spent (ms)=7730
13/08/06 21:19:13 INFO mapred.JobClient: Total committed heap usage (bytes)=312672256
13/08/06 21:19:13 INFO mapred.JobClient: Virtual memory (bytes) snapshot=5353742336
13/08/06 21:19:13 INFO mapred.JobClient: Map output records=4
13/08/06 21:19:13 INFO mapred.JobClient: SPLIT_RAW_BYTES=441
13/08/06 21:19:13 INFO mapreduce.ImportJobBase: Transferred 0 bytes in 213.1239 seconds (0 bytes/sec)
13/08/06 21:19:13 INFO mapreduce.ImportJobBase: Retrieved 4 records.
答案 0 :(得分:1)
--split-by Student.id
应为--split-by id