Save data into mysql from hive hadoop through sqoo

2019-06-11 13:06发布

I have my data store into hive table. i want to transfer hive tables selected data to mysql table using sqoop.

Please guide me how to do this?

2条回答
地球回转人心会变
2楼-- · 2019-06-11 13:42

You need to use sqoop export, here is the example

sqoop export --connect "jdbc:mysql://quickstart.cloudera:3306/retail_rpt_db" \
   --username retail_dba \
   --password cloudera \
   --table departments \
   --export-dir /user/hive/warehouse/retail_ods.db/departments \
   --input-fields-terminated-by '|' \
   --input-lines-terminated-by '\n' \
   --num-mappers 2 

sqoop export to export data to mysql from Hadoop.

  1. --connect JDBC url
  2. --username mysql username
  3. --password password for mysql user
  4. --table mysql table name
  5. --export-dir valid hadoop directory
  6. --input-fields-terminated-by column delimiter in Hadoop
  7. --input-lines-terminated-by row delimiter in Hadoop
  8. --num-mappers number of mappers to process the data
查看更多
smile是对你的礼貌
3楼-- · 2019-06-11 14:02

check out the sqoop guide here

查看更多
登录 后发表回答