Package org.elasticsearch.node.internal

Examples of org.elasticsearch.node.internal.InternalNode


import org.elasticsearch.node.internal.InternalNode;

public class GenericStatsLeak {

    public static void main(String[] args) {
        InternalNode node = (InternalNode) NodeBuilder.nodeBuilder().settings(ImmutableSettings.settingsBuilder()
                .put("monitor.os.refresh_interval", 0)
                .put("monitor.process.refresh_interval", 0)
                .put("monitor.network.refresh_interval", 0)
        ).node();

        JvmService jvmService = node.injector().getInstance(JvmService.class);
        OsService osService = node.injector().getInstance(OsService.class);
        ProcessService processService = node.injector().getInstance(ProcessService.class);
        NetworkService networkService = node.injector().getInstance(NetworkService.class);

        while (true) {
            jvmService.stats();
            osService.stats();
            processService.stats();
View Full Code Here


        assertThat(shardDirectory("server2", "test", 0).exists(), equalTo(false));
        assertThat(shardDirectory("server3", "test", 0).exists(), equalTo(true));
    }

    private File shardDirectory(String server, String index, int shard) {
        InternalNode node = ((InternalNode) node(server));
        NodeEnvironment env = node.injector().getInstance(NodeEnvironment.class);
        return env.shardLocation(new ShardId(index, shard));
    }
View Full Code Here

    /**
     * Builds the node without starting it.
     */
    public Node build() {
        return new InternalNode(settings.build(), loadConfigSettings);
    }
View Full Code Here

    }
  }

  private Settings toDynamicSettings(Settings settings) {
    // FIXME TransportClient?
    InternalNode node = (InternalNode) ((NodeClient) getClient()).getNode();

    DynamicSettings indexDynamicSettings = node.injector().getInstance(DynamicSettingsBean.class)
        .getIndexDynamicSettings();

    ImmutableSettings.Builder dynamicSettings = ImmutableSettings.builder();

    for (Map.Entry<String, String> e : settings.getAsMap().entrySet()) {
View Full Code Here

  @Override
  public void start() {
    LoggerFactory.getLogger(SearchServer.class).info("Starting Elasticsearch[{}] on port {}", settings.clusterName(), settings.tcpPort());

    node = new InternalNode(settings.build(), true);
    node.start();

    // When joining a cluster, make sur the master(s) have a
    // replication factor on all indices > 0
    if (settings.inCluster() && !settings.isMaster()) {
View Full Code Here

public class SQLServiceTest {

    @Test
    public void testDisableAndReEnable() throws Exception {
        InternalNode node = (InternalNode) NodeBuilder.nodeBuilder().local(true).data(true).settings(
                ImmutableSettings.builder()
                        .put(ClusterName.SETTING, getClass().getName())
                        .put("node.name", getClass().getName())
                        .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1)
                        .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 0)
                        .put(EsExecutors.PROCESSORS, 1)
                        .put("http.enabled", false)
                        .put("index.store.type", "ram")
                        .put("config.ignore_system_properties", true)
                        .put("gateway.type", "none")).build();
        node.start();

        SQLService sqlService = node.injector().getInstance(SQLService.class);
        TransportSQLAction transportSQLAction = node.injector().getInstance(TransportSQLAction.class);
        transportSQLAction.execute(new SQLRequest("select name from sys.cluster")).actionGet();

        sqlService.disable();

        try {
View Full Code Here

    /**
     * Builds the node without starting it.
     */
    public Node build() {
        return new InternalNode(settings.build(), loadConfigSettings);
    }
View Full Code Here

import java.util.Arrays;

public class RoutingBackwardCompatibilityTests extends ElasticsearchTestCase {

    public void testBackwardCompatibility() throws Exception {
        InternalNode node = new InternalNode();
        try {
            try (BufferedReader reader = new BufferedReader(new InputStreamReader(RoutingBackwardCompatibilityTests.class.getResourceAsStream("/org/elasticsearch/cluster/routing/shard_routes.txt"), "UTF-8"))) {
                for (String line = reader.readLine(); line != null; line = reader.readLine()) {
                    if (line.startsWith("#")) { // comment
                        continue;
                    }
                    String[] parts = line.split("\t");
                    assertEquals(Arrays.toString(parts), 7, parts.length);
                    final String index = parts[0];
                    final int numberOfShards = Integer.parseInt(parts[1]);
                    final String type = parts[2];
                    final String id = parts[3];
                    final String routing = "null".equals(parts[4]) ? null : parts[4];
                    final int pre20ExpectedShardId = Integer.parseInt(parts[5]);
                    final int currentExpectedShard = Integer.parseInt(parts[6]);

                    OperationRouting operationRouting = node.injector().getInstance(OperationRouting.class);
                    for (Version version : allVersions()) {
                        final Settings settings = settings(version).build();
                        IndexMetaData indexMetaData = IndexMetaData.builder(index).settings(settings).numberOfShards(numberOfShards).numberOfReplicas(randomInt(3)).build();
                        MetaData.Builder metaData = MetaData.builder().put(indexMetaData, false);
                        RoutingTable routingTable = RoutingTable.builder().addAsNew(indexMetaData).build();
                        ClusterState clusterState = ClusterState.builder(ClusterName.DEFAULT).metaData(metaData).routingTable(routingTable).build();
                        final int shardId = operationRouting.indexShards(clusterState, index, type, id, routing).shardId().getId();
                        if (version.before(Version.V_2_0_0)) {
                            assertEquals(pre20ExpectedShardId, shardId);
                        } else {
                            assertEquals(currentExpectedShard, shardId);
                        }
                    }
                }
            }
        } finally {
            node.close();
        }
    }
View Full Code Here

TOP

Related Classes of org.elasticsearch.node.internal.InternalNode

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.