Hi everyone,
I've set up 3 elasticsearch nodes that are booth master and data nodes.
I have a node js application that points to these nodes with this configuration
var ESDB = function () {
this.client = new elasticsearch.Client({
keepAlive: true,
hosts: process.env.ESDB.split(","),
httpAuth: process.env.ESDB_PASSWORD,
requestTimeout: 20000,
log: [{
type: 'stdio',
levels: ['error']
}],
ssl: {
ca: fs.readFileSync(process.env.CA),
rejectUnauthorized: true
}
});
};
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?