org.elasticsearch.transport.Netty3Plugin Java Examples

The following examples show how to use org.elasticsearch.transport.Netty3Plugin. 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: EmbeddedElasticsearchNodeEnvironmentImpl.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Override
public void start(File tmpDataFolder, String clusterName) throws Exception {
	if (node == null) {
		Settings settings = Settings.builder()
			.put("cluster.name", clusterName)
			.put("http.enabled", false)
			.put("path.home", tmpDataFolder.getParent())
			.put("path.data", tmpDataFolder.getAbsolutePath())
			.put(NetworkModule.HTTP_TYPE_KEY, Netty3Plugin.NETTY_HTTP_TRANSPORT_NAME)
			.put(NetworkModule.TRANSPORT_TYPE_KEY, Netty3Plugin.NETTY_TRANSPORT_NAME)
			.build();

		node = new PluginNode(settings);
		node.start();
	}
}
 
Example #2
Source File: EmbeddedElasticsearchNodeEnvironmentImpl.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public void start(File tmpDataFolder, String clusterName) throws Exception {
	if (node == null) {
		Settings settings = Settings.builder()
			.put("cluster.name", clusterName)
			.put("http.enabled", false)
			.put("path.home", tmpDataFolder.getParent())
			.put("path.data", tmpDataFolder.getAbsolutePath())
			.put(NetworkModule.HTTP_TYPE_KEY, Netty3Plugin.NETTY_HTTP_TRANSPORT_NAME)
			.put(NetworkModule.TRANSPORT_TYPE_KEY, Netty3Plugin.NETTY_TRANSPORT_NAME)
			.build();

		node = new PluginNode(settings);
		node.start();
	}
}
 
Example #3
Source File: EmbeddedElasticsearchServer.java    From fast-elasticsearch-vector-scoring with Apache License 2.0 6 votes vote down vote up
private void startNodeInAvailablePort(Settings.Builder settings) throws NodeValidationException {
    int findFreePortRetries = MAX_PORT_RETRIES;
    boolean success = false;

    while(!success) {
        try {
            settings.put("http.port", String.valueOf(this.port));

            // this a hack in order to load Groovy plug in since we want to enable the usage of scripts
            node = new NodeExt(settings.build() , Arrays.asList(Netty3Plugin.class, PainlessPlugin.class, ReindexPlugin.class, VectorScoringPlugin.class));
            node.start();
            success = true;
            System.out.println(EmbeddedElasticsearchServer.class.getName() + ": Using port: " + this.port);
        } catch (BindHttpException exception) {
            if(findFreePortRetries == 0) {
                System.out.println("Could not find any free port in range: [" + (this.port - MAX_PORT_RETRIES) + " - " + this.port+"]");
                throw exception;
            }
            findFreePortRetries--;
            System.out.println("Port already in use (" + this.port + "). Trying another port...");
            this.port = randomPort();
        }
    }
}
 
Example #4
Source File: EmbeddedElasticsearchNodeEnvironmentImpl.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public void start(File tmpDataFolder, String clusterName) throws Exception {
	if (node == null) {
		Settings settings = Settings.builder()
			.put("cluster.name", clusterName)
			.put("http.enabled", false)
			.put("path.home", tmpDataFolder.getParent())
			.put("path.data", tmpDataFolder.getAbsolutePath())
			.put(NetworkModule.HTTP_TYPE_KEY, Netty3Plugin.NETTY_HTTP_TRANSPORT_NAME)
			.put(NetworkModule.TRANSPORT_TYPE_KEY, Netty3Plugin.NETTY_TRANSPORT_NAME)
			.build();

		node = new PluginNode(settings);
		node.start();
	}
}
 
