Help Center> Object Storage Migration Service> Best Practices> Archive Data Migration> Migrating Archived Data in Alibaba Cloud OSS
Updated on 2024-04-19 GMT+08:00

Migrating Archived Data in Alibaba Cloud OSS

Alibaba Cloud OSS provides the ossutil tool to restore archive objects with specified prefixes.

ossutil is compatible with Windows, Linux, and macOS. Download and install the required version.

This section uses Windows as an example.

Procedure

  1. Download the ossutil tool.

  2. Decompress the installation package and double-click ossutil.bat.
  3. Run the following command to generate a configuration file:

    Decompression path\ossutil& >ossutil64.exe config

  4. Configure the generated file in interactive mode.

    1. Run the following config command:
      ./ossutil64 config
    2. Configure the path of the configuration file as prompted.

      You are advised to press Enter to use the default path of the configuration file.

    3. Configure the interface language of ossutil as prompted.

      Enter CH or EN. By default, the interface of ossutil is using the same language as the operating system. This configuration takes effect after you run the config command.

    4. Follow the prompts to configure parameters Endpoint, AccessKey ID, AccessKey Secret, and STSToken.

      Parameter description:

      • Endpoint: specifies the endpoint of the region in which your source bucket is located. You can also add http:// or https:// to the endpoint to specify that you want ossutil to use to OSS. The default protocol is HTTP. For example, if you want to access an OSS bucket in the China (Shenzhen) region by using HTTPS, set the endpoint to https://oss-cn-shenzhen.aliyuncs.com.
      • AccessKey ID and AccessKey Secret: specify the access key pair of your Alibaba Cloud account.
      • stsToken: This parameter is required only when you use temporary access credentials to access an OSS bucket.

    Example:

    ./ossutil64 config 
    Enter the name configuration file name. The file name can contain a path. The default path is /home/user/.ossutilconfig. If you press the Enter key without specifying a different path, the file is generated in the default path.
    If you want to generate the file in another path, set the -config-file option to the path when you run this command.
    If you do not specify the configuration file path, the default configuration file /home/user/.ossutilconfig is used.
    If you press the Enter key without configuring the following parameters, these parameters are ignored. To obtain more information about the parameters, run the help config command.
    Enter the endpoint:
    Enter the AccessKey ID:
    Enter the AccessKey Secret:
    Enter the STS Token:

  5. Run the restore command to restore archive files.

    Command syntax:
    Binary name restore oss://bucketname[/prefix][local_xml_file]
    [--encoding-type <value>]
    [--payer <value>]
    [--version-id <value>]
    [-r, --recursive]
    [-f, --force]
    [--retry-times <value>]
    [-j, --job <value>]

    The binary name at the beginning of the command line needs to be replaced based on the operating system. For example, replace the binary name with ./ossutil64 in a 64-bit Linux operating system. For details, see Getting Started with Alibaba Cloud OSS ossutil.

    The following table describes the parameters you can configure to run the restore command.

    Parameter

    Description

    bucketname

    The name of the bucket in which the objects to restore are stored.

    prefix

    The prefixes that are used to filter objects in the bucket.

    local_xml_file

    The local XML file used to store parameters that you can configure to restore archive objects.

    --encoding-type

    The method that is used to encode the value of the prefix parameter. The valid value is url.

    If you do not specify this parameter, the value of the prefix parameter is not encoded.

    --payer

    The payer of the traffic and request fees incurred when the command is run.

    To enable the requester to pay the traffic and request fees for accessing the resources in the specific path, set this parameter to requester.

    --version-id

    The version ID of the object that you want to restore. This parameter applies only to objects in buckets for which versioning is enabled or suspended.

    -r, --recursive

    If you specify this parameter, ossutil restores all objects whose names contain the specified prefix in the bucket.

    If you do not specify this parameter, ossutil restores only the specified object.

    -f, --force

    The operation that is forcibly performed without prompts.

    --retry-times

    The number of retries after the command fails to be run. The default value is 10. The value ranges from 1 to 500.

    -j, --job

    The number of concurrent tasks performed across multiple objects. The default value is 3. The value ranges from 1 to 10,000.

    For details, see the documents related to Alibaba Cloud OSS restore.

  6. Migrate restored data by referring to Migrating Data from Alibaba Cloud OSS to Huawei Cloud OBS.