0

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?

amitp
  • 23
  • 2
  • 4

2 Answers2

1

check out the sqoop guide here

Satya
  • 8,693
  • 5
  • 34
  • 55
1

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
Durga Viswanath Gadiraju
  • 3,896
  • 2
  • 14
  • 21