importing data from sql server to hbase

2019-06-13 19:29发布

问题:

I know that Sqoop allows us to import data from a RDBMS into HDFS. I was wondering if the sql server connector in sqoop also allows us to import it directly into HBase? I know we can do this with mysql. I was wondering if the same can be done with sql server too

回答1:

I am working in the Hortonworks Sandbox, and I was able to pull data from a SQL Server instance into an HBase table by doing the following steps:

  1. Get the SQL Server JDBC driver onto the Hadoop box.

curl -L 'http://download.microsoft.com/download/0/2/A/02AAE597-3865-456C-AE7F-613F99F850A8/sqljdbc_4.0.2206.100_enu.tar.gz' | tar xz

  1. Copy the driver into the correct location for sqoop to be able to find it:

cp sqljdbc_4.0/enu/sqljdbc4.jar /usr/lib/sqoop/lib

  1. Run a sqoop import

sqoop import --hbase-create-table --hbase-table table_name_in_hbase --column-family cf_name --hbase-row-key my_ID --connect "jdbc:sqlserver://hostname:1433;database=db_name;username=sqoop;password=???" --table tablename_in_sql_server -m 1

I referenced these sites:

http://hortonworks.com/hadoop-tutorial/import-microsoft-sql-server-hortonworks-sandbox-using-sqoop/

http://souravgulati.webs.com/apps/forums/topics/show/8680714-sqoop-import-data-from-mysql-to-hbase



回答2:

It is possible to directly import data into HBase from any relational database using Sqoop. This post how it can be done using a Mysql Database Server and import it directly to HBase.



回答3:

you can import data into HBase from any RDBMS as lons as it provides JDBC driver. Sqoop interface with any other RDBMS is using JDBC.