Configuring a Synchronization Request on the Source Platform
Scenarios
After you create a synchronization task, you need to configure a synchronization request on the source platform. Then the source object storage will call the synchronization API of OMS through a message notification or function to migrate newly added or modified source objects.
Desired Effects
- The names of newly added and modified objects in the source bucket can be obtained in real time.
- The synchronization API can be invoked to migrate the newly added and modified objects to the destination bucket.
Configuration Methods
- Using the object storage service and function service
On the source platform, you need to use a function service to create a function and configure event notification for synchronizing incremental source objects through OMS.
When objects are added to or modified in the source bucket, the source object storage service will call the configured function to trigger migration of these objects to the destination bucket.
- Using a self-built service system
When objects are added or modified in the source bucket, the self-build service system proactively captures the information about these objects through the messages received from the object storage service on the source platform or by analyzing the database changes to the service system. Then the system invokes the synchronization API of OMS to migrate the newly added and modified objects from the source bucket to the destination bucket.
Procedure
Following operations use HUAWEI CLOUD as the source platform to describe how to use FunctionGraph to configure synchronization requests:
- Log in to the management console.
- Click Service List and choose Computing > FunctionGraph.
The FunctionGraph console is displayed.
- In the navigation pane on the left, choose Templates.
- In the search box in the upper right corner of the displayed page, enter OMS and locate the OMS Data Synchronization template, as shown in Figure 1.
Click View Details to view the template details, such as template type, input parameters, output parameters, and precautions.
- Click Configure. The Create Function page is displayed, as shown in Figure 2. Set function parameters. For details about the parameters, see Table 1.
Table 1 Parameters required for creating a function Parameter
Description
Template
sync-oms-data-python
Function Name
Specify the function name as needed. The name must meet the following requirements:
App
Select default, the default app on FunctionGraph.
Agency
Select Use no agency.
Enterprise Project
Set this parameter as needed. The default value is default.
(Optional) Description
Describe the function as needed.
Runtime
Python 3.6
Handler
Enter index.handler.
Environment Variables
- sync_url: Enter the address for receiving synchronization requests, which can be obtained from the synchronization task details.
- sync_task_id: Enter the synchronization task ID, which can be obtained from the synchronization task list page.
- log_bucket: Enter the name of the bucket used for storing the function invoking logs. The lists of requested or unrequested objects will also be stored into this bucket. The bucket must reside in the current region.
- obs_endpoint: Enter the OBS domain name for current region. For details about regions and endpoints, see Regions and Endpoints.
- hw_ak: HUAWEI CLOUD access key ID
- hw_sk: HUAWEI CLOUD private access key NOTE:
Click Add Environment Variable to add a customized environment variable.
- Click Create Now in the pane on the right.
The function details page is displayed.
- On the displayed Code page, click Select on the right of Dependencies. In the displayed Select Dependency dialog box, select dependency obssdk-v3 and click OK.
- Click the Configuration tab. On the displayed page, set Execution Timeout (s) to 60 (recommended), and click Save in the upper right corner, as shown in Figure 3.
- Click the Triggers tab. In the upper right corner of the displayed page, click Create Trigger. The Create Trigger dialog box is displayed, as shown in Figure 4. Set trigger parameters. For details about the parameters, see Table 2.
Table 2 Parameters required for creating a trigger Parameter
Description
Trigger Type
Select Object Storage Service (OBS) from the drop-down list.
Bucket Name
Select the bucket where the data to be synchronized resides from the drop-down list.
Events
Set this parameter based on your requirements.
(Optional) Event Notification Name
An event name is automatically generated. You can specify a name as needed.
(Optional) Prefix
Enter a prefix to limit notifications to objects whose names start with the matching characters.
(Optional) Suffix
Enter a suffix to limit notifications to objects whose names end with the matching characters.
- Click OK.
You need to configure a test event to verify the function.
- In the upper right corner of the function details page, select Configure Test Event from the Select test event drop-down list. The Configure Test Event dialog box is displayed, as shown in Figure 5. Set the parameters listed in Table 3.
- Click Save.
- Click Test in the upper right corner of the function details page. The test result is displayed in the upper part of the page. Figure 6 Test result
After the test succeeds, upload an object to the source bucket. Wait for 10 minutes. Then the object will be synchronized to the destination bucket.
Obtaining Object Lists
| Object List | Path |
|---|---|
| List of requested objects | oms_source_record/success_object |
| List of unrequested objects | oms_source_record/failed_object/ |
The objects in the lists are those to be synchronized.
Last Article: Creating a Synchronization Task
Next Article: Monitoring a Synchronization Task





Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.