The process.env.ESDB contains a string of hosts that are separated by a "," which i then make into an array by using the .split() method.
I then export the client to use it in other files.
I had an incident where one of my nodes went down and it had something to do with Azure having some problems on their end. However i could not use the elasticsearch client in my node.js application during the time that it was down as it was still pointing to the node that went down.
Does the elasticsearch javascript client haven any configuration for adding health checks to see which one of the nodes is alive? I know it does load-balancing I'm just not sure weather it does health checks in order to avoid nodes that are down.
If not is there any way i can load-balance my nodes and perform health checks on them in order to avoid service disruptions like the one i just mentioned? Would a coordinator node do the trick?
Hello!
The client has an internal connection pool, and when it detects that a node is malfunctioning (5xx responses, timeout, connection faults...) it will mark it as dead, and remove it from the node rotation (round-robin by default). Once a node is dead, it will try every now and then to ping the node, to verify if it's back operational.
What do you mean with "I could not use elasticsearch client"?
Finally, it appears you are using the legacy Node.js client, I strongly recommend migrating to the new one, you can find the migration guide here.
Thank you for pointing out the new node.js client. I should probably start migrating to the new one right away.
Sorry for not being descriptive enough when i said i could not use the client.
I actually meant that the client was still sending requests to the node that went down and my users would sometimes see errors that something is not working at the moment when using my node.js application. I guess it takes a bit of time until the client realizes that the node went down?
Or since I'm using the legacy client it might not have worked as expected since the client was still sending requests to the node that went down for about 5 minutes until i manually removed it from the hosts that it should point to.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.