Examples of nodes()


Examples of org.elasticsearch.cluster.ClusterState.nodes()

        clusterState1 = clusterService1.state();
        routingNodeEntry1 = clusterState1.readOnlyRoutingNodes().nodesToShards().get(clusterState1.nodes().localNodeId());
        assertThat(routingNodeEntry1.numberOfShardsWithState(STARTED), anyOf(equalTo(5), equalTo(4), equalTo(3)));

        clusterState2 = clusterService2.state();
        routingNodeEntry2 = clusterState2.readOnlyRoutingNodes().nodesToShards().get(clusterState2.nodes().localNodeId());
        assertThat(routingNodeEntry2.numberOfShardsWithState(STARTED), anyOf(equalTo(5), equalTo(4), equalTo(3)));

        ClusterState clusterState3 = clusterService3.state();
        RoutingNode routingNodeEntry3 = clusterState3.readOnlyRoutingNodes().nodesToShards().get(clusterState3.nodes().localNodeId());
        assertThat(routingNodeEntry3.numberOfShardsWithState(STARTED), equalTo(3));
View Full Code Here

Examples of org.elasticsearch.cluster.ClusterState.nodes()

        clusterState2 = clusterService2.state();
        routingNodeEntry2 = clusterState2.readOnlyRoutingNodes().nodesToShards().get(clusterState2.nodes().localNodeId());
        assertThat(routingNodeEntry2.numberOfShardsWithState(STARTED), anyOf(equalTo(5), equalTo(4), equalTo(3)));

        ClusterState clusterState3 = clusterService3.state();
        RoutingNode routingNodeEntry3 = clusterState3.readOnlyRoutingNodes().nodesToShards().get(clusterState3.nodes().localNodeId());
        assertThat(routingNodeEntry3.numberOfShardsWithState(STARTED), equalTo(3));

        assertThat(routingNodeEntry1.numberOfShardsWithState(STARTED) + routingNodeEntry2.numberOfShardsWithState(STARTED) + routingNodeEntry3.numberOfShardsWithState(STARTED), equalTo(11));

        logger.info("Closing server1");
View Full Code Here

Examples of org.elasticsearch.cluster.ClusterState.nodes()

        clusterState2 = clusterService2.state();
        routingNodeEntry2 = clusterState2.readOnlyRoutingNodes().nodesToShards().get(clusterState2.nodes().localNodeId());
        assertThat(routingNodeEntry2.numberOfShardsWithState(STARTED), anyOf(equalTo(5), equalTo(6)));

        clusterState3 = clusterService3.state();
        routingNodeEntry3 = clusterState3.readOnlyRoutingNodes().nodesToShards().get(clusterState3.nodes().localNodeId());
        assertThat(routingNodeEntry3.numberOfShardsWithState(STARTED), anyOf(equalTo(5), equalTo(6)));

        assertThat(routingNodeEntry2.numberOfShardsWithState(STARTED) + routingNodeEntry3.numberOfShardsWithState(STARTED), equalTo(11));

        logger.info("Deleting index [test]");
View Full Code Here

Examples of org.elasticsearch.cluster.ClusterState.nodes()

        clusterState2 = clusterService2.state();
        routingNodeEntry2 = clusterState2.readOnlyRoutingNodes().nodesToShards().get(clusterState2.nodes().localNodeId());
        assertThat(routingNodeEntry2, nullValue());

        clusterState3 = clusterService3.state();
        routingNodeEntry3 = clusterState3.readOnlyRoutingNodes().nodesToShards().get(clusterState3.nodes().localNodeId());
        assertThat(routingNodeEntry3, nullValue());
    }

    @Test public void testTwoIndicesCreation() throws Exception {
View Full Code Here

Examples of org.elasticsearch.cluster.ClusterState.nodes()

        startNode("node1", settings);
        startNode("node2", settings);

        ClusterState state = client("node1").admin().cluster().prepareState().execute().actionGet().state();
        assertThat(state.nodes().size(), equalTo(2));

        state = client("node2").admin().cluster().prepareState().execute().actionGet().state();
        assertThat(state.nodes().size(), equalTo(2));
    }
}
View Full Code Here

Examples of org.elasticsearch.cluster.ClusterState.nodes()

        ClusterState state = client("node1").admin().cluster().prepareState().execute().actionGet().state();
        assertThat(state.nodes().size(), equalTo(2));

        state = client("node2").admin().cluster().prepareState().execute().actionGet().state();
        assertThat(state.nodes().size(), equalTo(2));
    }
}
View Full Code Here

Examples of org.elasticsearch.cluster.ClusterState.nodes()

        assertThat(state.blocks().hasGlobalBlock(Discovery.NO_MASTER_BLOCK), equalTo(false));
        state = client("node2").admin().cluster().prepareState().setLocal(true).execute().actionGet().state();
        assertThat(state.blocks().hasGlobalBlock(Discovery.NO_MASTER_BLOCK), equalTo(false));

        state = client("node1").admin().cluster().prepareState().execute().actionGet().state();
        assertThat(state.nodes().size(), equalTo(2));
        assertThat(state.metaData().indices().containsKey("test"), equalTo(false));

        client("node1").admin().indices().prepareCreate("test").execute().actionGet();
        logger.info("--> indexing some data");
        for (int i = 0; i < 100; i++) {
View Full Code Here

Examples of org.elasticsearch.cluster.ClusterState.nodes()

        logger.info("--> verify we the data back");
        for (int i = 0; i < 10; i++) {
            assertThat(client("node1").prepareCount().setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().count(), equalTo(100l));
        }

        String masterNodeName = state.nodes().masterNode().name();
        String nonMasterNodeName = masterNodeName.equals("node1") ? "node2" : "node1";
        logger.info("--> closing master node {}", masterNodeName);
        closeNode(masterNodeName);

        Thread.sleep(200);
View Full Code Here

Examples of org.elasticsearch.cluster.ClusterState.nodes()

        assertThat(state.blocks().hasGlobalBlock(Discovery.NO_MASTER_BLOCK), equalTo(false));
        state = client("node2").admin().cluster().prepareState().setLocal(true).execute().actionGet().state();
        assertThat(state.blocks().hasGlobalBlock(Discovery.NO_MASTER_BLOCK), equalTo(false));

        state = client("node1").admin().cluster().prepareState().execute().actionGet().state();
        assertThat(state.nodes().size(), equalTo(2));
        assertThat(state.metaData().indices().containsKey("test"), equalTo(true));

        logger.info("Running Cluster Health");
        ClusterHealthResponse clusterHealth = client("node1").admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet();
        logger.info("Done Cluster Health, status " + clusterHealth.status());
View Full Code Here

Examples of org.elasticsearch.cluster.ClusterState.nodes()

        logger.info("--> verify we the data back");
        for (int i = 0; i < 10; i++) {
            assertThat(client("node1").prepareCount().setQuery(QueryBuilders.matchAllQuery()).execute().actionGet().count(), equalTo(100l));
        }

        masterNodeName = state.nodes().masterNode().name();
        nonMasterNodeName = masterNodeName.equals("node1") ? "node2" : "node1";
        logger.info("--> closing non master node {}", nonMasterNodeName);
        closeNode(nonMasterNodeName);

        Thread.sleep(200);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.