-
Notifications
You must be signed in to change notification settings - Fork 286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Removing containers doesn't remove the nodes from Consul. #108
Comments
@ashish235, this is actually a feature for Consul. If you don't gracefully leave the cluster, by running Consul will remove nodes that it has not received an acknowledgement from after three days. Otherwise, you can perform a curl command against a consul server to force-leave the node that is failing. |
@djenriquez , I think you misunderstood my issue. My problem is not about the consul node but the services which I 've registered in Consul. Say I 've a container A with port exposed 80 and 3000, two services A:80 and A:3000 gets added to Consul, becuase I 'm using registrator also. Now when I remove the containers, the services remain. Even if I stop the registrator, restart the consul, deregister all the services, the services come back. Strange! Ashish |
Gotcha, so when you start service A and service B, they show up in consul. When you stop service A and service B, they remain in consul? If this is the case, your issue is most likely related to Registrator. Registrator is in charge of registering and deregistering containers to consul by monitoring changes to the docker.sock. What docker run command are you using to run Registrator? Also can you check the version of Registrator you are running? There was a release made to Registrator about two weeks ago that was pretty significant. |
@djenriquez, yeah you got it. I 've updated the registrator now. The new services which I 'm adding now gets updated and removed as well. The previous stale services are still there, I can't remove them. :( |
What you may want to do is call a force-removal on the node that those stale services reside in, then rejoin that node back to the cluster. |
i am also facing same issue, i am using using below command in instance to register other docker container applications |
I expected that services registered when containers where added would be removed when the container was removed too. This does not appear to be the case unless a health check of some sort is used. |
@philiphoy That is not happening . we are using ECS cluster having bunch of EC2 instance . Any one have solution for this , do we really need to gracefully leave of docker registrator container before the instance get terminate? @djenriquez |
I am facing a similar issue, I have Version 1 of Service A running on port 9100. This is messing up my service discovery. Did anyone figure out a resolution? |
I was having the same problem until I used Consul's leave_on_terminate setting. Once the Consul agent shut down, the node left the Consul cluster and took its services with it. They never returned. Registrator was still running. I'm using Consul with Registrator on an auto scaling ECS cluster. BTW, if you are running Consul in Docker, like me, make sure it will respond to a SIGTERM signal. This involves putting brackets around CMD in the Dockerfile. |
On removing or deleting the containers, the consul still keeps the records for those containers. Hence it is creating issues in my service discovery.
Thanks,
Ashish
The text was updated successfully, but these errors were encountered: