Updated on 2024-11-29 GMT+08:00

MOTService Data Aging Configuration

Scenario

When there are large service volume, the data to be stored in MOTService increases very rapidly. Effective management of aged data is the key to the long-term stable running of MOTService. Table-level data period management and aging configuration are implemented for the data stored in MOTService to ensure that the data volume of MOTService is appropriate and stable. Based on whether a data table contains any time field, you can determine whether the data has expired. You can manage MOTService data as follows:

  • A data table contains a time field.

    On the RTD web UI, when an event source is created, data period management is automatically created for the data import tables of each dimension. The maximum data storage duration, data deletion period, and data volume to be deleted can be customized. For details, see Adding an Event Source.

  • A data table does not contain a time field.

    The mot-clean-data.sh script is used to delete aged data in batches. You can customize the calling period and data deletion conditions.

The following describes how to use the mot-clean-data.sh script to delete MOTService data.

Procedure

  1. Log in to the active MOTService node as user omm and run the following command to start environment variables:

    source ${MOTSERVER_HOME}/.motservice_profile

  2. Run the following command to go to the tools/handleTools directory:

    cd ${MOTSERVER_HOME}/tools/handleTools

  3. Run the following command to configure the dbConf.properties file, add the following content to the file, and save the file:

    vi dbConf.properties
    g_rtdDbName=Name of the database from which data is to be deleted
    g_rtdDbUser=Username for connecting to the database
    g_batchSize=Maximum amount of data to be deleted at a time, for example, 10000
    g_delIntervalTime=Data deletion interval, in seconds, for example, 5

  4. Run the mot-clean-data.sh script to delete MOTService data.

    sh mot-clean-data.sh -n "t_payment_vt3" -c "pid>'123456'" -f "./dbConf.properties"

    Enter the password for connecting to the database as prompted. If the following information is displayed, the data is successfully deleted:

    Close the preparedStatement(pst) succeed.
    A total of (78671) data records are deleted.
    Close connection succeed!

    Parameter description:

    • -n: name of the database table from which data is to be deleted.
    • -c: condition for deleting data. If the table does not contain a time field, data can be deleted based on specified conditions.
    • -f: database parameter configuration file.