其他管理接口
- 获取已创建的模式
该接口支持列表查询和指定名称查询。
请求示例如下:
GET auto_sync/pattern GET auto_sync/pattern/{pattern_name}
接口返回示例如下:
{ "patterns" : [ { "name" : "pattern1", "pattern" : { "remote_cluster" : "leader", "remote_index_patterns" : [ "log*" ], "local_index_pattern" : "{{remote_index}}-sync", "settings" : { } } } ] }
- 删除已创建的模式
该接口支持指定模式名称删除
请求示例如下:
DELETE auto_sync/pattern/{pattern_name}
- 获取自动同步状态
该接口可以获取匹配索引同步的状态。
请求示例如下:
GET auto_sync/stats
接口返回示例如下:
{ "success_count" : 3, "failed_count" : 0, "failed_remote_cluster_state_requests_count" : 0, "last_fail_exception" : { }, "last_fail_remote_cluster_requests_exception" : { } }
- 获取正在同步的索引的同步状态
请求示例如下:
GET {index_name}/sync_stats
接口返回示例如下:
{ "indices" : { "data1_follower" : { "shards" : { "0" : [ { "primary" : false, "total_synced_times" : 27, "total_empty_times" : 25, "total_synced_files" : 4, "total_synced_bytes" : 3580, "total_paused_nanos" : 0, "total_paused_times" : 0, "current" : { "files_count" : 0, "finished_files_count" : 0, "bytes" : 0, "finished_bytes" : 0 } }, { "primary" : true, "total_synced_times" : 28, "total_empty_times" : 26, "total_synced_files" : 20, "total_synced_bytes" : 17547, "total_paused_nanos" : 0, "total_paused_times" : 0, "current" : { "files_count" : 0, "finished_files_count" : 0, "bytes" : 0, "finished_bytes" : 0 } } ] } } } }
- 修改同步周期
同步周期默认30秒,支持修改。
请求示例如下(修改同步周期为2秒):
PUT {index_name}/_settings { "index.remote_sync.sync_interval": "2s" }
- 开启强制同步
插件默认根据主集群索引的文档数是否发生变化来决定是否要同步元数据,当主集群只对文档进行更新且文档数不变时,插件不会同步该更新到从集群。支持修改配置,开启后,每个同步周期从集群都会强制同步主机群的索引元数据。
请求示例如下(开启强制同步):
PUT _cluster/settings { "persistent": { "remote_sync.force_synchronize": true } }