sqoop import --connect jdbc:mysql://ip:3306/bunny --username bunny --password /ChiVspa0gT1lhlCYwFOk= --table b_base_startid --hive-table dmp.b_base_startid --hive-import --hive-overwrite --null-string '' --null-non-string '' --fields-terminated-by '|' --lines-terminated-by '\n' --m 1 --delete-target-dir
sqoop import --connect jdbc:mysql://ip:3306/bunny --username bunny --password 83OGCufr9 --table b_building_property_demographic --hive-table dmp.b_building_property_demographic --hive-import --hive-overwrite --null-string '' --null-non-string '' --fields-terminated-by '|' --lines-terminated-by '\n' --m 1 --delete-target-dir
sqoop export:申明导出操作
–connect jdbc:mysql://cdh1:3306/kabaobao:将要导入的mysql数据库–table behavior:将要导入的mysql数据库表名
–username root –password 123:mysql数据库的账号密码
–fields-terminated-by ‘|’:申明字段区分符号,以Hive表中的字段区分符号作为mysql的字段区分符号
–export-dir /user/hive/warehouse/test.db/behavior1 :将要导出的hive表在hdfs中的目录
数据库中的数据同步到hive中语句
数据库中的数据导入到hive中
sqoop export --connect jdbc:mysql://ip:3306/bunny --table b_base_buildid_devicecount --username bunny --password 83OGCufr9 --fields-terminated-by '|' --export-dir /user/hive/warehouse/dmp.db/b_base_buildid_devicecount