Java Node info


(Matt Weber) #1

I am trying to get the node info for a specific node. I have access to the java "Node" object for the node I want, but it appears the only way I can get info is via a NodeInfoRequest to the client. A NodeInfoRequest targets all nodes or the node id's specified. Is there a way for me to get the node id of a Node object or a NodeInfoResponse from a specific node object?

--
Matt Weber
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

--


(Matt Weber) #2

I think I figured it out… is this the best approach?

String nodeId = ((InternalNode) node).injector().getInstance(ClusterService.class).state().nodes().localNodeId();
client.admin().cluster().nodesInfo(new NodesInfoRequest(nodeId)).actionGet()

--
Matt Weber
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

On Tuesday, August 21, 2012 at 12:59 PM, Matt Weber wrote:

I am trying to get the node info for a specific node. I have access to the java "Node" object for the node I want, but it appears the only way I can get info is via a NodeInfoRequest to the client. A NodeInfoRequest targets all nodes or the node id's specified. Is there a way for me to get the node id of a Node object or a NodeInfoResponse from a specific node object?

--
Matt Weber
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

--


(Shay Banon) #3

Use _local as the node id, it will give you the details of the local node.

On Aug 21, 2012, at 9:59 PM, Matt Weber matt@mattweber.org wrote:

I am trying to get the node info for a specific node. I have access to the java "Node" object for the node I want, but it appears the only way I can get info is via a NodeInfoRequest to the client. A NodeInfoRequest targets all nodes or the node id's specified. Is there a way for me to get the node id of a Node object or a NodeInfoResponse from a specific node object?

--
Matt Weber
Sent with Sparrow

--

--


(Matt Weber) #4

Perfect, thanks.

--
Matt Weber
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

On Tuesday, August 21, 2012 at 3:00 PM, Shay Banon wrote:

Use _local as the node id, it will give you the details of the local node.

On Aug 21, 2012, at 9:59 PM, Matt Weber <matt@mattweber.org (mailto:matt@mattweber.org)> wrote:

I am trying to get the node info for a specific node. I have access to the java "Node" object for the node I want, but it appears the only way I can get info is via a NodeInfoRequest to the client. A NodeInfoRequest targets all nodes or the node id's specified. Is there a way for me to get the node id of a Node object or a NodeInfoResponse from a specific node object?

--
Matt Weber
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

--

--

--


(system) #5