How to Import data into HBase from MySQL using Sqoop

Sqoop is a tool designed to transfer data between Hadoop and relational database servers
sandeep007
Posts: 2
Joined: Sat Aug 19, 2017 1:47 pm

Sat Aug 19, 2017 1:49 pm

Can we import data into HBase from MySQL using Sqoop? If yes then which columns will go to in which column family and what will become my Row key?
Administrator
Site Admin
Posts: 6
Joined: Wed Jul 12, 2017 7:24 am

Sat Aug 19, 2017 1:51 pm

Import Data into HBase from MYSql Using Sqoop
Yes. You can definitely import the data from MySQL into HBASE. Please use the following command :

Code: Select all

sqoop import --connect jdbc:mysql://mydbserver.com/sqoopex3 --table widgets --hbase-table 'customer' --column-family cf1 --username root --password '' --hbase-create-table --columns a1,b1 --hbase-row-key id
The above command connects to the the mysql database on mydbserver.com and imports the "widgets" table into hbase table 'myhbasetable' into a column family cf1. It import a1 and b1 columns only. If you have other column families and you want to move data from some other mysql columns to the other column families. You can execute the above command again :

Code: Select all

sqoop import --connect jdbc:mysql://mydbserver.com/sqoopex3 --table widgets --hbase-table 'customer' --column-family cf2 --username root --password '' --hbase-create-table --columns c1,d1 --hbase-row-key id
LarryBedeprifupe
Posts: 1
Joined: Thu Nov 02, 2017 12:07 pm

Thu Nov 16, 2017 6:19 am

How can I import a MySQL dumpfile into my database? My old hosting provider gave me data.sql file. I do have access via ssh to server.

Can anybody give light on this?
Post Reply