Package org.elasticsearch.node

Examples of org.elasticsearch.node.Node


    if (finalSettings.get("cluster.routing.schedule") != null) {
      // decrease the routing schedule so new nodes will be added quickly
      finalSettings = settingsBuilder().put(finalSettings).put("cluster.routing.schedule", "50ms").build();
    }

    Node node = nodeBuilder()
          .settings(finalSettings)
          .build();
    nodes.put(id, node);
   
//    ImmutableSettings.Builder elasticsearchSettings = ImmutableSettings.settingsBuilder()
//        .put("path.data", ES_DATA_DIR);
   
    clients.put(id, node.client());
    return node;
  }
View Full Code Here


  public void closeNode(String id) {
    Client client = clients.remove(id);
    if (client != null) {
      client.close();
    }
    Node node = nodes.remove(id);
    if (node != null) {
      node.close();
    }
  }
View Full Code Here

    public ShellNativeClient newNodeClient(String clusterName) {
        Settings settings = ImmutableSettings.settingsBuilder()
                .put("name", shellSettings.settings().get(ShellSettings.NODE_NAME))
                .put("http.enabled", false)
                .build();
        Node node  = NodeBuilder.nodeBuilder().clusterName(clusterName).client(true).settings(settings).build();
        node.start();
        //unfortunately the es clients are not type safe, need to cast it
        Client client = node.client();
        if (! (client instanceof org.elasticsearch.client.node.NodeClient) ) {
            throw new RuntimeException("Unable to create node client: the returned node isn't a NodeClient!");
        }
        org.elasticsearch.client.node.NodeClient nodeClient = (org.elasticsearch.client.node.NodeClient)client;
        //if clusterKo we immediately close both the client and the node that we just created
        if (clusterKo(nodeClient)) {
            nodeClient.close();
            node.close();
            return null;
        }

        AbstractClient<org.elasticsearch.client.node.NodeClient, JsonInput, JsonOutput> shellClient = clientWrapper.wrapEsNodeClient(node, nodeClient);
        resourceRegistry.registerResource(shellClient);
View Full Code Here

    public void beforeTest() throws IOException, TTransportException {
        // Starting a node in a Thread
        nodeThread = EsExecutors.daemonThreadFactory("node").newThread(new Runnable() {
            @Override
            public void run() {
                Node node = NodeBuilder.nodeBuilder().settings(ImmutableSettings.builder()
                        .put("thrift.port", SimpleThriftTests.getPort(0))
                        .put("plugins." + PluginsService.LOAD_PLUGIN_FROM_CLASSPATH, true)
                        .build()
                ).node();

                while (!stopped) {
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        if (node != null) {
                            node.stop();
                        }
                    }
                }

                node.stop();
            }
        });

        nodeThread.start();
View Full Code Here

        if (finalSettings.get("cluster.routing.schedule") != null) {
            // decrease the routing schedule so new nodes will be added quickly
            finalSettings = settingsBuilder().put(finalSettings).put("cluster.routing.schedule", "50ms").build();
        }

        Node node = nodeBuilder()
                .settings(finalSettings)
                .build();
        nodes.put(id, node);
        clients.put(id, node.client());
        return node;
    }
View Full Code Here

    public void closeNode(String id) {
        Client client = clients.remove(id);
        if (client != null) {
            client.close();
        }
        Node node = nodes.remove(id);
        if (node != null) {
            node.close();
        }
    }
View Full Code Here

        if (finalSettings.get("cluster.routing.schedule") != null) {
            // decrease the routing schedule so new nodes will be added quickly
            finalSettings = settingsBuilder().put(finalSettings).put("cluster.routing.schedule", "50ms").build();
        }

        Node node = nodeBuilder()
                .settings(finalSettings)
                .build();
        nodes.put(id, node);
        clients.put(id, node.client());
        return node;
    }
View Full Code Here

    public void closeNode(String id) {
        Client client = clients.remove(id);
        if (client != null) {
            client.close();
        }
        Node node = nodes.remove(id);
        if (node != null) {
            node.close();
        }
    }
View Full Code Here

                .put(settings)
                .put("name", id)
                .put("gateway.type", "none")
                .put("cluster.routing.schedule", "50ms")
                .build();
        Node node = nodeBuilder().settings(finalSettings).build();
        Client client = node.client();
        nodes.put(id, node);
        clients.put(id, client);
        return node;
    }
View Full Code Here

*/
public class NodeTest{

  @Test
  public void testNode() throws InterruptedException {
    Node node = null;

    // Then we start our node for tests
    // TODO Build a Node here
    // node = ... ;

    Assert.assertNotNull(node);
    Assert.assertFalse(node.isClosed());
  }
View Full Code Here

TOP

Related Classes of org.elasticsearch.node.Node

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.