Search in sources :

Example 1 with Settings

use of org.elasticsearch.common.settings.Settings in project zeppelin by apache.

the class ElasticsearchInterpreterTest method populate.

@BeforeClass
public static void populate() throws IOException {
    final Settings settings = Settings.settingsBuilder().put("cluster.name", ELS_CLUSTER_NAME).put("network.host", ELS_HOST).put("http.port", ELS_HTTP_PORT).put("transport.tcp.port", ELS_TRANSPORT_PORT).put("path.home", ELS_PATH).build();
    elsNode = NodeBuilder.nodeBuilder().settings(settings).node();
    elsClient = elsNode.client();
    elsClient.admin().indices().prepareCreate("logs").addMapping("http", jsonBuilder().startObject().startObject("http").startObject("properties").startObject("content_length").field("type", "integer").endObject().endObject().endObject().endObject()).get();
    for (int i = 0; i < 48; i++) {
        elsClient.prepareIndex("logs", "http", "" + i).setRefresh(true).setSource(jsonBuilder().startObject().field("date", new Date()).startObject("request").field("method", METHODS[RandomUtils.nextInt(METHODS.length)]).field("url", "/zeppelin/" + UUID.randomUUID().toString()).field("headers", Arrays.asList("Accept: *.*", "Host: apache.org")).endObject().field("status", STATUS[RandomUtils.nextInt(STATUS.length)]).field("content_length", RandomUtils.nextInt(2000))).get();
    }
    for (int i = 1; i < 3; i++) {
        elsClient.prepareIndex("logs", "http", "very/strange/id#" + i).setRefresh(true).setSource(jsonBuilder().startObject().field("date", new Date()).startObject("request").field("method", METHODS[RandomUtils.nextInt(METHODS.length)]).field("url", "/zeppelin/" + UUID.randomUUID().toString()).field("headers", Arrays.asList("Accept: *.*", "Host: apache.org")).endObject().field("status", STATUS[RandomUtils.nextInt(STATUS.length)]).field("content_length", RandomUtils.nextInt(2000))).get();
    }
    final Properties props = new Properties();
    props.put(ElasticsearchInterpreter.ELASTICSEARCH_HOST, ELS_HOST);
    props.put(ElasticsearchInterpreter.ELASTICSEARCH_CLUSTER_NAME, ELS_CLUSTER_NAME);
    props.put(ElasticsearchInterpreter.ELASTICSEARCH_PORT, ELS_TRANSPORT_PORT);
    props.put(ElasticsearchInterpreter.ELASTICSEARCH_CLIENT_TYPE, "transport");
    transportInterpreter = new ElasticsearchInterpreter(props);
    transportInterpreter.open();
    props.put(ElasticsearchInterpreter.ELASTICSEARCH_PORT, ELS_HTTP_PORT);
    props.put(ElasticsearchInterpreter.ELASTICSEARCH_CLIENT_TYPE, "http");
    httpInterpreter = new ElasticsearchInterpreter(props);
    httpInterpreter.open();
}
Also used : Properties(java.util.Properties) Settings(org.elasticsearch.common.settings.Settings) DataPoint(org.junit.experimental.theories.DataPoint) Date(java.util.Date) BeforeClass(org.junit.BeforeClass)

Example 2 with Settings

use of org.elasticsearch.common.settings.Settings in project crate by crate.

the class SrvDiscoveryIntegrationTest method testClusterSrvDiscovery.

