打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Sqoop1.4.4实现关系型数据库多表同时导入HDFS或Hive中

问题导读:

         1、使用Sqoop哪个工具实现多表导入?

         2、满足多表导入的三个条件是?

         3、如何指定导入HDFS某个目录?如何指定导入Hive某个数据库

一、介绍

        有时候我们需要将关系型数据库中多个表一起导入到HDFS或者hive中,这个时候可以使用Sqoop的另一个工具sqoop-import-all-tables。每个表数据被分别存储在以表名命名的HDFS上的不同目录中。

       在使用多表导入之前,以下三个条件必须同时满足:
           1、每个表必须都只有一个列作为主键;
           2、必须将每个表中所有的数据导入,而不是部分;
           3、你必须使用默认分隔列,且WHERE子句无任何强加的条件

        --table, --split-by, --columns, 和 --where 参数在sqoop-import-all-tables命令中是不合法的。--exclude-tables:可以用来排除导入某个表。具体的导入用法和单表导入差不多。

二、关系数据表

        我的spice数据库中,有以下四张表:

  1. mysql> show tables;  
  2. +-----------------+  
  3. | Tables_in_spice |  
  4. +-----------------+  
  5. | servers         |  
  6. | users           |  
  7. | vmLog           |  
  8. | vms             |  
  9. +-----------------+  
  10. 4 rows in set (0.00 sec)  
