-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add option to close idle connections for dead nodes #1507
base: release-branch.v7
Are you sure you want to change the base?
Conversation
This commit adds a configuration option `SetCloseIdleConnections` to a client. The effect of enabling it is that whenever the Client finds a dead node, it will call `CloseIdleConnections` on the underlying HTTP transport. This is useful for.e.g. AWS Elasticsearch Service. When AWS ES reconfigures the cluster, it may change the underlying IP addresses while keeping the DNS entry stable. If the Client would _not_ close idle connections, the underlying HTTP client would re-use existing HTTP connections and use the old IP addresses. See #1091 for a discussion of this problem. The commit also illustrates how to connect to an AWS ES cluster in the recipes in [`recipes/aws-mapping-v4`](https://github.com/olivere/elastic/tree/release-branch.v7/recipes/aws-mapping-v4) and [`recipts/aws-es-client`](https://github.com/olivere/elastic/tree/release-branch.v7/recipes/aws-es-client). See the `ConnectToAWS` method for a blueprint of how to connect to an AWS ES cluster. See #1091
Nice! |
Do you actually have the chance to test it? |
Yes! Now the bad news. Here's my log lines... 12 minutes to do a health check is terrible. I'm going to add a timeout like But the good news at least, is closeIdleConnections sorts it out fast. |
@chrisharrisonkiwi I'm confused. I tried to put the automatic connection reset (by means of closing idle connections) into the client. So why do you still do it in your code? As for any request, you can use the context to cancel early, like so:
|
@olivere Well now I'm confused also. Has this pull request been merged already? |
Spent some time checking the closeIdleConnections technique once the cluster health timeout took place. I ended up re-generating my ES client on cluster health timeout. I'll keep watching this PR for now in case more detail on CloseIdleConnections comes to hand. |
No, this PR is not merged yet. I was asking for anyone to test this PR (besides me). I don't have too much experience with running an Elasticsearch cluster on AWS, so I was hoping for a few more thumbs up. This PR closes idle connections, automatically, once it finds a "dead" node during any of its requests. To enable (and test) this behaviour, you need to check out this PR and use it instead of the official To enable the feature of automatically closing idle connections, one also needs to pass
|
I use the dumb client to get around it as well |
This commit adds a configuration option
SetCloseIdleConnections
.The effect of enabling it is that whenever the Client finds a
dead node, it will call
CloseIdleConnections
on the underlying HTTPtransport.
This is useful for e.g. AWS Elasticsearch Service. When AWS ES
reconfigures the cluster, it may change the underlying IP addresses
while keeping the DNS entry stable. If the Client would not close idle
connections, the underlying HTTP client would re-use existing HTTP
connections and use the old IP addresses. See #1091 for a discussion of
this problem.
The commit also illustrates how to connect to an AWS ES cluster in the
recipes in
recipes/aws-mapping-v4
andrecipts/aws-es-client
.See the
ConnectToAWS
method for a blueprint of how to connect to anAWS ES cluster.
See #1091