Sqoop with MySQL-part-1

Sqoop with MySQL-part-1

Sqoop with MySQL-part-1

Import data from mysql to hdfs
Loading data from mysql to sqooop

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

β€’ Create database by using below command.

β€’ Use your created database use below command.

β€’ Create table .

β€’ Insert values into created table.

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

οƒ˜ Go to below link and download mysql-connector-java-5.1.26-bin.jar,
http://prwatech.in/online-support/ and put on cloudera desktop .
β€’ Copy mysql connector jar into sqoop using below command.

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

β€’ To check the ipaddress of your machine open machine command prompt and type below command.

β€’ In Mysql command prompt grant all privillagies to ipaddress of VMnet1
By using below command.

οƒ˜ Import data from mysql to sqoop
Using below syntax
Sqoop/bin$ sqoop import –connect jdbc:mysql:ipaddress/databasename
–table tablename –username password –P –target-dir /dirname -m 1

οƒ˜ To check output
β€’ Open browser and go to /usr/sqoopOut/part-m-00000

IMPORT DATA FROM MYSQL USING PRIMARY KEY
1. Create Table Test inside database prwatech, where P_id is used as a Primary Key

2. In VMware type the command as given below in the screenshot-

3. Now In the HDFS the file will be displayed as-

Call our Counselors ✆+91 8147111254