TalendOpenStudio BigData GettingStarted 5.4.1 en
TalendOpenStudio BigData GettingStarted 5.4.1 en
5.4.1
Adapted for v5.4.1. Supersedes previous Getting Started Guide releases. Publication date: December 12, 2013
Copyleft
This documentation is provided under the terms of the Creative Commons Public License (CCPL). For more information about what you can and cannot do with this documentation in accordance with the CCPL, please read: http://creativecommons.org/licenses/by-nc-sa/2.0/
Notices
All brands, product names, company names, trademarks and service marks are the properties of their respective owners.
Table of Contents
Preface ................................................. v
1. General information . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1. Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2. Audience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3. Typographical conventions . . . . . . . . . . . 2. Feedback and Support . . . . . . . . . . . . . . . . . . . . . . . . v v v v v
Chapter 2. Getting started with Talend Big Data using the demo project .............. 5
2.1. Introduction to the Big Data demo project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.1. Hortonworks_Sandbox_Samples . . . . . . . . . . 2.1.2. NoSQL_Examples . . . . . . . . . . . . . . . . . . 2.2. Setting up the environment for the demo Jobs to work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2.1. Installing Hortonworks Sandbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2.2. Understanding context variables used in the demo project . . . . . . . . . 6 6 8 8 8 9
Preface
1. General information
1.1. Purpose
Unless otherwise stated, "Talend Studio" or "Studio" throughout this guide refers to any Talend Studio product with Big Data capabilities.
This Getting Started Guide explains how to manage Big Data specific functions of Talend Studio in a normal operational context. Information presented in this document applies to Talend Studio releases beginning with 5.4.1.
1.2. Audience
This guide is for users and administrators of Talend Studio.
The layout of GUI screens provided in this document may vary slightly from your actual GUI.
http://talendforge.org/forum
vi
Three different types of functional blocks are defined: at least one Studio where you can design big data Jobs that leverage the Apache Hadoop platform to handle large data sets. These Jobs can be either executed locally or deployed, scheduled and executed on a Hadoop grid via the Oozie workflow scheduler system integrated within the studio. a workflow scheduler system integrated within the studio through which you can deploy, schedule, and execute big data Jobs on a Hadoop grid and monitor the execution status and results of the Jobs. a Hadoop grid independent of the Talend system to handle large data sets.
Chapter 2. Getting started with Talend Big Data using the demo project
This chapter provides short descriptions about the sample Jobs included in the demo project and introduces the necessary preparations required to run the sample Jobs on a Hadoop platform. For how to import a demo project, see the section on importing a demo project of Talend Studio User Guide. Before you start working in the studio, you need to be familiar with its Graphical User Interface (GUI). For more information, see the appendix describing GUI elements of Talend Studio User Guide.
With the Big Data demo project imported and opened in your Talend studio, all the sample Jobs included in it are available in different folders under the Job Designs node of the Repository tree view.
The following sections briefly describe the Jobs contained in each sub-folder of the main folders.
2.1.1. Hortonworks_Sandbox_Samples
The main folder Hortonworks_Sandbox_Samples gathers standard Talend Jobs that are intended to demonstrate how handle data on a Hadoop platform.
Hortonworks_Sandbox_Samples
Folder Advanced_Examples
Sub-folder
Description The Advanced_Examples folder has some use cases, including an example of processing Apache Weblogs using the Talend's Apache Weblog, HCatalog and Pig components, an example of computing US Government Spending data using a Hive query, and an example of extracting data from any MySQL database and loading all the data from the tables dynamically. If there are multiple steps to achieve a use case they are named Step_1, Step_2 and so on.
ApacheWebLog
This folder has a classic Weblog file process that shows loading an Apache web log into HCatalog and HDFS and filtering out specific codes. There are two examples computing counts of unique IP addresses or web codes. These examples use Pig Scripts and HCatalog load. There are 6 steps in this example, run each step in the order listed in the Job names. For more details of this example, see section Gathering Web traffic information using Hadoop of appendix Big Data Job examples, which guides you step by step through the creation and configuration of the example Jobs.
Gov_Spending_Analysis
This is an example of a two-step process that loads some sample US Government spending data into HCatalog and then in step two it uses a Hive query to get the total spending amount per Government agency. There is an extra Data Integration Job that takes a file from the http://usaspending.gov/data web site and prepares it for the input to the Job that loads the data to HCatalog. You will need to replace the tFixedFlowInput component with the input file. There are 2 steps in this example, run each step in the order listed in the Job names.
RDBMS_Migration_SQOOP
This is a two step process that will read data from any MySQL schema and load it to HDFS. The database can be any MySQL5.5 or newer. The schema needs to have as many tables as you desire. Set the database and the schema in the context variables labeled SQOOP_SCENARIO_CONTEXT and the first Job will dynamically read the schema and create two files with list of tables. One file consists of tables with Primary Keys to be partitioned in HCatalog or Hive if used and the second one consists of the same tables without Primary Keys. The second step uses the two files to then load all the data from MySQL tables in the schema to HDFS. There will be a file per table. Keep in mind when running this process not to select a schema with a large amount of volume if you are using the Sandbox single node VM, as it has not a lot of power. For more information on using the proposed Sandbox single node VM, see section Installing Hortonworks Sandbox.
E2E_hCat_2_Hive
This folder contains a very simple process that loads some sample data to HCatalog in the first step and then in the second step just shows how you can use the Hive components to access and process the data. This folder contains simple examples of how to load data to HBase and read data from it. There are two examples for HCatalog: the first one puts a file directly on the HDFS and then loads the meta store with the information into HCatalog. The second example loads data streaming directly into HCatalog in the defined partitions. The examples in this folder show the basic HDFS operations like Get, Put, and Streaming loads. This folder contains three examples: the first Job shows how to use the Hive components to complete basic operations on Hive like creating a database, creating a table and loading data to the table. The next two
HBASE HCATALOG
HDFS HIVE
NoSQL_Examples
Folder
Sub-folder
Description Jobs shows first how to load two tables to Hive, which are then used in the second step, an example of how you can do ELT with Hive. This folder contains many different examples of how Pig components can be used to perform many different key functions such as aggregations and filtering and an example of how the Pig Code works.
PIG
2.1.2. NoSQL_Examples
The main folder NoSQL_Examples gathers Jobs that are intended to demonstrate how to handle data with NoSQL databases.
Folder Cassandra MongoDB Description This is another example of how to do the basic write and read to the Cassandra Database to then start using the Cassandra NoSQL database right away. This folder has an example of how to use MongoDB to easily and quickly search open text unstructured data for blog entries with key words.
2. 3.
4.
5.
Start the Hortonworks Sandbox virtual appliance to get the Hadoop platform up and running, and check that the IP address assigned to the Sandbox virtual machine is pingable.
Then, before launching the demo Jobs, add an IP-domain mapping entry in your hosts file to resolve the host name sandbox, which is defined as the value of a couple of context variables in this demo project, rather than using an IP address of the Sandbox virtual machine, as this will minimize the changes you will need to make to the configured context variables. For more information about context variables used in the demo project, see section Understanding context variables used in the demo project.
To view or edit the settings of the context variables of a group, double-click the group name in the Repository tree view to open the [Create / Edit a context group] wizard, and then select the Values as tree or Values as table tab.
The context variables in the HDP group are used in all the demo examples in the Hortonworks_Sandbox_Samples folder. If you want, you can change the values of these variables. For example, if you want to use the IP address for the Sandbox Platform VM rather than the host name sandbox, you can change the value of the host name variables to the IP address. If you change any of the default configurations on the Sandbox VM, you need to change the context settings accordingly; otherwise the demo examples may not work as intended.
Variable name namenode_host namenode_port user templeton_host templeton_port hive_host hive_port jobtracker_host jobtracker_port mysql_host mysql_port mysql_user mysql_passed mysql_testes Description Namenode host name Namenode port User name to connect to the Hadoop system HCatalog server host name HCatalog server port Hive metastore host name Hive metastore port Jobtracker host name Jobtracker port Host of the Sandbox for the Hive metastore Port of the Hive metastore User name to connect to the Hive metastore Password to connect to the Hive metastore Name of the test database for the Hive metastore Default value sandbox 8020 sandbox sandbox 50111 sandbox 9083 sandbox 50300 sandbox 3306 hep hep testes
10
The context variables in the SQOOP_SCENARIO_CONTEXT group are used for the RDBMS_Migration_SQOOP demo examples only. You will need to go through the following context variables and update your information for the Sandbox VM on your local MySQL connections if you want to use the RDBMS_Migration_SQOOP demo.
Description
Default value
A directory holding table files on your local machine that C:/Talend/BigData/ the studio has full access to Name of your own MySQL database to migrate to HDFS dstar_crm Host name or IP address of the MySQL database Port of the MySQL database User name to connect to the MySQL database Password to connect to the MySQL database Target location on the Sandbox HDFS where you want /user/hdp/sqoop/ to load the data 192.168.56.1 3306 tisadmin
To use project-level context variables in a Job, you need to import them into the Job first by clicking the button in the Context view. You can also define context variables in the Contexts view of a Job. These variables are built-in variables that work only for that Job. The Contexts view shows the built-in context variables defined in the Job and the project-level context variables imported into the Job.
Once defined, variables are referenced in the configurations of components. The following example shows how context variables are used in the configurations of the tHDFSConnection component in a Pig Job of the demo project.
11
Once these are setup to reflect how you have configured the HortonWorks Sandbox, the examples will run with little intervention. You can see how many of the core functions work allowing you to have good samples to implement your Big Data projects. For more information on defining and using context variables, see the section on how to centralize contexts and variables of the Talend Studio User Guide. For how to run a Job from the Run console, see the section on how to run a Job of the Talend Studio User Guide. For how to run a Job from the Oozie scheduler view, see section How to run a Job via Oozie.
12
2.
14
3.
Fill in the required information in the corresponding fields, and click OK close the dialog box.
Description Hadoop distribution to be connected to. This distribution hosts the HDFS file system to be used. If you select Custom to connect to a custom Hadoop distribution, then you need to click the [...] button to open the [Import custom definition] dialog box and from this dialog box, to import the jar files required by that custom distribution. For further information, see section Connecting to a custom Hadoop distribution.
Version of the Hadoop distribution to be connected to. This list disappears if you select Custom from the Hadoop distribution list. If you are accessing the Hadoop cluster running with Kerberos security, select this check box, then, enter the Kerberos principal name for the NameNode in the field displayed. This enables you to use your user name to authenticate against the credentials stored in Kerberos. This check box is available depending on the Hadoop distribution you are connecting to.
User Name Name node end point Job tracker end point Oozie end point
Login user name. URI of the name node, the centerpiece of the HDFS file system. URI of the Job Tracker node, which farms out MapReduce tasks to specific nodes in the cluster. URI of the Oozie web console, for Job execution monitoring.
15
Description If you need to use custom configuration for the Hadoop of interest, complete this table with the property or properties to be customized. Then at runtime, these changes will override the corresponding default properties used by the Studio for its Hadoop engine. For further information about the properties required by Hadoop, see Apache's Hadoop documentation on http://hadoop.apache.org, or the documentation of the Hadoop distribution you need to use. Settings defined in this table are effective on a per-Job basis.
Once the Hadoop distribution/version and connection details are defined in the Oozie scheduler view, the settings in the [Preferences] window are automatically updated, and vice versa. For information on Oozie preference settings, see section Defining HDFS connection details in preference settings. Upon defining the deployment path in the Oozie scheduler view, you are ready to schedule executions of your Job, or run it immediately, on the HDFS server.
3.
16
Description Hadoop distribution to be connected to. This distribution hosts the HDFS file system to be used. If you select Custom to connect to a custom Hadoop distribution, then you need to click the button to open the [Import custom definition] dialog box and from this dialog box, to import the jar files required by that custom distribution. For further information, see section Connecting to a custom Hadoop distribution.
Version of the Hadoop distribution to be connected to. This list disappears if you select Custom from the Hadoop distribution list. If you are accessing the Hadoop cluster running with Kerberos security, select this check box, then, enter the Kerberos principal name for the NameNode in the field displayed. This enables you to use your user name to authenticate against the credentials stored in Kerberos. This check box is available depending on the Hadoop distribution you are connecting to.
User Name Name node end point Job tracker end point Oozie end point
Login user name. URI of the name node, the centerpiece of the HDFS file system. URI of the Job Tracker node, which farms out MapReduce tasks to specific nodes in the cluster. URI of the Oozie web console, for Job execution monitoring.
Once the settings are defined in the[Preferences] window, the Hadoop distribution/version and connection details in the Oozie scheduler view are automatically updated, and vice versa. For information on the Oozie scheduler view, see section How to run a Job via Oozie.
17
2.
Verify that the Oozie check box is selected. This allows you to import the jar files pertinent to the Oozie and HDFS to be used. Click OK and then in the pop-up warning, click Yes to accept overwriting any custom setup of jar files previously implemented for this connection. Once done, the [Custom Hadoop version definition] dialog box becomes active.
3.
4. If you still need to add more jar files, click the button to open the [Select libraries] dialog box.
5.
If required, in the filter field above the Internal libraries list, enter the name of the jar file you need to use, in order to verify whether that file is provided with the Studio. Select the External libraries option to open its view.
6.
18
7. 8.
Browse to and select any jar file you need to import. Click OK to validate the changes and to close the [Select libraries] dialog box. Once done, the selected jar file appears in the list in the Oozie tab view.
Then, you can repeat this procedure to import more jar files. If you need to share the jar files with another Studio, you can export this custom connection from the [Custom Hadoop version definition] dialog box using the button.
Your Job data is zipped, sent to, and deployed on the HDFS server based on the server connection settings and automatically executed. Depending on your connectivity condition, this may take some time. The console displays the Job deployment and execution status. To stop the Job execution before it is completed, click the Kill button.
19
2.
3.
Fill in the Frequency field with an integer and select a time unit from the Time Unit list to define the Job execution frequency. Click the [...] button next to the Start Time field to open the [Select Date & Time] dialog box, select the date, hour, minute, and second values, and click OK to set the Job execution start time. Then, set the Job execution end time in the same way.
4.
5.
Click OK to close the dialog box and start scheduled executions of your Job. The Job automatically runs based on the defined scheduling parameters. To stop the Job, click Kill.
20
To display the detailed information of a particular Job, click any field of that Job to open a separate page showing the details of the Job.
21
22
tPigMap interface
The Map Editor is made of several panels: The Input panel is the top left panel on the editor. It offers a graphical representation of all (main and lookup) incoming data flows. The data are gathered in various columns of input tables. Note that the table name reflects the main or lookup row from the Job design on the design workspace. The Output panel is the top right panel on the editor. It allows mapping data and fields from input tables to the appropriate output rows. The Search panel is the central panel. It allow you to search in the editor for columns or expressions that contain the text you enter in the Find field. Both bottom panels are the input and output schemas description. The Schema editor tab offers a schema view of all columns of input and output tables in selection in their respective panel.
24
tPigMap operation
Expression editor is the editing tool for all expression keys of input/output data or filtering conditions. The name of input/output tables in the Map Editor reflects the name of the incoming and outgoing flows (row connections). This Map Editor stays the way a typical Talend mapping component's map editor, such as tMap's, is designed and used. Therefore, in order for you to understand fully how a classic mapping component works, we recommend reading as reference the chapter describing how Talend Studio maps data flows of Talend Studio User Guide.
Value Inner Join; Left Outer Join; Right Outer Join; Full Outer Join. The default join option is Left Outer Join when you do not activate this option settings panel by displaying it. These options perform the join of two or more flows based on common field values. When more than one lookup tables need join, the main input flow starts the join from the first lookup flow, then uses the result to join the second and so on in the same manner until the last lookup flow is joined.
25
Value None; Replicated; Skewed; Merge. The default join option is None when you do not activate this option settings panel by displaying it. These options are used to perform more efficient join operations. For example, if you are using the parallelism of multiple reduce tasks, the Skewed join can be used to counteract the load imbalance problem if the data to be processed is sufficiently skewed. Each of these options is subject to the constraints explained in Apache's documentation about Pig Latin.
Custom Partitioner
Enter the Hadoop partitioner you need to use to control the partitioning of the keys of the intermediate map-outputs. For example, enter, in double quotation marks,
org.apache.pig.test.utils.SimpleCustomPartitioner
to use the partitioner SimpleCustomPartitioner. The jar file of this partitioner must have been registered in the Register jar table in the Advanced settings view of the tPigLoad component linked with the tPigMap component to be used. For further information about the code of this SimpleCustomPartitioner, see Apache's documentation about Pig Latin. Increase Parallelism Enter the number of reduce tasks for the Hadoop Map/Reduce tasks generated by Pig. For further information about the parallelism of reduce tasks, see Apache's documentation about Pig Latin.
Value True;
26
Editing expressions
Output properties
Value False. This option, once activated, allows you to catch the records rejected by a filter you have defined in the appropriate area.
True; False. This option, once activated, allows you to catch the records rejected by the inner join operation performed on the input flows.
27
Editing expressions
If you have created any Pig user-defined function (Pig UDF) in the Studio, a Pig UDF Functions option appears automatically in the Categories list and you can select it to edit the mapping expression you need to use.
You need to use the Pig UDF item under the Code node of the Repository tree to create a Pig UDF function. Although you need to know how to write a Pig function using Pig Latin, a Pig UDF function is created the same way as a Talend routine.
28
Editing expressions
Note that your Repository may look different from this image depending on the license you are using. For further information about a routine, see the chapter describing how to manage a routine of the User Guide. To open the Expression editor view, 1. 2. In the lower half of the editor, click the Expression editor tab to open the corresponding view. Click the column you need to set expressions for and edit the expressions in the Expression editor view.
If you need to set filtering conditions for an input or output flow, you have to click the button and then edit the expressions in the displayed area or by using the Expression editor view or the [Expression Builder] dialog box.
29
30
2.
From the Template list, select the type of the Pig UDF function to be created. Based on your choice, the Studio will provide the corresponding template to help the development of the Pig UDF you need. Complete the other fields in the wizard. Click Finish to validate the changes and the Pig UDF template is opened in the workspace. Write your code in the template.
3. 4. 5.
Once done, this Pig UDF will automatically appear in the Categories list in the Expression Builder view of tPigMap and is ready for use.
31
A.1.1. Prerequisites
Before discovering this example and creating the Jobs, you should have: Imported the demo project, and obtained the input access log file used in this example by executing the Job GenerateWebLogFile provided with the demo project. Installed and started Hortonworks Sandbox virtual appliance that the demo project is designed to work on, as described in section Installing Hortonworks Sandbox. An IP to host name mapping entry has been added in the hosts file to resolve the host name sandbox.
34
3.
4.
2.
3.
4.
5.
35
2.
3.
2.
36
3.
3.
37
2.
To use a centralized HDFS connection, click the Property Type list box and select Repository, and then click the [...] button to open the [Repository Content] dialog box. Select the HDFS connection defined for connecting to the HDFS system and click OK. All the connection details are automatically filled in the respective fields.
38
If you are using Talend Open Studio for Big Data, you have to define the following connection details manually: Hadoop distribution: HortonWorks Hadoop version: Hortonworks Data Platform V1 NameNode URI: hdfs://sandbox:8020 User name: sandbox 3. In the File or Directory Path field, specify the directory where the access log file will be stored on the HDFS, /user/hdp/weblog in this example. Double-click the first tHCatalogOperation component, which is labelled HCatalog_Create_DB in this example, to open its Basic settings view on the Component tab.
4.
39
5.
To use a centralized HCatalog connection, click the Property Type list box and select Repository, and then click the [...] button to open the [Repository Content] dialog box. Select the HCatalog connection defined for connecting to the HCatalog database and click OK. All the connection details are automatically filled in the respective fields.
If you are using Talend Open Studio for Big Data, you have to define the following connection details manually: Hadoop distribution: HortonWorks Hadoop version: Hortonworks Data Platform V1 Templeton host name: sandbox or the IP address assigned to your Sandbox virtual machine
40
Templeton port: 50111 Database: talend User name: sandbox 6. 7. 8. From the Operation on list, select Database; from the Operation list, select Drop if exist and create. In the Option list of the Drop configuration area, select Cascade. In the Database location field, enter the location for the database file is to be created in HDFS, /user/hdp/ weblog/weblogdb in this example.
2. 3.
Define the same HCatalog connection details using the same procedure as for the first tHCatalogOperation component. Click the Schema list box and select Repository, then click the [...] button next to the field that appears to open the [Repository Content] dialog box, expand Metadata > Generic schemas > access_log and select schema. Click OK to confirm your choice and close the dialog box. The generic schema of access_log is automatically applied to the component. Alternatively, you can directly select the generic schema of access_log from the Repository tree view and then drag and drop it onto this component to apply the schema. If you are using Talend Open Studio for Big Data, you need to define the schema manually by clicking the [...] button next to Edit schema and pasting the read-only schema of the tApacheLogInput component into the [Schema] dialog box.
4.
From the Operation on list, select Table; from the Operation list, select Drop if exist and create.
41
5. 6.
In the Table field, enter a name for the table to be created, weblog in this example. Select the Set partitions check box and click the [...] button next to Edit schema to set a partition and partition schema. Note that the partition schema must not contain any column name defined in the table schema. In this example, the partition schema column is named ipaddresses.
Upon completion of the component settings, press Ctrl+S to save your Job configurations.
2.
3. 4.
From the Logical operator used to combine conditions list box, select AND. Click the [+] button to add a line in the Filter configuration table, and set filter parameters to send records that contain the code of "301" to the Reject flow and pass the rest records on to the Filter flow: In the InputColumn field, select the code column of the schema. In the Operator field, select Not equal to. In the Value field, enter 301.
42
5.
6.
To use a centralized HCatalog connection, click the Property Type list box and select Repository, and then click the [...] button to open the [Repository Content] dialog box. Select the HCatalog connection defined for connecting to the HCatalog database and click OK. All the connection details are automatically filled in the respective fields.
If you are using Talend Open Studio for Big Data, you have to define the following connection details manually: Hadoop distribution: HortonWorks Hadoop version: Hortonworks Data Platform V1
43
NameNode URI: hdfs://sandbox:8020 Templeton host name: sandbox Templeton port: 50111 Database: talend User name: sandbox 7. Click the [...] button to verify that the schema has been properly propagated from the preceding component. If needed, click Sync columns to retrieve the schema. From the Action list, select Create to create the file or Overwrite if the file already exists. In the Partition field, enter the partition name-value pair between double quotation marks, ipaddresses='192.168.1.15' in this example.
8. 9.
10. In the File location field, enter the path where the data will be save, /user/hdp/weblog/access_log in this example. 11. Double-click the tLogRow component to open its Basic settings view, and select the Vertical option to display each row of the output content in a list for better readability. Upon completion of the component settings, press Ctrl+S to save your Job configurations.
2.
To use a centralized HCatalog connection, click the Property Type list box and select Repository, and then click the [...] button to open the [Repository Content] dialog box. Select the HCatalog connection defined for connecting to the HCatalog database and click OK. All the connection details are automatically filled in the respective fields.
44
If you are using Talend Open Studio for Big Data, you have to define manually the following connection details, which are the same as in the tHCatalogOutput component in the previous Job: Hadoop distribution: HortonWorks Hadoop version: Hortonworks Data Platform V1 NameNode URI: hdfs://sandbox:8020 Templeton host name: sandbox Templeton port: 50111 Database: talend User name: sandbox 3. Click the Schema list box and select Repository, then click the [...] button next to the field that appears to open the [Repository Content] dialog box, expand Metadata > Generic schemas > access_log and select schema. Click OK to confirm your select and close the dialog box. The generic schema of access_log is automatically applied to the component. Alternatively, you can directly select the generic schema of access_log from the Repository tree view and then drag and drop it onto this component to apply the schema. If you are using Talend Open Studio for Big Data, you need to define the schema manually by clicking the [...] button next to Edit schema and pasting the read-only schema of the tApacheLogInput component used in the previous Job into the [Schema] dialog box. 4. In the Basic settings view of the tLogRow component, select the Vertical mode to display the each row in a key-value manner when the Job is executed.
Upon completion of the component settings, press Ctrl+S to save your Job configurations.
2.
To use a centralized HDFS connection, click the Property Type list box and select Repository, and then click the [...] button to open the [Repository Content] dialog box. Select the HDFS connection defined for connecting to the HDFS system and click OK. All the connection details are automatically filled in the respective fields.
If you are using Talend Open Studio for Big Data, you have to select the Map/Reduce mode and define the following connection details manually: Hadoop distribution: HortonWorks Hadoop version: Hortonworks Data Platform V1 NameNode URI: hdfs://sandbox:8020 JobTracker host: sandbox:50300 in this example
46
3.
Select the generic schema of access_log from the Repository tree view and then drag and drop it onto this component to apply the schema. If you are using Talend Open Studio for Big Data, you need to define the schema manually by clicking the [...] button next to Edit schema and pasting the read-only schema of the tApacheLogInput component used in the second Job into the [Schema] dialog box.
4.
From the Load function list, select PigStorage, and fill the Input file URI field with the file path defined in the previous Job, /user/hdp/weblog/access_log/out.log in this example.
2.
In the Basic settings view of the tPigFilterColumns component, click the [...] button to open the [Schema] dialog box. Select the column code in the Input panel and click the single-arrow button to copy the column to the Output panel to pass the information of the code column to the output flow. Click OK to confirm the output schema settings and close the dialog box.
47
3.
In the Basic settings view of the tPigAggregate component, click Sync columns to retrieve the schema from the preceding component, and permit the schema to be propagated to the next component. Click the [...] button next to Edit schema to open the [Schema] dialog box, and add a new column: count. This column will store the number of occurrences of each code of successful service calls. Configure the following parameters to count the number of occurrences of each code: In the Group by area, click the [+] button to add a line in the table, and select the column count in the Column field. In the Operations area, click the [+] button to add a line in the table, and select the column count in the Additional Output Column field, select count in the Function field, and select the column code in the Input Column field.
4.
5.
48
6.
In the Basic settings view of the tPigSort component, configure the sorting parameters to sort the data to be passed on: Click the [+] button to add a line in the Sort key table. In the Column field, select count to set the column count as the key. In the Order field, select DESC to sort data in the descendent order.
7.
In the Basic settings view of the tPigStoreResult component, configure the component properties to upload the result data to the specified location on the Hadoop system: Click Sync columns to retrieve the schema from the preceding component. In the Result file URI field, enter the path to the result file, /user/hdp/weblog/apache_code_cnt in this example. From the Store function list, select PigStorage. If needed, select the Remove result directory if exists check box.
Upon completion of the component settings, press Ctrl+S to save your Job configurations.
49
In the tPigAggregate component, select the column host in the Column field of the Group by table and in the Input Column field of the Operations table.
In the tPigStoreResult component, fill the Result file URI field with /user/hdp/weblog/apache_ip_cnt. Upon completion of the component settings, press Ctrl+S to save your Job configurations.
50
2.
To use a centralized HDFS connection, click the Property Type list box and select Repository, and then click the [...] button to open the [Repository Content] dialog box. Select the HDFS connection defined for connecting to the HDFS system and click OK. All the connection details are automatically filled in the respective fields.
If you are using Talend Open Studio for Big Data, you have to select the Map/Reduce mode and define manually the following connection details manually: Hadoop distribution: HortonWorks Hadoop version: Hortonworks Data Platform V1
Talend Open Studio for Big Data Getting Started Guide 51
NameNode URI: hdfs://sandbox:8020 User name: sandbox in this example 3. Apply the generic schema of ip_count to this component. The schema should contain two columns, host (string, 50 characters) and count (integer, 5 characters), If you are using Talend Open Studio for Big Data, you need to set the schema manually, or copy the schema of the tPigStoreResult component in the previous Job and paste it into the [Schema] dialog box of this component. 4. In the File Name field, enter the path to the result file in HDFS, /user/hdp/weblog/apache_ip_cnt/partr-00000 in this example. From the Type list, select the type of the file to read, Text File in this example. In the Basic settings view of the tLogRow component, select the Table option for better readability. Configure the other subjob in the same way, but in the second tHDFSInput component: Apply the generic schema of code_count, or configure the schema of this component manually so that it contains two columns: code (integer, 5 characters) and count (integer, 5 characters). Fill the File Name field with /user/hdp/weblog/apache_code_cnt/part-r-00000. Upon completion of the component settings, press Ctrl+S to save your Job configurations.
5. 6. 7.
52
It is possible to run all the Jobs in the required order at one click. To do so: 1. Drop a tRunJob component onto the design workspace of the first Job, A_HCatalog_Create in this example. This component appears as a subjob. Link the preceding subjob to the tRunJob component using a Trigger > On Subjob Ok connection.
2.
3. 4.
Double-click the tRunJob component to open its Basic settings view. Click the [...] button next to the Job field to open the [Repository Content] dialog box. Select the Job that should be triggered after successful execution of the current Job, and click OK to close the dialog box. The next Job to run appears in the Job field.
53
5. 6.
Double-click the tRunJob component again to open the next Job. Repeat the steps above until a tRunJob is configured in the Job E_Pig_Count_IPs to trigger the last Job, F_Read_Results. Run the first Job. The successful execution of each Job triggers the next Job, until all the Jobs are executed, and the execution results are displayed in the console of the first Job.
54