2018-11-13 12:15:37 -05:00
|
|
|
[role="xpack"]
|
|
|
|
[testenv="platinum"]
|
|
|
|
[[ccr-requirements]]
|
2019-09-17 14:25:46 -04:00
|
|
|
== Requirements for leader indices
|
2018-11-13 12:15:37 -05:00
|
|
|
|
2019-03-12 17:27:17 -04:00
|
|
|
{ccr-cap} works by replaying the history of individual write
|
2018-11-13 12:15:37 -05:00
|
|
|
operations that were performed on the shards of the leader index. This means that the
|
|
|
|
history of these operations needs to be retained on the leader shards so that
|
|
|
|
they can be pulled by the follower shard tasks. The underlying mechanism used to
|
|
|
|
retain these operations is _soft deletes_. A soft delete occurs whenever an
|
|
|
|
existing document is deleted or updated. By retaining these soft deletes up to
|
|
|
|
configurable limits, the history of operations can be retained on the leader
|
|
|
|
shards and made available to the follower shard tasks as it replays the history
|
|
|
|
of operations.
|
|
|
|
|
|
|
|
Soft deletes must be enabled for indices that you want to use as leader
|
2018-12-11 18:58:49 -05:00
|
|
|
indices. Soft deletes are enabled by default on new indices created on
|
|
|
|
or after {es} 7.0.0.
|
2018-11-13 12:15:37 -05:00
|
|
|
|
|
|
|
IMPORTANT: This means that {ccr} can not be used on existing indices. If you have
|
|
|
|
existing data that you want to replicate from another cluster, you must
|
|
|
|
{ref}/docs-reindex.html[reindex] your data into a new index with soft deletes
|
|
|
|
enabled.
|
|
|
|
|
|
|
|
[float]
|
|
|
|
[[ccr-overview-soft-deletes]]
|
2019-09-17 14:25:46 -04:00
|
|
|
=== Soft delete settings
|
2018-11-13 12:15:37 -05:00
|
|
|
|
|
|
|
`index.soft_deletes.enabled`::
|
|
|
|
|
|
|
|
Whether or not soft deletes are enabled on the index. Soft deletes can only be
|
|
|
|
configured at index creation and only on indices created on or after 6.5.0. The
|
2018-12-11 18:58:49 -05:00
|
|
|
default value is `true`.
|
2018-11-13 12:15:37 -05:00
|
|
|
|
2019-03-21 14:08:23 -04:00
|
|
|
`index.soft_deletes.retention_lease.period`::
|
2018-11-13 12:15:37 -05:00
|
|
|
|
2019-03-21 14:08:23 -04:00
|
|
|
The maximum period to retain a shard history retention lease before it is considered
|
|
|
|
expired. Shard history retention leases ensure that soft deletes are retained during
|
|
|
|
merges on the Lucene index. If a soft delete is merged away before it can be replicated
|
|
|
|
to a follower the following process will fail due to incomplete history on the leader.
|
|
|
|
The default value is `12h`.
|
2018-11-13 12:15:37 -05:00
|
|
|
|
2018-12-06 16:07:40 -05:00
|
|
|
For more information about index settings, see {ref}/index-modules.html[Index modules].
|
|
|
|
|
|
|
|
[float]
|
|
|
|
[[ccr-overview-beats]]
|
2019-09-17 14:25:46 -04:00
|
|
|
=== Setting soft deletes on indices created by APM Server or Beats
|
2018-12-06 16:07:40 -05:00
|
|
|
|
|
|
|
If you want to replicate indices created by APM Server or Beats, and are
|
2018-12-11 18:58:49 -05:00
|
|
|
allowing APM Server or Beats to manage index templates, you need to configure
|
|
|
|
soft deletes on the underlying index templates. To configure soft deletes on the
|
2018-12-13 16:14:59 -05:00
|
|
|
underlying index templates, incorporate the following changes to the relevant
|
|
|
|
APM Server or Beats configuration file.
|
2018-12-06 16:07:40 -05:00
|
|
|
|
|
|
|
["source","yaml"]
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
setup.template.overwrite: true
|
|
|
|
setup.template.settings:
|
|
|
|
index.soft_deletes.retention.operations: 1024
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
|
|
|
For additional information on controlling the index templates managed by APM
|
|
|
|
Server or Beats, see the relevant documentation on loading the Elasticsearch
|
|
|
|
index template.
|
2018-12-13 16:14:59 -05:00
|
|
|
|
|
|
|
[float]
|
|
|
|
[[ccr-overview-logstash]]
|
2019-09-17 14:25:46 -04:00
|
|
|
=== Setting soft deletes on indices created by Logstash
|
2018-12-13 16:14:59 -05:00
|
|
|
|
|
|
|
If you want to replicate indices created by Logstash, and are using Logstash to
|
|
|
|
manage index templates, you need to configure soft deletes on a custom Logstash
|
|
|
|
index template. To configure soft deletes on the underlying index template,
|
|
|
|
incorporate the following change to a custom Logstash template.
|
|
|
|
|
|
|
|
["source","js"]
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
"settings" : {
|
|
|
|
"index.soft_deletes.retention.operations" : 1024
|
|
|
|
}
|
|
|
|
}
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
// NOTCONSOLE
|
|
|
|
|
|
|
|
Additionally, you will need to configure the Elasticsearch output plugin to use
|
|
|
|
this custom template.
|
|
|
|
|
|
|
|
["source","ruby"]
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
output {
|
|
|
|
elasticsearch {
|
|
|
|
template => "/path/to/custom/logstash/template.json"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
|
|
|
For additional information on controlling the index templates managed by
|
|
|
|
Logstash, see the relevant documentation on the Elasticsearch output plugin.
|