首页 > 大数据 > Hadoop > sqoop简单使用


原创 Hadoop 作者:suifeng2316 时间:2015-04-16 17:30:46 0 删除 编辑
[hadoop@dbsrv1 bin]$ ./sqoop help
Available commands:
  codegen            Generate code to interact with database records
  create-hive-table  Import a table definition into Hive
  eval               Evaluate a SQL statement and display the results
  export             Export an HDFS directory to a database table
  help               List available commands
  import             Import a table from a database to HDFS
  import-all-tables  Import tables from a database to HDFS
  job                Work with saved jobs
  list-databases     List available databases on a server
  list-tables        List available tables in a database
  merge              Merge results of incremental imports
  metastore          Run a standalone Sqoop metastore
  version            Display version information
[hadoop@dbsrv1 lib]$ pwd
[hadoop@dbsrv1 bin]$ ./sqoop list-databases --connect jdbc:mysql://localhost:3306/ --username root --password aaa#123
[hadoop@dbsrv1 bin]$ ./sqoop list-tables   --connect jdbc:mysql://localhost:3306/jiradb --username root --password aaa#123
[hadoop@dbsrv1 bin]$ ./sqoop  import --table avatar --fields-terminated-by '==' -m 1 --connect jdbc:mysql://localhost:3306/jiradb --username root --password aaa#123

[hadoop@dbsrv1 lib]$ sqoop import --table t_guide --fields-terminated-by '\t' -m 1 --connect jdbc:oracle:thin:@ --username test --password=test#123 
15/04/16 16:33:58 INFO sqoop.Sqoop: Running Sqoop version: 1.4.5
15/04/16 16:33:59 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.
15/04/16 16:33:59 INFO oracle.OraOopManagerFactory: Data Connector for Oracle and Hadoop is disabled.
15/04/16 16:33:59 INFO manager.SqlManager: Using default fetchSize of 1000
15/04/16 16:33:59 INFO tool.CodeGenTool: Beginning code generation
15/04/16 16:34:00 INFO manager.OracleManager: Time zone has been set to GMT
15/04/16 16:34:00 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM t_guide t WHERE 1=0
15/04/16 16:34:02 ERROR tool.ImportTool: Imported Failed: There is no column found in the target table t_guide. Please ensure that your table name is correct.

[hadoop@dbsrv1 lib]$ sqoop import --table T_GUIDE --fields-terminated-by '\t' -m 1 --connect jdbc:oracle:thin:@ --username test --password=test#123 
记录:将一个oracle表 记录数:260w,物理大小4G,从oracle到hdfs用时4m

来自 “ ITPUB博客 ” ,链接:,如需转载,请注明出处,否则将追究法律责任。

上一篇: sqooq安装
下一篇: hive在centos上安装
请登录后发表评论 登录


  • 博文量
  • 访问量