Examples of routingTable()


Examples of org.elasticsearch.action.admin.cluster.state.ClusterStateRequest.routingTable()

        if (request.hasParam("metric")) {
            EnumSet<ClusterState.Metric> metrics = ClusterState.Metric.parseString(request.param("metric"), true);
            // do not ask for what we do not need.
            clusterStateRequest.nodes(metrics.contains(ClusterState.Metric.NODES) || metrics.contains(ClusterState.Metric.MASTER_NODE));
            clusterStateRequest.routingTable(metrics.contains(ClusterState.Metric.ROUTING_TABLE));
            clusterStateRequest.metaData(metrics.contains(ClusterState.Metric.METADATA));
            clusterStateRequest.blocks(metrics.contains(ClusterState.Metric.BLOCKS));
        }

        client.admin().cluster().state(clusterStateRequest, new RestBuilderListener<ClusterStateResponse>(channel) {
View Full Code Here

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

        ShardsAllocation strategy = new ShardsAllocation();
        clusterState = newClusterStateBuilder().state(clusterState).routingTable(strategy.reroute(clusterState).routingTable()).build();

        ClusterState serializedClusterState = ClusterState.Builder.fromBytes(ClusterState.Builder.toBytes(clusterState), newNode("node1"));

        assertThat(serializedClusterState.routingTable().prettyPrint(), equalTo(clusterState.routingTable().prettyPrint()));
    }


    @Test public void testRoutingTableSerialization() throws Exception {
        MetaData metaData = newMetaDataBuilder()
View Full Code Here

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

        ShardsAllocation strategy = new ShardsAllocation();
        clusterState = newClusterStateBuilder().state(clusterState).routingTable(strategy.reroute(clusterState).routingTable()).build();

        ClusterState serializedClusterState = ClusterState.Builder.fromBytes(ClusterState.Builder.toBytes(clusterState), newNode("node1"));

        assertThat(serializedClusterState.routingTable().prettyPrint(), equalTo(clusterState.routingTable().prettyPrint()));
    }


    @Test public void testRoutingTableSerialization() throws Exception {
        MetaData metaData = newMetaDataBuilder()
View Full Code Here

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

    }

    @Override public void contribute(Dump dump) throws DumpContributionFailedException {
        ClusterState clusterState = clusterService.state();
        DiscoveryNodes nodes = clusterState.nodes();
        RoutingTable routingTable = clusterState.routingTable();

        PrintWriter writer = new PrintWriter(dump.createFileWriter("cluster.txt"));

        writer.println("===== CLUSTER NODES ======");
        writer.print(nodes.prettyPrint());
View Full Code Here

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

                            .blocks(blocks)
                            .metaData(metaDataBuilder)
                            .build();

                    // initialize all index routing tables as empty
                    RoutingTable.Builder routingTableBuilder = RoutingTable.builder().routingTable(updatedState.routingTable());
                    for (IndexMetaData indexMetaData : updatedState.metaData().indices().values()) {
                        if (indexMetaData.state() == IndexMetaData.State.OPEN) {
                            IndexRoutingTable.Builder indexRoutingBuilder = new IndexRoutingTable.Builder(indexMetaData.index())
                                    .initializeEmpty(updatedState.metaData().index(indexMetaData.index()), false /*not from API*/);
                            routingTableBuilder.add(indexRoutingBuilder);
View Full Code Here

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

                            .blocks(blocks)
                            .metaData(metaDataBuilder)
                            .build();

                    // initialize all index routing tables as empty
                    RoutingTable.Builder routingTableBuilder = RoutingTable.builder().routingTable(updatedState.routingTable());
                    for (IndexMetaData indexMetaData : updatedState.metaData().indices().values()) {
                        if (indexMetaData.state() == IndexMetaData.State.OPEN) {
                            IndexRoutingTable.Builder indexRoutingBuilder = new IndexRoutingTable.Builder(indexMetaData.index())
                                    .initializeEmpty(updatedState.metaData().index(indexMetaData.index()), false /*not from API*/);
                            routingTableBuilder.add(indexRoutingBuilder);
View Full Code Here

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

                    ClusterState updatedState = newClusterStateBuilder().state(currentState).metaData(builder).build();

                    // wait for responses from other nodes if needed
                    int counter = 0;
                    for (String index : request.indices) {
                        IndexRoutingTable indexRoutingTable = updatedState.routingTable().index(index);
                        if (indexRoutingTable != null) {
                            counter += indexRoutingTable.numberOfNodesShardsAreAllocatedOn(updatedState.nodes().masterNodeId());
                        }
                    }
View Full Code Here

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

                    ClusterState updatedState = newClusterStateBuilder().state(currentState).metaData(builder).build();

                    // wait for responses from other nodes if needed
                    int counter = 0;
                    for (String index : request.indices) {
                        IndexRoutingTable indexRoutingTable = updatedState.routingTable().index(index);
                        if (indexRoutingTable != null) {
                            counter += indexRoutingTable.numberOfNodesShardsAreAllocatedOn(updatedState.nodes().masterNodeId());
                        }
                    }
View Full Code Here

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

                ClusterBlocks.Builder blocks = ClusterBlocks.builder().blocks(currentState.blocks())
                        .removeIndexBlock(request.index, INDEX_CLOSED_BLOCK);

                ClusterState updatedState = ClusterState.builder().state(currentState).metaData(mdBuilder).blocks(blocks).build();

                RoutingTable.Builder rtBuilder = RoutingTable.builder().routingTable(updatedState.routingTable());
                IndexRoutingTable.Builder indexRoutingBuilder = new IndexRoutingTable.Builder(request.index)
                        .initializeEmpty(updatedState.metaData().index(request.index), false);
                rtBuilder.add(indexRoutingBuilder);

                RoutingAllocation.Result routingResult = shardsAllocation.reroute(newClusterStateBuilder().state(updatedState).routingTable(rtBuilder).build());
View Full Code Here

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

                ClusterBlocks.Builder blocks = ClusterBlocks.builder().blocks(currentState.blocks())
                        .removeIndexBlock(request.index, INDEX_CLOSED_BLOCK);

                ClusterState updatedState = ClusterState.builder().state(currentState).metaData(mdBuilder).blocks(blocks).build();

                RoutingTable.Builder rtBuilder = RoutingTable.builder().routingTable(updatedState.routingTable());
                IndexRoutingTable.Builder indexRoutingBuilder = new IndexRoutingTable.Builder(request.index)
                        .initializeEmpty(updatedState.metaData().index(request.index), false);
                rtBuilder.add(indexRoutingBuilder);

                RoutingAllocation.Result routingResult = shardsAllocation.reroute(newClusterStateBuilder().state(updatedState).routingTable(rtBuilder).build());
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.