Configuring Synchronization Policies in Batches
Function
- This API is used to configure synchronization policies in batches, including conflict policies, DROP Database filtering, and object synchronization scope.
- This API is used to configure Kafka synchronization policies.
Debugging
You can debug the API in API Explorer to support automatic authentication. API Explorer can automatically generate and debug example SDK code.
Constraints
- This API can be called only after a task is created, the task status is CONFIGURATION, the test of connections to the source and destination databases is successful, and the API for modifying the task is successfully called.
- Kafka synchronization policies can be configured for the following data flow scenarios: synchronization from PostgreSQL to Kafka, from Oracle to Kafka, from GaussDB to Kafka, from GaussDB(for MySQL) to Kafka, and from MySQL to Kafka.
- GaussDB(for MySQL)-to-Kafka synchronization and MySQL-to-Kafka synchronization allow you to modify the Kafka policy configuration when the task is in the INCRE_TRANSFER_STARTED state. After the configuration is modified, you can edit the synchronization objects only when the task status changes to INCRE_TRANSFER_STARTED.
URI
POST /v3/{project_id}/jobs/batch-sync-policy
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID of a tenant in a region For details about how to obtain the project ID, see Obtaining a Project ID. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
Content-Type |
Yes |
String |
The content type. The default value is application/json. |
X-Auth-Token |
Yes |
String |
User token obtained from IAM. |
X-Language |
No |
String |
Request language type Default value: en-us Values:
|
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
jobs |
Yes |
Array of objects |
List of requests for setting synchronization policies in batches. For details, see Table 4. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
job_id |
Yes |
String |
Task ID. |
conflict_policy |
No |
String |
Conflict policy. Values:
|
filter_ddl_policy |
No |
String |
DDL filtering policy. Value: drop_database |
ddl_trans |
No |
Boolean |
Whether to synchronize DDL during incremental synchronization. |
index_trans |
No |
Boolean |
Whether to synchronize indexes during incremental synchronization. |
topic_policy |
No |
String |
Topic synchronization policy. This parameter is mandatory when destination database is Kafka. Values for synchronization from GaussDB Distributed to Kafka:
Values for synchronization from GaussDB Primary/Standby to Kafka and from PostgreSQL to Kafka:
Values for synchronization from Oracle to Kafka:
Values for synchronization from MySQL to Kafka:
Values for synchronization from GaussDB(for MySQL) to Kafka:
|
topic |
No |
String |
Topic name. This parameter is mandatory when topic_policy is set to 0. Ensure that the topic exists. |
partition_policy |
No |
String |
The policy for synchronizing topics to the Kafka partitions. This parameter is mandatory when the destination database is Kafka..
When topic_policy is set to 0, the value can be 0, 1, 2, 3, 4, or 5. When topic_policy is set to 1, the value can be 1, 2, or 5. When topic_policy is set to 2, the value can be 0, 1, 3, or 4. When topic_policy is set to 3, the value can be 0 or 1. When topic_policy is set to 4, the value can be 0, 1, or 3. |
kafka_data_format |
No |
String |
Data format delivered to Kafka. Available options:
If this parameter is left blank, the default value is json.
NOTE:
|
topic_name_format |
No |
String |
The topic name format. This parameter is required if topic_policy is set to 1, 2, or 3. Values for synchronization from PostgreSQL to Kafka and synchronization from GaussDB primary/standby to Kafka:
Values for synchronization from Oracle to Kafka:
Values for synchronization from MySQL to Kafka and GaussDB(for MySQL) to Kafka:
|
partitions_num |
No |
String |
Number of partitions. The value ranges from 1 to 2147483647. This parameter is mandatory if topic_policy is set to 1, 2, or 3. If this parameter is left blank, the default value is 1. |
replication_factor |
No |
String |
Number of replicas. The value ranges from 1 to 32767. This parameter is mandatory if topic_policy is set to 1, 2, or 3. If this parameter is left blank, the default value is 1. |
is_fill_materialized_view |
No |
Boolean |
Whether to fill the materialized view in the PostgreSQL full migration/synchronization phase. If this parameter is not specified, the default value is false. |
export_snapshot |
No |
Boolean |
Whether to export data in snapshot mode in the PostgreSQL full migration/synchronization phase. If this parameter is not specified, the default value is false. |
slot_name |
No |
String |
Replication slot name. This parameter is mandatory for tasks from GaussDB Primary/Standby to Kafka. This parameter is optional for an incremental synchronization task with PostgreSQL serving as the source database. |
file_and_position |
No |
String |
|
gtid_set |
No |
String |
|
ddl_topic |
No |
String |
Topic for storing DDLs. This parameter is mandatory when Kafka is the destination database and ddl_trans is set to true. Value: name of an existing topic in the destination database. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
count |
Integer |
Total number. |
results |
Array of objects |
List of returned synchronization policies that are configured in batches. For details, see Table 6. |
Example Request
- Configuring synchronization task policies in batches, in which conflict_policy is set to ignore, ddl_trans is set to true, and filter_ddl_policy is set to drop_database
https://{endpoint}/v3/054ba152d480d55b2f5dc0069e7ddef0/jobs/batch-sync-policy { "jobs": [{ "conflict_policy": "ignore", "ddl_trans": true, "filter_ddl_policy": "drop_database", "index_trans": true, "job_id": "19557d51-1ee6-4507-97a6-8f69164jb201" }] }
- Configuring MySQL incremental synchronization task policies in batches:
https://{endpoint}/v3/054ba152d480d55b2f5dc0069e7ddef0/jobs/batch-sync-policy { "jobs": [ { "conflict_policy": "ignore", "ddl_trans": true, "filter_ddl_policy": "drop_database", "index_trans": true, "job_id": "19557d51-1ee6-4507-97a6-8f69164jb201", "file_and_position": "mysql-bin.000019:197", "gtid_set":"e4979f26-4bc3-11ee-b279-fa163ef21d64:1-23" } ] }
Example Response
Status code: 200
OK
{ "results" : [ { "id" : "19557d51-1ee6-4507-97a6-8f69164jb201", "status" : "success" } ], "count" : 1 }
Status Code
Status Code |
Description |
---|---|
200 |
OK |
400 |
Bad Request |
Error Code
For details, see Error Code.
Feedback
Was this page helpful?
Provide feedbackThank 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