Sqoop的简单使用

it2024-04-19  2

Sqoop的简单使用

RDBMS到HDFS

全部导入

$ bin/sqoop import \ --connect jdbc:mysql://192.168.34.21:3306/company \ --username root \ --password 123456 \ --table staff \ --target-dir /company \ --delete-target-dir \ --fields-terminated-by "\t" \ --num-mappers 1 \ --split-by id

导入指定列 –columns

$ bin/sqoop import \ --connect jdbc:mysql://hadoop101:3306/company \ --username root \ --password 123456 \ --table staff \ --columns id,name \ --target-dir /company \ --delete-target-dir \ --fields-terminated-by "\t" \ --num-mappers 1 \ --split-by id

提示:columns中如果涉及到多列,用逗号分隔,分隔时不要添加空格

导入指定行 –where

$ bin/sqoop import \ --connect jdbc:mysql://hadoop101:3306/company \ --username root \ --password 123456 \ --table staff \ --where 'id >= 1 an
最新回复(0)