2017-07-05 20 views
1

Sqoop導入腳本:Sqoop進口--target-dir的不工作,而不是放在默認目錄下的文件

sqoop import --connect jdbc:mysql://localhost/retail_db --username root --password cloudera --target-dir /user/cloudera/retail_db/products_test --table products --hive-import --create-hive-table --hive-table retail_db.products_test 

成功sqoop進口和蜂巢表創建後 位置是/hive/warehouse/retail_db.db/products_test代替/用戶/ Cloudera的/ retail_db/products_test

HIVE:

SHOW CREATE TABLE products_test; 


CREATE TABLE `products_test`(
    `product_id` int, 
    `product_category_id` int, 
    `product_name` string, 
    `product_description` string, 
    `product_price` double, 
    `product_image` string) 
COMMENT 'Imported by sqoop on 2017/07/05 05:52:43' 
ROW FORMAT SERDE 
    'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe' 
WITH SERDEPROPERTIES ( 
    'field.delim'='\u0001', 
    'line.delim'='\n', 
    'serialization.format'='\u0001') 
STORED AS INPUTFORMAT 
    'org.apache.hadoop.mapred.TextInputFormat' 
OUTPUTFORMAT 
    'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat' 
LOCATION 
    'hdfs://quickstart.cloudera:8020/user/hive/warehouse/retail_db.db/products_test' 
TBLPROPERTIES (
    'COLUMN_STATS_ACCURATE'='true', 
    'numFiles'='4', 
    'totalSize'='173993', 
    'transient_lastDdlTime'='1499259177') 
Time taken: 0.892 seconds, Fetched: 25 row(s) 

回答

0

目錄/用戶/ Cloudera的是,其中數據被導入,這將b被蜂巢拾起並創建表格。因此,這個目錄中創建一個蜂巢表u需要重新框查詢像

sqoop import --connect jdbc:mysql://localhost/retail_db --username root --password cloudera --target-dir /user/cloudera/retail_db/products_test --table products --hive-import --create-hive-table --hive-table --warehouse-dir /user/cloudera retail_db.products_test 

我已經添加了倉庫目錄( - 倉庫DIR)選項。希望能幫助到你。

相關問題