2017-07-05 22 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)选项。希望能帮助到你。

相关问题