跨集群复制(CCR)
- class elasticsearch.client.CcrClient
To use this client, access
client.ccr
from anElasticsearch
client. For example:from elasticsearch import Elasticsearch # Create the client instance client = Elasticsearch(...) # Use the ccr client client.ccr.<method>(...)
- delete_auto_follow_pattern(*, name, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None)
删除自动跟随模式。
删除一组跨集群复制的自动跟随模式。
https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-ccr-delete-auto-follow-pattern
- Parameters:
- Return type:
- follow(*, index, leader_index=None, remote_cluster=None, data_stream_name=None, error_trace=None, filter_path=None, human=None, master_timeout=None, max_outstanding_read_requests=None, max_outstanding_write_requests=None, max_read_request_operation_count=None, max_read_request_size=None, max_retry_delay=None, max_write_buffer_count=None, max_write_buffer_size=None, max_write_request_operation_count=None, max_write_request_size=None, pretty=None, read_poll_timeout=None, settings=None, wait_for_active_shards=None, body=None)
创建跟随者索引。 创建一个跨集群复制的跟随者索引,跟随特定的领导者索引。 当API返回时,跟随者索引已存在,跨集群复制开始将操作从领导者索引复制到跟随者索引。
https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-ccr-follow
- Parameters:
index (str) – 跟随者索引的名称。
leader_index (str | None) – 要跟随的领导者集群中的索引名称。
remote_cluster (str | None) – 包含领导者索引的远程集群。
data_stream_name (str | None) – 如果领导者索引是数据流的一部分, 则指定跟随索引的本地数据流应重命名的名称。
master_timeout (str | Literal[-1] | ~typing.Literal[0] | None) – 等待连接到主节点的时间。
max_outstanding_read_requests (int | None) – 从远程集群的最大未完成读取请求数。
max_outstanding_write_requests (int | None) – 跟随者上最大未完成写入请求数。
max_read_request_operation_count (int | None) – 每次从远程集群读取时拉取的最大操作数。
max_read_request_size (int | str | None) – 每次从远程集群拉取操作批次的最大字节大小。
max_retry_delay (str | Literal[-1] | ~typing.Literal[0] | None) – 在重试失败操作前等待的最大时间。 重试时采用指数退避策略。
max_write_buffer_count (int | None) – 可以排队等待写入的最大操作数。 当达到此限制时,从远程集群的读取将被推迟,直到排队操作数低于限制。
max_write_buffer_size (int | str | None) – 可以排队等待写入的操作总字节数上限。 当达到此限制时,从远程集群的读取将被推迟,直到排队操作的总字节数低于限制。
max_write_request_operation_count (int | None) – 在跟随者上执行的每个批量写入请求的最大操作数。
max_write_request_size (int | str | None) – 在跟随者上执行的每个批量写入请求的操作总字节数上限。
read_poll_timeout (str | Literal[-1] | ~typing.Literal[0] | None) – 当跟随者索引与领导者索引同步时, 等待远程集群上新操作的最大时间。 超时后,操作轮询将返回到跟随者以便更新统计信息。 然后跟随者会立即尝试再次从领导者读取。
wait_for_active_shards (int | str | Literal['all', 'index-setting'] | None) – 指定在响应前需要等待激活的分片数。 默认不等待任何分片激活。 分片必须从领导者索引恢复后才能激活。 恢复跟随者分片需要将所有远程Lucene段文件传输到跟随者索引。
error_trace (bool | None)
human (bool | None)
pretty (bool | None)
- Return type:
- follow_info(*, index, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None)
获取跟随者信息。
获取所有跨集群复制跟随者索引的信息。 例如,结果包括跟随者索引名称、领导者索引名称、复制选项以及跟随者索引是处于活动状态还是暂停状态。
https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-ccr-follow-info
- Parameters:
- Return type:
- follow_stats(*, index, error_trace=None, filter_path=None, human=None, pretty=None, timeout=None)
获取跟随者统计信息。
获取跨集群复制跟随者统计信息。 API返回指定索引的每个分片关联的"跟随任务"的分片级统计信息。
https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-ccr-follow-stats
- forget_follower(*, index, error_trace=None, filter_path=None, follower_cluster=None, follower_index=None, follower_index_uuid=None, human=None, leader_remote_cluster=None, pretty=None, timeout=None, body=None)
遗忘跟随者。 从领导者移除跨集群复制跟随者的保留租约。
跟随索引会在其领导者索引上获取保留租约。 这些租约用于增加领导者索引分片保留跟随索引分片运行复制所需操作历史的可能性。 当通过取消跟随API(直接调用API或索引生命周期管理任务)将跟随索引转换为常规索引时,这些租约会被移除。 但是,移除租约可能会失败,例如当包含领导者索引的远程集群不可用时。 虽然租约最终会自行过期,但它们的存在会导致领导者索引保留比必要更多的历史记录,并阻止索引生命周期管理对领导者索引执行某些操作。 此API用于在取消跟随API无法移除租约时手动移除它们。
注意:此API不会停止跟随索引的复制。如果将此API用于仍在主动跟随的跟随索引,跟随索引会重新在领导者上添加保留租约。 此API的唯一目的是处理调用取消跟随API后无法移除跟随保留租约的情况。
https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-ccr-forget-follower
- Parameters:
index (str) – 应移除指定跟随者保留租约的领导者索引名称
follower_cluster (str | None)
follower_index (str | None)
follower_index_uuid (str | None)
leader_remote_cluster (str | None)
timeout (str | Literal[-1] | ~typing.Literal[0] | None) – 等待响应的超时时间。 如果在超时前未收到响应,请求将失败并返回错误。
error_trace (bool | None)
human (bool | None)
pretty (bool | None)
- Return type:
- get_auto_follow_pattern(*, name=None, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None)
获取自动跟随模式。
获取跨集群复制的自动跟随模式。
https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-ccr-get-auto-follow-pattern-1
- Parameters:
- Return type:
- pause_auto_follow_pattern(*, name, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None)
暂停自动跟随模式。
暂停跨集群复制的自动跟随模式。当API返回时,该自动跟随模式将处于非活动状态。远程集群上新创建的且匹配该模式的索引将被忽略。
可通过恢复自动跟随模式API重新激活。恢复后,该模式将再次活跃,并自动为远程集群上新创建的匹配索引配置跟随索引。在暂停期间创建的远程索引也会被跟随,除非它们在此期间已被删除或关闭。
https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-ccr-pause-auto-follow-pattern
- Parameters:
- Return type:
- pause_follow(*, index, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None)
暂停跟随者。
暂停跨集群复制的跟随者索引。该跟随者索引将不再从领导者索引获取任何操作。可通过恢复跟随API重新开始跟随。暂停和恢复跟随者索引可用于更改跟随任务的配置。
https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-ccr-pause-follow
- put_auto_follow_pattern(*, name, remote_cluster=None, error_trace=None, filter_path=None, follow_index_pattern=None, human=None, leader_index_exclusion_patterns=None, leader_index_patterns=None, master_timeout=None, max_outstanding_read_requests=None, max_outstanding_write_requests=None, max_read_request_operation_count=None, max_read_request_size=None, max_retry_delay=None, max_write_buffer_count=None, max_write_buffer_size=None, max_write_request_operation_count=None, max_write_request_size=None, pretty=None, read_poll_timeout=None, settings=None, body=None)
创建或更新自动跟随模式。为远程集群创建跨集群复制的自动跟随模式集合。远程集群上新创建的匹配任一模式的索引将自动配置为跟随者索引。在自动跟随模式创建前已存在的远程集群索引即使匹配模式也不会被自动跟随。
此API也可用于更新自动跟随模式。注意:在更新自动跟随模式前已自动配置的跟随者索引即使不匹配新模式也将保持不变。
https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-ccr-put-auto-follow-pattern
- Parameters:
name (str) – 自动跟随模式集合名称。
remote_cluster (str | None) – 包含要匹配的领导者索引的远程集群。
follow_index_pattern (str | None) – 跟随者索引名称模板。可使用{{leader_index}}从领导者索引名称派生跟随者索引名称。跟随数据流时使用{{leader_index}};CCR不支持更改跟随者数据流后备索引的名称。
leader_index_exclusion_patterns (Sequence[str] | None) – 用于排除索引不被自动跟随的简单索引模式数组。远程集群中名称同时匹配leader_index_patterns和leader_index_exclusion_patterns的索引不会被跟随。
leader_index_patterns (Sequence[str] | None) – 用于匹配remote_cluster字段指定的远程集群中索引的简单索引模式数组。
master_timeout (str | Literal[-1] | ~typing.Literal[0] | None) – 等待连接到主节点的时间。
max_outstanding_read_requests (int | None) – 从远程集群的最大未完成读取请求数。
max_outstanding_write_requests (int | None) – 从远程集群的最大未完成写入请求数。
max_read_request_operation_count (int | None) – 每次从远程集群拉取操作的最大数量。
max_read_request_size (int | str | None) – 每次从远程集群拉取操作批次的最大字节数。
max_retry_delay (str | Literal[-1] | ~typing.Literal[0] | None) – 在重试失败操作前的最大等待时间。采用指数退避策略进行重试。
max_write_buffer_count (int | None) – 可排队等待写入的最大操作数。达到此限制时,从远程集群的读取将被延迟,直到排队操作数低于限制。
max_write_buffer_size (int | str | None) – 可排队等待写入的操作总字节数最大值。达到此限制时,从远程集群的读取将被延迟,直到排队操作总字节数低于限制。
max_write_request_operation_count (int | None) – 在跟随者上执行的每个批量写入请求的最大操作数。
max_write_request_size (int | str | None) – 在跟随者上执行的每个批量写入请求的操作总字节数最大值。
read_poll_timeout (str | Literal[-1] | ~typing.Literal[0] | None) – 当跟随者索引与领导者索引同步时,等待远程集群上新操作的最大时间。超时后,操作轮询将返回到跟随者以更新统计信息,然后跟随者会立即尝试再次从领导者读取。
settings (Mapping[str, Any] | None) – 要覆盖领导者索引的设置。注意某些设置无法被覆盖(如index.number_of_shards)。
error_trace (bool | None)
human (bool | None)
pretty (bool | None)
- Return type:
- resume_auto_follow_pattern(*, name, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None)
恢复自动跟随模式。
恢复被暂停的跨集群复制自动跟随模式。该模式将恢复为远程集群上新创建的匹配索引配置跟随索引。在暂停期间创建的远程索引也会被跟随,除非它们在此期间已被删除或关闭。
https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-ccr-resume-auto-follow-pattern
- Parameters:
- Return type:
- resume_follow(*, index, error_trace=None, filter_path=None, human=None, master_timeout=None, max_outstanding_read_requests=None, max_outstanding_write_requests=None, max_read_request_operation_count=None, max_read_request_size=None, max_retry_delay=None, max_write_buffer_count=None, max_write_buffer_size=None, max_write_request_operation_count=None, max_write_request_size=None, pretty=None, read_poll_timeout=None, body=None)
恢复一个跟随者索引。
恢复一个被暂停的跨集群复制跟随者索引。 该跟随者索引可能之前通过暂停跟随API被暂停, 也可能由于在跟随任务期间发生无法重试的故障而自动暂停。 当此API返回时,跟随者索引将恢复从领导者索引获取操作。
https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-ccr-resume-follow
- Parameters:
index (str) – 要恢复跟随的跟随索引名称。
master_timeout (str | Literal[-1] | ~typing.Literal[0] | None) – 等待连接主节点的时间。
max_outstanding_read_requests (int | None)
max_outstanding_write_requests (int | None)
max_read_request_operation_count (int | None)
max_read_request_size (str | None)
max_retry_delay (str | Literal[-1] | ~typing.Literal[0] | None)
max_write_buffer_count (int | None)
max_write_buffer_size (str | None)
max_write_request_operation_count (int | None)
max_write_request_size (str | None)
read_poll_timeout (str | Literal[-1] | ~typing.Literal[0] | None)
error_trace (bool | None)
human (bool | None)
pretty (bool | None)
- Return type:
- stats(*, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None, timeout=None)
获取跨集群复制统计信息。
此API返回自动跟随统计信息以及与获取跟随者统计API相同的分片级别统计信息。
https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-ccr-stats
- Parameters:
- Return type:
- unfollow(*, index, error_trace=None, filter_path=None, human=None, master_timeout=None, pretty=None)
取消跟随一个索引。
将跨集群复制的跟随者索引转换为常规索引。 该API会停止与跟随者索引关联的跟随任务,并移除与跨集群复制相关的索引元数据和设置。 在调用取消跟随API之前,跟随者索引必须处于暂停和关闭状态。
提示 当前跨集群复制不支持将现有常规索引转换为跟随者索引。将跟随者索引转换为常规索引是不可逆操作。
https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-ccr-unfollow
- Parameters:
- Return type: