Help Center/ Cloud Search Service/ Troubleshooting/ Functions/ How Do I Back Up Large Amounts of Data Using Snapshots?
Updated on 2024-11-20 GMT+08:00

How Do I Back Up Large Amounts of Data Using Snapshots?

Improve snapshot backup configurations to ensure that each snapshot takes less than 24 hours to create. For example:

  1. Specify indexes and back up data in batches. The default value is *, indicating that all indexes are backed up.
  2. Use a custom snapshot repository.
    1. Create a custom repository.

      CSS provides the repo_auto repository by default. You can create one by calling the following API:

      PUT _snapshot/my_backup
      {
          "type" : "obs",
          "settings" : {
            "bucket" : "css-backup-name",    // Bucket name
            "base_path" : "css_backup/711/",  // Backup path
            "chunk_size" : "2g",
            "endpoint" : "obs.xxx.com:443", //OBS domain name address
            "region" : "xxx",        //Region name
            "compress" : "true",        
            "access_key": "xxxxx",        //AK
            "secret_key": "xxxxxxxxxxxxxxxxx"    //SK
           "max_restore_bytes_per_sec": "100mb",           // OBS speed. The default value is 40 MB. You can increase the value if your cluster can achieve higher performance.
            "max_snapshot_bytes_per_sec": "100mb"
          }
      }
    2. Create a snapshot using a custom repository.
      PUT _snapshot/my_backup/Snapshot_name
      {
        "indices": "*", // Backup index. The asterisk (*) indicates indexes. Multiple indexes are separated by commas (,).
        "ignore_unavailable": true, // Whether to ignore the availability of a single index. The value true indicates that the availability is ignored.
      "include_global_state": false //: The default value is false, indicating that the cluster state and some other states are not saved.
      }
    3. Query the snapshot status.
      GET _snapshot/my_backup/snapshot_name/_status
    4. Restore indexes in the custom repository.
      POST /_snapshot/my_backup/snapshot_name/_restore
      {
        "indices": "test-00000000000",
        "ignore_unavailable": true,
        "include_global_state": false,
        "rename_pattern": "(.+)",
        "rename_replacement": "$1"
      }