icinga2 icon indicating copy to clipboard operation
icinga2 copied to clipboard

Request: Allow multiple Elasticsearch hosts in ElasticsearchWriter

Open rustyricky opened this issue 7 years ago • 7 comments

Most applications allow you to define a host array for Elasticsearch. When opening an Elasticsearch connection a random node from the array will be selected. If this node is not reachable the next node from the array is selected until either a working node was found or no nodes are left in the array.

This allows for both load balancing and redundancy.

It would be great if we had this in Icinga 2's ElasticsearchWriter, too:

object ElasticsearchWriter "elasticsearch" {
  host = [ "host01:9200", "host02:9200" ]
  ...
}

rustyricky avatar Jul 09 '19 06:07 rustyricky

Since the ES feature does not have a persistent HTTP connection, this would require re-evaluation on each connect with a delay in timeouts if the first node is not reachable. In order to avoid such, one needs an intelligent caching algorithm.

Such balancing is doable within an HTTP proxy in front of the ES instance now, isn't it?

dnsmichi avatar Jul 09 '19 09:07 dnsmichi

I'm not sure how it's handled right now in Icinga 2 but how I solved this was sending data using the bulk API and either reconnect before every bulk request or keep the connection up and only select another node if the bulk request fails. To make sure no documents are lost I collect documents in an array and when it reaches a certain size I try to send them to ES via a bulk request. If the request succeeds I empty the array, if not I try the next host.

rustyricky avatar Jul 09 '19 10:07 rustyricky

@matthenning So it's no longer a problem for you?

Al2Klimov avatar Feb 28 '20 16:02 Al2Klimov

I'm not using the feature at the moment, so you could say that, yes. Sadly I wasn't able to test dnsmichi's suggestion yet, but will update this issue in case I have to do so in the future.

rustyricky avatar Mar 02 '20 09:03 rustyricky

@N-o-X Do you find it reasonable to let the user load-balance ESes via e.g. nginx?

Al2Klimov avatar Mar 02 '20 09:03 Al2Klimov

PING @N-o-X

Al2Klimov avatar Sep 07 '21 15:09 Al2Klimov

I don't think this feature is worth the work at the moment and using a load balancer as a workaround should be simple enough.

N-o-X avatar Sep 09 '21 10:09 N-o-X