• Object Storage Service

obs
  1. Help Center
  2. Object Storage Service
  3. User Guide (S3cmd)
  4. Operation Guide
  5. Object Management
  6. Synchronizing an Object

Synchronizing an Object

When local data or data stored on OBS changes, you can perform this operation to synchronize the changed data from your local client to OBS or from OBS to your local client. By doing so, local data and data stored on OBS are consistent.

Procedure

  1. Open the command line tool.
  2. Run a command specific to the scenario:

    • Synchronizing local data to a bucket on OBS

    s3cmd sync params local-dir s3://my-bucket/prefix

    • Synchronizing data in a bucket on OBS to a local client

    s3cmd sync params s3://my-bucket/prefix local-dir

    NOTE:
    • local-dir is the path of local data.
    • my-bucket/prefix is the object to be synchronized. prefix is optional and specifies the prefix of objects in this bucket. If you do not specify objects, it indicates that all objects will be synchronized.
    • params is an optional variable that indicates the command parameter. You can configure a specific parameter to set properties of the object to be uploaded. Table 1 describes the optional parameters.
    Table 1 Parameters of synchronizing an object

    Parameter

    Description

    --no-check-md5

    Configure this parameter when the MD5 check is not required. After configuring this parameter, consistency between source objects and target objects is checked by object names and size.

    --skip-existing

    Skips existing objects that do not need to be synchronized.

    --delete-removed

    my-bucket/prefix is the object to be synchronized. prefix is optional and specifies the prefix of objects in this bucket.

    --recursive

    Recursively uploads objects.

    --multipart-chunk-size-mb=value

    Specifies the part size. The part size configured through S3cmd ranges from 5 MB to 5120 MB. The number of parts ranges from 1 to 10,000. The default part size is 15 MB.

    --continue-put

    Continues uploading an object's remaining content.

    --server-side-encryption-kms-id

    Specifies the server-side KMS encryption password.

    In the command output, if done is displayed at the end of all objects synchronized, and the cursor appears on the CLI again, it indicates that all objects have been synchronized.

  3. (Optional) Run a command specific to the scenario to check whether objects have been synchronized.

    • Check whether the local object has been synchronized with the target object on OBS.

      s3cmd ls s3://my-bucket

    • Check whether the object on OBS has been synchronized to the local client.

      ls local-dir