org.elasticsearch.transport.Netty4Plugin Java Examples
The following examples show how to use
org.elasticsearch.transport.Netty4Plugin.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestElasticsearchAppender.java From karaf-decanter with Apache License 2.0 | 6 votes |
@Before public void setup() throws Exception { Collection plugins = Arrays.asList(Netty4Plugin.class); Settings settings = Settings.builder() .put(ClusterName.CLUSTER_NAME_SETTING.getKey(), CLUSTER_NAME) .put(Node.NODE_NAME_SETTING.getKey(), "test") .put(NetworkModule.HTTP_TYPE_KEY, Netty4Plugin.NETTY_HTTP_TRANSPORT_NAME) .put(Environment.PATH_HOME_SETTING.getKey(), "target/data") .put(Environment.PATH_DATA_SETTING.getKey(), "target/data") .put("network.host", HOST) .put("http.port", HTTP_PORT) .put(NetworkModule.TRANSPORT_TYPE_KEY, Netty4Plugin.NETTY_TRANSPORT_NAME) .put("transport.port", TRANSPORT_PORT) .build(); node = new MockNode(settings, plugins); node.start(); }
Example #2
Source File: ElasticsearchCollectorTest.java From karaf-decanter with Apache License 2.0 | 6 votes |
@Before public void setup() throws Exception { Collection plugins = Arrays.asList(Netty4Plugin.class); Settings settings = Settings.builder() .put(ClusterName.CLUSTER_NAME_SETTING.getKey(), CLUSTER_NAME) .put(Node.NODE_NAME_SETTING.getKey(), "test") .put(NetworkModule.HTTP_TYPE_KEY, Netty4Plugin.NETTY_HTTP_TRANSPORT_NAME) .put(Environment.PATH_HOME_SETTING.getKey(), "target/data") .put(Environment.PATH_DATA_SETTING.getKey(), "target/data") .put("network.host", HOST) .put("http.port", HTTP_PORT) .put(NetworkModule.TRANSPORT_TYPE_KEY, Netty4Plugin.NETTY_TRANSPORT_NAME) .put("transport.port", TRANSPORT_PORT) .build(); node = new MockNode(settings, plugins); node.start(); }
Example #3
Source File: ElasticsearchServerServlet.java From wildfly-camel with Apache License 2.0 | 6 votes |
@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); } }
Example #4
Source File: EmbeddedElasticsearch5.java From baleen with Apache License 2.0 | 6 votes |
public EmbeddedElasticsearch5(Path dataPath, String clusterName, int httpPort, int transportPort) throws NodeValidationException { this.clusterName = clusterName; this.httpPort = httpPort; this.transportPort = transportPort; this.dataPath = dataPath; // NB 'transport.type' is not 'local' as connecting via separate transport client Settings settings = Settings.builder() .put("path.home", dataPath.toString()) .put("cluster.name", clusterName) .put("http.port", Integer.toString(httpPort)) .put("transport.tcp.port", Integer.toString(transportPort)) .put("http.enabled", true) .build(); Collection<Class<? extends Plugin>> plugins = Collections.singletonList(Netty4Plugin.class); node = new PluginConfigurableNode(settings, plugins); node.start(); }
Example #5
Source File: AbstractUnitTest.java From deprecated-security-ssl with Apache License 2.0 | 6 votes |
public final void startES(final Settings settings) throws Exception { FileUtils.deleteDirectory(new File("data")); esNode1 = new PluginAwareNode(getDefaultSettingsBuilder(1, false, true).put( settings == null ? Settings.Builder.EMPTY_SETTINGS : settings).build(), Netty4Plugin.class, OpenDistroSecuritySSLPlugin.class); esNode2 = new PluginAwareNode(getDefaultSettingsBuilder(2, true, true).put( settings == null ? Settings.Builder.EMPTY_SETTINGS : settings).build(), Netty4Plugin.class, OpenDistroSecuritySSLPlugin.class); esNode3 = new PluginAwareNode(getDefaultSettingsBuilder(3, true, false).put( settings == null ? Settings.Builder.EMPTY_SETTINGS : settings).build(), Netty4Plugin.class, OpenDistroSecuritySSLPlugin.class); esNode1.start(); esNode2.start(); esNode3.start(); waitForGreenClusterState(esNode1.client()); }
Example #6
Source File: IndexerTest.java From elasticactors with Apache License 2.0 | 6 votes |
@BeforeClass public void startElasticsearch() throws Exception { Settings.Builder settings = Settings.builder() .put("node.name", "test-node") .put("path.data", tmpElasticsearchDataDir) .put("path.home", tmpElasticsearchHomeDir) .put("cluster.name", "indexer-test-cluster") .put("transport.type", "netty4") .put("http.type", "netty4") .put("http.enabled", true); testNode = new PluginConfigurableNode(settings.build(), Collections.singletonList(Netty4Plugin.class)); testNode.start(); client = testNode.client(); }
Example #7
Source File: ElasticsearchTransportClientTest.java From java-specialagent with Apache License 2.0 | 6 votes |
@BeforeClass @SuppressWarnings({"rawtypes", "unchecked"}) public static void startElasticsearch() throws Exception { final Settings settings = Settings.builder() .put("path.home", ES_WORKING_DIR) .put("path.data", ES_WORKING_DIR + "/data") .put("path.logs", ES_WORKING_DIR + "/logs") .put("transport.type", "netty4") .put("http.type", "netty4") .put("cluster.name", clusterName) .put("http.port", HTTP_PORT) .put("transport.tcp.port", HTTP_TRANSPORT_PORT) .put("network.host", "127.0.0.1") .build(); final Collection plugins = Collections.singletonList(Netty4Plugin.class); node = new PluginConfigurableNode(settings, plugins); node.start(); }
Example #8
Source File: ElasticsearchRestClientTest.java From java-specialagent with Apache License 2.0 | 6 votes |
@BeforeClass @SuppressWarnings({"rawtypes", "unchecked"}) public static void startElasticsearch() throws NodeValidationException { final Settings settings = Settings.builder() .put("path.home", ES_WORKING_DIR) .put("path.data", ES_WORKING_DIR + "/data") .put("path.logs", ES_WORKING_DIR + "/logs") .put("transport.type", "netty4") .put("http.type", "netty4") .put("cluster.name", clusterName) .put("http.port", HTTP_PORT) .put("transport.tcp.port", HTTP_TRANSPORT_PORT) .put("network.host", "127.0.0.1") .build(); final Collection plugins = Collections.singletonList(Netty4Plugin.class); node = new PluginConfigurableNode(settings, plugins); node.start(); }
Example #9
Source File: ElasticsearchITest.java From java-specialagent with Apache License 2.0 | 6 votes |
public static void main(final String[] args) throws Exception { final Settings settings = Settings.builder() .put("path.home", ES_WORKING_DIR) .put("path.data", ES_WORKING_DIR + "/data") .put("path.logs", ES_WORKING_DIR + "/logs") .put("transport.type", "netty4") .put("http.type", "netty4") .put("cluster.name", clusterName) .put("http.port", HTTP_PORT) .put("transport.tcp.port", HTTP_TRANSPORT_PORT) .put("network.host", "127.0.0.1") .build(); final Collection<Class<? extends Plugin>> classpathPlugins = Collections.singletonList(Netty4Plugin.class); try (final Node node = NodeFactory.makeNode(settings, classpathPlugins)) { node.start(); runRestClient(); runTransportClient(); } TestUtil.checkSpan(new ComponentSpanCount("java-elasticsearch", 4)); }
Example #10
Source File: EsEmbeddedServer.java From datashare with GNU Affero General Public License v3.0 | 6 votes |
public EsEmbeddedServer(String clusterName, String homePath, String dataPath, String httpPort) { Settings settings = Settings.builder() .put("transport.type", "netty4") .put("http.type", "netty4") .put("path.home", homePath) .put("path.data", dataPath) .put("http.port", httpPort) .put("cluster.name", clusterName).build(); node = new PluginConfigurableNode(settings, asList( Netty4Plugin.class, ParentJoinPlugin.class, CommonAnalysisPlugin.class, PainlessPlugin.class, ReindexPlugin.class )); }
Example #11
Source File: EmbeddedElasticSearch.java From jetlinks-community with Apache License 2.0 | 5 votes |
@SneakyThrows public EmbeddedElasticSearch(EmbeddedElasticSearchProperties properties) { super(InternalSettingsPreparer.prepareEnvironment( properties.applySetting( Settings.builder() .put("node.name", "test") .put("discovery.type", "single-node") .put("transport.type", "netty4") .put("http.type", "netty4") .put("network.host", "0.0.0.0") .put("http.port", 9200) ).build(), null), Collections.singleton(Netty4Plugin.class), false); }
Example #12
Source File: ElasticsearchBaseIT.java From datacollector with Apache License 2.0 | 5 votes |
TestNode(Settings settings) { super( InternalSettingsPreparer.prepareEnvironment(settings, null), // To enable an http port in integration tests, the following plugin must be loaded. Collections.singletonList(Netty4Plugin.class) ); }
Example #13
Source File: LocalNode.java From core-ng-project with Apache License 2.0 | 5 votes |
private static List<Class<? extends Plugin>> plugins() { return List.of(ReindexPlugin.class, Netty4Plugin.class, MapperExtrasPlugin.class, // for scaled_float type PainlessPlugin.class, CommonAnalysisPlugin.class); // for stemmer analysis }
Example #14
Source File: EmbeddedElasticSearchV6.java From conductor with Apache License 2.0 | 5 votes |
public synchronized void start(String clusterName, String host, int port) throws Exception { if (instance != null) { String msg = String.format( "An instance of this Embedded Elastic Search server is already running on port: %s. " + "It must be stopped before you can call start again.", getPort() ); logger.error(msg); throw new IllegalStateException(msg); } final Settings settings = getSettings(clusterName, host, port); dataDir = setupDataDir(settings.get(ElasticSearchConfiguration.EMBEDDED_DATA_PATH_DEFAULT_VALUE)); logger.info("Starting ElasticSearch for cluster {} ", settings.get("cluster.name")); instance = new PluginConfigurableNode(settings, singletonList(Netty4Plugin.class)); instance.start(); Runtime.getRuntime().addShutdownHook(new Thread(() -> { try { if (instance != null) { instance.close(); } } catch (IOException e) { logger.error("Error closing ElasticSearch"); } })); logger.info("ElasticSearch cluster {} started in local mode on port {}", instance.settings().get("cluster.name"), getPort()); }
Example #15
Source File: EmbeddedElasticSearchV5.java From conductor with Apache License 2.0 | 5 votes |
public synchronized void start(String clusterName, String host, int port) throws Exception { if (instance != null) { String msg = String.format( "An instance of this Embedded Elastic Search server is already running on port: %d. " + "It must be stopped before you can call start again.", getPort() ); logger.error(msg); throw new IllegalStateException(msg); } final Settings settings = getSettings(clusterName, host, port); dataDir = setupDataDir(settings.get(ElasticSearchConfiguration.EMBEDDED_DATA_PATH_DEFAULT_VALUE)); logger.info("Starting ElasticSearch for cluster {} ", settings.get("cluster.name")); instance = new PluginConfigurableNode(settings, singletonList(Netty4Plugin.class)); instance.start(); Runtime.getRuntime().addShutdownHook(new Thread(() -> { try { if (instance != null) { instance.close(); } } catch (IOException e) { logger.error("Error closing ElasticSearch"); } })); logger.info("ElasticSearch cluster {} started in local mode on port {}", instance.settings().get("cluster.name"), getPort()); }
Example #16
Source File: OpenSSLTest.java From deprecated-security-ssl with Apache License 2.0 | 5 votes |
@Test public void testNodeClientSSLwithOpenSslTLSv13() throws Exception { Assume.assumeTrue(OpenSsl.isAvailable() && OpenSsl.version() > 0x10101009L); final Settings settings = Settings.builder().put("opendistro_security.ssl.transport.enabled", true) .put(SSLConfigConstants.OPENDISTRO_SECURITY_SSL_HTTP_ENABLE_OPENSSL_IF_AVAILABLE, allowOpenSSL) .put(SSLConfigConstants.OPENDISTRO_SECURITY_SSL_TRANSPORT_ENABLE_OPENSSL_IF_AVAILABLE, allowOpenSSL) .put(SSLConfigConstants.OPENDISTRO_SECURITY_SSL_TRANSPORT_KEYSTORE_ALIAS, "node-0") .put("opendistro_security.ssl.transport.keystore_filepath", getAbsoluteFilePathFromClassPath("node-0-keystore.jks")) .put("opendistro_security.ssl.transport.truststore_filepath", getAbsoluteFilePathFromClassPath("truststore.jks")) .put("opendistro_security.ssl.transport.enforce_hostname_verification", false) .put("opendistro_security.ssl.transport.resolve_hostname", false) .putList(SSLConfigConstants.OPENDISTRO_SECURITY_SSL_TRANSPORT_ENABLED_PROTOCOLS, "TLSv1.3") .putList(SSLConfigConstants.OPENDISTRO_SECURITY_SSL_TRANSPORT_ENABLED_CIPHERS, "TLS_CHACHA20_POLY1305_SHA256") .build(); startES(settings); final Settings tcSettings = Settings.builder().put("cluster.name", clustername).put("path.home", ".") .put("node.name", "client_node_" + new Random().nextInt()) .put(settings)// ----- .build(); try (Node node = new PluginAwareNode(tcSettings, Netty4Plugin.class, OpenDistroSecuritySSLPlugin.class).start()) { ClusterHealthResponse res = node.client().admin().cluster().health(new ClusterHealthRequest().waitForNodes("4").timeout(TimeValue.timeValueSeconds(5))).actionGet(); Assert.assertFalse(res.isTimedOut()); Assert.assertEquals(4, res.getNumberOfNodes()); Assert.assertEquals(4, node.client().admin().cluster().nodesInfo(new NodesInfoRequest()).actionGet().getNodes().size()); } Assert.assertFalse(executeSimpleRequest("_nodes/stats?pretty").contains("\"tx_size_in_bytes\" : 0")); Assert.assertFalse(executeSimpleRequest("_nodes/stats?pretty").contains("\"rx_count\" : 0")); Assert.assertFalse(executeSimpleRequest("_nodes/stats?pretty").contains("\"rx_size_in_bytes\" : 0")); Assert.assertFalse(executeSimpleRequest("_nodes/stats?pretty").contains("\"tx_count\" : 0")); }
Example #17
Source File: SSLTest.java From deprecated-security-ssl with Apache License 2.0 | 5 votes |
@Test public void testNodeClientSSLwithJavaTLSv13() throws Exception { //Java TLS 1.3 is available since Java 11 Assume.assumeTrue(!allowOpenSSL && PlatformDependent.javaVersion() >= 11); final Settings settings = Settings.builder().put("opendistro_security.ssl.transport.enabled", true) .put(SSLConfigConstants.OPENDISTRO_SECURITY_SSL_HTTP_ENABLE_OPENSSL_IF_AVAILABLE, allowOpenSSL) .put(SSLConfigConstants.OPENDISTRO_SECURITY_SSL_TRANSPORT_ENABLE_OPENSSL_IF_AVAILABLE, allowOpenSSL) .put(SSLConfigConstants.OPENDISTRO_SECURITY_SSL_TRANSPORT_KEYSTORE_ALIAS, "node-0") .put("opendistro_security.ssl.transport.keystore_filepath", getAbsoluteFilePathFromClassPath("node-0-keystore.jks")) .put("opendistro_security.ssl.transport.truststore_filepath", getAbsoluteFilePathFromClassPath("truststore.jks")) .put("opendistro_security.ssl.transport.enforce_hostname_verification", false) .put("opendistro_security.ssl.transport.resolve_hostname", false) .putList(SSLConfigConstants.OPENDISTRO_SECURITY_SSL_TRANSPORT_ENABLED_PROTOCOLS, "TLSv1.3") .putList(SSLConfigConstants.OPENDISTRO_SECURITY_SSL_TRANSPORT_ENABLED_CIPHERS, "TLS_AES_128_GCM_SHA256") .build(); startES(settings); final Settings tcSettings = Settings.builder().put("cluster.name", clustername).put("path.home", ".") .put("node.name", "client_node_" + new Random().nextInt()) .put(settings)// ----- .build(); try (Node node = new PluginAwareNode(tcSettings, Netty4Plugin.class, OpenDistroSecuritySSLPlugin.class).start()) { ClusterHealthResponse res = node.client().admin().cluster().health(new ClusterHealthRequest().waitForNodes("4").timeout(TimeValue.timeValueSeconds(5))).actionGet(); Assert.assertFalse(res.isTimedOut()); Assert.assertEquals(4, res.getNumberOfNodes()); Assert.assertEquals(4, node.client().admin().cluster().nodesInfo(new NodesInfoRequest()).actionGet().getNodes().size()); } Assert.assertFalse(executeSimpleRequest("_nodes/stats?pretty").contains("\"tx_size_in_bytes\" : 0")); Assert.assertFalse(executeSimpleRequest("_nodes/stats?pretty").contains("\"rx_count\" : 0")); Assert.assertFalse(executeSimpleRequest("_nodes/stats?pretty").contains("\"rx_size_in_bytes\" : 0")); Assert.assertFalse(executeSimpleRequest("_nodes/stats?pretty").contains("\"tx_count\" : 0")); }
Example #18
Source File: SSLTest.java From deprecated-security-ssl with Apache License 2.0 | 5 votes |
@Test public void testNodeClientSSL() throws Exception { final Settings settings = Settings.builder().put("opendistro_security.ssl.transport.enabled", true) .put(SSLConfigConstants.OPENDISTRO_SECURITY_SSL_HTTP_ENABLE_OPENSSL_IF_AVAILABLE, allowOpenSSL) .put(SSLConfigConstants.OPENDISTRO_SECURITY_SSL_TRANSPORT_ENABLE_OPENSSL_IF_AVAILABLE, allowOpenSSL) .put(SSLConfigConstants.OPENDISTRO_SECURITY_SSL_TRANSPORT_KEYSTORE_ALIAS, "node-0") .put("opendistro_security.ssl.transport.keystore_filepath", getAbsoluteFilePathFromClassPath("node-0-keystore.jks")) .put("opendistro_security.ssl.transport.truststore_filepath", getAbsoluteFilePathFromClassPath("truststore.jks")) .put("opendistro_security.ssl.transport.enforce_hostname_verification", false) .put("opendistro_security.ssl.transport.resolve_hostname", false) .build(); startES(settings); final Settings tcSettings = Settings.builder().put("cluster.name", clustername).put("path.home", ".") .put("node.name", "client_node_" + new Random().nextInt()) .put(settings)// ----- .build(); try (Node node = new PluginAwareNode(tcSettings, Netty4Plugin.class, OpenDistroSecuritySSLPlugin.class).start()) { ClusterHealthResponse res = node.client().admin().cluster().health(new ClusterHealthRequest().waitForNodes("4").timeout(TimeValue.timeValueSeconds(5))).actionGet(); Assert.assertFalse(res.isTimedOut()); Assert.assertEquals(4, res.getNumberOfNodes()); Assert.assertEquals(4, node.client().admin().cluster().nodesInfo(new NodesInfoRequest()).actionGet().getNodes().size()); } Assert.assertFalse(executeSimpleRequest("_nodes/stats?pretty").contains("\"tx_size_in_bytes\" : 0")); Assert.assertFalse(executeSimpleRequest("_nodes/stats?pretty").contains("\"rx_count\" : 0")); Assert.assertFalse(executeSimpleRequest("_nodes/stats?pretty").contains("\"rx_size_in_bytes\" : 0")); Assert.assertFalse(executeSimpleRequest("_nodes/stats?pretty").contains("\"tx_count\" : 0")); }
Example #19
Source File: SQLTransportIntegrationTest.java From crate with Apache License 2.0 | 5 votes |
@Override protected Collection<Class<? extends Plugin>> nodePlugins() { return Arrays.asList( SQLPlugin.class, BlobPlugin.class, Netty4Plugin.class ); }
Example #20
Source File: AdminUIHttpIntegrationTest.java From crate with Apache License 2.0 | 4 votes |
@SuppressWarnings("unchecked") @Override protected Collection<Class<? extends Plugin>> nodePlugins() { return Arrays.asList(Netty4Plugin.class); }
Example #21
Source File: PluginLoaderTest.java From crate with Apache License 2.0 | 4 votes |
@Override protected Collection<Class<? extends Plugin>> nodePlugins() { return Arrays.asList(PluginLoaderPlugin.class, Netty4Plugin.class); }
Example #22
Source File: EmbeddedElasticsearchNode.java From immutables with Apache License 2.0 | 4 votes |
/** * Creates an instance with existing settings * @param settings configuration parameters of ES instance * @return instance which needs to be explicitly started (using {@link #start()}) */ private static EmbeddedElasticsearchNode create(Settings settings) { // ensure PainlessPlugin is installed or otherwise scripted fields would not work Node node = new LocalNode(settings, Arrays.asList(Netty4Plugin.class, PainlessPlugin.class, ReindexPlugin.class)); return new EmbeddedElasticsearchNode(node); }
Example #23
Source File: BlobIntegrationTestBase.java From crate with Apache License 2.0 | 4 votes |
@Override protected Collection<Class<? extends Plugin>> nodePlugins() { return Arrays.asList(Netty4Plugin.class, SQLPlugin.class, BlobPlugin.class); }
Example #24
Source File: DecompoundQueryTests.java From elasticsearch-plugin-bundle with GNU Affero General Public License v3.0 | 4 votes |
@Override protected Collection<Class<? extends Plugin>> nodePlugins() { return Arrays.asList(CommonAnalysisPlugin.class, Netty4Plugin.class, BundlePlugin.class); }
Example #25
Source File: EmbeddedElasticsearchNodeEnvironmentImpl.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
public PluginNode(Settings settings) { super(InternalSettingsPreparer.prepareEnvironment(settings, null), Collections.<Class<? extends Plugin>>singletonList(Netty4Plugin.class)); }
Example #26
Source File: AzureSimpleTests.java From crate with Apache License 2.0 | 4 votes |
@Override protected Collection<Class<? extends Plugin>> nodePlugins() { return Arrays.asList(AzureDiscoveryPlugin.class, Netty4Plugin.class); }
Example #27
Source File: CustomESTransportClient.java From foxtrot with Apache License 2.0 | 4 votes |
public CustomESTransportClient(Settings settings) { super(settings, ImmutableList.of(Netty4Plugin.class)); }
Example #28
Source File: EmbeddedElasticsearchNode.java From calcite with Apache License 2.0 | 4 votes |
/** * Creates an instance with existing settings * @param settings configuration parameters of ES instance * @return instance which needs to be explicitly started (using {@link #start()}) */ private static EmbeddedElasticsearchNode create(Settings settings) { // ensure PainlessPlugin is installed or otherwise scripted fields would not work Node node = new LocalNode(settings, Arrays.asList(Netty4Plugin.class, PainlessPlugin.class)); return new EmbeddedElasticsearchNode(node); }
Example #29
Source File: EmbeddedElasticsearchNodeEnvironmentImpl.java From flink with Apache License 2.0 | 4 votes |
public PluginNode(Settings settings) { super(InternalSettingsPreparer.prepareEnvironment(settings, null), Collections.<Class<? extends Plugin>>singletonList(Netty4Plugin.class)); }
Example #30
Source File: EmbeddedElasticsearchNodeEnvironmentImpl.java From flink with Apache License 2.0 | 4 votes |
public PluginNode(Settings settings) { super(InternalSettingsPreparer.prepareEnvironment(settings, Collections.emptyMap(), null, () -> "node1"), Collections.<Class<? extends Plugin>>singletonList(Netty4Plugin.class), true); }