:original_name: mrs_01_1064.html

.. _mrs_01_1064:

Typical Scenario: Collecting Local Dynamic Logs and Uploading Them to HDFS
==========================================================================

Scenario
--------

This section describes how to use the Flume client to collect dynamic logs from a local host and save them to the **/flume/test** directory on HDFS.

This section applies to MRS 3.\ *x* or later clusters.

.. note::

   By default, the cluster network environment is secure and the SSL authentication is not enabled during the data transmission process. For details about how to use the encryption mode, see :ref:`Configuring the Encrypted Transmission <mrs_01_1069>`. The configuration applies to scenarios where only the Flume is configured, for example, Taildir Source+Memory Channel+HDFS Sink.

Prerequisites
-------------

-  The cluster has been installed, including the HDFS and Flume services.
-  The Flume client has been installed. For details, see `Installing the Flume Client <https://docs.otc.t-systems.com/cmpntguide/mrs/mrs_01_0392.html>`__.
-  The network environment of the cluster is secure.
-  You have created user **flume_hdfs** and authorized the HDFS directory and data to be operated during log verification.

Procedure
---------

#. On FusionInsight Manager, choose **System > User** and choose **More > Download Authentication Credential** to download the Kerberos certificate file of user **flume_hdfs** and save it to the local host.

#. Set Flume parameters.

   Use the Flume configuration tool on FusionInsight Manager to configure the Flume role client parameters and generate a configuration file.

   a. Log in to FusionInsight Manager and choose **Cluster** > **Services**. On the page that is displayed, choose **Flume**. On the displayed page, click the **Configuration Tool** tab.

   b. Set **Agent Name** to **client**. Select the source, channel, and sink to be used, drag them to the GUI on the right, and connect them.

      Use Taildir Source, Memory Channel, and HDFS Sink.

   c. Double-click the source, channel, and sink. Set corresponding configuration parameters by referring to :ref:`Table 1 <mrs_01_1064__table275562484>` based on the actual environment.

      .. note::

         -  If you want to continue using the **properties.propretites** file by modifying it, log in to FusionInsight Manager, choose **Cluster** > *Name of the desired cluster* > **Services**. On the page that is displayed, choose **Flume**. On the displayed page, click the **Configuration Tool** tab, click **Import**, import the file, and modify the configuration items related to non-encrypted transmission.
         -  It is recommended that the numbers of Sources, Channels, and Sinks do not exceed 40 during configuration file import. Otherwise, the response time may be very long.

      .. _mrs_01_1064__table275562484:

      .. table:: **Table 1** Parameters to be modified for the Flume role client

          
         | Parameter              | Description                                                                                                                                                                                                                                                                                                  | Example Value                                                                                                                                                                                                                              |
          
         | Name                   | The value must be unique and cannot be left blank.                                                                                                                                                                                                                                                           | test                                                                                                                                                                                                                                       |
          
         | filegroups             | Specifies the file group list name. This parameter cannot be left blank. The value contains the following two parts:                                                                                                                                                                                         | ``-``                                                                                                                                                                                                                                      |
         |                        |                                                                                                                                                                                                                                                                                                              |                                                                                                                                                                                                                                            |
         |                        | -  **Name**: name of the file group list.                                                                                                                                                                                                                                                                    |                                                                                                                                                                                                                                            |
         |                        | -  **filegroups**: absolute path of dynamic log files.                                                                                                                                                                                                                                                       |                                                                                                                                                                                                                                            |
          
         | positionFile           | Specifies the location where the collected file information (file name and location from which the file collected) is saved. This parameter cannot be left blank. The file does not need to be created manually, but the Flume running user needs to have the write permission on its upper-level directory. | /home/omm/flume/positionfile                                                                                                                                                                                                               |
          
         | batchSize              | Specifies the number of events that Flume sends in a batch.                                                                                                                                                                                                                                                  | 61200                                                                                                                                                                                                                                      |
          
         | hdfs.path              | Specifies the HDFS data write directory. This parameter cannot be left blank.                                                                                                                                                                                                                                | hdfs://hacluster/flume/test                                                                                                                                                                                                                |
          
         | hdfs.filePrefix        | Specifies the file name prefix after data is written to HDFS.                                                                                                                                                                                                                                                | TMP\_                                                                                                                                                                                                                                      |
          
         | hdfs.batchSize         | Specifies the maximum number of events that can be written to HDFS once.                                                                                                                                                                                                                                     | 61200                                                                                                                                                                                                                                      |
          
         | hdfs.kerberosPrincipal | Specifies the Kerberos authentication user, which is mandatory in security versions. This configuration is required only in security clusters.                                                                                                                                                               | flume_hdfs                                                                                                                                                                                                                                 |
          
         | hdfs.kerberosKeytab    | Specifies the keytab file path for Kerberos authentication, which is mandatory in security versions. This configuration is required only in security clusters.                                                                                                                                               | /opt/test/conf/user.keytab                                                                                                                                                                                                                 |
         |                        |                                                                                                                                                                                                                                                                                                              |                                                                                                                                                                                                                                            |
         |                        |                                                                                                                                                                                                                                                                                                              | .. note::                                                                                                                                                                                                                                  |
         |                        |                                                                                                                                                                                                                                                                                                              |                                                                                                                                                                                                                                            |
         |                        |                                                                                                                                                                                                                                                                                                              |    Obtain the **user.keytab** file from the Kerberos certificate file of the user **flume_hdfs**. In addition, ensure that the user who installs and runs the Flume client has the read and write permissions on the **user.keytab** file. |
          
         | hdfs.useLocalTimeStamp | Specifies whether to use the local time. Possible values are **true** and **false**.                                                                                                                                                                                                                         | true                                                                                                                                                                                                                                       |
          

   d. .. _mrs_01_1064__l78938a30f82d4a5283b7c4aaa1bb79b1:

      Click **Export** to save the **properties.properties** configuration file to the local.

#. Upload the configuration file.

   Upload the file exported in :ref:`2.d <mrs_01_1064__l78938a30f82d4a5283b7c4aaa1bb79b1>` to the *Flume client installation directory*\ **/fusioninsight-flume-**\ *Flume component version number*\ **/conf** directory of the cluster.

4. Verify log transmission.

   a. Log in to FusionInsight Manager as a user who has the management permission on HDFS. For details, see :ref:`Accessing FusionInsight Manager (MRS 3.x or Later) <mrs_01_2124>`. Choose **Cluster** > **Services** > **HDFS**. On the page that is displayed, click the **NameNode(**\ *Node name*\ **,Active)** link next to **NameNode WebUI** to go to the HDFS web UI. On the displayed page, choose **Utilities** > **Browse the file system**.
   b. Check whether the data is generated in the **/flume/test** directory on the HDFS.
