Copied.
Same-Region Replication Within an Account Using OMS
Scenarios
Same-region replication within an account is to replicate data from a source bucket to a destination bucket within the same region of an account.
This section describes how to replicate data between buckets within the same region of an account using the OMS console, OMS APIs, OBS APIs, OBS SDKs, OBS Browser+, or obsutil.
Replication scope: files/folders, object lists, objects with a specified prefix, URL lists, and objects modified after a specified time
Replication content: object content, metadata (object name, size, last modification time, creator, version number, and user-defined metadata), ACL (supported by OBS APIs and obsutil), WORM retention policy (supported by OBS APIs), object tag (supported by OBS APIs), and storage class
OBS helps you replicate your service data stored in OBS to another bucket in the same region. However, Huawei Cloud does not have visibility into your data and is not responsible for ensuring the legal compliance of your use of OBS.
Constraints
For details about the constraints on using OMS for data migration, see OMS Notes and Constraints.
Billing for Same-Region Replication Within an Account
- When you use the OMS console or APIs to migrate data, OBS APIs of both the source and destination ends are invoked to handle data upload and download. You will be billed for the API requests and data download traffic. For details, see OMS Billing. In addition, you will be billed for storing the objects in the destination bucket. For details, see Storage Costs.
- When you use OBS APIs, OBS SDKs, OBS Browser+, or obsutil to replicate data within the same region, you will be billed for requests and storage. For details, see Table 1.
Table 1 Billing for data replication in the same region Action
Billing Item
Description
Billing Mode
Replicate data in the same region
Requests
You are billed for the number of successfully replicated objects. Successfully replicating one object creates a copy request. For details, see Copying Objects.
To learn about the request billing, see Requests.
Pay-per-use
Data transfer
Free, because data in the same region is replicated over an intranet.
N/A
Storage space
Storage space occupied by objects stored in the destination bucket.
If you have specified another storage class for object copies in the destination bucket, these copies are billed based on the new storage class.
Pay-per-use
Resource packages
Prerequisites
- There is a source bucket in a region of an account.
- There is a destination bucket in the same region of the same account. To create a bucket, see Creating a Bucket.
Same-Region Replication Within an Account
You can use the OMS console or APIs to migrate data within the same account and region or use OBS APIs, SDKs, or obsutil to replicate data within the same account and region.
OMS does not automatically migrate data. This means that data changes in a source bucket will not be automatically synchronized to the destination bucket. To synchronize the data changes, you must execute a migration task.
Using the OMS Console
The following example describes how to use OMS to migrate data from bucket-C in the CN North-Beijing4 region of account C to bucket-D in the same region of the same account. In this example, both the source and destination data are stored in Huawei Cloud OBS buckets.
- If the source bucket has no more than 3 TB of data or has no more than 5 million objects, perform the following steps to migrate the data. For more information, see Creating a Migration Task.
- If the source bucket has more than 3 TB of data or has more than 5 million objects, create a migration task group to migrate the data in the bucket.
- Create AK/SK pairs for the source and destination accounts.
- Source: Log in to the console using account C and create an AK/SK pair by referring to Obtaining Access Keys (AK/SK).
- Destination: The destination has the same AK/SK pair as the source.
- Use account C to create a migration task on the OMS console.
- Log in to the OMS console and select the region where the destination bucket is located.
- In the navigation pane, choose Migration Tasks and click Create Migration Task in the upper right corner.
- (Optional) Perform a pre-migration assessment. You can enable or disable Pre-Migration Evaluation.
After this option is enabled, you can specify the number of files to migrate, their total size, and the estimated migration duration. Then, let OMS start an assessment to help you better plan the migration and ensure that your services are not affected during the migration.
- Configure source parameters. For details, see Table 2.
Table 2 Source parameters Parameter
Example Value
Description
Data Source
Huawei Cloud
The source cloud service provider
Access Key ID
Account C's AK obtained in 1
The AK used to access the source cloud platform. It can contain a maximum of 100 characters.
Secret Access Key
Account C's SK obtained in 1
The SK used to access the source cloud platform. It matches the AK. It can contain a maximum of 100 characters.
KMS Key
Disabled
Choose whether to use a KMS key to encrypt your source key.
Specify Source Bucket
Disabled
Enable this option if your source account does not have the permissions required to list buckets but has the permissions to list objects in buckets, obtain object metadata, and obtain object content. Then specify the bucket path to be migrated.
For details, see the description of whether to specify the source bucket.
Bucket
bucket-C
Click the Bucket drop-down list or the refresh icon and select the bucket where data needs to be migrated. OMS will check whether the source platform can be connected using the information you provided. If the source platform is connected and your account has permissions to list buckets, all buckets in your account will appear in the Bucket drop-down list.
- Configure destination parameters. For details, see Table 3.
Table 3 Destination parameters Parameter
Example Value
Description
Access Key ID
Account C's AK obtained in 1
The AK used to access Huawei Cloud. It can contain a maximum of 100 characters.
Secret Access Key
Account C's SK obtained in 1
The SK used to access Huawei Cloud. It matches the AK. It can contain a maximum of 100 characters.
KMS Key
Disabled
Choose whether to use a KMS key to encrypt your destination key.
Bucket
bucket-D
Click the Bucket drop-down list or the refresh icon and select the Huawei Cloud OBS bucket for storing the migrated data. The destination bucket must be located in the region where you are using OMS.
- Click Next in the lower right corner and configure task parameters.
- Configure task parameters for the source. For details about migration methods, see Creating a Migration Task.
Table 4 Task parameters for the source Parameter
Example Value
Description
Migration Method
File/Folder
Select a migration method based on your requirements.
File/Folder
BigData, a folder in the source bucket bucket-C
Select the files or folders to be migrated. If no files or folders are selected, all objects in the bucket will be migrated by default. If you specify an object name prefix, all objects that match the prefix will be migrated.
- Configure task parameters for the destination.
Table 5 Task parameters for the destination Parameter
Example Value
Description
Specify Prefix
Disabled
When this option is enabled, you must specify a prefix. After the migration, the prefix will be added to the object names in the destination bucket. For details, see Using a Specified Prefix for Migration.
Object Storage Class
Default
Choose the storage class for the objects after they are migrated to Huawei Cloud OBS. For details about storage classes, see Overview.
- Click
next to Advanced Settings. Configure the displayed options by referring to Table 6. Table 6 Advanced settings Parameter
Example Value
Description
Object Metadata
Do not migrate
Choose a metadata migration method.
Incremental Data
Disabled
If you enable this option, you can specify a time so that only source objects modified after that time are migrated.
Failed Object Record
Enabled
Determine whether to record the objects that fail to be migrated.
Archive Data Restoration
Disabled
Determine whether to automatically restore archived data and migrate it. Enabling this option will incur additional costs.
NOTE:This function is applicable to the following clouds: Huawei Cloud (COLD), Alibaba Cloud (Archive), Kingsoft Cloud (ARCHIVE), Tencent Cloud (ARCHIVE), and UCloud (ARCHIVE).
Send Notification
Unselected
If you enable this option, you will be notified of the migration result. Ensure that you have subscribed to the selected topic. Otherwise, SMN notifications will not be sent to your intended address.
Traffic Limit
Disabled
Set the maximum bandwidth for the migration task during different periods.
Object Overwrite
Overwrite if source newer or different size
Choose how to overwrite objects with the same name.
Consistency Check
By size and last modification time
Choose how to check data consistency after the migration.
Priority
Medium
If there are a large number of tasks, you can set task priorities to control which tasks take precedence over others.
Description
Custom input
Enter a brief description about the migration task. Enter a maximum of 255 characters.
- Configure task parameters for the source. For details about migration methods, see Creating a Migration Task.
- Click Next to open the confirmation page.
- Ensure the migration settings are correct and click Migrate Now.
Read the prompted information and click OK.
- Go back to the task list. Then, check the created migration task.
Click the task name to check the number of migrated objects, total number of objects, task progress, migration speed, source and destination information, and migration task settings.
Using APIs
- Using OMS APIs
- Using OBS APIs
- To replicate an object that is between 0 bytes and 5 GB in size, see Copying an Object.
- To replicate an object larger than 5 GB, you can only copy part of the object.
Using the GUI Tool - OBS Browser+
Constraints
- Files or folders in external buckets cannot be copied.
- The restore status of Archive objects cannot be copied.
- The source path and target path must be different.
Procedure
- Log in to OBS Browser+.
- Go to the target bucket. Right-click the file or folder and choose Copy from the shortcut menu.
- Right-click the path for saving the file or folder and choose Paste from the shortcut menu.
Using the OBS CLI Tool - obsutil
When using obsutil to replicate objects within the same account and region, do not enable cross-region replication. In other words, do not configure the crr parameter.
- Do not change the source objects in the OBS bucket when copying a single object or objects in batches. Otherwise, the operation may fail or data may be inconsistent.
- If the storage class of the object to be copied is cold, you must restore the object to be copied first. Otherwise, the copy fails.
- To copy objects, you must have the read permission on the objects to be copied and the write permission on the destination bucket.
- If the client-side cross-region replication function is not enabled, ensure that the source bucket and destination bucket are in the same region.
- If the source bucket is a parallel file system (supporting POSIX), the destination bucket must also be a parallel file system.
Constraints
- The source and destination paths cannot be the same.
- The source and destination paths cannot be nested during a batch copy.
- If the destination path has the source path as its prefix, recursive copy may occur.
- If the source path has the destination path as its prefix, overwriting may occur.
Command Line Structure
- Windows
- Copying a single object
obsutil cp obs://srcbucket/key obs://dstbucket/[dest] [-dryRun][-u] [-crr] [-vlength] [-vmd5] [-p=1] [-threshold=52428800] [-versionId=xxx] [-acl=xxx] [-sc=xxx] [-meta=aaa:bbb#ccc:ddd] [-ps=auto] [-cpd=xxx] [-fr] [-o=xxx] [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx]
- Copying objects in batches
obsutil cp obs://srcbucket[/key] obs://dstbucket[/dest] -r [-dryRun][-f] [-flat] [-u] [-crr] [-vlength] [-vmd5] [-j=1] [-p=1] [-threshold=52428800] [-acl=xxx] [-sc=xxx] [-meta=aaa:bbb#ccc:ddd] [-ps=auto] [-include=*.xxx] [-exclude=*.xxx] [-timeRange=time1-time2] [-mf] [-o=xxx] [-cpd=xxx] [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx]
- Copying a single object
- macOS or Linux
- Copying a single object
./obsutil cp obs://srcbucket/key obs://dstbucket/[dest] [-dryRun] [-u] [-crr] [-vlength] [-vmd5] [-p=1] [-threshold=52428800] [-versionId=xxx] [-acl=xxx] [-sc=xxx] [-meta=aaa:bbb#ccc:ddd] [-ps=auto] [-cpd=xxx] [-fr] [-o=xxx] [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx]
- Copying objects in batches
./obsutil cp obs://srcbucket[/key] obs://dstbucket[/dest] -r [-dryRun] [-f] [-flat] [-u] [-crr] [-vlength] [-vmd5] [-j=1] [-p=1] [-threshold=52428800] [-acl=xxx] [-sc=xxx] [-meta=aaa:bbb#ccc:ddd] [-ps=auto] [-include=*.xxx] [-exclude=*.xxx] [-timeRange=time1-time2] [-mf] [-o=xxx] [-cpd=xxx] [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx]
- Copying a single object
Examples
- In Windows, run obsutil cp obs://bucket-test/key obs://bucket-test2 to copy a single object.
obsutil cp obs://bucket-test/key obs://bucket-test2 Start at 2024-09-30 08:30:09.0815415 +0000 UTC Parallel: 3 Jobs: 3 Threshold: 50.00MB PartSize: auto CheckpointDir: xxxx [=====================================================] 100.00% 6/s 0s Waiting for the copied key to be completed on server side. Copy successfully, 19B, obs://bucket-test/key --> obs://bucket-test2/key ext.txt, cost [1708], status [200], request id [00000192420D227E4017336A12F1DC22]
- In Windows, run obsutil cp obs://bucket-test/temp/ obs://bucket-test2 -f -r to copy objects in batches.
obsutil cp obs://bucket-test/temp/ obs://bucket-test2 -r -f Start at 2024-09-30 08:34:02.7819703 +0000 UTC Parallel: 5 Jobs: 5 Threshold: 50.00MB PartSize: auto CheckpointDir: xxxx Task id: 0476929d-9d23-4dc5-b2f8-0a0493f027c5 OutputDir: xxxx [=============================================================] 100.00% 10/s 0s Succeed count: 5 Failed count: 0 Metrics [max cost:298 ms, min cost:192 ms, average cost:238.00 ms, average tps:9.71, transferred size: 7.20MB] Task id: 0476929d-9d23-4dc5-b2f8-0a0493f027c5
- For more examples, see Common Examples.
Parameter Description
| Parameter | Optional or Mandatory | Description |
|---|---|---|
| srcbucket | Mandatory | The source bucket name |
| dstbucket | Mandatory | The destination bucket name |
| dest | Optional | The destination object name when copying an object, or the name prefix of destination objects when copying objects in batches |
| key | Mandatory for copying an object. Optional for copying objects in batches. | The source object name when copying an object, or the name prefix of source objects when copying objects in batches The rules are as follows:
NOTE: For details about how to use this parameter, see Copy. |
| fr | Optional for copying an object (additional parameter) | Generates an operation result file when copying an object. |
| flat | Optional for copying objects in batches (additional parameter) | The name prefix of the parent object is excluded when copying objects in batches. |
| dryRun | Optional (additional parameter) | Conducts a dry run. |
| crr | Do not set this parameter for same-region replication within an account. | Enables the client-side cross-region replication function. In this mode, data is directly copied to the destination bucket from the source bucket through data stream. The buckets can be any two OBS buckets.
NOTE: The configurations of the source bucket and destination bucket are respectively akCrr/skCrr/tokenCrr/endpointCrr and ak/sk/token/endpoint in the configuration file. |
| vlength | Optional (additional parameter) | Verifies whether the object size in the destination bucket is the same as that in the source bucket after the copy task completes. This parameter must be used together with crr. |
| vmd5 | Optional (additional parameter) | Verifies whether the MD5 value of the destination bucket is the same as that of the source bucket after the copy task completes.
|
| u | Optional (additional parameter) | Indicates incremental copy. If this parameter is set, each object can be copied only when it does not exist in the destination bucket, its size is different from the namesake one in the destination bucket, or it has the latest modification time. |
| p | Optional (additional parameter) | The maximum number of concurrent multipart copy tasks when copying an object. The default value is the value of defaultParallels in the configuration file. |
| threshold | Optional (additional parameter) | The threshold for enabling multipart copy. If the size of the object to be copied is smaller than the threshold, copy the object directly. If not, a multipart copy is required. The default value is the value of defaultBigfileThreshold in the configuration file. Unit: byte This parameter value can contain a unit, for example, 1MB (indicating 1,048,576 bytes). NOTE: If you copy an object directly, no part record is generated, and resumable transmission is not supported. |
| versionId | Optional for copying an object (additional parameter) | The source object version ID that can be specified when copying an object |
| acl | Optional (additional parameter) | The access control policies for destination objects that can be specified when copying objects. Possible values are:
|
| sc | Optional (additional parameter) | The storage classes of the destination objects that can be specified when copying objects. Possible values are:
|
| meta | Optional (additional parameter) | The standard or user-defined metadata that can be specified during object replication.
|
| fs | Optional (additional parameter) | Specifies whether the method of listing parallel file systems is applied. If you are listing parallel file systems, you are recommended to add this parameter.
|
| ps | Optional (additional parameter) | The size of each part in a multipart copy task
|
| cpd | Optional (additional parameter) | The folder where the part records reside. The default value is .obsutil_checkpoint, the subfolder in the home directory of the user who executes obsutil commands. A part record is generated during a multipart copy and saved to the upload subfolder. After the copy succeeds, its part record is deleted automatically. If the copy fails or is suspended, the system attempts to resume the task according to its part record when you perform the copy the next time. |
| r | Mandatory for copying objects in batches (additional parameter) | Copies objects in batches based on a specified name prefix of objects in the source bucket. |
| f | Optional for copying objects in batches (additional parameter) | Runs in force mode. |
| j | Optional for copying objects in batches (additional parameter) | The maximum number of concurrent tasks for copying objects in batches. The default value is the value of defaultJobs in the configuration file. NOTE: The value is ensured to be greater than or equal to 1. |
| exclude | Optional for copying objects in batches (additional parameter) | The matching patterns of source objects that are excluded. After this parameter is specified, if the name of the object to be copied matches the value of this parameter, the object is skipped. For example, if this parameter is set to *.txt, all files whose names end with .txt are skipped and not copied.
Constraints: This matching pattern applies only to objects whose names do not end with a slash (/). NOTE:
|
| include | Optional for copying objects in batches (additional parameter) | The included matching patterns of source objects. After this parameter is specified, if the name of the object to be copied matches the value of this parameter, the object is copied. For example, if this parameter is set to *.txt, all objects whose names end with .txt are copied.
Constraints:
Example: ./obsutil cp obs://src-bucket/ obs://target-bucket/ -include=/src-object/* -f -r This command copies files whose names start with src-object/ from the src-bucket bucket to the target-bucket bucket. NOTE:
|
| timeRange | Optional for copying objects in batches (additional parameter) | The time range matching pattern when copying objects. Only objects whose latest modification time is within the configured time range are copied. This pattern has a lower priority than the file matching patterns (exclude/include). That is, the time range matching pattern is executed after the configured file matching patterns.
This matching pattern applies only to objects whose names do not end with a slash (/). |
| mf | Optional (additional parameter) | Indicates that the name matching pattern (include or exclude) and the time matching pattern (timeRange) also take effect on objects whose names end with a slash (/). |
| o | Optional (additional parameter) | The folder that stores the result files. After the command is executed, result files (possibly success, failure, and warning files) will be created in the specified folder. The default value is .obsutil_output, a subfolder in the user's home directory where obsutil commands are executed.
|
| config | Optional (additional parameter) | The user-defined configuration file for executing the current command. To learn the parameters that can be configured in this file, see Configuration Parameters. |
| e | Optional (additional parameter) | The endpoint |
| i | Optional (additional parameter) | The user's AK |
| k | Optional (additional parameter) | The user's SK |
| t | Optional (additional parameter) | The user's security token |
Response
| Field | Description |
|---|---|
| Parallel | The parameter -p in the request |
| Jobs | The parameter -j in the request |
| Threshold | The parameter -threshold in the request |
| PartSize | The parameter -ps in the request |
| Exclude | The parameter -exclude in the request |
| Include | The parameter -include in the request |
| TimeRange | The parameter -timeRange in the request |
| VerifyLength | The parameter -vlength in the request |
| VerifyMd5 | The parameter -vmd5 in the request |
| CheckpointDir | The parameter -cpd in the request |
| OutputDir | The parameter -o in the request |
| ArcDir | The parameter -arcDir in the request |
| Succeed count | The number of successful tasks |
| Failed count | The number of failed tasks |
| Skip count | The number of tasks that are skipped during incremental upload, download, or copy, and synchronous upload, download, or copy. NOTE: Skipped tasks are recorded into successful tasks. |
| Warning count | The number of tasks that are executed successfully but contain warnings. NOTE:
|
| Succeed bytes | The number of bytes that are successfully uploaded or downloaded. |
| max cost | The maximum duration of all tasks, in ms |
| min cost | The minimum duration of all tasks, in ms |
| average cost | The average duration of all tasks, in ms |
| average tps | The average number of tasks completed per second |
| Task id | The unique ID of an operation, which is used to search for the result file generated for a batch task |
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot