July 30, 2023

tHDFSInput – Docs for ESB 7.x

tHDFSInput

Extracts the data in a HDFS file for other components to process it.

tHDFSInput reads a file located on a given Hadoop distributed
file system (HDFS) and puts the data of interest from this file into a
Talend schema. Then it passes the data to the component that follows.

Depending on the Talend
product you are using, this component can be used in one, some or all of the following
Job frameworks:

tHDFSInput Standard properties

These properties are used to configure tHDFSInput running in the Standard Job framework.

The Standard
tHDFSInput component belongs to the Big Data and the File families.

The component in this framework is available in all Talend products with Big Data
and in Talend Data Fabric.

Basic settings

Property type

Either Built-In or Repository.

Built-In: No property data stored centrally.

Repository: Select the repository file where the
properties are stored.

Schema and Edit Schema

A schema is a row description. It defines the number of fields
(columns) to be processed and passed on to the next component. When you create a Spark
Job, avoid the reserved word line when naming the
fields.

Click Edit
schema
to make changes to the schema. If the current schema is of the Repository type, three options are available:

  • View schema: choose this
    option to view the schema only.

  • Change to built-in property:
    choose this option to change the schema to Built-in for local changes.

  • Update repository connection:
    choose this option to change the schema stored in the repository and decide whether
    to propagate the changes to all the Jobs upon completion. If you just want to
    propagate the changes to the current Job, you can select No upon completion and choose this schema metadata
    again in the Repository Content
    window.

 

Built-In: You create and store the schema locally for this component
only.

 

Repository: You have already created the schema and stored it in the
Repository. You can reuse it in various projects and Job designs.

Use an existing connection

Select this check box and in the Component List click the HDFS connection component from which
you want to reuse the connection details already defined.

Note that when a Job contains the parent Job and the child Job,
Component List presents only the
connection components in the same Job level.

Distribution

