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

Backing Up MOTService Data

Scenario

Logically back up the current database and back up specified database objects to a specified path.

Prerequisites

MOTService has been installed in the cluster and all components in the cluster are running properly.

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. Create a backup directory. (The /opt/backup directory is used as an example. The user omm must have operation permissions on this directory.)

    mkdir -p /opt/backup

  6. Change the owner of the backup directory.

    chown omm:wheel /opt/backup

  7. Back up service data to a specified path.

    • Back up only metadata.

      gs_dump -U user_name -W password -p 20105 database_name --schema-only -f Backup file name

      • user_name and password: username and password for connecting to the database.
      • database_name: name of the database to be backed up.
      • Backup file name: Enter the absolute path and name of the backup file, for example, /opt/backup/backup.sql.

      For example, run the following command:

      gs_dump -U motuser -W password -p 20105 db_mot --schema-only -f /opt/backup/backup.sql

      gs_dump[port='20105'][db_mot1][2022-09-01 14:37:35]: The total objects number is 411.
      gs_dump[port='20105'][db_mot1][2022-09-01 14:37:35]: [100.00%] 411 objects have been dumped.
      gs_dump[port='20105'][db_mot1][2022-09-01 14:37:35]: dump database db_mot1 successfully
      gs_dump[port='20105'][db_mot1][2022-09-01 14:37:35]: total time: 2427  ms
    • Back up metadata and service data at the same time.

      gs_dump -U user_name -W password -p 20105 database_name -f Backup file name

      The following is an example:

      gs_dump[port='20105'][db_mot1][2022-09-01 14:32:52]: The total objects number is 412.
      gs_dump[port='20105'][db_mot1][2022-09-01 14:32:52]: [100.00%] 412 objects have been dumped.
      gs_dump: [port='20105'] [db_mot1] [archiver] [2022-09-01 14:32:52] WARNING: archive items not in correct section order
      gs_dump[port='20105'][db_mot1][2022-09-01 14:32:52]: dump database db_mot1 successfully
      gs_dump[port='20105'][db_mot1][2022-09-01 14:32:52]: total time: 1804  ms