Search in sources :

Example 31 with NodeValidationException

use of org.elasticsearch.node.NodeValidationException in project wildfly-camel by wildfly-extras.

the class ElasticsearchServerServlet method init.

@Override
public void init() throws ServletException {
    System.setProperty("es.set.netty.runtime.available.processors", "false");
    Settings settings = Settings.builder().put("http.port", AvailablePortFinder.getAndStoreNextAvailable("es-port.txt")).put("http.cors.enabled", true).put("http.cors.allow-origin", "*").put("path.data", DATA_PATH).put("path.home", HOME_PATH).build();
    List<Class<? extends Plugin>> plugins = new ArrayList<>();
    plugins.add(Netty4Plugin.class);
    node = new ElasticsearchNode(settings, plugins);
    try {
        node.start();
    } catch (NodeValidationException e) {
        throw new ServletException(e);
    }
}
Also used : ServletException(javax.servlet.ServletException) NodeValidationException(org.elasticsearch.node.NodeValidationException) ArrayList(java.util.ArrayList) Settings(org.elasticsearch.common.settings.Settings) Plugin(org.elasticsearch.plugins.Plugin) Netty4Plugin(org.elasticsearch.transport.Netty4Plugin)

Example 32 with NodeValidationException

use of org.elasticsearch.node.NodeValidationException in project elasticsearch-cluster-runner by codelibs.

the class ElasticsearchClusterRunner method startNode.

/**
 * Start a closed node.
 *
 * @param i the number of nodes
 * @return true if the node is started.
 */
public boolean startNode(final int i) {
    if (i >= nodeList.size()) {
        return false;
    }
    if (!nodeList.get(i).isClosed()) {
        return false;
    }
    final Node node = new ClusterRunnerNode(envList.get(i), pluginList);
    try {
        node.start();
        nodeList.set(i, node);
        return true;
    } catch (final NodeValidationException e) {
        print(e.getLocalizedMessage());
    }
    return false;
}
Also used : NodeValidationException(org.elasticsearch.node.NodeValidationException) ClusterRunnerNode(org.codelibs.elasticsearch.runner.node.ClusterRunnerNode) Node(org.elasticsearch.node.Node) ClusterRunnerNode(org.codelibs.elasticsearch.runner.node.ClusterRunnerNode)

Example 33 with NodeValidationException

use of org.elasticsearch.node.NodeValidationException in project lobid-resources by hbz.

the class LocBibframeInstances2ElasticsearchTest method setup.

@BeforeClass
public static void setup() {
    try {
        if (System.getProperty("generateTestData", "false").equals("true")) {
            LOG.info("You set generateTestData=true. Thus, first going to remove all test files residing in " + "the test directory. The build will be mostly 'succesful' and you sould check the changes " + "by oing a 'git diff' on your own.");
            Files.walk(Paths.get(DIRECTORY_TO_TEST_JSON_FILES)).filter(Files::isRegularFile).map(Path::toFile).forEach(File::delete);
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
    node = new Node(Settings.builder().put(Node.NODE_NAME_SETTING.getKey(), "testNodeLocNtriples2ElasticsearchLobidTest").put(NetworkModule.TRANSPORT_TYPE_KEY, NetworkModule.LOCAL_TRANSPORT).put(NetworkModule.HTTP_ENABLED.getKey(), // 
    false).put(Environment.PATH_HOME_SETTING.getKey(), // 
    "tmp").build());
    try {
        node.start();
    } catch (NodeValidationException e) {
        e.printStackTrace();
    }
    rdfGraphToJsonLd.setContextLocationFilname("web/conf/context-loc.jsonld");
    rdfGraphToJsonLd.setRdfTypeToIdentifyRootId("http://id.loc.gov/ontologies/bibframe/Work");
    client = node.client();
    client.admin().indices().prepareDelete("_all").execute().actionGet();
    client.admin().cluster().prepareHealth().setWaitForYellowStatus().execute().actionGet();
    etl(client);
}
Also used : NodeValidationException(org.elasticsearch.node.NodeValidationException) Node(org.elasticsearch.node.Node) JsonNode(com.fasterxml.jackson.databind.JsonNode) IOException(java.io.IOException) Files(java.nio.file.Files) File(java.io.File) BeforeClass(org.junit.BeforeClass)

Example 34 with NodeValidationException

use of org.elasticsearch.node.NodeValidationException in project asquare by cognizone.

the class EmbeddedContext method getEmbeddedElastic.

protected EmbeddedElasticsearch7Store getEmbeddedElastic(String uri) {
    return embeddedElasticsearch7StoreByOriginalUri.computeIfAbsent(uri, map -> {
        File dataFolder = getTemporaryFolder("elastic: " + uri);
        EmbeddedElasticsearch7Store embeddedElasticsearch7Store = new EmbeddedElasticsearch7Store(dataFolder);
        try {
            embeddedElasticsearch7Store.start();
            return embeddedElasticsearch7Store;
        } catch (NodeValidationException e) {
            log.error("Embedded elastic server {} can not be started, {}", uri, e.getLocalizedMessage());
        }
        return null;
    });
}
Also used : NodeValidationException(org.elasticsearch.node.NodeValidationException) EmbeddedElasticsearch7Store(zone.cogni.asquareroot.elastic.EmbeddedElasticsearch7Store) File(java.io.File)

Aggregations

NodeValidationException (org.elasticsearch.node.NodeValidationException)34 IOException (java.io.IOException)8 Settings (org.elasticsearch.common.settings.Settings)8 Node (org.elasticsearch.node.Node)8 Matchers.hasToString (org.hamcrest.Matchers.hasToString)6 AtomicLong (java.util.concurrent.atomic.AtomicLong)5 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)5 ArrayList (java.util.ArrayList)4 Logger (org.apache.logging.log4j.Logger)4 BeforeClass (org.junit.BeforeClass)4 JsonNode (com.fasterxml.jackson.databind.JsonNode)3 File (java.io.File)3 Path (java.nio.file.Path)3 AtomicReference (java.util.concurrent.atomic.AtomicReference)3 Plugin (org.elasticsearch.plugins.Plugin)3 Netty4Plugin (org.elasticsearch.transport.Netty4Plugin)3 BootstrapException (io.crate.bootstrap.BootstrapException)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 PrintStream (java.io.PrintStream)2 URISyntaxException (java.net.URISyntaxException)2