Help Center/ MapReduce Service/ Component Operation Guide (LTS) (Ankara Region)/ Using Loader/ Exporting Data/ Typical Scenario: Exporting Data from HBase to an SFTP Server
Updated on 2024-11-29 GMT+08:00

Typical Scenario: Exporting Data from HBase to an SFTP Server

Scenario

Use Loader to export data from HBase to an SFTP server.

Prerequisites

  • You have obtained the service username and password for creating a Loader job.
  • You have had the permission to access the HBase tables or phoenix tables that are used during job execution.
  • You have obtained the username and password of the SFTP server and the user has the write permission of the data export directory on the SFTP server.
  • No disk space alarm is reported, and the available disk space is sufficient for importing and exporting data.
  • If a configured task requires the Yarn queue function, the user must be authorized with related Yarn queue permission.
  • The user who configures a task must obtain execution permission on the task and obtain usage permission on the related connection of the task.

Procedure

Configure basic job information.

  1. Access the Loader web UI.

    1. Log in to FusionInsight Manager.
    2. Choose Cluster > Services > Loader.
    3. Click LoaderServer(Node name, Active). The Loader web UI is displayed.
      Figure 1 Loader web UI

  2. Click New Job. Configure basic job parameters on the Basic Information page displayed.

    Figure 2 Basic Information page
    1. Enter a job name in Name.
    2. Set Type to Export.
    3. Set Group to the group to which the job belongs. There is no group created by default. Click Add, enter the group name, and click OK.
    4. Set Queue to the Yarn queue that executes the job. The default value is root.default.
    5. Set Priority to the priority of the Yarn queue that executes the job. The default value is NORMAL. The options are VERY_LOW, LOW, NORMAL, HIGH, and VERY_HIGH.

  3. In the Connection area, click Add to create a connection, set Connector to sftp-connector, click Add, set connection parameters, and click Test to verify whether the connection is available. When "Test Success" is displayed, click OK. Loader allows multiple SFTP servers to be configured. Click Add to add the configuration information of multiple SFTP servers.

    Table 1 Connection parameters

    Parameter

    Description

    Example Value

    Name

    Specifies the name of the SFTP server connection.

    sftpName

    SFTP server IP

    Specifies the IP address of the SFTP server.

    10.16.0.1

    SFTP server port

    Specifies the port number of the SFTP server.

    22

    SFTP username

    Specifies the user name for accessing the SFTP server.

    root

    SFTP password

    Specifies the password for accessing the SFTP server.

    xxxx

    SFTP public key

    Specifies public key of the SFTP server.

    OdDt/yn...etM

    When multiple SFTP servers are configured, the data of HBase tables or phoenix tables will be divided into multiple parts and saved to the SFTP servers randomly.

    Configure data source information.

  4. Click Next. On the displayed From page, set Source type to HBASE.

    Table 2 Data source parameters

    Parameter

    Description

    Example Value

    HBase instance

    Specifies the HBase service instance that Loader selects from all available HBase service instances in the cluster. If the selected HBase service instance is not added to the cluster, the HBase job cannot be run properly.

    HBase

    Quantity

    Number of Maps that are started at the same time in a MapReduce task of a data configuration operation. The value must be less than or equal to 3000. You are advised to set the parameter to the maximum number of connections on the SFTP server.

    20

    Configure data transformation.

  5. Click Next. On the displayed Transform page, set the transformation operations in the data transformation process. For details about how to select operators and set parameters, see Operator Help and Table 3.

    Table 3 Input and output parameters of the operator

    Input Type

    Output Type

    HBase Input

    File Output

    In input, drag HBase Input to the grid. In output, drag File Output to the grid. Use an arrow to connect HBase Input to File Output.

    Set data storage information and execute the job.

  6. Click Next. On the displayed To page, set the data storage mode.

    Table 4 Parameter description

    Parameter

    Description

    Example Value

    Output path

    Specifies the path or file name of the exported file on an SFTP server. If multiple SFTP server IP addresses are configured for the connector, you can set this parameter to multiple paths or file names separated with semicolons (;). Ensure that the number of paths or file names is the same as the number of SFTP servers configured for the connector.

    NOTE:

    You can use macros to define path parameters. For details, see Using Macro Definitions in Configuration Items.

    /opt/tempfile

    Operation

    Specifies the action during data import. When all data is imported from the input path to the destination path, the data is stored in a temporary directory and then copied from the temporary directory to the destination path. After data import is complete, the data in the temporary directory is deleted. One of the following actions can be taken when there are duplicate file names during data transfer:

    • OVERRIDE: overrides the old file.
    • RENAME: renames the new file. For a file without a file name extension, a string is added to the file name as the extension; for a file with a file name extension, a string is added to the extension. The string is unique.
    • APPEND: adds the content of the new file to the end of the old file. This action only adds content regardless of whether the file can be used. For example, a text file can be used after this action, while a compressed file cannot.
    • IGNORE: reserves the old file and does not copy the new file.
    • ERROR: stops the task and reports an error if there are duplicate file names. Transferred files are imported successfully, while files that have duplicate names and files that are not transferred fail to import.

    OVERRIDE

    Encode type

    Specifies the exported file encoding format, for example, UTF-8. This parameter can be set only in text file export.

    UTF-8

    Compression

    Indicates whether to enable the compressed transmission function when SFTP is used to export data.

    • The value true indicates that compression is enabled.
    • The value false indicates that compression is disabled.

    true

  7. Click Save and Run to save and run the job.

    View the job execution result.

  8. Go to the Loader web UI. When Status is Succeeded, the job is complete.

    Figure 3 Viewing a job