The Lindorm search engine supports cross-cluster replication for scenarios such as disaster recovery and read/write splitting. This topic describes how to use the cross-cluster replication feature of the Lindorm search engine.
Notes
Cross-cluster replication for the Lindorm search engine is in public preview. To use this feature, you can contact Lindorm technical support on DingTalk (ID: s0s3eg3) to enable it.
Before you begin
The search engine version must be 3.10.4 or later.
Cross-cluster replication provides the following capabilities:
Synchronization between primary and standby clusters: Ensures real-time data synchronization between the primary and standby clusters.
Supported write operations on the primary cluster:
Batch writes (bulk)
Single-document operations (put)
Deletions by ID (delete by id)
Operations with eventual consistency: Real-time consistency is not guaranteed for the following operations.
Updates by ID (update by id)
Conditional updates (update by query)
Conditional deletions (delete by query)
Cross-cluster replication
You must use the ES API to configure cross-cluster replication. A UI-based configuration method is not yet available.
Create a leader index
You can create a leader index on the primary cluster.
Syntax
PUT /leaderindexParameters
Parameter | Description |
ccr_mode | Specifies the cross-cluster replication mode. parallel: Indicates parallel synchronization. The primary cluster uses multiple partitions to synchronize data to the standby cluster. |
ccr_id | A custom cluster ID. Note: For two-way synchronization, the primary and standby clusters must have different IDs to distinguish between their data streams. |
Example
curl -XPUT "host:port/leaderindex" -H 'Content-Type: application/json' -d'{
"settings": {
"index": {
"ccr_mode": "parallel",
"ccr_id": 1
}
},
"mappings": {
"properties": {
"title": {
"type": "keyword"
},
"date": {
"type": "date"
}
}
}
}'Create a follow index
You can create a follow index on the standby cluster.
Syntax
PUT /followindexParameters
Parameter | Description |
ccr_mode | Specifies the cross-cluster replication mode. parallel: Indicates parallel synchronization. The primary cluster uses multiple partitions to synchronize data to the standby cluster. |
ccr_id | A custom cluster ID. Note: For two-way synchronization, the primary and standby clusters must have different IDs to distinguish between their data streams. |
Example
curl -XPUT "host:port/followindex" -H 'Content-Type: application/json' -d'{
"settings": {
"index": {
"ccr_mode": "parallel",
"ccr_id": 2
}
},
"mappings": {
"properties": {
"title": {
"type": "keyword"
},
"date": {
"type": "date"
}
}
}
}'Start data synchronization
You can run a command on the standby cluster to start data synchronization from the leader index to the follow index.
Syntax
POST _plugins/_ccr/followindex/start_followParameters
Parameter | Description |
message_cluster | Specifies the address of the message engine. The built-in message engine is used by default. To find the message_cluster address, run the |
leader_index | The leader index on the primary cluster. Specifies the index on the primary cluster from which the follow index synchronizes data. |
Example
curl -XPOST --header 'Content-Type: application/json' -d '{
"message_cluster" : "ld-txxxx-solr-001.lindorm.rds.aliyuncs.com/172.21.64.28:30080",
"leader_index" : "leaderindex"
}' 'http://host:port/_plugins/_ccr/followindex/start_follow'Stop data synchronization
You can run a command on the standby cluster to stop data synchronization from the leader index to the follow index.
Syntax
POST _plugins/_ccr/followindex/stop_followParameters
Parameter | Description |
message_cluster | Specifies the address of the message engine. The built-in message engine is used by default. To find the message_cluster address, run the |
leader_index | The leader index on the primary cluster. Specifies the index on the primary cluster from which the follow index stops synchronizing data. |
Example
curl -XPOST "host:port/_plugins/_ccr/followindex/stop_follow" -H 'Content-Type: application/json' -d'{
"leader_index" : "leaderindex",
"message_cluster" : "ld-xxx.lindorm.rds.aliyuncs.com/172.xx.xx.xx:30080"
}'Check link status
After you create the leader and follow indexes, you can run the following command on each cluster to check the status of the active/standby links.
Syntax
GET _plugins/_ccr/info?prettyExample
curl -XGET host:port/_plugins/_ccr/info?pretty