@Test
public void testClusterSrvDiscovery() throws Exception {
    Settings localSettings = settingsBuilder().put("node.mode", "network").put("discovery.type", "srv").put(SrvUnicastHostsProvider.DISCOVERY_SRV_QUERY, "_test._srv.crate.internal.").build();
    internalCluster().startNode(localSettings);
    internalCluster().startNode(localSettings);
    internalCluster().startNode(localSettings);
    internalCluster().ensureAtLeastNumDataNodes(3);
    internalCluster().ensureAtMostNumDataNodes(3);
    assertEquals(3, internalCluster().size());
    internalCluster().stopCurrentMasterNode();
    internalCluster().ensureAtLeastNumDataNodes(2);
    internalCluster().ensureAtMostNumDataNodes(2);
    assertEquals(2, internalCluster().size());
    internalCluster().stopRandomNonMasterNode();
    internalCluster().ensureAtLeastNumDataNodes(1);
    internalCluster().ensureAtMostNumDataNodes(1);
    assertEquals(1, internalCluster().size());
}
Also used : Settings(org.elasticsearch.common.settings.Settings) Test(org.junit.Test)

Example 3 with Settings

use of org.elasticsearch.common.settings.Settings in project crate by crate.

the class ClusterIdServiceTest method testClusterIdTransient.

@Test
public void testClusterIdTransient() throws Exception {
    Settings localSettings = settingsBuilder().put("discovery.type", "local").build();
    String node_0 = internalCluster().startNode(localSettings);
    ClusterIdService clusterIdService = internalCluster().getInstance(ClusterIdService.class, node_0);
    String clusterId = clusterIdService.clusterId().get().value().toString();
    internalCluster().stopRandomDataNode();
    node_0 = internalCluster().startNode(localSettings);
    clusterIdService = internalCluster().getInstance(ClusterIdService.class, node_0);
    String clusterId2 = clusterIdService.clusterId().get().value().toString();
    assertNotNull(clusterId2);
    assertNotSame(clusterId, clusterId2);
}
Also used : Settings(org.elasticsearch.common.settings.Settings) Test(org.junit.Test)

Example 4 with Settings

use of org.elasticsearch.common.settings.Settings in project crate by crate.

the class ClusterIdServiceTest method testClusterIdGeneration.

@Test
public void testClusterIdGeneration() throws Exception {
    Settings localSettings = settingsBuilder().put("discovery.type", "local").build();
    String node_0 = internalCluster().startNode(localSettings);
    ClusterIdService clusterIdService = internalCluster().getInstance(ClusterIdService.class, node_0);
    assertNotNull(clusterIdService.clusterId().get());
}
Also used : Settings(org.elasticsearch.common.settings.Settings) Test(org.junit.Test)

Example 5 with Settings

use of org.elasticsearch.common.settings.Settings in project crate by crate.

the class ObjectTemplateMappingBWCTest method loadLegacy.

@Before
public void loadLegacy() throws IOException {
    Path zippedIndexDir = getDataPath("/indices/bwc/bwc-object_template_mapping-0.54.9.zip");
    Settings nodeSettings = prepareBackwardsDataDir(zippedIndexDir);
    internalCluster().startNode(nodeSettings);
    ensureYellow();
}
Also used : Path(java.nio.file.Path) Settings(org.elasticsearch.common.settings.Settings) Before(org.junit.Before)

Aggregations

Settings (org.elasticsearch.common.settings.Settings)866 IndexSettings (org.elasticsearch.index.IndexSettings)112 Path (java.nio.file.Path)91 IOException (java.io.IOException)83 ClusterState (org.elasticsearch.cluster.ClusterState)76 IndexMetaData (org.elasticsearch.cluster.metadata.IndexMetaData)72 ClusterSettings (org.elasticsearch.common.settings.ClusterSettings)68 HashMap (java.util.HashMap)66 ArrayList (java.util.ArrayList)64 Version (org.elasticsearch.Version)63 Environment (org.elasticsearch.env.Environment)63 DiscoveryNode (org.elasticsearch.cluster.node.DiscoveryNode)61 Test (org.junit.Test)60 Map (java.util.Map)55 Index (org.elasticsearch.index.Index)55 Matchers.containsString (org.hamcrest.Matchers.containsString)54 List (java.util.List)45 ThreadPool (org.elasticsearch.threadpool.ThreadPool)40 XContentBuilder (org.elasticsearch.common.xcontent.XContentBuilder)37 MetaData (org.elasticsearch.cluster.metadata.MetaData)36