32 BDA Exp2
32 BDA Exp2
Experiment No: 2
Name : Jess John Roll No : 32
Batch : B
Topic: Use of Sqoop tool to transfer data between Hadoop and relational
databaseservers.
a. Sqoop and MySQL - Installation.
To execute basic commands of Hadoop eco system component Sqoop.
Prerequi o Familiarity with command-line interfaces such as bash
site: o Basic knowledge of Relational database management systems.
MySQL Basic familiarity with the purpose and operation of Hadoop
o
Mapping CSL704.3
With
COs:
Objectiv Ingest data using Sqoop.
e:
Outcome Students will be able to use the Sqoop tool - for transferring data between Hadoop
: &relational databases
Instructi This experiment is a compulsory experiment. All the students are required to
ons: perform this experiment individually.
Faculty: Sana Shaikh Lab Manual - BDA 2024-2025
Delivera SQOOP INSTALLATION
bles: Sqoop is a tool designed to transfer data between Hadoop and relational
database servers. It is used to import data from relational databases such
as MySQL, Oracle to Hadoop HDFS, and export from Hadoop file
system to relational databases. The traditional application management
system, that is, the interaction of applications with relational database
using RDBMS, is one of the sources that generate Big Data. Such Big
Data, generated by RDBMS, isstored in Relational Database Servers in
the relational database structure.
When Big Data storages and analyzers such as MapReduce, Hive, HBase,
Cassandra, Pig, etc. of the Hadoop ecosystem came into picture, they required a tool
tointeract with the relational database servers for importing and
exporting the Big Data residing in them. Here, Sqoop occupies a place
in the Hadoop ecosystem to provide feasible interaction between
relational databaseserver and Hadoop’s HDFS.
Sqoop Import
The import tool imports individual tables from RDBMS to HDFS. Each
row ina table is treated as a record in HDFS. All records are stored as
text data in text files or as binary data in Avro and Sequence files.
Sqoop Export
The export tool exports a set of files from HDFS back to an RDBMS.
The filesgiven as input to Sqoop contain records, which are called as
rows in table.
Those are read and parsed into a set of records and delimited with
userspecified delimiter.
4. Now save this bashrc file permanently by the command source ~/.bashrc
To add contents in the sqoopenv.sh file use the command: nano sqoopenv.sh
Faculty: Sana Shaikh Lab Manual - BDA 2024-2025
Crtl+X...Y ...Enter
3. To login to the MySQL user, use the following command: mysql u root p
Faculty: Sana Shaikh Lab Manual - BDA 2024-2025
It will be asked to enter the password for the corresponding user. Enter the
password. Now the MySQL script will run and the user will be logged in. This
verifies the successful completion of the MySQL installation onto the system.
IMPORT/EXPORT
1. We check if all the services are running using the jps command.
5. Now we create a table in mysql which we will import into HDFS. create table
Faculty (id int primary key, name varchar(10), city varchar(10), salary bigint);
Faculty: Sana Shaikh Lab Manual - BDA 2024-2025
8. Now, we grant privileges to the user so that we can perform import function.
grantall privileges on *.* to ‘root’@’localhost’;
http://localhost:50070/explorer.html#/user/slade/Faculty
Faculty: Sana Shaikh Lab Manual - BDA 2024-2025
mmm
Conclusi Students will be able to use Sqoop tool for transferring data between
on: Hadoop &relational databases
Referenc http://moodle.dbit.in/
es: https://www.edureka.co/blog/apache-sqoop-tutorial/
https://dwgeek.com/sqoop-command-with-secure-password.html/