How to connect client in LAN (newbie)


(srrin) #1

Hi,
I am new to Elasticsearch and I tried to connect elastic search client running in my local network , but I am getting index missing exception. Here is my code

NodeBuilder node = nodeBuilder();//.client(true).node();
node.settings().put("cluster.name", "CapdigiRA2");
node.settings().put("node.local", "false");
node.settings().put("discovery.zen.ping.unicast.hosts","192.168.65.1:9302");
Client clientNew = node.client(true).node().client();
CountRequest cr = new CountRequest("db2028") ;
cr.query(queryString("_currentstatus:x"));
ActionFuture af = clientNew.count(cr);
CountResponse cres = af.actionGet();
System.out.println(cres.count()) ;

Here is my node info

{
"cluster_name": "TEST",
"nodes": {
"1tlhBHXWTnyDh6C_ez9FpA": {
"name": "Crooked Man",
"transport_address": "inet[/192.168.65.1:9300]",
"attributes": {
"client": "true",
"data": "false"
},
"http_address": "inet[/192.168.65.1:9200]",
"os": {},
"process": {
"id": 2260
},
"jvm": {
"pid": 2260,
"vm_name": "Java HotSpot(TM) 64-Bit Server VM",
"vm_version": "16.0-b13",
"vm_vendor": "Sun Microsystems Inc.",
"start_time": 1293698827694
},
"network": {},
"thread_pool": {
"type": "cached",
"min_threads": 0,
"max_threads": -1,
"scheduler_threads": 20
},
"transport": {
"bound_address": "inet[/0.0.0.0:9300]",
"publish_address": "inet[/192.168.65.1:9300]"
}
},
"RjR1AtROQreajr24xTS1Qg": {
"name": "Captain Zero",
"transport_address": "inet[/192.168.65.1:9302]",
"attributes": {},
"http_address": "inet[/192.168.65.1:9202]",
"os": {
"cpu": {
"vendor": "Intel",
"model": "Xeon",
"mhz": 2400,
"total_cores": 8,
"total_sockets": 8,
"cores_per_socket": 1,
"cache_size": "-1b",
"cache_size_in_bytes": -1
},
"mem": {
"total": "15.9gb",
"total_in_bytes": 17168867328
},
"swap": {
"total": "19.3gb",
"total_in_bytes": 20825812992
}
},
"process": {
"id": 6340
},
"jvm": {
"pid": 6340,
"vm_name": "Java HotSpot(TM) Client VM",
"vm_version": "17.0-b16",
"vm_vendor": "Sun Microsystems Inc.",
"start_time": 1293698911095
},
"network": {
"primary_interface": {
"address": "192.168.0.141",
"name": "eth0",
"mac_address": "18:A9:05:63:8C:4A"
}
},
"thread_pool": {
"type": "cached",
"min_threads": 0,
"max_threads": -1,
"scheduler_threads": 20
},
"transport": {
"bound_address": "inet[/0.0.0.0:9302]",
"publish_address": "inet[/192.168.65.1:9302]"
}
},
"umfr8akMTtOwDCxmqr7IfQ": {
"name": "Jameson, J. Jonah",
"transport_address": "inet[/192.168.65.1:9301]",
"attributes": {
"client": "true",
"data": "false"
},
"http_address": "inet[/192.168.65.1:9201]",
"os": {},
"process": {
"id": 2260
},
"jvm": {
"pid": 2260,
"vm_name": "Java HotSpot(TM) 64-Bit Server VM",
"vm_version": "16.0-b13",
"vm_vendor": "Sun Microsystems Inc.",
"start_time": 1293698827694
},
"network": {
"primary_interface": {
"address": "",
"name": "",
"mac_address": ""
}
},
"thread_pool": {
"type": "cached",
"min_threads": 0,
"max_threads": -1,
"scheduler_threads": 20
},
"transport": {
"bound_address": "inet[/0.0.0.0:9301]",
"publish_address": "inet[/192.168.65.1:9301]"
}
}
}
}

Kindly help me. I think I am missing something. But not able to resolve.
Is there any sample code available to test this ?


(Shay Banon) #2

Hi,

Can you check if adding Thread.sleep(10000) after the construction of the
node and calling the count request, does it work then?

-shay.banon

On Mon, Jan 3, 2011 at 9:59 AM, srrIN srrranga@gmail.com wrote:

