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

Restoring MOTService Data

Scenario

Use a backed up SQL file to restore MOTService data on a database instance before any services are running on the instance.

Prerequisites

  • MOTService has been installed in the cluster and all components in the cluster are running properly.
  • A backed up SQL file has been obtained by referring to Backing Up MOTService Data, and the user omm has been granted the read permission on the file.

Procedure

  1. Log in to FusionInsight Manager, choose Cluster > Services > MOTService, click Instance, and view and record the service IP address of the MOTServer(Active) instance.
  2. Log in to the active MOTService node as user omm.
  3. Run the following command to switch to the MOTService installation directory:

    cd $MOTSERVER_HOME

  4. Run the following command to configure environment variables:

    source .motservice_profile

  5. Run the following command to restore data:

    gsql -d database_name -p port -U user_name -W password -f Data backup file

    Restore the metadata or metadata and service data based on the backup file content.

    For example:

    gsql -d db_mot -p 20105 -U motuser -W password -f /opt/backup.sql

    SET
    SET
    SET
    SET
    SET
    SET
    SET
    SET
    CREATE FOREIGN TABLE
    ALTER FOREIGN TABLE
    ALTER FOREIGN TABLE
    REVOKE
    REVOKE
    GRANT
    GRANT
    total time: 43  ms

    For example, if no service data is found in the database, the following command output is displayed:

    db_mot=> select  * from t_transaction_mot;
     seq_no | pid | uid | sid | appid | clt_num | tm_acct_no | dd_apdate | client_age | tm_onsite | acct_no | miaoshu | auth_type | dev_type | trx_code | auth_id_type | auth_id | phy_id_type | phy_id | client_ip | acct_type | acct_bbk | trx_currency | trx
    _amount | mch_no | transaction_type | bll_no | bll_date | ext_data | lbs_distance | lbs_x | lbs_y | safe_distance_flag | lbs | lbs_city | lbs_country | chnl_cod | ptl_type | bank_customer_id | bank_customer_age | bank_customer_salary | amt | num | int
    _num
    --------+-----+-----+-----+-------+---------+------------+-----------+------------+-----------+---------+---------+-----------+----------+----------+--------------+---------+-------------+--------+-----------+-----------+----------+--------------+----
    --------+--------+------------------+--------+----------+----------+--------------+-------+-------+--------------------+-----+----------+-------------+----------+----------+------------------+-------------------+----------------------+-----+-----+----
    -----
    (0 rows)