Package org.elasticsearch.action.admin.cluster.node.info

Examples of org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse


                        logger.debug("failed to connect to node [{}], removed from nodes list", e, listedNode);
                        continue;
                    }
                }
                try {
                    NodesInfoResponse nodeInfo = transportService.submitRequest(listedNode, NodesInfoAction.NAME,
                            headers.applyTo(Requests.nodesInfoRequest("_local")),
                            TransportRequestOptions.options().withType(TransportRequestOptions.Type.STATE).withTimeout(pingTimeout),
                            new FutureTransportResponseHandler<NodesInfoResponse>() {
                                @Override
                                public NodesInfoResponse newInstance() {
                                    return new NodesInfoResponse();
                                }
                            }).txGet();
                    if (!ignoreClusterName && !clusterName.equals(nodeInfo.getClusterName())) {
                        logger.warn("node {} not part of the cluster {}, ignoring...", listedNode, clusterName);
                        newFilteredNodes.add(listedNode);
                    } else if (nodeInfo.getNodes().length != 0) {
                        // use discovered information but do keep the original transport address, so people can control which address is exactly used.
                        DiscoveryNode nodeWithInfo = nodeInfo.getNodes()[0].getNode();
                        newNodes.add(new DiscoveryNode(nodeWithInfo.name(), nodeWithInfo.id(), nodeWithInfo.getHostName(), nodeWithInfo.getHostAddress(), listedNode.address(), nodeWithInfo.attributes(), nodeWithInfo.version()));
                    } else {
                        // although we asked for one node, our target may not have completed initialization yet and doesn't have cluster nodes
                        logger.debug("node {} didn't return any discovery info, temporarily using transport discovery node", listedNode);
                        newNodes.add(listedNode);
View Full Code Here


        ensureGreen();

        // now that the cluster is stable, remove timeout
        removePublishTimeout();

        NodesInfoResponse nodesInfo = client().admin().cluster().prepareNodesInfo().get();
        String excludedNodeId = null;
        for (NodeInfo nodeInfo : nodesInfo) {
            if (nodeInfo.getNode().isDataNode()) {
                excludedNodeId = nodeInfo.getNode().id();
                break;
View Full Code Here

        ensureGreen();

        // now that the cluster is stable, remove timeout
        removePublishTimeout();

        NodesInfoResponse nodesInfo = client().admin().cluster().prepareNodesInfo().get();
        String excludedNodeId = null;
        for (NodeInfo nodeInfo : nodesInfo) {
            if (nodeInfo.getNode().isDataNode()) {
                excludedNodeId = nodeInfo.getNode().id();
                break;
View Full Code Here

    @Test
    public void testNodeStatsSetIndices() throws Exception {
        createIndex("test");

        NodesInfoResponse nodesInfo = client().admin().cluster().prepareNodesInfo().execute().actionGet();

        Settings settings = ImmutableSettings.settingsBuilder()
                .put("client.transport.ignore_cluster_name", true)
                .put("node.name", "transport_client_" + getTestName()).build();

        // We explicitly connect to each node with a custom TransportClient
        for (NodeInfo n : nodesInfo.getNodes()) {
            TransportClient tc = new TransportClient(settings).addTransportAddress(n.getNode().address());
            // Just verify that the NS can be sent and serialized/deserialized between nodes with basic indices
            NodesStatsResponse ns = tc.admin().cluster().prepareNodesStats().setIndices(true).execute().actionGet();
            tc.close();
        }
View Full Code Here

    @Test
    public void testNodeStatsSetRandom() throws Exception {
        createIndex("test");

        NodesInfoResponse nodesInfo = client().admin().cluster().prepareNodesInfo().execute().actionGet();

        Settings settings = ImmutableSettings.settingsBuilder()
                .put("node.name", "transport_client_" + getTestName())
                .put("client.transport.ignore_cluster_name", true).build();

        // We explicitly connect to each node with a custom TransportClient
        for (NodeInfo n : nodesInfo.getNodes()) {
            TransportClient tc = new TransportClient(settings).addTransportAddress(n.getNode().address());

            // randomize the combination of flags set
            // Uses reflection to find methods in an attempt to future-proof this test against newly added flags
            NodesStatsRequestBuilder nsBuilder = tc.admin().cluster().prepareNodesStats();
View Full Code Here

        @Override @SuppressWarnings("unchecked")
        public <T extends TransportResponse> void sendRequest(DiscoveryNode node, String action, TransportRequest request, TransportRequestOptions options, TransportResponseHandler<T> handler) {
            if (NodesInfoAction.NAME.equals(action)) {
                assertHeaders(request);
                ((TransportResponseHandler<NodesInfoResponse>) handler).handleResponse(new NodesInfoResponse(ClusterName.DEFAULT, new NodeInfo[0]));
                return;
            }
            if (ClusterStateAction.NAME.equals(action)) {
                assertHeaders(request);
                ClusterName cluster1 = new ClusterName("cluster1");
View Full Code Here

        //we make sure that nodes get added to the connected ones when calling addTransportAddress, by returning proper nodes info
        if (connectMode) {
            TransportResponseHandler transportResponseHandler = transportServiceAdapter.remove(requestId);
            NodeInfo nodeInfo = new NodeInfo(Version.CURRENT, Build.CURRENT, node, null, null, null, null, null, null, null, null, null, null);
            NodesInfoResponse nodesInfoResponse = new NodesInfoResponse(ClusterName.DEFAULT, new NodeInfo[]{nodeInfo});
            transportResponseHandler.handleResponse(nodesInfoResponse);
            return;
        }

        //once nodes are connected we'll just return errors for each sendRequest call
View Full Code Here

   * Returns information about a cluster.
   * @return a map of key value pairs containing cluster information
   */
  public static Map<String, String> getSearchClusterMetadata() {
    Map<String, String> md = new HashMap<String, String>();
    NodesInfoResponse res = getClient().admin().cluster().nodesInfo(new NodesInfoRequest().all()).actionGet();
    md.put("cluser.name", res.getClusterName().toString());

    for (NodeInfo nodeInfo : res) {
      md.put("node.name", nodeInfo.getNode().getName());
      md.put("node.name", nodeInfo.getNode().getAddress().toString());
      md.put("node.data", Boolean.toString(nodeInfo.getNode().isDataNode()));
View Full Code Here

    @BeforeMethod
    public void createIndices() throws Exception {
        startNode("1");

        NodesInfoRequest nodesInfoRequest = new NodesInfoRequest().transport(true);
        NodesInfoResponse response = client("1").admin().cluster().nodesInfo(nodesInfoRequest).actionGet();
        InetSocketTransportAddress address = (InetSocketTransportAddress)response.iterator().next()
                        .getTransport().getAddress().publishAddress();

        addresses.put("1", address);

        client("1").admin().indices()
View Full Code Here

TOP

Related Classes of org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.