If you are using the relay you should probably not use subscriptions since they are essentially the same thing but at different steps in the process. If you point Kapacitor at the list of both hosts when one host goes down Kapacitor will get errors, it will retry in most cases but it will not stop trying the downed host thus adding extra work and latency for all the retry logic. As a result point Kapacitor at the load balancer would be best since the loadbalancer can drop out the dead host. But since you don't want to subscribe to both hosts and setting up some kind of loadbalancer routing for the subscirption queries would be fragile I recommend disabling subscriptions and add Kapacitor as a host to the relay.
I recommend this setup Writes: telegraf --> Loadbalancer-->influxdbrelay --> influxdb@host1 and @host2 and kapacitor@host3 Queries kapacitor -> Loadbalancer -> influxdb@host1 and @host2. and disable subscriptions. In this setup Kapacitor will get all writes without having to manage subscriptions; and queries will be balanced across both hosts through the load balancer. On Thursday, November 3, 2016 at 12:36:04 PM UTC-6, [email protected] wrote: > > I am trying to setup high availability setup of influxdb using influxdb > relays.So telegraf clients send data to both host1 and host2 via influxdb > relay. > > telegraf --> Loadbalancer-->influxdbrelay --> influxdb@host1 and @host2 > > I want kapacitor to generate alert from influxdb@host1 if its available > and for some reason if host1 goes down i want it to query influxdb@host2. > Is it possible? > > Should i be pointing kapacitor to loadbalancer infront of influxdbrelays > or directly as given below in kapacitor.conf==> > > [[influxdb]] > # Connect to an InfluxDB cluster > # Kapacitor can subscribe, query and write to this cluster. > # Using InfluxDB is not required and can be disabled. > enabled = true > default = true > name = "xyzhost" > urls = ["http://host1:8086","http://host2:8086"] > > Or should it be > urls = ["http://loadbalancer hostname:port"] > > If you have above influxdb configuration with host1, host2 in urls list, > will kapacitor subscribe to both host1 and host2 and query both. Or will it > first query host1 and if it fails then queries host2? > > If i subsequently define a task that generates alert for high cpu will it > generate from host1 or host2? > > > -- Remember to include the version number! --- You received this message because you are subscribed to the Google Groups "InfluxData" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/influxdb. To view this discussion on the web visit https://groups.google.com/d/msgid/influxdb/eb71cd93-8a37-4278-aaff-ab7b129f2905%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
