安装sqoop 步骤略.
mysql
启动sqoop:sql
成功启动!windows
在本地mysql(windows) 建立表:tbl_placeoop
字段:spa
1、Transferring an Entire Table:code
1. 命令为:ci
sqoop import \get
--connect jdbc:mysql://mysql.example.com/sqoop \input
--username sqoop \it
--password sqoop \
--table cities
检查建立的文件内容:
2、Specifying a Target Directory
1.
sqoop import \
--connect jdbc:mysql://XXXX/sqoop \
--username root \
--password root \
--table tbl_place \
--target-dir /etl/input/tbl_place
执行命令前:创建好目录etl、input
3、Specifying a Target parent Directory
1.
sqoop import \
--connect jdbc:mysql:/xxxxxx/sqoop \
--username root \
--password root \
--table tbl_place \
--warehouse-dir /etl/input/
4、Importing Only a Subset of Data
1.
sqoop import \
--connect jdbc:mysql://xxxxxx/sqoop \
--username root \
--password root \
--table bl_place \
--where "place_code=2"
5、Protecting Your Password(Here’s a Sqoop execution that will read the password from standard input:)
1.
sqoop import \
--connect jdbc:mysql://xxx/sqoop \
--username root \
--table tbl_place \
-P
会提示你输入密码。输入便可回车便可!
2.Here’s an example of reading the password from a file:
sqoop import \
--connect jdbc:mysql://mysql.example.com/sqoop \
--username sqoop \
--table cities \
password-file my-sqoop-password