导入hdfs:
bin/sqoop import
–connect jdbc:mysql://master:3306/ke_eleloss
–username hadoop
–password hadoop
–query “select * from transRecord where nodeId=1 and $CONDITIONS”
–target-dir hdfs://master:9000/lineloss_test
–direct
–fields-terminated-by ‘\t’
–m 1
直接从mysql导入到hive:(如果是双引号的话要在$CONDITIONS前面加转义字符)
bin/sqoop import
–connect jdbc:mysql://master:3306/ke_eleloss
–username hadoop
–password hadoop
–query “select * from transRecord where nodeId=1 and $CONDITIONS”
–target-dir hdfs://master:9000/user/hive/warehouse/test.db/transrecord
–fields-terminated-by ‘\t’
–hive-import
–hive-database test
–hive-table transRecord
–m 1