Import and export data with Sqoop in HDFS

  • date 24th February, 2019 |
  • by Prwatech |
  • 0 Comments

Import and Export Data with Sqoop in HDFS

 

Import and export data with Sqoop in HDFS, Welcome to the world of advanced Tutorials on Hadoop technology. Are you looking forward to How to Import Data from MySQL to HDFS using sqoop?

 

There are many possible ways to Import and export data with Sqoop in HDFS, just follow the below-mentioned step by step process of How to import and export data from MySQL to HDFS using Sqoop tutorials which was originally designed by India’s Leading Hadoop Training institute Professionals who also offering advanced Hadoop Course and Certification Programs.

 

Import data from MySQL to HDFS using Sqoop

 

Install mysql on your machine,open terminal after open the terminal it asking for password enter password as root.

 

Import data with Sqoop in HDFS

 

Create database by using below command.

 

Import data with Sqoop in HDFS

 

Import data with Sqoop in HDFS

 

Use your created database use below command.

 

Import data with Sqoop in HDFS

 

Import data with Sqoop in HDFS

 

Create table .

 

Import data with Sqoop in HDFS

 

Insert values into created table.

 

Import data with Sqoop in HDFS

 

If you want to see the inserted data use below query.

 

Import data with Sqoop in HDFS

 

Import data with Sqoop in HDFS

 

Go to below link and download mysql-connector-java-5.1.26-bin.jar, link and put on cloudera desktop .

 

Copy mysql connector jar into sqoop using below command.

 

Import data with Sqoop in HDFS

 

Password is cloudera

 

Import data with Sqoop in HDFS

 

You can check weather jar file is copied sqoop/lib or not using below command.

 

Import data with Sqoop in HDFS

 

To check the IP address of your machine open machine command prompt and type below command.

 

Import data with Sqoop in HDFS

 

Import data with Sqoop in HDFS

 

In MySQL command prompt grant all privileges to IP address of VMnet1 by using below command.

 

Import data with Sqoop in HDFS

 

Import data from mysql to sqoop

 

Using below syntax : Sqoop/bin$ sqoop import –connect jdbc:mysql:ipaddress/databasename

–table <tablename> –username <username of mysql> –P –target-dir /dirname -m 1

Import data with Sqoop in HDFS

 

EnterPassword: root

 

Import data with Sqoop in HDFS

 

Import data with Sqoop in HDFS

 

To check output : Open browser and go to /usr/sqoopOut/part-m-00000

 

Import data with Sqoop in HDFS

 

Export Data from HDFS to MySQL using Sqoop

 

Create table in mysql

 

Export data with Sqoop in HDFS

 

Use below command for export data from hdfs to mysql

 

Syntax: Sqoop/bin$ sqoop export –connect jdbc://ipaddress/databasename –username username –password password –table tablename –export-dir /dirname

 

Export data with Sqoop in HDFS

 

To check data where data exported use below query

 

Export data with Sqoop in HDFS

Get success in your career as a Hadoop developer by being a part of the Prwatech, India’s leading Hadoop training institute in Bangalore.

 

 

0
0

Quick Support

image image