In this recipe, we'll be using Sqoop2 or Sqoop 1.4.x to export data from HDFS to a PostgreSQL database.
A working Hadoop2 cluster with a Sqoop2 or Sqoop 1.4.x installation is required for this recipe.
We will be using a PostgreSQL database. You can also use another RDBMS for this purpose as well, but the following recipe steps will have to be changed accordingly.
Follow the previous recipe, Importing data to HDFS from a relational database using Apache Sqoop.
This section demonstrates how to export data from HDFS to a PostgreSQL database using SQOOP. Proceed with the following steps:
Follow the step 1 of the previous Importing data to HDFS from a relational database using Apache Sqoop recipe to create a user and a database in the PostgreSQL database.
Create a database table using the following statements in the PostgreSQL shell:
$ psql test test=> CREATE TABLE bookcrossing.ratings_copy (user_id...