Cross-cluster replication copies documents in user indices. Users, roles, dashboards, templates and policies are yours to move. Here is how we closed the gap, including the security index workaround we ran on 7.x.

The first time you fail over to a CCR follower, you find out what replication didn't bring along. Better to find out on a whiteboard.

What replicates and what doesn't

Item Replicated by CCR? How we handled it
Documents in user indices Yes Leader and follower indices
Mappings and most index settings Yes, from the leader Nothing to do
Alias membership Yes, but is_write_index is forced to false Site-local write aliases (Part 4)
Replica count changes on the leader No Set replicas on each cluster
Index templates No Config as code, applied to both
ILM and SLM policies No Config as code, same names on both (Part 5)
Ingest pipelines and cluster settings No Config as code, with per-site variables
Users, roles, role mappings No Snapshot and restore, or external identity
System indices (security, Kibana saved objects) No Snapshot and restore; saved-object export
Watchers and machine learning jobs No Recreate from code on both clusters
Searchable snapshot indices No Same repository setup and policy on each cluster
Snapshot repository settings No Configure each cluster's repositories

Security: what didn't work

In the proof of concept, we tried the obvious things first. An auto-follow pattern on the security index could be created, but users added on the primary never appeared on DR. A follower can't be created for a dot-prefixed system index, and a follower can't be created where an index with the same name already exists. Native replication was a dead end.

What we ran on 7.x: scheduled snapshot and restore

We confirmed the approach with the vendor's support team before building it.

  1. Every hour, snapshot the security index on the primary into a dedicated repository.
  2. That repository replicates to DR with the rest of the snapshot storage.
  3. At DR, restore the latest snapshot under a new, timestamped index name (.security-<timestamp>).
  4. Atomically repoint the .security alias from the old copy to the new one. The previous copy stays in place, so rollback is a single alias swap.
  5. Prune copies older than 15 days.
  6. Alert if the newest snapshot being restored is more than 2 hours old, or if a snapshot or restore fails. Each script also emits a "job ran" metric, so a dead cron job raises an alert too.

Hourly security snapshot restored at DR under a timestamped name, with an alias swap and a rollback copy.

On current versions, don't touch the security index directly. Elastic's docs say security configuration isn't replicated by CCR and recommend regular snapshots of the security feature state, which you restore to bring back native users, roles and tokens. The idea is the same as ours; the mechanism is supported and simpler.

The gotcha: the restore broke replication

Restoring the primary's security state onto DR overwrote DR-local pieces that replication depended on, and CCR broke. The fix was symmetry. Both clusters define both remote clusters, both auto-follow patterns, and the same replication users and roles. After that, an overwrite from either direction changes nothing replication needs. This is why Part 3 recommends defining both sides on both clusters from day one.

Better still: don't replicate identity at all

If I built this today, I would externalize authentication through SAML, OIDC or LDAP, and keep role definitions and role mappings in git, applied to both clusters by a pipeline. Then only a few native and service accounts remain to sync.

What about remote reindex from the primary? It is a good tool for one-off copies of user indices. It is not a way to copy the security index.

Saved objects

Dashboards, visualizations and saved searches live in a Kibana system index, so CCR skips them. Export and import them through the Saved Objects API on a schedule, or keep them in git. We moved them by hand during every DR switch, which is exactly the kind of step that gets forgotten at 2 a.m. Automate it.

Templates, policies, pipelines and cluster settings

Keep them as code in one repository and apply it to both clusters, with per-site variables such as the site suffix and remote cluster names. Add a nightly drift check that compares templates, ILM and SLM policies, pipelines and roles between the clusters and alerts on any difference.

Node configuration: back up per site, never cross-restore

elasticsearch.yml, jvm.options, log4j2.properties, the keystore and OS limits are specific to each node and site. Back them up daily per site, in version control or file backup, along with a dump of the persistent cluster settings (GET _cluster/settings?flat_settings&filter_path=persistent). Never restore the primary's configuration onto DR: node names, paths, seeds and certificates all differ.

Risks and precautions

  • Assume DR has no users until you prove otherwise, or your first failover locks everyone out.
  • Keep the previous security copy, so a bad restore rolls back in one step.
  • Alert on stale security snapshots. A silently old restore is worse than a failed one.
  • Automate saved-object sync before the outage, not during it.
  • Run a drift check. Two clusters configured by hand will diverge.

Security config in version control applied to both clusters, with the words If it isn't data, it's code.

Part 6 of 8 in Elasticsearch Replication & DR Field Notes . Previous: Part 5, CCR Meets ILM. Next: Part 7, Failover, Failback, and the 2,000-Index Unfollow Problem.

Sources