The first is to install the MySQL database. Installation is complete using the sudo apt-get install mysql-server command. The table is then created and the data is inserted:
Then download the Sqoop and the jar package that connects to the MySQL database. The next step is to install Sqoop. The first is to configure the sqoop-env.sh file:
Then comment out the Config-sqoop file that does not need to be checked:
The next step is to copy the Sqoop-1.4.4.jar package and the jar that connects MySQL to the Lib directory in the Hadoop directory, and copy the Hadoop-core-1.2.1.jar package to the Sqoop Lib directory. Then start Sqoop successfully.
The following is the export of the Dept table in the MySQL database to HDFs: The Export command is: Sqoop import jdbc:mysql://localhost:3306/mysql--username root--password "--table dept-m 1
Then we look at the results.
Come here, finally got it! The data exchange between the relational database and HDFs is realized.
Install Sqoop and export table data from MySQL to a text file under HDFs