Dussehra Offer - Flat 20% Off on All Courses | Offer Ending In :
# In Hue, Get the location of mysql Jar /user/oozie/share/lib/sqoop/mysql-connector-java.jar # Go to Workflows -> Editors # Click on Create Button on right site #Drag and drop sqoop1 # Set the password in following command and copy paste # Also, change the HDFS absolute location import --connect jdbc:mysql://ip-172-31-13-154:3306/sqoopex --username sqoopuser --password NHkkP876rp --table widgets --target-dir hdfs:///user/sandeepgiri9034/widgets_import # Add the files of mysql connector # Save and Submit # Open File Browser check if the files are created.
[Oozie - Example - Using Hue]
Let’s run an Oozie job using Hue. Hue provides a really nice UI for defining workflows. We will run Sqoop import where we will take data from MySQL widgets table in sqoopex database and push to HDFS.
Login to Hue. Click on “Workflows”, and then “Editors". It will open a dashboard with our previous workflows. Click on “Create”. Select action as “sqoop1” and drop it to the editor. Type in command displayed on the screen. ip-172-31-13-154 is the host where MySQL server is running. We can find MySQL host, username and password from “MySQL Credentials” section under “My Lab”. We will be storing the data in widgets_import directory in HDFS under our home directory.
Click on "Add"
Now specify MySQL connector JAR which is located at /user/oozie/share/lib/sqoop. Click on “Files” and add the MySQL connector JAR
Let's name our workflow as “Sqoop import”. Press Enter. Click on “save” and then click on “Submit”. Click on “Submit” when the confirmation dialog popups.
Our job has started running now. We'll Wait for some time to get it executed. To see the data let’s go to the widgets_import directory in HDFS. We can see multiple files inside widgets_import containing data from widgets table.
Taking you to the next exercise in seconds...