org.elasticsearch.common.network.NetworkUtils Java Examples
The following examples show how to use
org.elasticsearch.common.network.NetworkUtils.
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: StoreLocalClientProvider.java From elasticsearch-inout-plugin with Apache License 2.0 | 6 votes |
protected Settings buildNodeSettings() { // Build settings ImmutableSettings.Builder builder = ImmutableSettings.settingsBuilder() .put("node.name", "node-test-" + System.currentTimeMillis()) .put("node.data", true) .put("cluster.name", "cluster-test-" + NetworkUtils.getLocalAddress().getHostName()) .put("path.data", "./target/elasticsearch-test/data") .put("path.work", "./target/elasticsearch-test/work") .put("path.logs", "./target/elasticsearch-test/logs") .put("index.number_of_shards", "1") .put("index.number_of_replicas", "0") .put("cluster.routing.schedule", "50ms") .put("node.local", true); if (settings != null) { builder.put(settings); } return builder.build(); }
Example #2
Source File: TcpTransport.java From crate with Apache License 2.0 | 6 votes |
@Override public List<String> getDefaultSeedAddresses() { List<String> local = new ArrayList<>(); local.add("127.0.0.1"); // check if v6 is supported, if so, v4 will also work via mapped addresses. if (NetworkUtils.SUPPORTS_V6) { local.add("[::1]"); // may get ports appended! } return local.stream() .flatMap( address -> Arrays.stream(defaultPortRange()) .limit(LIMIT_LOCAL_PORTS_COUNT) .mapToObj(port -> address + ":" + port) ) .collect(Collectors.toList()); }
Example #3
Source File: NettyTransport.java From Elasticsearch with Apache License 2.0 | 5 votes |
private Settings createFallbackSettings() { Settings.Builder fallbackSettingsBuilder = settingsBuilder(); String fallbackBindHost = settings.get("transport.netty.bind_host", settings.get("transport.bind_host", settings.get("transport.host"))); if (fallbackBindHost != null) { fallbackSettingsBuilder.put("bind_host", fallbackBindHost); } String fallbackPublishHost = settings.get("transport.netty.publish_host", settings.get("transport.publish_host", settings.get("transport.host"))); if (fallbackPublishHost != null) { fallbackSettingsBuilder.put("publish_host", fallbackPublishHost); } String fallbackTcpNoDelay = settings.get("transport.netty.tcp_no_delay", settings.get(TCP_NO_DELAY, "true")); if (fallbackTcpNoDelay != null) { fallbackSettingsBuilder.put("tcp_no_delay", fallbackTcpNoDelay); } String fallbackTcpKeepAlive = settings.get("transport.netty.tcp_keep_alive", settings.get(TCP_KEEP_ALIVE, "true")); if (fallbackTcpKeepAlive != null) { fallbackSettingsBuilder.put("tcp_keep_alive", fallbackTcpKeepAlive); } boolean fallbackReuseAddress = settings.getAsBoolean("transport.netty.reuse_address", settings.getAsBoolean(TCP_REUSE_ADDRESS, NetworkUtils.defaultReuseAddress())); fallbackSettingsBuilder.put("reuse_address", fallbackReuseAddress); ByteSizeValue fallbackTcpSendBufferSize = settings.getAsBytesSize("transport.netty.tcp_send_buffer_size", settings.getAsBytesSize(TCP_SEND_BUFFER_SIZE, TCP_DEFAULT_SEND_BUFFER_SIZE)); if (fallbackTcpSendBufferSize != null) { fallbackSettingsBuilder.put("tcp_send_buffer_size", fallbackTcpSendBufferSize); } ByteSizeValue fallbackTcpBufferSize = settings.getAsBytesSize("transport.netty.tcp_receive_buffer_size", settings.getAsBytesSize(TCP_RECEIVE_BUFFER_SIZE, TCP_DEFAULT_RECEIVE_BUFFER_SIZE)); if (fallbackTcpBufferSize != null) { fallbackSettingsBuilder.put("tcp_receive_buffer_size", fallbackTcpBufferSize); } return fallbackSettingsBuilder.build(); }
Example #4
Source File: NettyTransport.java From Elasticsearch with Apache License 2.0 | 5 votes |
@Override public List<String> getLocalAddresses() { List<String> local = new ArrayList<>(); local.add("127.0.0.1"); // check if v6 is supported, if so, v4 will also work via mapped addresses. if (NetworkUtils.SUPPORTS_V6) { local.add("[::1]"); // may get ports appended! } return local; }