Skip to content

Instantly share code, notes, and snippets.

@kosho
Last active November 21, 2018 07:45
Show Gist options
  • Save kosho/ef4186df819a82fd8ec96a3c8495e85d to your computer and use it in GitHub Desktop.
Save kosho/ef4186df819a82fd8ec96a3c8495e85d to your computer and use it in GitHub Desktop.
##################################################
# Cross Cluster Replication Example
##################################################
# On follower (remote), register "leader" (origin) cluster
PUT /_cluster/settings
{
"persistent" : {
"cluster" : {
"remote" : {
"leader" : {
"seeds" : [
"127.0.0.1:9301"
]
}
}
}
}
}
GET _cluster/settings
GET /_remote/info
# You can search through Cross Cluster Search functionality
GET leader:apache-2014/_search
# On leader, makesure index.soft_delete.enabled is true
GET apache-2014/_settings
# On follower, follow apache-2014 index
PUT /apache-2014-copy/_ccr/follow
{
"remote_cluster" : "leader",
"leader_index" : "apache-2014"
}
GET _ccr/stats
GET apache-2014-copy/_search
# Alternatively automaticallly follow index creations
PUT /_ccr/auto_follow/apache
{
"remote_cluster" : "leader",
"leader_index_patterns" :
[
"apache-*"
],
"follow_index_pattern" : "{{leader_index}}-copy"
}
GET _ccr/auto_follow
DELETE _ccr/auto_follow/apache
# Pause and unfollow to be a regular index
POST /apache-2014-copy/_ccr/pause_follow
POST apache-2014-copy/_close
POST /apache-2014-copy/_ccr/unfollow
POST apache-2014-copy/_open
# Cleanup
DELETE apache-2014-copy
PUT /_cluster/settings
{
"persistent" : {
"cluster.remote.leader.seeds" : null
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment