Saturday 15 May 2010

how cluster failover works in ElasticSearch using NEST -



how cluster failover works in ElasticSearch using NEST -

i new in elastic search. want know how cluster failover works in es using nest. went through available links http://nest.azurewebsites.net/elasticsearch-net/cluster-failover.html , http://nest.azurewebsites.net/elasticsearch-net/connecting.html. not much clear me.

suppose have 2 nodes. node1(10.20.2.1:9203) , node2(10.20.2.2:9204). both nodes connected single cluster 'testcluster'. requirement that, if of node down, want info live node.

my config file node1(10.20.2.1:9203) follows

cluster.name: testcluster node.name: "node1" node.master: true node.data: true network.host: 10.20.2.1 http.port: 9203

my config file node2(10.20.2.2:9204) follows

cluster.name: testcluster node.name: "node2" node.master: false node.data: true network.host: 10.20.2.2 http.port: 9204

i accessing es client follows

private static elasticclient elasticclientnew { { var node = new uri("http://10.20.2.1:9203"); var node1 = new uri("http://10.20.2.2:9204"); var connectionpool = new sniffingconnectionpool(new[] { node, node1 }); var setting = new connectionsettings(connectionpool) .sniffonconnectionfault(false) .sniffonstartup(false) .snifflifespan(timespan.fromminutes(1)); homecoming new elasticclient(setting); } }

i using es client searching follows

var result = elasticclientnew.search<attendance>(s => s .from(0) .size(5000) .index("attendance").type("worker"));

i running mvs application node1, , elasticsearch service stopped in machine. es service running in node2. when seek search, getting error follows

failed after retrying 1 times: 'post attendance/worker/_search'. innerexception: pingexception, innermessage: pinging http://10.20.2.1:9203 caused exception, innerstacktrace: @ elasticsearch.net.connection.transport.ping(itransportrequeststate requeststate) in c:\users\gmarz\code\elasticsearch-net\src\elasticsearch.net\connection\transport.cs:line 96 @ elasticsearch.net.connection.transport.dorequest[t](transportrequeststate`1 requeststate) in c:\users\gmarz\code\elasticsearch-net\src\elasticsearch.net\connection\transport.cs:line 334

please suggest how cluster failover can achieved in application.

the problem 1 of nodes has

node.master: true

set when node goes downwards other node masterless , turns off well.

elasticsearch nest

No comments:

Post a Comment