Kapacitor may run in cloud environment, and it might start every time on different machine with different ip.
Once, it connects to influxdb, kapacitor sets up udp stream on influxdb server which will send data to kapacitor.
But since kapacitor can be moved from one host to another in cloud environments, there should be some automatic system to cleanup stale subscriptions.
Opened this as advised in #782
@rubycut Thanks for the issue and example use case.
I have a similar issue but it's not related to hostname changing. I deploy kapacitor in a docker container that talks to a long running influxDB server. Everytime I re-deploy kapacitor it creates a new subscription and the old one is left behind (despite a graceful termination of the previous). I need to be able to deploy kapacitor statelessly and after about 1300 subscriptions I started to have influxdb issues.. I will need to write a subscription cleaner script but I would prefer that kapacitor just cleans these subscriptions when it terminates or etc.. +1 thx!
Incase anyone else needs some help deleting subscriptions I wrote this today.
https://github.com/jeremyd/influxdb-subscription-cleaner
We were just burned by this on our production system. We have a use case very similar to @jeremyd where we would very much like to have subscriptions cleaned up when kapacitor is restarted.
All we saw on our end were OOMs. Frustrating to diagnose.
Any updates on this from the Influx team?
+1
+1
Regarding the issue reported by @jeremyd, I was not able to reproduce it. I did try it by deploying kapacitor in a docker container as well as in a cloud (AWS) on ubuntu platform. I did not notice new subscription(s) were created when kapacitor was re-deployed. By re-deploy I mean (in my testing) running docker-compose up (start up kapacitor) and then shutting it down (ctrl+C). Ran it for 100 times.
I was running latest influxdb release 1.5.1 and kapacitor 1.3.3 in ubuntu 16.04. @jeremyd , please let me know if my repo is wrong
@gshif Thanks for taking a look. We recently experienced this issue and it brought down our production cluster as well. I think what may be missing from your reproduction environment is changing hostnames. As we provision kapacitor using AWS ECS, a new container hostname is created. This new hostname is used to register for subscriptions. Unfortunately, InfluxDb attempts to deliver data to the old subscriptions (even though the old kapacitor is gone). In our environment we saw 100% cpu load on InfluxDb and nearly 3TBs of traffic egress from our Influx cluster in attempts to send data to the 100s of defunct kapacitor nodes.
Hopefully that helps some? If not, please feel free to reach out to me. I can easily reproduce this issue in our environment and would love to find a solution.
Thanks again,
Doran
Update: I should mention, we're running InfluxEnterprise 1.3 and kapacitor 1.4.
@doransmestad , Thank you for your reply. We are aware of the situation when changing hostnames/IPs won't remove the stale subscriptions. We are currently looking into resolving this issue.
Thanks,
Gershon
I have customers waiting on this. Is there a new plan to fix this issue?
On top of this clean-up issue, I'm running into a problem where such stale subscriptions are still consumed by new Kapacitor installations (considering its URL remains the same), which results into duplicated data flow through stream() node. @ https://github.com/influxdata/kapacitor/issues/2038
@nathanielc @gshif
This is still an issue for cloud/ docker swarm clusters for stale connections. Is this something the influxdb side should be taking care of cleaning these up or should kapacitor call in to clean this up? We have this issue docker swarm cluster and as Kapacitor gets restarted it creates another container and another stale connection.
I think it might be a good idea for Kapacitor to clean up its own subscriptions when it comes up.
Most helpful comment
@nathanielc @gshif
This is still an issue for cloud/ docker swarm clusters for stale connections. Is this something the influxdb side should be taking care of cleaning these up or should kapacitor call in to clean this up? We have this issue docker swarm cluster and as Kapacitor gets restarted it creates another container and another stale connection.