三、多表同时导入HDFS中

  1. [hadoopUser@secondmgt ~]$ sqoop-import-all-tables --connect jdbc:mysql://secondmgt:3306/spice  --username hive --password hive --as-textfile --warehouse-dir /output/  
  2. Warning: /usr/lib/hcatalog does not exist! HCatalog jobs will fail.  
  3. Please set $HCAT_HOME to the root of your HCatalog installation.  
  4. 15/01/19 20:21:15 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.  
  5. 15/01/19 20:21:15 INFO manager.MySQLManager: Preparing to use a MySQL streaming resultset.  
  6. 15/01/19 20:21:15 INFO tool.CodeGenTool: Beginning code generation  
  7. 15/01/19 20:21:15 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM `servers` AS t LIMIT 1  
  8. 15/01/19 20:21:15 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM `servers` AS t LIMIT 1  
  9. 15/01/19 20:21:15 INFO orm.CompilationManager: HADOOP_MAPRED_HOME is /home/hadoopUser/cloud/hadoop/programs/hadoop-2.2.0  
  10. Note: /tmp/sqoop-hadoopUser/compile/0bdbced5e58f170e1670516db3339f91/servers.java uses or overrides a deprecated API.  
  11. Note: Recompile with -Xlint:deprecation for details.  
  12. 15/01/19 20:21:16 INFO orm.CompilationManager: Writing jar file: /tmp/sqoop-hadoopUser/compile/0bdbced5e58f170e1670516db3339f91/servers.jar  
  13. 15/01/19 20:21:16 WARN manager.MySQLManager: It looks like you are importing from mysql.  
  14. 15/01/19 20:21:16 WARN manager.MySQLManager: This transfer can be faster! Use the --direct  
  15. 15/01/19 20:21:16 WARN manager.MySQLManager: option to exercise a MySQL-specific fast path.  
  16. 15/01/19 20:21:16 INFO manager.MySQLManager: Setting zero DATETIME behavior to convertToNull (mysql)  
  17. 15/01/19 20:21:16 INFO mapreduce.ImportJobBase: Beginning import of servers  
  18. 15/01/19 20:21:16 INFO Configuration.deprecation: mapred.job.tracker is deprecated. Instead, use mapreduce.jobtracker.address  
  19. SLF4J: Class path contains multiple SLF4J bindings.  
  20. SLF4J: Found binding in [jar:file:/home/hadoopUser/cloud/hadoop/programs/hadoop-2.2.0/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]  
  21. SLF4J: Found binding in [jar:file:/home/hadoopUser/cloud/hbase/hbase-0.96.2-hadoop2/lib/slf4j-log4j12-1.6.4.jar!/org/slf4j/impl/StaticLoggerBinder.class]  
  22. SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.  
  23. SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]  
  24. 15/01/19 20:21:17 INFO Configuration.deprecation: mapred.jar is deprecated. Instead, use mapreduce.job.jar  
  25. 15/01/19 20:21:17 INFO Configuration.deprecation: mapred.map.tasks is deprecated. Instead, use mapreduce.job.maps  
  26. 15/01/19 20:21:17 INFO client.RMProxy: Connecting to ResourceManager at secondmgt/192.168.2.133:8032  
  27. 15/01/19 20:21:18 INFO db.DataDrivenDBInputFormat: BoundingValsQuery: SELECT MIN(`src_id`), MAX(`src_id`) FROM `servers`  
  28. 15/01/19 20:21:18 INFO mapreduce.JobSubmitter: number of splits:3  
  29. 15/01/19 20:21:19 INFO Configuration.deprecation: mapred.job.classpath.files is deprecated. Instead, use mapreduce.job.classpath.files  
  30. 15/01/19 20:21:19 INFO Configuration.deprecation: user.name is deprecated. Instead, use mapreduce.job.user.name  
  31. 15/01/19 20:21:19 INFO Configuration.deprecation: mapred.cache.files.filesizes is deprecated. Instead, use mapreduce.job.cache.files.filesizes  
  32. 15/01/19 20:21:19 INFO Configuration.deprecation: mapred.cache.files is deprecated. Instead, use mapreduce.job.cache.files  
  33. 15/01/19 20:21:19 INFO Configuration.deprecation: mapred.reduce.tasks is deprecated. Instead, use mapreduce.job.reduces  
  34. 15/01/19 20:21:19 INFO Configuration.deprecation: mapred.output.value.class is deprecated. Instead, use mapreduce.job.output.value.class  
  35. 15/01/19 20:21:19 INFO Configuration.deprecation: mapreduce.map.class is deprecated. Instead, use mapreduce.job.map.class  
  36. 15/01/19 20:21:19 INFO Configuration.deprecation: mapred.job.name is deprecated. Instead, use mapreduce.job.name  
  37. 15/01/19 20:21:19 INFO Configuration.deprecation: mapreduce.inputformat.class is deprecated. Instead, use mapreduce.job.inputformat.class  
  38. 15/01/19 20:21:19 INFO Configuration.deprecation: mapred.output.dir is deprecated. Instead, use mapreduce.output.fileoutputformat.outputdir  
  39. 15/01/19 20:21:19 INFO Configuration.deprecation: mapreduce.outputformat.class is deprecated. Instead, use mapreduce.job.outputformat.class  
  40. 15/01/19 20:21:19 INFO Configuration.deprecation: mapred.cache.files.timestamps is deprecated. Instead, use mapreduce.job.cache.files.timestamps  
  41. 15/01/19 20:21:19 INFO Configuration.deprecation: mapred.output.key.class is deprecated. Instead, use mapreduce.job.output.key.class  
  42. 15/01/19 20:21:19 INFO Configuration.deprecation: mapred.working.dir is deprecated. Instead, use mapreduce.job.working.dir  
  43. 15/01/19 20:21:19 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_1421373857783_0035  
  44. 15/01/19 20:21:19 INFO impl.YarnClientImpl: Submitted application application_1421373857783_0035 to ResourceManager at secondmgt/192.168.2.133:8032  
  45. 15/01/19 20:21:19 INFO mapreduce.Job: The url to track the job: http://secondmgt:8088/proxy/application_1421373857783_0035/  
  46. 15/01/19 20:21:19 INFO mapreduce.Job: Running job: job_1421373857783_0035  
  47. 15/01/19 20:21:32 INFO mapreduce.Job: Job job_1421373857783_0035 running in uber mode : false  
  48. 15/01/19 20:21:32 INFO mapreduce.Job:  map 0% reduce 0%  
  49. 15/01/19 20:21:43 INFO mapreduce.Job:  map 33% reduce 0%  
  50. 15/01/19 20:21:46 INFO mapreduce.Job:  map 67% reduce 0%  
  51. 15/01/19 20:21:48 INFO mapreduce.Job:  map 100% reduce 0%  
  52. 15/01/19 20:21:48 INFO mapreduce.Job: Job job_1421373857783_0035 completed successfully  
  53. 15/01/19 20:21:48 INFO mapreduce.Job: Counters: 27  
  54.         File System Counters  
  55.                 FILE: Number of bytes read=0  
  56.                 FILE: Number of bytes written=275913  
  57.                 FILE: Number of read operations=0  
  58.                 FILE: Number of large read operations=0  
  59.                 FILE: Number of write operations=0  
  60.                 HDFS: Number of bytes read=319  
  61.                 HDFS: Number of bytes written=39  
  62.                 HDFS: Number of read operations=12  
  63.                 HDFS: Number of large read operations=0  
  64.                 HDFS: Number of write operations=6  
  65.         Job Counters  
  66.                 Launched map tasks=3  
  67.                 Other local map tasks=3  
  68.                 Total time spent by all maps in occupied slots (ms)=127888  
  69.                 Total time spent by all reduces in occupied slots (ms)=0  
  70.         Map-Reduce Framework  
  71.                 Map input records=3  
  72.                 Map output records=3  
  73.                 Input split bytes=319  
  74.                 Spilled Records=0  
  75.                 Failed Shuffles=0  
  76.                 Merged Map outputs=0  
  77.                 GC time elapsed (ms)=201  
  78.                 CPU time spent (ms)=7470  
  79.                 Physical memory (bytes) snapshot=439209984  
  80.                 Virtual memory (bytes) snapshot=2636304384  
  81.                 Total committed heap usage (bytes)=252706816  
  82.         File Input Format Counters  
  83.                 Bytes Read=0  
  84.         File Output Format Counters  
  85.                 Bytes Written=39  
  86. 15/01/19 20:21:48 INFO mapreduce.ImportJobBase: Transferred 39 bytes in 30.8769 seconds (1.2631 bytes/sec)  
  87. 15/01/19 20:21:48 INFO mapreduce.ImportJobBase: Retrieved 3 records.  
  88. 15/01/19 20:21:48 INFO tool.CodeGenTool: Beginning code generation  
  89. 15/01/19 20:21:48 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM `users` AS t LIMIT 1  
  90. 15/01/19 20:21:48 INFO orm.CompilationManager: HADOOP_MAPRED_HOME is /home/hadoopUser/cloud/hadoop/programs/hadoop-2.2.0  
  91. Note: /tmp/sqoop-hadoopUser/compile/0bdbced5e58f170e1670516db3339f91/users.java uses or overrides a deprecated API.  
  92. Note: Recompile with -Xlint:deprecation for details.  
  93. 15/01/19 20:21:48 INFO orm.CompilationManager: Writing jar file: /tmp/sqoop-hadoopUser/compile/0bdbced5e58f170e1670516db3339f91/users.jar  
  94. 15/01/19 20:21:48 INFO mapreduce.ImportJobBase: Beginning import of users  
  95. 15/01/19 20:21:48 INFO client.RMProxy: Connecting to ResourceManager at secondmgt/192.168.2.133:8032  
  96. 15/01/19 20:21:49 INFO db.DataDrivenDBInputFormat: BoundingValsQuery: SELECT MIN(`id`), MAX(`id`) FROM `users`  
  97. 15/01/19 20:21:49 INFO mapreduce.JobSubmitter: number of splits:4  
  98. 15/01/19 20:21:49 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_1421373857783_0036  
  99. 15/01/19 20:21:49 INFO impl.YarnClientImpl: Submitted application application_1421373857783_0036 to ResourceManager at secondmgt/192.168.2.133:8032  
  100. 15/01/19 20:21:49 INFO mapreduce.Job: The url to track the job: http://secondmgt:8088/proxy/application_1421373857783_0036/  
  101. 15/01/19 20:21:49 INFO mapreduce.Job: Running job: job_1421373857783_0036  
  102. 15/01/19 20:22:02 INFO mapreduce.Job: Job job_1421373857783_0036 running in uber mode : false  
  103. 15/01/19 20:22:02 INFO mapreduce.Job:  map 0% reduce 0%  
  104. 15/01/19 20:22:13 INFO mapreduce.Job:  map 25% reduce 0%  
  105. 15/01/19 20:22:18 INFO mapreduce.Job:  map 75% reduce 0%  
  106. 15/01/19 20:22:23 INFO mapreduce.Job:  map 100% reduce 0%  
  107. 15/01/19 20:22:23 INFO mapreduce.Job: Job job_1421373857783_0036 completed successfully  
  108. 15/01/19 20:22:23 INFO mapreduce.Job: Counters: 27  
  109.         File System Counters  
  110.                 FILE: Number of bytes read=0  
  111.                 FILE: Number of bytes written=368040  
  112.                 FILE: Number of read operations=0  
  113.                 FILE: Number of large read operations=0  
  114.                 FILE: Number of write operations=0  
  115.                 HDFS: Number of bytes read=401  
  116.                 HDFS: Number of bytes written=521  
  117.                 HDFS: Number of read operations=16  
  118.                 HDFS: Number of large read operations=0  
  119.                 HDFS: Number of write operations=8  
  120.         Job Counters  
  121.                 Launched map tasks=4  
  122.                 Other local map tasks=4  
  123.                 Total time spent by all maps in occupied slots (ms)=175152  
  124.                 Total time spent by all reduces in occupied slots (ms)=0  
  125.         Map-Reduce Framework  
  126.                 Map input records=13  
  127.                 Map output records=13  
  128.                 Input split bytes=401  
  129.                 Spilled Records=0  
  130.                 Failed Shuffles=0  
  131.                 Merged Map outputs=0  
  132.                 GC time elapsed (ms)=257  
  133.                 CPU time spent (ms)=10250  
  134.                 Physical memory (bytes) snapshot=627642368  
  135.                 Virtual memory (bytes) snapshot=3547209728  
  136.                 Total committed heap usage (bytes)=335544320  
  137.         File Input Format Counters  
  138.                 Bytes Read=0  
  139.         File Output Format Counters  
  140.                 Bytes Written=521  
  141. 15/01/19 20:22:23 INFO mapreduce.ImportJobBase: Transferred 521 bytes in 34.6285 seconds (15.0454 bytes/sec)  
  142. 15/01/19 20:22:23 INFO mapreduce.ImportJobBase: Retrieved 13 records.  
  143. 15/01/19 20:22:23 INFO tool.CodeGenTool: Beginning code generation  
  144. 15/01/19 20:22:23 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM `vmLog` AS t LIMIT 1  
  145. 15/01/19 20:22:23 INFO orm.CompilationManager: HADOOP_MAPRED_HOME is /home/hadoopUser/cloud/hadoop/programs/hadoop-2.2.0  
  146. Note: /tmp/sqoop-hadoopUser/compile/0bdbced5e58f170e1670516db3339f91/vmLog.java uses or overrides a deprecated API.  
  147. Note: Recompile with -Xlint:deprecation for details.  
  148. 15/01/19 20:22:23 INFO orm.CompilationManager: Writing jar file: /tmp/sqoop-hadoopUser/compile/0bdbced5e58f170e1670516db3339f91/vmLog.jar  
  149. 15/01/19 20:22:23 INFO mapreduce.ImportJobBase: Beginning import of vmLog  
  150. 15/01/19 20:22:23 INFO client.RMProxy: Connecting to ResourceManager at secondmgt/192.168.2.133:8032  
  151. 15/01/19 20:22:24 INFO db.DataDrivenDBInputFormat: BoundingValsQuery: SELECT MIN(`id`), MAX(`id`) FROM `vmLog`  
  152. 15/01/19 20:22:24 INFO mapreduce.JobSubmitter: number of splits:4  
  153. 15/01/19 20:22:24 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_1421373857783_0037  
  154. 15/01/19 20:22:24 INFO impl.YarnClientImpl: Submitted application application_1421373857783_0037 to ResourceManager at secondmgt/192.168.2.133:8032  
  155. 15/01/19 20:22:24 INFO mapreduce.Job: The url to track the job: http://secondmgt:8088/proxy/application_1421373857783_0037/  
  156. 15/01/19 20:22:24 INFO mapreduce.Job: Running job: job_1421373857783_0037  
  157. 15/01/19 20:22:37 INFO mapreduce.Job: Job job_1421373857783_0037 running in uber mode : false  
  158. 15/01/19 20:22:37 INFO mapreduce.Job:  map 0% reduce 0%  
  159. 15/01/19 20:22:47 INFO mapreduce.Job:  map 25% reduce 0%  
  160. 15/01/19 20:22:52 INFO mapreduce.Job:  map 75% reduce 0%  
  161. 15/01/19 20:22:58 INFO mapreduce.Job:  map 100% reduce 0%  
  162. 15/01/19 20:22:58 INFO mapreduce.Job: Job job_1421373857783_0037 completed successfully  
  163. 15/01/19 20:22:59 INFO mapreduce.Job: Counters: 27  
  164.         File System Counters  
  165.                 FILE: Number of bytes read=0  
  166.                 FILE: Number of bytes written=367872  
  167.                 FILE: Number of read operations=0  
  168.                 FILE: Number of large read operations=0  
  169.                 FILE: Number of write operations=0  
  170.                 HDFS: Number of bytes read=398  
  171.                 HDFS: Number of bytes written=635  
  172.                 HDFS: Number of read operations=16  
  173.                 HDFS: Number of large read operations=0  
  174.                 HDFS: Number of write operations=8  
  175.         Job Counters  
  176.                 Launched map tasks=4  
  177.                 Other local map tasks=4  
  178.                 Total time spent by all maps in occupied slots (ms)=171552  
  179.                 Total time spent by all reduces in occupied slots (ms)=0  
  180.         Map-Reduce Framework  
  181.                 Map input records=23  
  182.                 Map output records=23  
  183.                 Input split bytes=398  
  184.                 Spilled Records=0  
  185.                 Failed Shuffles=0  
  186.                 Merged Map outputs=0  
  187.                 GC time elapsed (ms)=182  
  188.                 CPU time spent (ms)=10480  
  189.                 Physical memory (bytes) snapshot=588107776  
  190.                 Virtual memory (bytes) snapshot=3523424256  
  191.                 Total committed heap usage (bytes)=337641472  
  192.         File Input Format Counters  
  193.                 Bytes Read=0  
  194.         File Output Format Counters  
  195.                 Bytes Written=635  
  196. 15/01/19 20:22:59 INFO mapreduce.ImportJobBase: Transferred 635 bytes in 35.147 seconds (18.067 bytes/sec)  
  197. 15/01/19 20:22:59 INFO mapreduce.ImportJobBase: Retrieved 23 records.  
  198. 15/01/19 20:22:59 INFO tool.CodeGenTool: Beginning code generation  
  199. 15/01/19 20:22:59 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM `vms` AS t LIMIT 1  
  200. 15/01/19 20:22:59 INFO orm.CompilationManager: HADOOP_MAPRED_HOME is /home/hadoopUser/cloud/hadoop/programs/hadoop-2.2.0  
  201. Note: /tmp/sqoop-hadoopUser/compile/0bdbced5e58f170e1670516db3339f91/vms.java uses or overrides a deprecated API.  
  202. Note: Recompile with -Xlint:deprecation for details.  
  203. 15/01/19 20:22:59 INFO orm.CompilationManager: Writing jar file: /tmp/sqoop-hadoopUser/compile/0bdbced5e58f170e1670516db3339f91/vms.jar  
  204. 15/01/19 20:22:59 INFO mapreduce.ImportJobBase: Beginning import of vms  
  205. 15/01/19 20:22:59 INFO client.RMProxy: Connecting to ResourceManager at secondmgt/192.168.2.133:8032  
  206. 15/01/19 20:23:00 INFO db.DataDrivenDBInputFormat: BoundingValsQuery: SELECT MIN(`id`), MAX(`id`) FROM `vms`  
  207. 15/01/19 20:23:00 INFO mapreduce.JobSubmitter: number of splits:4  
  208. 15/01/19 20:23:00 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_1421373857783_0038  
  209. 15/01/19 20:23:00 INFO impl.YarnClientImpl: Submitted application application_1421373857783_0038 to ResourceManager at secondmgt/192.168.2.133:8032  
  210. 15/01/19 20:23:00 INFO mapreduce.Job: The url to track the job: http://secondmgt:8088/proxy/application_1421373857783_0038/  
  211. 15/01/19 20:23:00 INFO mapreduce.Job: Running job: job_1421373857783_0038  
  212. 15/01/19 20:23:13 INFO mapreduce.Job: Job job_1421373857783_0038 running in uber mode : false  
  213. 15/01/19 20:23:13 INFO mapreduce.Job:  map 0% reduce 0%  
  214. 15/01/19 20:23:24 INFO mapreduce.Job:  map 25% reduce 0%  
  215. 15/01/19 20:23:28 INFO mapreduce.Job:  map 75% reduce 0%  
  216. 15/01/19 20:23:34 INFO mapreduce.Job:  map 100% reduce 0%  
  217. 15/01/19 20:23:35 INFO mapreduce.Job: Job job_1421373857783_0038 completed successfully  
  218. 15/01/19 20:23:35 INFO mapreduce.Job: Counters: 27  
  219.         File System Counters  
  220.                 FILE: Number of bytes read=0  
  221.                 FILE: Number of bytes written=367932  
  222.                 FILE: Number of read operations=0  
  223.                 FILE: Number of large read operations=0  
  224.                 FILE: Number of write operations=0  
  225.                 HDFS: Number of bytes read=401  
  226.                 HDFS: Number of bytes written=240  
  227.                 HDFS: Number of read operations=16  
  228.                 HDFS: Number of large read operations=0  
  229.                 HDFS: Number of write operations=8  
  230.         Job Counters  
  231.                 Launched map tasks=4  
  232.                 Other local map tasks=4  
  233.                 Total time spent by all maps in occupied slots (ms)=168328  
  234.                 Total time spent by all reduces in occupied slots (ms)=0  
  235.         Map-Reduce Framework  
  236.                 Map input records=8  
  237.                 Map output records=8  
  238.                 Input split bytes=401  
  239.                 Spilled Records=0  
  240.                 Failed Shuffles=0  
  241.                 Merged Map outputs=0  
  242.                 GC time elapsed (ms)=210  
  243.                 CPU time spent (ms)=10990  
  244.                 Physical memory (bytes) snapshot=600018944  
  245.                 Virtual memory (bytes) snapshot=3536568320  
  246.                 Total committed heap usage (bytes)=335544320  
  247.         File Input Format Counters  
  248.                 Bytes Read=0  
  249.         File Output Format Counters  
  250.                 Bytes Written=240  
  251. 15/01/19 20:23:35 INFO mapreduce.ImportJobBase: Transferred 240 bytes in 35.9131 seconds (6.6828 bytes/sec)  
  252. 15/01/19 20:23:35 INFO mapreduce.ImportJobBase: Retrieved 8 records.  
      由导入过程日志可知,其实多表导入过程也是一个个单表导入的整合。

      查看导入结果:

  1. [hadoopUser@secondmgt ~]$ hadoop fs -ls /output/  
  2. Found 4 items  
  3. drwxr-xr-x   - hadoopUser supergroup          0 2015-01-19 20:21 /output/servers  
  4. drwxr-xr-x   - hadoopUser supergroup          0 2015-01-19 20:22 /output/users  
  5. drwxr-xr-x   - hadoopUser supergroup          0 2015-01-19 20:22 /output/vmLog  
  6. drwxr-xr-x   - hadoopUser supergroup          0 2015-01-19 20:23 /output/vms  

四、多表导入Hive中

       我们将上述四个表导入到Hive中,如下:

  1. [hadoopUser@secondmgt ~]$ sqoop-import-all-tables --connect jdbc:mysql://secondmgt:3306/spice --username hive --password hive --hive-import --as-textfile --create-hive-table  

       查看结果:

  1.  hive> show tables;  
  2. OK  
  3. servers  
  4. users  
  5. vmlog  
  6. vms  
  7. Time taken: 0.022 seconds, Fetched: 4 row(s)  
       默认是导入到default数据库中,如果想指定导入到某个数据库中,可以使用--hive-database参数,如下:

  1. [hadoopUser@secondmgt ~]$ sqoop-import-all-tables --connect jdbc:mysql://secondmgt:3306/spice  --username hive --password hive --hive-import --hive-database test  --as-textfile --create-hive-table  


   

       

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
Sqoop详细介绍包括:sqoop命令,原理,流程【转】
Intellij IDEA中配置依赖 ---- Hadoop 普通 java 项目
本文将大数据学习门槛降到了地平线
配置hadoop
第二代map-reduce架构YARN解析
Sqoop使用
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服