Example #5
Source File: Elasticsearch5ApiCallBridge.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public TransportClient createClient(Map<String, String> clientConfig) {
	Settings settings = Settings.builder().put(clientConfig)
		.put(NetworkModule.HTTP_TYPE_KEY, Netty3Plugin.NETTY_HTTP_TRANSPORT_NAME)
		.put(NetworkModule.TRANSPORT_TYPE_KEY, Netty3Plugin.NETTY_TRANSPORT_NAME)
		.build();

	TransportClient transportClient = new PreBuiltTransportClient(settings);
	for (TransportAddress transport : ElasticsearchUtils.convertInetSocketAddresses(transportAddresses)) {
		transportClient.addTransportAddress(transport);
	}

	// verify that we actually are connected to a cluster
	if (transportClient.connectedNodes().isEmpty()) {

		// close the transportClient here
		IOUtils.closeQuietly(transportClient);

		throw new RuntimeException("Elasticsearch client is not connected to any Elasticsearch nodes!");
	}

	if (LOG.isInfoEnabled()) {
		LOG.info("Created Elasticsearch TransportClient with connected nodes {}", transportClient.connectedNodes());
	}

	return transportClient;
}
 
Example #6
Source File: Elasticsearch5ApiCallBridge.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public TransportClient createClient(Map<String, String> clientConfig) {
	Settings settings = Settings.builder().put(clientConfig)
		.put(NetworkModule.HTTP_TYPE_KEY, Netty3Plugin.NETTY_HTTP_TRANSPORT_NAME)
		.put(NetworkModule.TRANSPORT_TYPE_KEY, Netty3Plugin.NETTY_TRANSPORT_NAME)
		.build();

	TransportClient transportClient = new PreBuiltTransportClient(settings);
	for (TransportAddress transport : ElasticsearchUtils.convertInetSocketAddresses(transportAddresses)) {
		transportClient.addTransportAddress(transport);
	}

	// verify that we actually are connected to a cluster
	if (transportClient.connectedNodes().isEmpty()) {

		// close the transportClient here
		IOUtils.closeQuietly(transportClient);

		throw new RuntimeException("Elasticsearch client is not connected to any Elasticsearch nodes!");
	}

	if (LOG.isInfoEnabled()) {
		LOG.info("Created Elasticsearch TransportClient with connected nodes {}", transportClient.connectedNodes());
	}

	return transportClient;
}
 
Example #7
Source File: Elasticsearch5ApiCallBridge.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public TransportClient createClient(Map<String, String> clientConfig) {
	Settings settings = Settings.builder()
		.put(NetworkModule.HTTP_TYPE_KEY, Netty3Plugin.NETTY_HTTP_TRANSPORT_NAME)
		.put(NetworkModule.TRANSPORT_TYPE_KEY, Netty3Plugin.NETTY_TRANSPORT_NAME)
		.put(clientConfig)
		.build();

	TransportClient transportClient = new PreBuiltTransportClient(settings);
	for (TransportAddress transport : ElasticsearchUtils.convertInetSocketAddresses(transportAddresses)) {
		transportClient.addTransportAddress(transport);
	}

	return transportClient;
}
 
Example #8
Source File: EmbeddedElasticsearchNodeEnvironmentImpl.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
public PluginNode(Settings settings) {
	super(InternalSettingsPreparer.prepareEnvironment(settings, null), Collections.<Class<? extends Plugin>>singletonList(Netty3Plugin.class));
}
 
Example #9
Source File: EmbeddedElasticsearchNodeEnvironmentImpl.java    From flink with Apache License 2.0 4 votes vote down vote up
public PluginNode(Settings settings) {
	super(InternalSettingsPreparer.prepareEnvironment(settings, null), Collections.<Class<? extends Plugin>>singletonList(Netty3Plugin.class));
}
 
Example #10
Source File: EmbeddedElasticsearchNodeEnvironmentImpl.java    From flink with Apache License 2.0 4 votes vote down vote up
public PluginNode(Settings settings) {
	super(InternalSettingsPreparer.prepareEnvironment(settings, null), Collections.<Class<? extends Plugin>>singletonList(Netty3Plugin.class));
}