I'm trying to wrap my head around something. I have 3 ES nodes, with just 1 shard for simplicity. The first node is just the master node. The second node holds the primary shard and the third one holds the replica shard.
Master Node: 10.42.0.100:9200
Data node1 (Primary): 10.42.0.101:9200
Data node2 (Replica): 10.42.0.102:9200
This is my config from logstash, where I write the data:
output {
elasticsearch {
hosts => ["10.42.0.101:9200"]
index => "twitter"
document_type => "tweet"
template => "/etc/logstash/template/twitter_template.json"
template_name => "twitter"
}
}
Everything looks good and logstash will write the data to my primary ES node. However - what if that node completely dies? How do I make it failover and write to the replica node?
According the elastic.co documentation, the master node keeps track of all this and will assign a new primary node if something goes wrong. However, my logstash config doesn't know this since it's hardcoded to the first node. How can I notify logstash that the primary is down and a new one has been assigned?
First, I was thinking of this kind of configuration.
output {
elasticsearch {
hosts => ["10.42.0.101:9200", "10.42.0.102:9200"]
index => "twitter"
document_type => "tweet"
template => "/etc/logstash/template/twitter_template.json"
template_name => "twitter"
}
}
Writing data to both the replica and primary - but this is just wrong right? The primary already replicates data to the second node so it doesn't make any sense to write to them both.