Select the cluster you are using from the drop-down list. The options in the
list vary depending on the component you are using. Among these options, the following
ones requires specific configuration:

  • If available in this Distribution drop-down
    list, the Microsoft HD
    Insight
    option allows you to use a Microsoft HD Insight
    cluster. For this purpose, you need to configure the connections to the HD
    Insightcluster and the Windows Azure Storage service of that cluster in the
    areas that are displayed. For
    detailed explanation about these parameters, search for configuring the
    connection manually on Talend Help Center (https://help.talend.com).

  • If you select Amazon EMR, find more details about Amazon EMR getting started in
    Talend Help Center (https://help.talend.com).

  • The Custom option
    allows you to connect to a cluster different from any of the distributions
    given in this list, that is to say, to connect to a cluster not officially
    supported by
    Talend
    .

  1. Select Import from existing
    version
    to import an officially supported distribution as base
    and then add other required jar files which the base distribution does not
    provide.

  2. Select Import from zip to
    import the configuration zip for the custom distribution to be used. This zip
    file should contain the libraries of the different Hadoop elements and the index
    file of these libraries.

    In
    Talend

    Exchange, members of
    Talend
    community have shared some ready-for-use configuration zip files
    which you can download from this Hadoop configuration
    list and directly use them in your connection accordingly. However, because of
    the ongoing evolution of the different Hadoop-related projects, you might not be
    able to find the configuration zip corresponding to your distribution from this
    list; then it is recommended to use the Import from
    existing version
    option to take an existing distribution as base
    to add the jars required by your distribution.

    Note that custom versions are not officially supported by

    Talend
    .
    Talend
    and its community provide you with the opportunity to connect to
    custom versions from the Studio but cannot guarantee that the configuration of
    whichever version you choose will be easy, due to the wide range of different
    Hadoop distributions and versions that are available. As such, you should only
    attempt to set up such a connection if you have sufficient Hadoop experience to
    handle any issues on your own.

    Note:

    In this dialog box, the active check box must be kept
    selected so as to import the jar files pertinent to the connection to be
    created between the custom distribution and this component.

    For a step-by-step example about how to connect to a custom
    distribution and share this connection, see Hortonworks.

Version

Select the version of the Hadoop distribution you are using. The available
options vary depending on the component you are using.

Scheme Select the URI scheme of the file system to be used from the
Scheme drop-down list. This scheme could be

  • HDFS
  • WebHDFS. WebHDFS with SSL is not supported yet.
  • ADLS. Only Azure Data Lake Storage Gen1 is supported.

The schemes present on this list vary depending on the distribution you
are using and only the scheme that appears on this list with a given
distribution is officially supported by Talend.

Once a scheme is
selected, the corresponding syntax such as
webhdfs://localhost:50070/ for WebHDFS is displayed in the
field for the NameNode location of your cluster.

If you have selected
ADLS, the connection parameters to be defined become:

  • In the
    Client ID and the Client
    key
    fields, enter, respectively, the authentication
    ID and the authentication key generated upon the registration of the
    application that the current Job you are developing uses to access
    Azure Data Lake Storage.

    Ensure that the application to be used has appropriate
    permissions to access Azure Data Lake. You can check this on the
    Required permissions view of this application on Azure. For further
    information, see Azure documentation Assign the Azure AD application to
    the Azure Data Lake Storage account file or folder
    .

  • In the
    Token endpoint field, copy-paste the
    OAuth 2.0 token endpoint that you can obtain from the
    Endpoints list accessible on the
    App registrations page on your Azure
    portal.

For a
video demonstration, see Configure and use Azure in a
Job
.

NameNode URI

Type in the URI of the Hadoop NameNode, the master node of a
Hadoop system. For example, we assume that you have chosen a machine called masternode as the NameNode, then the location is
hdfs://masternode:portnumber. If you are using WebHDFS, the location should be
webhdfs://masternode:portnumber; WebHDFS with SSL is not
supported yet.

Use kerberos authentication

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.

  • If this cluster is a MapR cluster of the version 5.0.0 or later, you can set the
    MapR ticket authentication configuration in addition or as an alternative by following
    the explanation in Connecting to a security-enabled MapR.

    Keep in mind that this configuration generates a new MapR security ticket for the username
    defined in the Job in each execution. If you need to reuse an existing ticket issued for the
    same username, leave both the Force MapR ticket
    authentication
    check box and the Use Kerberos
    authentication
    check box clear, and then MapR should be able to automatically
    find that ticket on the fly.

This check box is available depending on the Hadoop distribution you are
connecting to.

Use a keytab to authenticate

Select the Use a keytab to authenticate
check box to log into a Kerberos-enabled system using a given keytab file. A keytab
file contains pairs of Kerberos principals and encrypted keys. You need to enter the
principal to be used in the Principal field and
the access path to the keytab file itself in the Keytab field. This keytab file must be stored in the machine in
which your Job actually runs, for example, on a Talend Jobserver.

Note that the user that executes a keytab-enabled Job is not necessarily
the one a principal designates but must have the right to read the keytab file being
used. For example, the user name you are using to execute a Job is user1 and the principal to be used is guest; in this
situation, ensure that user1 has the right to read the keytab
file to be used.

User name

The User name field is available when you are not using
Kerberos to authenticate. In the User name field, enter the
login user name for your distribution. If you leave it empty, the user name of the machine
hosting the Studio will be used.

Group

Enter the membership including the authentication user under which the HDFS instances were
started. This field is available depending on the distribution you are using.

File Name

Browse to, or enter the path pointing to the data to be used in the file system.

If the path you set points to a folder, this component will read all of the
files stored in that folder. Furthermore, if sub-folders exist in that folder
and you need to read files in the sub-folders, select the Include
sub-directories if path is directory
check box in the
Advanced settings view.

Type

Select the type of the file to be processed. The type of the file may be:

  • Text file.

  • Sequence file: a Hadoop sequence file
    consists of binary key/value pairs and is suitable for the Map/Reduce framework.
    For further information, see http://wiki.apache.org/hadoop/SequenceFile.

    Once you select the Sequence file format, the
    Key column list and the Value column list appear to allow you to select the
    keys and the values of that Sequence file to be processed.

Row separator

The separator used to identify the end of a row.

This field is not available for a Sequence file.

Field separator

Enter character, string or regular expression to separate fields for the transferred
data.

This field is not available for a Sequence file.

Header

Set values to ignore the header of the transferred data. For example, enter
0 to ignore no rows for the data without header and set 1 for
the data with header at the first row.

This field is not available for a Sequence file.

Custom encoding

You may encounter encoding issues when you process the stored data. In that
situation, select this check box to display the Encoding list.

Select the encoding from the list or select Custom
and define it manually. This field is compulsory for database data handling. The
supported encodings depend on the JVM that you are using. For more information, see
https://docs.oracle.com.

This option is not available for a Sequence file.

Compression

Select the Uncompress the data check box to uncompress
the input data.

Hadoop provides different compression formats that help reduce the space needed for
storing files and speed up data transfer. When reading a compressed file, the Studio needs
to uncompress it before being able to feed it to the input flow.

This option is not available for a Sequence file.

Advanced settings

Include sub-directories if path is
directory

Select this check box to read not only the folder you have
specified in the File name field
but also the sub-folders in that folder.

Hadoop properties


Talend Studio
uses a default configuration for its engine to perform
operations in a Hadoop distribution. If you need to use a custom configuration in a specific
situation, complete this table with the property or properties to be customized. Then at
runtime, the customized property or properties will override those default ones.

  • Note that if you are using the centrally stored metadata from the Repository, this table automatically inherits the
    properties defined in that metadata and becomes uneditable unless you change the
    Property type from Repository to Built-in.

For further information about the properties required by Hadoop and its related systems such
as HDFS and Hive, see the documentation of the Hadoop distribution you
are using or see Apache’s Hadoop documentation on http://hadoop.apache.org/docs and then select the version of the documentation you want. For demonstration purposes, the links to some properties are listed below:

tStatCatcher Statistics

Select this check box to collect log data at the component level.
Note that this check box is not available in the Map/Reduce version
of the component.

Global Variables

Global Variables

ERROR_MESSAGE: the error message generated by the
component when an error occurs. This is an After variable and it returns a string. This
variable functions only if the Die on error check box is
cleared, if the component has this check box.

A Flow variable functions during the execution of a component while an After variable
functions after the execution of the component.

To fill up a field or expression with a variable, press Ctrl +
Space
to access the variable list and choose the variable to use from it.

For further information about variables, see
Talend Studio

User Guide.

Usage

Usage rule

This component needs an output link.

Dynamic settings

Click the [+] button to add a row in the
table and fill the Code field with a context variable
to choose your HDFS connection dynamically from multiple connections planned in your
Job. This feature is useful when you need to access files in different HDFS systems or
different distributions, especially when you are working in an environment where you
cannot change your Job settings, for example, when your Job has to be deployed and
executed independent of
Talend Studio
.

The Dynamic settings table is
available only when the Use an existing
connection
check box is selected in the Basic settings view. Once a dynamic parameter is
defined, the Component List box in the
Basic settings view becomes unusable.

For examples on using dynamic parameters, see Reading data from databases through context-based dynamic connections and Reading data from different MySQL databases using dynamically loaded connection parameters. For more information on Dynamic
settings
and context variables, see Talend Studio
User Guide.

Prerequisites

The Hadoop distribution must be properly installed, so as to guarantee the interaction
with
Talend Studio
. The following list presents MapR related information for
example.

  • Ensure that you have installed the MapR client in the machine where the Studio is,
    and added the MapR client library to the PATH variable of that machine. According
    to MapR’s documentation, the library or libraries of a MapR client corresponding to
    each OS version can be found under MAPR_INSTALL
    hadoophadoop-VERSIONlib
    ative
    . For example, the library for
    Windows is lib
    ativeMapRClient.dll
    in the MapR
    client jar file. For further information, see the following link from MapR: http://www.mapr.com/blog/basic-notes-on-configuring-eclipse-as-a-hadoop-development-environment-for-mapr.

    Without adding the specified library or libraries, you may encounter the following
    error: no MapRClient in java.library.path.

  • Set the -Djava.library.path argument, for example, in the Job Run VM arguments area
    of the Run/Debug view in the Preferences dialog box in the Window menu. This argument provides to the Studio the path to the
    native library of that MapR client. This allows the subscription-based users to make
    full use of the Data viewer to view locally in the
    Studio the data stored in MapR.

For further information about how to install a Hadoop distribution, see the manuals
corresponding to the Hadoop distribution you are using.

Limitations

JRE 1.6+ is required.

Using HDFS components to work with Azure Data Lake Storage (ADLS)

This scenario describes how to use the HDFS components to read data from and write data to Azure Data Lake Storage.

This scenario applies only to Talend products with Big Data.

  • tFixedFlowInput: it provides sample data to the Job.

  • tHDFSOutput: it writes sample data to Azure Data Lake
    Store.

  • tHDFSInput: it reads sample data from Azure Data Lake
    Store.

  • tLogRow: it displays the output of the Job on the console of
    the Run view of the Job.

Grant your application the access to your ADLS Gen2

An Azure subscription is required.

  1. Create your Azure Data Lake Storage Gen2 account if you do not have it
    yet.

  2. Create an Azure Active Directory application on your Azure portal. For more
    details about how to do this, see the “Create an Azure Active Directory
    application” section in Azure documentation: Use portal to create an Azure Active Directory
    application
    .
  3. Obtain the application ID, object ID and the client secret of the application
    to be used from the portal.

    1. On the list of the registered applications, click the application you
      created and registered in the previous step to display its information
      blade.
    2. Click Overview to open its blade, and from the
      top section of the blade, copy the Object ID and
      the application ID displayed as Application (client)
      ID
      . Keep them somewhere safe for later use.
    3. Click Certificates & secrets to open its
      blade and then create the authentication key (client secret) to be used
      on this blade in the Client secrets
      section.
  4. Back to the Overview blade of the application to be
    used, click Endpoints on the top of this blade, copy the
    value of OAuth 2.0 token endpoint (v1) from the endpoint
    list that appears and keep it somewhere safe for later use.
  5. Set the read and write permissions to the ADLS Gen2 filesystem to be used for
    the service principal of your application.

    It is very likely that the administrator of your Azure system has included
    your account and your applications in the group that has access to a given ADLS
    Gen2 storage account and a given ADLS Gen2 filesystem. In this case, ask your
    administrator to ensure that you have the proper access and then ignore this
    step.
    1. Start your Microsoft Azure Storage Explorer and find your ADLS Gen2
      storage account on the Storage Accounts
      list.

      If you have not installed Microsoft Azure Storage Explorer, you can
      download it from the Microsoft Azure official site.
    2. Expand this account and the Blob Containers node
      under it; then click the ADLS Gen2 hierarchical filesystem to be used
      under this node.

      tHDFSInput_1.png

      The filesystem in this image is for demonstration purposes only.
      Create the filesystem to be used under the Blob
      Containers
      node in your Microsoft Azure Storage
      Explorer, if you do not have one yet.

    3. On the blade that is opened, click Manage Access
      to open its wizard.
    4. At the bottom of this wizard, add the object ID of your application to
      the Add user or group field and click
      Add.
    5. Select the object ID just added from the Users and
      groups
      list and select all the permission for
      Access and
      Default.
    6. Click Save to validate these changes and close
      this wizard.

Creating an HDFS Job in the Studio

  1. On the Integration
    perspective, drop the following components from the
    Palette onto the design workspace:
    tFixedFlowInput, tHDFSOutput,
    tHDFSInput and tLogRow.
  2. Connect tFixedFlowInput to
    tHDFSOutput using a Row > Main link.
  3. Do the same to connect tHDFSInput to
    tLogRow.
  4. Connect tFixedFlowInput to tHDFSInput using a Trigger > OnSubjobOk link.
tHDFSInput_2.png

Configuring the HDFS components to work with Azure Data Lake Storage

  1. Double-click tFixedFlowInput to open its
    Component view to provide sample data to the
    Job.

    The sample data to be used contains only one row with two column:
    id and name.

  2. Click the […] button next to Edit
    schema
    to open the schema editor.
  3. Click the [+] button to add the two columns and rename
    them to id and name.
  4. Click OK to close the schema editor and validate the
    schema.
  5. In the Mode area, select Use single
    table
    .

    The id and the name columns
    automatically appear in the Value table and you can
    enter the values you want within double quotation marks in the
    Value column for the two schema values.

  6. Double-click tHDFSOutput to open its
    Component view.

    tHDFSInput_3.png

  7. In the Version area, select
    Hortonworks or Cloudera
    depending on the distribution you are using. In the Standard
    framework, only these two distributions with ADLS are supported by the HDFS
    components.
  8. From the Scheme drop-down list, select
    ADLS. The ADLS related parameters appear in the
    Component view.
  9. In the URI field, enter the NameNode service of your
    application. The location of this service is actually the address of your Data
    Lake Store.

    For example, if your Data Lake Storage name is
    data_lake_store_name, the NameNode URI to be used
    is
    adl://data_lake_store_name.azuredatalakestore.net.

  10. In the
    Client ID and the Client
    key
    fields, enter, respectively, the authentication
    ID and the authentication key generated upon the registration of the
    application that the current Job you are developing uses to access
    Azure Data Lake Storage.

    Ensure that the application to be used has appropriate
    permissions to access Azure Data Lake. You can check this on the
    Required permissions view of this application on Azure. For further
    information, see Azure documentation Assign the Azure AD application to
    the Azure Data Lake Storage account file or folder
    .

    This application must be the one to
    which you assigned permissions to access your Azure Data Lake Storage in
    the previous step.

  11. In the
    Token endpoint field, copy-paste the
    OAuth 2.0 token endpoint that you can obtain from the
    Endpoints list accessible on the
    App registrations page on your Azure
    portal.
  12. In the File name field, enter the directory to be used
    to store the sample data on Azure Data Lake Storage.
  13. From the Action drop-down list, select
    Create if the directory to be used does not exist yet
    on Azure Data Lake Storage; if this folder already exists, select
    Overwrite.
  14. Do the same configuration for tHDFSInput.
  15. If you run your Job on Windows, following this procedure to add the winutils.exe program to your Job.
  16. Press F6 to run your Job.

tHDFSInput MapReduce properties (deprecated)

These properties are used to configure tHDFSInput running in the MapReduce Job framework.

The MapReduce
tHDFSInput component belongs to the MapReduce family.

The component in this framework is available in all subscription-based Talend products with Big Data
and Talend Data Fabric.

The MapReduce framework is deprecated from Talend 7.3 onwards. Use Talend Jobs for Apache Spark to accomplish your integration tasks.

Basic settings

Property type

Either Built-In or Repository.

Built-In: No property data stored centrally.

Repository: Select the repository file where the
properties are stored.

The properties are stored centrally under the Hadoop
Cluster
node of the Repository
tree.

For further information about the Hadoop
Cluster
node, see the Getting Started Guide.

Schema and Edit
Schema

A schema is a row description. It defines the number of fields
(columns) to be processed and passed on to the next component. When you create a Spark
Job, avoid the reserved word line when naming the
fields.

Click Edit
schema
to make changes to the schema.

Note: If you
make changes, the schema automatically becomes built-in.
 

Built-In: You create and store the schema locally for this component
only.

 

Repository: You have already created the schema and stored it in the
Repository. You can reuse it in various projects and Job designs.

Folder/File

Browse to, or enter the path pointing to the data to be used in the file system.

If the path you set points to a folder, this component will read all of the files stored in that folder, for example,/user/talend/in; if sub-folders exist, the sub-folders are automatically ignored unless you define the property mapreduce.input.fileinputformat.input.dir.recursive to be true in the Hadoop properties table in the Hadoop configuration tab.

If you want to specify more than one files or directories in this
field, separate each path using a comma (,).

If the file to be read is a compressed one, enter the file name with
its extension; then tHDFSInput
automatically decompresses it at runtime. The supported compression
formats and their corresponding extensions are:

  • DEFLATE: *.deflate

  • gzip: *.gz

  • bzip2: *.bz2

  • LZO: *.lzo

Note that you need
to ensure you have properly configured the connection to the Hadoop
distribution to be used in the Hadoop
configuration
tab in the Run view.

Die on error

Select the check box to stop the execution of the Job when an error
occurs.

Clear the check box to skip any rows on error and complete the process for
error-free rows. When errors are skipped, you can collect the rows on error using a Row > Reject link.

Type

Select the type of the file to be processed. The type of the file may be:

  • Text file.

  • Sequence file: a Hadoop sequence file
    consists of binary key/value pairs and is suitable for the Map/Reduce framework.
    For further information, see http://wiki.apache.org/hadoop/SequenceFile.

    Once you select the Sequence file format, the
    Key column list and the Value column list appear to allow you to select the
    keys and the values of that Sequence file to be processed.

Row separator

The separator used to identify the end of a row.

This field is not available for a Sequence file.

Field separator

Enter character, string or regular expression to separate fields for the transferred
data.

This field is not available for a Sequence file.

Header

Enter the number of rows to be skipped in the beginning of file.

For example, enter 0 to ignore no
rows for the data without header and set 1 for the data with header at the first row.

This field is not available for a Sequence file.

Custom Encoding

You may encounter encoding issues when you process the stored data. In that
situation, select this check box to display the Encoding list.

Then select the encoding to be used from the list or select Custom and define it manually.

This option is not available for a Sequence file.

Advanced settings

Advanced separator (for number)

Select this check box to change the separator used for numbers. By default, the thousands separator is a comma (,) and the decimal separator is a period (.).

Trim all columns

Select this check box to remove the leading and trailing whitespaces from all
columns. When this check box is cleared, the Check column to
trim
table is displayed, which lets you select particular columns to
trim.

Check column to trim

This table is filled automatically with the schema being used. Select the check
box(es) corresponding to the column(s) to be trimmed.

tStatCatcher Statistics

Select this check box to collect log data at the component
level.

Global Variables

Global Variables

ERROR_MESSAGE: the error message generated by the
component when an error occurs. This is an After variable and it returns a string. This
variable functions only if the Die on error check box is
cleared, if the component has this check box.

A Flow variable functions during the execution of a component while an After variable
functions after the execution of the component.

To fill up a field or expression with a variable, press Ctrl +
Space
to access the variable list and choose the variable to use from it.

For further information about variables, see
Talend Studio

User Guide.

Usage

Usage rule

In a
Talend
Map/Reduce Job, it is used as a start component and requires
a transformation component as output link. The other components used along with it must be
Map/Reduce components, too. They generate native Map/Reduce code that can be executed
directly in Hadoop.

Once a Map/Reduce Job is opened in the workspace, tHDFSInput as well as the MapReduce family
appears in the Palette of the
Studio.

Note that in this documentation, unless otherwise
explicitly stated, a scenario presents only Standard Jobs,
that is to say traditional
Talend
data integration Jobs, and non Map/Reduce Jobs.

Hadoop Connection

You need to use the Hadoop Configuration tab in the
Run view to define the connection to a given Hadoop
distribution for the whole Job.

This connection is effective on a per-Job basis.

Related scenarios

If you are a subscription-based Big Data user, you can consult a
Talend
Map/Reduce Job using
the Map/Reduce version of tHDFSInput:


Document get from Talend https://help.talend.com
Thank you for watching.
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x