安裝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