问题导读:
1、--connect参数作用?
2、使用哪个参数从控制台读取数据库访问密码?
3、Sqoop将关系型数据库表中数据导入HDFS基本参数要求及命令?
4、数据默认导入HDFS文件系统中的路径?
5、--columns参数的作用?
6、--where参数的作用?
一、部分关键参数介绍
参数介绍
--connect <jdbc-uri> 指定关系型数据库JDBC连接字符串
--connection-manager <class-name> 指定数据库使用的管理类
--driver <class-name> 手动指定要使用JDBC驱动程序类
--hadoop-mapred-home <dir> 重写覆盖$HADOOP_MAPRED_HOME
--help 使用提示帮助提示
--password-file 设置包含身份验证密码的路径文件
-P 从控制台读取数据库访问密码
--password <password> 设置数据库身份验证密码
--username <username> 设置数据库访问用户
--verbose 打印更多程序执行流程信息
--connection-param-file <filename> 用于提供连接参数的可选的属性文件
二、要导出的MySQL数据库
[hadoopUser@secondmgt ~]$ mysql -uhive -phive spice
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 419
Server version: 5.1.73 Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> select * from users;
+----+----------+----------+-----+---------+------------+-------+------+
| id | username | password | sex | content | datetime | vm_id | isad |
+----+----------+----------+-----+---------+------------+-------+------+
| 56 | hua | hanyun | 男 | 开通 | 2013-12-02 | 0 | 1 |
| 58 | feng | 123456 | 男 | 开通 | 2013-11-22 | 0 | 0 |
| 59 | test | 123456 | 男 | 开通 | 2014-03-05 | 58 | 0 |
| 60 | user1 | 123456 | 男 | 开通 | 2014-06-26 | 66 | 0 |
| 61 | user2 | 123 | 男 | 开通 | 2013-12-13 | 56 | 0 |