Hi,
I am new to Elasticsearch and I tried to connect elastic search client
running in my local network , but I am getting index missing exception.
Here
is my code

NodeBuilder node = nodeBuilder();//.client(true).node();
node.settings().put("cluster.name", "CapdigiRA2");
node.settings().put("node.local", "false");

node.settings().put("discovery.zen.ping.unicast.hosts","192.168.65.1:9302
");
Client clientNew = node.client(true).node().client();
CountRequest cr = new CountRequest("db2028") ;
cr.query(queryString("_currentstatus:x"));
ActionFuture af = clientNew.count(cr);
CountResponse cres = af.actionGet();
System.out.println(cres.count()) ;

Here is my node info

{
"cluster_name": "TEST",
"nodes": {
"1tlhBHXWTnyDh6C_ez9FpA": {
"name": "Crooked Man",
"transport_address": "inet[/192.168.65.1:9300]",
"attributes": {
"client": "true",
"data": "false"
},
"http_address": "inet[/192.168.65.1:9200]",
"os": {},
"process": {
"id": 2260
},
"jvm": {
"pid": 2260,
"vm_name": "Java HotSpot(TM) 64-Bit Server VM",
"vm_version": "16.0-b13",
"vm_vendor": "Sun Microsystems Inc.",
"start_time": 1293698827694
},
"network": {},
"thread_pool": {
"type": "cached",
"min_threads": 0,
"max_threads": -1,
"scheduler_threads": 20
},
"transport": {
"bound_address": "inet[/0.0.0.0:9300]",
"publish_address": "inet[/192.168.65.1:9300]"
}
},
"RjR1AtROQreajr24xTS1Qg": {
"name": "Captain Zero",
"transport_address": "inet[/192.168.65.1:9302]",
"attributes": {},
"http_address": "inet[/192.168.65.1:9202]",
"os": {
"cpu": {
"vendor": "Intel",
"model": "Xeon",
"mhz": 2400,
"total_cores": 8,
"total_sockets": 8,
"cores_per_socket": 1,
"cache_size": "-1b",
"cache_size_in_bytes": -1
},
"mem": {
"total": "15.9gb",
"total_in_bytes": 17168867328
},
"swap": {
"total": "19.3gb",
"total_in_bytes": 20825812992
}
},
"process": {
"id": 6340
},
"jvm": {
"pid": 6340,
"vm_name": "Java HotSpot(TM) Client VM",
"vm_version": "17.0-b16",
"vm_vendor": "Sun Microsystems Inc.",
"start_time": 1293698911095
},
"network": {
"primary_interface": {
"address": "192.168.0.141",
"name": "eth0",
"mac_address": "18:A9:05:63:8C:4A"
}
},
"thread_pool": {
"type": "cached",
"min_threads": 0,
"max_threads": -1,
"scheduler_threads": 20
},
"transport": {
"bound_address": "inet[/0.0.0.0:9302]",
"publish_address": "inet[/192.168.65.1:9302]"
}
},
"umfr8akMTtOwDCxmqr7IfQ": {
"name": "Jameson, J. Jonah",
"transport_address": "inet[/192.168.65.1:9301]",
"attributes": {
"client": "true",
"data": "false"
},
"http_address": "inet[/192.168.65.1:9201]",
"os": {},
"process": {
"id": 2260
},
"jvm": {
"pid": 2260,
"vm_name": "Java HotSpot(TM) 64-Bit Server VM",
"vm_version": "16.0-b13",
"vm_vendor": "Sun Microsystems Inc.",
"start_time": 1293698827694
},
"network": {
"primary_interface": {
"address": "",
"name": "",
"mac_address": ""
}
},
"thread_pool": {
"type": "cached",
"min_threads": 0,
"max_threads": -1,
"scheduler_threads": 20
},
"transport": {
"bound_address": "inet[/0.0.0.0:9301]",
"publish_address": "inet[/192.168.65.1:9301]"
}
}
}
}

Kindly help me. I think I am missing something. But not able to resolve.
Is there any sample code available to test this ?

--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/How-to-connect-client-in-LAN-newbie-tp2183522p2183522.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.


(srrin) #3

Hi Shay,
Thanks for your immediate reply.
I am still getting the same error.

Can you check my node info and check whether I am connecting to correct client.
My ES instance is running in a different machine in LAN environment and trying to connect from my local machine.


(Shay Banon) #4

You cluster.name of the nodes you started seems to be TEST, and you define a
different one when you construct the node client, maybe thats the problem?

On Mon, Jan 3, 2011 at 11:43 AM, srrIN srrranga@gmail.com wrote:

Hi Shay,
Thanks for your immediate reply.
I am still getting the same error.

Can you check my node info and check whether I am connecting to correct
client.
My ES instance is running in a different machine in LAN environment and
trying to connect from my local machine.

--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/How-to-connect-client-in-LAN-newbie-tp2183522p2183814.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.


(srrin) #5

Hi Shay,
I changed the Cluster.name and still the problem not solved. If there is any sample or examples available to connect ES instance running in different machine? please send me the link.
Please find the exceptions I have encountered while connecting

Exception in thread "main" org.elasticsearch.indices.IndexMissingException: [db2028] missing
at org.elasticsearch.cluster.metadata.MetaData.concreteIndices(MetaData.java:161)
at org.elasticsearch.action.support.broadcast.TransportBroadcastOperationAction$AsyncBroadcastAction.(TransportBroadcastOperationAction.java:153)
at org.elasticsearch.action.support.broadcast.TransportBroadcastOperationAction.doExecute(TransportBroadcastOperationAction.java:73)
at org.elasticsearch.action.support.broadcast.TransportBroadcastOperationAction.doExecute(TransportBroadcastOperationAction.java:53)
at org.elasticsearch.action.support.BaseAction.execute(BaseAction.java:54)
at org.elasticsearch.action.support.BaseAction.execute(BaseAction.java:43)
at org.elasticsearch.client.node.NodeClient.count(NodeClient.java:150)
at com.capdigisoft.bulk.IndexerRunner.main(IndexerRunner.java:71)


(Shay Banon) #6

Do you have that index?

On Mon, Jan 3, 2011 at 12:47 PM, srrIN srrranga@gmail.com wrote:

Hi Shay,
I changed the Cluster.name and still the problem not solved. Please find
the
exceptions

Exception in thread "main" org.elasticsearch.indices.IndexMissingException:
[db2028] missing
at

org.elasticsearch.cluster.metadata.MetaData.concreteIndices(MetaData.java:161)
at

org.elasticsearch.action.support.broadcast.TransportBroadcastOperationAction$AsyncBroadcastAction.(TransportBroadcastOperationAction.java:153)
at

org.elasticsearch.action.support.broadcast.TransportBroadcastOperationAction.doExecute(TransportBroadcastOperationAction.java:73)
at

org.elasticsearch.action.support.broadcast.TransportBroadcastOperationAction.doExecute(TransportBroadcastOperationAction.java:53)
at
org.elasticsearch.action.support.BaseAction.execute(BaseAction.java:54)
at
org.elasticsearch.action.support.BaseAction.execute(BaseAction.java:43)
at
org.elasticsearch.client.node.NodeClient.count(NodeClient.java:150)
at com.capdigisoft.bulk.IndexerRunner.main(IndexerRunner.java:71)

View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/How-to-connect-client-in-LAN-newbie-tp2183522p2184033.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.


(srrin) #7

Yes, the index existing in the path. Also I changed and checked for some other index. But it ended up with same error message. I am not sure whether the client has connected to correct cluster or not.

I would like to add one more point. My Elastic search instance is running as a SERVICE.


(Shay Banon) #8

You can issue a cluster health or state request from the client and check
that.

On Mon, Jan 3, 2011 at 12:54 PM, srrIN srrranga@gmail.com wrote:

Yes, the index existing in the path. Also I changed and checked for some
other index. But it ended up with same error message. I am not sure whether
the client has connected to correct cluster or not.

--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/How-to-connect-client-in-LAN-newbie-tp2183522p2184060.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.


(srrin) #9

Hi Shay,
Can you post a sample code snippet for the same?
Or if there is any link please provide me.
Thank you


(Shay Banon) #10

client.cluster.prepareXXX are where the health and state API are. For
information, see the REST section in the docs (the options are the same).

On Mon, Jan 3, 2011 at 12:57 PM, srrIN srrranga@gmail.com wrote:

Hi Shay,
Can you post a sample code snippet for the same?
Or if there is any link please provide me.
Thank you

View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/How-to-connect-client-in-LAN-newbie-tp2183522p2184067.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.


(system) #11