Nest retries when using multiple nodes behind load balancer

16 Views Asked by At

In the docs of Nest v7, we can find:

By default, NEST will retry a request as many times as there are nodes in the cluster, that the client knows about

I'm instantiating the ElasticClient as follows:

var connectionSettings = new ConnectionSettings(new Uri(configuration.BaseUrl))
    .BasicAuthentication(configuration.User, configuration.Password)
    .EnableApiVersioningHeader()
    .ThrowExceptions();

var client = new ElasticClient(connectionSettings);

The configuration.BaseUrl has the following format:

https://elasticsearch.service:9200/

It's basically an address to a Kubernetes service. Behind that service there are 4 replicas of elasticsearch.

I wonder, do retries work in this case? Does Nest discover that there are 4 replicas, and does it send up to 4 retries?

If it doesn't, what should I do to enable that? Do I need to expose each replica under seperate service and use that to initialize the client? Or maybe, should I just use Polly instead?

0

There are 0 best solutions below