mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-09 14:34:43 +00:00
Rename static Zen1 settings (#38333)
Renames the following settings to remove the mention of `zen` in their names: - `discovery.zen.hosts_provider` -> `discovery.seed_providers` - `discovery.zen.ping.unicast.concurrent_connects` -> `discovery.seed_resolver.max_concurrent_resolvers` - `discovery.zen.ping.unicast.hosts.resolve_timeout` -> `discovery.seed_resolver.timeout` - `discovery.zen.ping.unicast.hosts` -> `discovery.seed_addresses`
This commit is contained in:
parent
89feaa0e23
commit
2d114a02ff
@ -131,10 +131,12 @@ class ClusterFormationTasks {
|
||||
writeConfigSetup = { Map esConfig ->
|
||||
if (config.getAutoSetHostsProvider()) {
|
||||
// Don't force discovery provider if one is set by the test cluster specs already
|
||||
if (esConfig.containsKey('discovery.zen.hosts_provider') == false) {
|
||||
esConfig['discovery.zen.hosts_provider'] = 'file'
|
||||
final String seedProvidersSettingName =
|
||||
node.nodeVersion.onOrAfter("7.0.0") ? "discovery.seed_providers" : "discovery.zen.hosts_provider";
|
||||
if (esConfig.containsKey(seedProvidersSettingName) == false) {
|
||||
esConfig[seedProvidersSettingName] = 'file'
|
||||
}
|
||||
esConfig['discovery.zen.ping.unicast.hosts'] = []
|
||||
esConfig[node.nodeVersion.onOrAfter("7.0.0") ? "discovery.seed_hosts" : "discovery.zen.ping.unicast.hosts"] = []
|
||||
}
|
||||
boolean supportsInitialMasterNodes = hasBwcNodes == false || config.bwcVersion.onOrAfter("7.0.0")
|
||||
if (esConfig['discovery.type'] == null && config.getAutoSetInitialMasterNodes() && supportsInitialMasterNodes) {
|
||||
|
@ -62,10 +62,10 @@ ${path.logs}
|
||||
#
|
||||
# --------------------------------- Discovery ----------------------------------
|
||||
#
|
||||
# Pass an initial list of hosts to perform discovery when new node is started:
|
||||
# Pass an initial list of hosts to perform discovery when this node is started:
|
||||
# The default list of hosts is ["127.0.0.1", "[::1]"]
|
||||
#
|
||||
#discovery.zen.ping.unicast.hosts: ["host1", "host2"]
|
||||
#discovery.seed_hosts: ["host1", "host2"]
|
||||
#
|
||||
# Bootstrap the cluster using an initial set of master-eligible nodes:
|
||||
#
|
||||
|
@ -30,7 +30,7 @@ cloud:
|
||||
type: pkcs12
|
||||
|
||||
discovery:
|
||||
zen.hosts_provider: azure
|
||||
seed_providers: azure
|
||||
----
|
||||
|
||||
[IMPORTANT]
|
||||
|
@ -20,7 +20,7 @@ provider for Zen discovery to `ec2`:
|
||||
|
||||
[source,yaml]
|
||||
----
|
||||
discovery.zen.hosts_provider: ec2
|
||||
discovery.seed_providers: ec2
|
||||
----
|
||||
|
||||
==== Settings
|
||||
|
@ -19,7 +19,7 @@ cloud:
|
||||
project_id: <your-google-project-id>
|
||||
zone: <your-zone>
|
||||
discovery:
|
||||
zen.hosts_provider: gce
|
||||
seed_providers: gce
|
||||
--------------------------------------------------
|
||||
|
||||
The following gce settings (prefixed with `cloud.gce`) are supported:
|
||||
@ -232,7 +232,7 @@ cloud:
|
||||
project_id: es-cloud
|
||||
zone: europe-west1-a
|
||||
discovery:
|
||||
zen.hosts_provider: gce
|
||||
seed_providers: gce
|
||||
--------------------------------------------------
|
||||
|
||||
|
||||
@ -346,7 +346,7 @@ cloud:
|
||||
project_id: <your-google-project-id>
|
||||
zone: ["<your-zone1>", "<your-zone2>"]
|
||||
discovery:
|
||||
zen.hosts_provider: gce
|
||||
seed_providers: gce
|
||||
--------------------------------------------------
|
||||
|
||||
|
||||
@ -382,7 +382,7 @@ cloud:
|
||||
project_id: es-cloud
|
||||
zone: europe-west1-a
|
||||
discovery:
|
||||
zen.hosts_provider: gce
|
||||
seed_providers: gce
|
||||
gce:
|
||||
tags: elasticsearch, dev
|
||||
--------------------------------------------------
|
||||
@ -497,7 +497,7 @@ cloud:
|
||||
project_id: es-cloud
|
||||
zone: europe-west1-a
|
||||
discovery:
|
||||
zen.hosts_provider: gce
|
||||
seed_providers: gce
|
||||
--------------------------------------------------
|
||||
|
||||
Replaces `project_id` and `zone` with your settings.
|
||||
|
@ -35,6 +35,6 @@ Production deployments of Elasticsearch now require at least one of the
|
||||
following settings to be specified in the `elasticsearch.yml` configuration
|
||||
file:
|
||||
|
||||
- `discovery.zen.ping.unicast.hosts`
|
||||
- `discovery.zen.hosts_provider`
|
||||
- `discovery.seed_hosts`
|
||||
- `discovery.seed_providers`
|
||||
- `cluster.initial_master_nodes`
|
||||
|
@ -94,6 +94,6 @@ If any of the following settings are configured then auto-bootstrapping will not
|
||||
take place, and you must configure `cluster.initial_master_nodes` as described
|
||||
in the <<modules-discovery-bootstrap-cluster,section on cluster bootstrapping>>:
|
||||
|
||||
* `discovery.zen.hosts_provider`
|
||||
* `discovery.zen.ping.unicast.hosts`
|
||||
* `discovery.seed_providers`
|
||||
* `discovery.seed_hosts`
|
||||
* `cluster.initial_master_nodes`
|
||||
|
@ -105,9 +105,10 @@ Discovery and cluster formation are affected by the following settings:
|
||||
`discovery.cluster_formation_warning_timeout`::
|
||||
|
||||
Sets how long a node will try to form a cluster before logging a warning
|
||||
that the cluster did not form. Defaults to `10s`. If a cluster has not
|
||||
that the cluster did not form. Defaults to `10s`. If a cluster has not
|
||||
formed after `discovery.cluster_formation_warning_timeout` has elapsed then
|
||||
the node will log a warning message that starts with the phrase `master not discovered` which describes the current state of the discovery process.
|
||||
the node will log a warning message that starts with the phrase `master not
|
||||
discovered` which describes the current state of the discovery process.
|
||||
|
||||
`discovery.find_peers_interval`::
|
||||
|
||||
@ -128,9 +129,9 @@ Discovery and cluster formation are affected by the following settings:
|
||||
Sets how long a node will wait after asking its peers again before
|
||||
considering the request to have failed. Defaults to `3s`.
|
||||
|
||||
`discovery.zen.hosts_provider`::
|
||||
Specifies which type of <<built-in-hosts-providers,hosts provider>> provides
|
||||
the list of seed nodes. By default, it is the
|
||||
`discovery.seed_providers`::
|
||||
Specifies which types of <<built-in-hosts-providers,seed provider>> provide
|
||||
the addresses of seed nodes. By default, it is the
|
||||
<<settings-based-hosts-provider,settings-based hosts provider>>.
|
||||
|
||||
[[no-master-block]]`discovery.zen.no_master_block`::
|
||||
@ -157,7 +158,7 @@ APIs are not be blocked and can run on any available node.
|
||||
===============================
|
||||
--
|
||||
|
||||
`discovery.zen.ping.unicast.hosts`::
|
||||
`discovery.seed_hosts`::
|
||||
|
||||
Provides a list of master-eligible nodes in the cluster. The list contains
|
||||
either an array of hosts or a comma-delimited string. Each value has the
|
||||
@ -165,7 +166,12 @@ APIs are not be blocked and can run on any available node.
|
||||
`transport.profiles.default.port`. Note that IPv6 hosts must be bracketed.
|
||||
The default value is `127.0.0.1, [::1]`. See <<unicast.hosts>>.
|
||||
|
||||
`discovery.zen.ping.unicast.hosts.resolve_timeout`::
|
||||
`discovery.seed_resolver.timeout`::
|
||||
|
||||
Sets the amount of time to wait for DNS lookups on each round of discovery.
|
||||
This is specified as a <<time-units, time unit>> and defaults to `5s`.
|
||||
|
||||
`discovery.seed_resolver.max_concurrent_resolvers`::
|
||||
|
||||
Sets the number of threads with which to perform DNS lookups for seed nodes.
|
||||
This defaults to `10`.
|
||||
|
@ -34,7 +34,7 @@ By default the cluster formation module offers two hosts providers to configure
|
||||
the list of seed nodes: a _settings_-based and a _file_-based hosts provider.
|
||||
It can be extended to support cloud environments and other forms of hosts
|
||||
providers via {plugins}/discovery.html[discovery plugins]. Hosts providers are
|
||||
configured using the `discovery.zen.hosts_provider` setting, which defaults to
|
||||
configured using the `discovery.seed_providers` setting, which defaults to
|
||||
the _settings_-based hosts provider. Multiple hosts providers can be specified
|
||||
as a list.
|
||||
|
||||
@ -49,12 +49,12 @@ round of discovery. Note that if you are in an environment where DNS resolutions
|
||||
vary with time, you might need to adjust your <<networkaddress-cache-ttl,JVM
|
||||
security settings>>.
|
||||
|
||||
The list of hosts is set using the <<unicast.hosts,`discovery.zen.ping.unicast.hosts`>> static
|
||||
The list of hosts is set using the <<unicast.hosts,`discovery.seed_hosts`>> static
|
||||
setting. For example:
|
||||
|
||||
[source,yaml]
|
||||
--------------------------------------------------
|
||||
discovery.zen.ping.unicast.hosts:
|
||||
discovery.seed_hosts:
|
||||
- 192.168.1.10:9300
|
||||
- 192.168.1.11 <1>
|
||||
- seeds.mydomain.com <2>
|
||||
@ -64,9 +64,9 @@ discovery.zen.ping.unicast.hosts:
|
||||
<2> A hostname that resolves to multiple IP addresses will try all resolved
|
||||
addresses.
|
||||
|
||||
Additionally, the `discovery.zen.ping.unicast.hosts.resolve_timeout` configures
|
||||
the amount of time to wait for DNS lookups on each round of discovery. This is
|
||||
specified as a <<time-units, time unit>> and defaults to 5s.
|
||||
Additionally, the `discovery.seed_resolver.timeout` configures the amount of
|
||||
time to wait for DNS lookups on each round of discovery. This is specified as a
|
||||
<<time-units, time unit>> and defaults to 5s.
|
||||
|
||||
Unicast discovery uses the <<modules-transport,transport>> module to perform the
|
||||
discovery.
|
||||
@ -87,7 +87,7 @@ in the `elasticsearch.yml` file:
|
||||
|
||||
[source,yml]
|
||||
----------------------------------------------------------------
|
||||
discovery.zen.hosts_provider: file
|
||||
discovery.seed_providers: file
|
||||
----------------------------------------------------------------
|
||||
|
||||
Then create a file at `$ES_PATH_CONF/unicast_hosts.txt` in the format described
|
||||
@ -95,13 +95,13 @@ below. Any time a change is made to the `unicast_hosts.txt` file the new changes
|
||||
will be picked up by Elasticsearch and the new hosts list will be used.
|
||||
|
||||
Note that the file-based discovery plugin augments the unicast hosts list in
|
||||
`elasticsearch.yml`. If there are valid unicast host entries in
|
||||
`discovery.zen.ping.unicast.hosts`, they are used in addition to those
|
||||
supplied in `unicast_hosts.txt`.
|
||||
`elasticsearch.yml`. If there are valid seed addresses in
|
||||
`discovery.seed_hosts` then they are used in addition to those supplied in
|
||||
`unicast_hosts.txt`.
|
||||
|
||||
The `discovery.zen.ping.unicast.hosts.resolve_timeout` setting also applies to
|
||||
DNS lookups for nodes specified by address via file-based discovery. This is
|
||||
specified as a <<time-units, time unit>> and defaults to 5s.
|
||||
The `discovery.seed_resolver.timeout` setting also applies to DNS lookups for
|
||||
seed addresses given via file-based discovery. This is specified as a
|
||||
<<time-units, time unit>> and defaults to 5s.
|
||||
|
||||
The format of the file is to specify one node entry per line. Each node entry
|
||||
consists of the host (host name or IP address) and an optional transport port
|
||||
@ -123,7 +123,7 @@ the default port:
|
||||
----------------------------------------------------------------
|
||||
|
||||
Host names are allowed instead of IP addresses (similar to
|
||||
`discovery.zen.ping.unicast.hosts`), and IPv6 addresses must be specified in
|
||||
`discovery.seed_hosts`), and IPv6 addresses must be specified in
|
||||
brackets with the port coming after the brackets.
|
||||
|
||||
You can also add comments to this file. All comments must appear on
|
||||
|
@ -28,19 +28,18 @@ because `:` is a special character in YAML.
|
||||
+
|
||||
Defaults to `_local_`.
|
||||
|
||||
`discovery.zen.ping.unicast.hosts`::
|
||||
`discovery.seed_hosts`::
|
||||
|
||||
In order to join a cluster, a node needs to know the hostname or IP address of
|
||||
at least some of the other nodes in the cluster. This setting provides the
|
||||
initial list of other nodes that this node will try to contact. Accepts IP
|
||||
addresses or hostnames. If a hostname lookup resolves to multiple IP
|
||||
addresses then each IP address will be used for discovery.
|
||||
initial list of addresses this node will try to contact. Accepts IP addresses
|
||||
or hostnames. If a hostname lookup resolves to multiple IP addresses then each
|
||||
IP address will be used for discovery.
|
||||
https://en.wikipedia.org/wiki/Round-robin_DNS[Round robin DNS] -- returning a
|
||||
different IP from a list on each lookup -- can be used for discovery; non-
|
||||
existent IP addresses will throw exceptions and cause another DNS lookup
|
||||
on the next round of pinging (subject to JVM DNS caching).
|
||||
+
|
||||
Defaults to `["127.0.0.1", "[::1]"]`.
|
||||
existent IP addresses will throw exceptions and cause another DNS lookup on the
|
||||
next round of pinging (subject to JVM DNS caching). + Defaults to
|
||||
`["127.0.0.1", "[::1]"]`.
|
||||
|
||||
`http.port`::
|
||||
|
||||
|
@ -136,7 +136,7 @@ services:
|
||||
image: {docker-image}
|
||||
environment:
|
||||
- node.name=es02
|
||||
- discovery.zen.ping.unicast.hosts=es01
|
||||
- discovery.seed_hosts=es01
|
||||
- cluster.initial_master_nodes=es01,es02
|
||||
- ELASTIC_PASSWORD=$ELASTIC_PASSWORD
|
||||
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
|
||||
|
@ -252,6 +252,6 @@ This bootstrap check ensures that discovery is not running with the default
|
||||
configuration. It can be satisfied by setting at least one of the following
|
||||
properties:
|
||||
|
||||
- `discovery.zen.ping.unicast.hosts`
|
||||
- `discovery.zen.hosts_provider`
|
||||
- `discovery.seed_hosts`
|
||||
- `discovery.seed_providers`
|
||||
- `cluster.initial_master_nodes`
|
||||
|
@ -10,7 +10,7 @@ each other and elect a master node.
|
||||
|
||||
[float]
|
||||
[[unicast.hosts]]
|
||||
==== `discovery.zen.ping.unicast.hosts`
|
||||
==== `discovery.seed_hosts`
|
||||
|
||||
Out of the box, without any network configuration, Elasticsearch will bind to
|
||||
the available loopback addresses and will scan local ports 9300 to 9305 to try
|
||||
@ -18,7 +18,7 @@ to connect to other nodes running on the same server. This provides an auto-
|
||||
clustering experience without having to do any configuration.
|
||||
|
||||
When the moment comes to form a cluster with nodes on other servers, you must
|
||||
use the `discovery.zen.ping.unicast.hosts` setting to provide a seed list of
|
||||
use the `discovery.seed_hosts` setting to provide a seed list of
|
||||
other nodes in the cluster that are master-eligible and likely to be live and
|
||||
contactable. This setting should normally contain the addresses of all the
|
||||
master-eligible nodes in the cluster.
|
||||
@ -44,7 +44,7 @@ This list is set using the `cluster.initial_master_nodes` setting.
|
||||
|
||||
[source,yaml]
|
||||
--------------------------------------------------
|
||||
discovery.zen.ping.unicast.hosts:
|
||||
discovery.seed_hosts:
|
||||
- 192.168.1.10:9300
|
||||
- 192.168.1.11 <1>
|
||||
- seeds.mydomain.com <2>
|
||||
@ -62,4 +62,4 @@ cluster.initial_master_nodes:
|
||||
<5> If multiple master nodes share an IP address then the port must be used to
|
||||
disambiguate them.
|
||||
|
||||
For more information, see <<modules-discovery-settings>>.
|
||||
For more information, see <<modules-discovery-settings>>.
|
||||
|
@ -187,7 +187,7 @@ services:
|
||||
container_name: es02
|
||||
environment:
|
||||
- node.name=es02
|
||||
- discovery.zen.ping.unicast.hosts=es01
|
||||
- discovery.seed_hosts=es01
|
||||
- cluster.initial_master_nodes=es01,es02
|
||||
- cluster.name=docker-cluster
|
||||
- bootstrap.memory_lock=true
|
||||
|
@ -49,6 +49,7 @@ import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import static org.elasticsearch.common.util.CollectionUtils.newSingletonArrayList;
|
||||
import static org.elasticsearch.discovery.DiscoveryModule.DISCOVERY_SEED_PROVIDERS_SETTING;
|
||||
|
||||
public abstract class AbstractAzureComputeServiceTestCase extends ESIntegTestCase {
|
||||
|
||||
@ -63,7 +64,7 @@ public abstract class AbstractAzureComputeServiceTestCase extends ESIntegTestCas
|
||||
protected Settings nodeSettings(int nodeOrdinal) {
|
||||
Settings.Builder builder = Settings.builder()
|
||||
.put(super.nodeSettings(nodeOrdinal))
|
||||
.put("discovery.zen.hosts_provider", "azure");
|
||||
.put(DISCOVERY_SEED_PROVIDERS_SETTING.getKey(), "azure");
|
||||
|
||||
// We add a fake subscription_id to start mock compute service
|
||||
builder.put(Management.SUBSCRIPTION_ID_SETTING.getKey(), "fake")
|
||||
|
@ -116,7 +116,7 @@ public class AzureDiscoveryClusterFormationTests extends ESIntegTestCase {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return Settings.builder().put(super.nodeSettings(nodeOrdinal))
|
||||
.put(DiscoveryModule.DISCOVERY_HOSTS_PROVIDER_SETTING.getKey(), AzureDiscoveryPlugin.AZURE)
|
||||
.put(DiscoveryModule.DISCOVERY_SEED_PROVIDERS_SETTING.getKey(), AzureDiscoveryPlugin.AZURE)
|
||||
.put(Environment.PATH_LOGS_SETTING.getKey(), resolve)
|
||||
.put(TransportSettings.PORT.getKey(), 0)
|
||||
.put(Node.WRITE_PORTS_FILE_SETTING.getKey(), "true")
|
||||
|
@ -54,7 +54,7 @@ integTestCluster {
|
||||
plugin ':plugins:discovery-ec2'
|
||||
keystoreSetting 'discovery.ec2.access_key', 'ec2_integration_test_access_key'
|
||||
keystoreSetting 'discovery.ec2.secret_key', 'ec2_integration_test_secret_key'
|
||||
setting 'discovery.zen.hosts_provider', 'ec2'
|
||||
setting 'discovery.seed_providers', 'ec2'
|
||||
setting 'network.host', '_ec2_'
|
||||
setting 'discovery.ec2.endpoint', "http://${-> ec2Fixture.addressAndPort}"
|
||||
systemProperty "com.amazonaws.sdk.ec2MetadataServiceEndpointOverride", "http://${-> ec2Fixture.addressAndPort}"
|
||||
|
@ -38,7 +38,7 @@ import static org.hamcrest.CoreMatchers.is;
|
||||
public class Ec2DiscoveryUpdateSettingsTests extends AbstractAwsTestCase {
|
||||
public void testMinimumMasterNodesStart() {
|
||||
Settings nodeSettings = Settings.builder()
|
||||
.put(DiscoveryModule.DISCOVERY_HOSTS_PROVIDER_SETTING.getKey(), "ec2")
|
||||
.put(DiscoveryModule.DISCOVERY_SEED_PROVIDERS_SETTING.getKey(), "ec2")
|
||||
.build();
|
||||
internalCluster().startNode(nodeSettings);
|
||||
|
||||
|
@ -51,7 +51,7 @@ integTestCluster {
|
||||
dependsOn gceFixture
|
||||
numNodes = gceNumberOfNodes
|
||||
plugin ':plugins:discovery-gce'
|
||||
setting 'discovery.zen.hosts_provider', 'gce'
|
||||
setting 'discovery.seed_providers', 'gce'
|
||||
|
||||
// use gce fixture for Auth calls instead of http://metadata.google.internal
|
||||
integTestCluster.environment 'GCE_METADATA_HOST', "http://${-> gceFixture.addressAndPort}"
|
||||
|
@ -40,6 +40,7 @@ import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import static java.util.Collections.singletonList;
|
||||
import static org.elasticsearch.discovery.DiscoveryModule.DISCOVERY_SEED_PROVIDERS_SETTING;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoTimeout;
|
||||
|
||||
@ESIntegTestCase.ClusterScope(supportsDedicatedMasters = false, numDataNodes = 0, numClientNodes = 0)
|
||||
@ -62,7 +63,7 @@ public class GceDiscoverTests extends ESIntegTestCase {
|
||||
protected Settings nodeSettings(int nodeOrdinal) {
|
||||
return Settings.builder()
|
||||
.put(super.nodeSettings(nodeOrdinal))
|
||||
.put("discovery.zen.hosts_provider", "gce")
|
||||
.put(DISCOVERY_SEED_PROVIDERS_SETTING.getKey(), "gce")
|
||||
.put("cloud.gce.project_id", "test")
|
||||
.put("cloud.gce.zone", "test")
|
||||
.build();
|
||||
|
@ -52,8 +52,8 @@ import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static org.elasticsearch.cluster.coordination.ClusterBootstrapService.INITIAL_MASTER_NODES_SETTING;
|
||||
import static org.elasticsearch.discovery.DiscoveryModule.DISCOVERY_HOSTS_PROVIDER_SETTING;
|
||||
import static org.elasticsearch.discovery.zen.SettingsBasedHostsProvider.DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING;
|
||||
import static org.elasticsearch.discovery.DiscoveryModule.DISCOVERY_SEED_PROVIDERS_SETTING;
|
||||
import static org.elasticsearch.discovery.zen.SettingsBasedHostsProvider.DISCOVERY_SEED_HOSTS_SETTING;
|
||||
|
||||
/**
|
||||
* We enforce bootstrap checks once a node has the transport protocol bound to a non-loopback interface or if the system property {@code
|
||||
@ -735,7 +735,7 @@ final class BootstrapChecks {
|
||||
return BootstrapCheckResult.failure(String.format(
|
||||
Locale.ROOT,
|
||||
"the default discovery settings are unsuitable for production use; at least one of [%s] must be configured",
|
||||
Stream.of(DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING, DISCOVERY_HOSTS_PROVIDER_SETTING, INITIAL_MASTER_NODES_SETTING)
|
||||
Stream.of(DISCOVERY_SEED_HOSTS_SETTING, DISCOVERY_SEED_PROVIDERS_SETTING, INITIAL_MASTER_NODES_SETTING)
|
||||
.map(Setting::getKey).collect(Collectors.joining(", "))));
|
||||
}
|
||||
}
|
||||
|
@ -48,8 +48,10 @@ import java.util.stream.StreamSupport;
|
||||
|
||||
import static java.util.Collections.emptyList;
|
||||
import static java.util.Collections.unmodifiableSet;
|
||||
import static org.elasticsearch.discovery.DiscoveryModule.DISCOVERY_HOSTS_PROVIDER_SETTING;
|
||||
import static org.elasticsearch.discovery.zen.SettingsBasedHostsProvider.DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING;
|
||||
import static org.elasticsearch.discovery.DiscoveryModule.DISCOVERY_SEED_PROVIDERS_SETTING;
|
||||
import static org.elasticsearch.discovery.DiscoveryModule.LEGACY_DISCOVERY_HOSTS_PROVIDER_SETTING;
|
||||
import static org.elasticsearch.discovery.zen.SettingsBasedHostsProvider.DISCOVERY_SEED_HOSTS_SETTING;
|
||||
import static org.elasticsearch.discovery.zen.SettingsBasedHostsProvider.LEGACY_DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING;
|
||||
|
||||
public class ClusterBootstrapService {
|
||||
|
||||
@ -91,8 +93,9 @@ public class ClusterBootstrapService {
|
||||
}
|
||||
|
||||
public static boolean discoveryIsConfigured(Settings settings) {
|
||||
return Stream.of(DISCOVERY_HOSTS_PROVIDER_SETTING, DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING, INITIAL_MASTER_NODES_SETTING)
|
||||
.anyMatch(s -> s.exists(settings));
|
||||
return Stream.of(DISCOVERY_SEED_PROVIDERS_SETTING, LEGACY_DISCOVERY_HOSTS_PROVIDER_SETTING,
|
||||
DISCOVERY_SEED_HOSTS_SETTING, LEGACY_DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING,
|
||||
INITIAL_MASTER_NODES_SETTING).anyMatch(s -> s.exists(settings));
|
||||
}
|
||||
|
||||
void onFoundPeersUpdated() {
|
||||
|
@ -387,7 +387,8 @@ public final class ClusterSettings extends AbstractScopedSettings {
|
||||
NodeEnvironment.NODE_ID_SEED_SETTING,
|
||||
DiscoverySettings.INITIAL_STATE_TIMEOUT_SETTING,
|
||||
DiscoveryModule.DISCOVERY_TYPE_SETTING,
|
||||
DiscoveryModule.DISCOVERY_HOSTS_PROVIDER_SETTING,
|
||||
DiscoveryModule.DISCOVERY_SEED_PROVIDERS_SETTING,
|
||||
DiscoveryModule.LEGACY_DISCOVERY_HOSTS_PROVIDER_SETTING,
|
||||
FaultDetection.PING_RETRIES_SETTING,
|
||||
FaultDetection.PING_TIMEOUT_SETTING,
|
||||
FaultDetection.REGISTER_CONNECTION_LISTENER_SETTING,
|
||||
@ -402,9 +403,12 @@ public final class ClusterSettings extends AbstractScopedSettings {
|
||||
ZenDiscovery.MASTER_ELECTION_WAIT_FOR_JOINS_TIMEOUT_SETTING,
|
||||
ZenDiscovery.MASTER_ELECTION_IGNORE_NON_MASTER_PINGS_SETTING,
|
||||
ZenDiscovery.MAX_PENDING_CLUSTER_STATES_SETTING,
|
||||
SettingsBasedHostsProvider.DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING,
|
||||
UnicastZenPing.DISCOVERY_ZEN_PING_UNICAST_CONCURRENT_CONNECTS_SETTING,
|
||||
UnicastZenPing.DISCOVERY_ZEN_PING_UNICAST_HOSTS_RESOLVE_TIMEOUT,
|
||||
SettingsBasedHostsProvider.DISCOVERY_SEED_HOSTS_SETTING,
|
||||
SettingsBasedHostsProvider.LEGACY_DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING,
|
||||
UnicastZenPing.DISCOVERY_SEED_RESOLVER_MAX_CONCURRENT_RESOLVERS_SETTING,
|
||||
UnicastZenPing.DISCOVERY_SEED_RESOLVER_TIMEOUT_SETTING,
|
||||
UnicastZenPing.LEGACY_DISCOVERY_ZEN_PING_UNICAST_CONCURRENT_CONNECTS_SETTING,
|
||||
UnicastZenPing.LEGACY_DISCOVERY_ZEN_PING_UNICAST_HOSTS_RESOLVE_TIMEOUT,
|
||||
SearchService.DEFAULT_KEEPALIVE_SETTING,
|
||||
SearchService.KEEPALIVE_INTERVAL_SETTING,
|
||||
SearchService.MAX_KEEPALIVE_SETTING,
|
||||
|
@ -74,8 +74,12 @@ public class DiscoveryModule {
|
||||
|
||||
public static final Setting<String> DISCOVERY_TYPE_SETTING =
|
||||
new Setting<>("discovery.type", ZEN2_DISCOVERY_TYPE, Function.identity(), Property.NodeScope);
|
||||
public static final Setting<List<String>> DISCOVERY_HOSTS_PROVIDER_SETTING =
|
||||
Setting.listSetting("discovery.zen.hosts_provider", Collections.emptyList(), Function.identity(), Property.NodeScope);
|
||||
public static final Setting<List<String>> LEGACY_DISCOVERY_HOSTS_PROVIDER_SETTING =
|
||||
Setting.listSetting("discovery.zen.hosts_provider", Collections.emptyList(), Function.identity(),
|
||||
Property.NodeScope, Property.Deprecated);
|
||||
public static final Setting<List<String>> DISCOVERY_SEED_PROVIDERS_SETTING =
|
||||
Setting.listSetting("discovery.seed_providers", Collections.emptyList(), Function.identity(),
|
||||
Property.NodeScope);
|
||||
|
||||
private final Discovery discovery;
|
||||
|
||||
@ -90,7 +94,7 @@ public class DiscoveryModule {
|
||||
for (DiscoveryPlugin plugin : plugins) {
|
||||
plugin.getZenHostsProviders(transportService, networkService).forEach((key, value) -> {
|
||||
if (hostProviders.put(key, value) != null) {
|
||||
throw new IllegalArgumentException("Cannot register zen hosts provider [" + key + "] twice");
|
||||
throw new IllegalArgumentException("Cannot register seed provider [" + key + "] twice");
|
||||
}
|
||||
});
|
||||
BiConsumer<DiscoveryNode, ClusterState> joinValidator = plugin.getJoinValidator();
|
||||
@ -98,7 +102,8 @@ public class DiscoveryModule {
|
||||
joinValidators.add(joinValidator);
|
||||
}
|
||||
}
|
||||
List<String> hostsProviderNames = DISCOVERY_HOSTS_PROVIDER_SETTING.get(settings);
|
||||
|
||||
List<String> hostsProviderNames = getSeedProviderNames(settings);
|
||||
// for bwc purposes, add settings provider even if not explicitly specified
|
||||
if (hostsProviderNames.contains("settings") == false) {
|
||||
List<String> extendedHostsProviderNames = new ArrayList<>();
|
||||
@ -110,7 +115,7 @@ public class DiscoveryModule {
|
||||
final Set<String> missingProviderNames = new HashSet<>(hostsProviderNames);
|
||||
missingProviderNames.removeAll(hostProviders.keySet());
|
||||
if (missingProviderNames.isEmpty() == false) {
|
||||
throw new IllegalArgumentException("Unknown zen hosts providers " + missingProviderNames);
|
||||
throw new IllegalArgumentException("Unknown seed providers " + missingProviderNames);
|
||||
}
|
||||
|
||||
List<UnicastHostsProvider> filteredHostsProviders = hostsProviderNames.stream()
|
||||
@ -151,8 +156,18 @@ public class DiscoveryModule {
|
||||
discovery = Objects.requireNonNull(discoverySupplier.get());
|
||||
}
|
||||
|
||||
private List<String> getSeedProviderNames(Settings settings) {
|
||||
if (LEGACY_DISCOVERY_HOSTS_PROVIDER_SETTING.exists(settings)) {
|
||||
if (DISCOVERY_SEED_PROVIDERS_SETTING.exists(settings)) {
|
||||
throw new IllegalArgumentException("it is forbidden to set both [" + DISCOVERY_SEED_PROVIDERS_SETTING.getKey() + "] and ["
|
||||
+ LEGACY_DISCOVERY_HOSTS_PROVIDER_SETTING.getKey() + "]");
|
||||
}
|
||||
return LEGACY_DISCOVERY_HOSTS_PROVIDER_SETTING.get(settings);
|
||||
}
|
||||
return DISCOVERY_SEED_PROVIDERS_SETTING.get(settings);
|
||||
}
|
||||
|
||||
public Discovery getDiscovery() {
|
||||
return discovery;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -41,8 +41,6 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import static org.elasticsearch.discovery.zen.UnicastZenPing.DISCOVERY_ZEN_PING_UNICAST_CONCURRENT_CONNECTS_SETTING;
|
||||
|
||||
public class UnicastConfiguredHostsResolver extends AbstractLifecycleComponent implements ConfiguredHostsResolver {
|
||||
private static final Logger logger = LogManager.getLogger(UnicastConfiguredHostsResolver.class);
|
||||
|
||||
@ -53,6 +51,7 @@ public class UnicastConfiguredHostsResolver extends AbstractLifecycleComponent i
|
||||
private final SetOnce<ExecutorService> executorService = new SetOnce<>();
|
||||
private final TimeValue resolveTimeout;
|
||||
private final String nodeName;
|
||||
private final int concurrentConnects;
|
||||
|
||||
public UnicastConfiguredHostsResolver(String nodeName, Settings settings, TransportService transportService,
|
||||
UnicastHostsProvider hostsProvider) {
|
||||
@ -60,13 +59,13 @@ public class UnicastConfiguredHostsResolver extends AbstractLifecycleComponent i
|
||||
this.nodeName = nodeName;
|
||||
this.transportService = transportService;
|
||||
this.hostsProvider = hostsProvider;
|
||||
resolveTimeout = UnicastZenPing.DISCOVERY_ZEN_PING_UNICAST_HOSTS_RESOLVE_TIMEOUT.get(settings);
|
||||
resolveTimeout = UnicastZenPing.getResolveTimeout(settings);
|
||||
concurrentConnects = UnicastZenPing.getMaxConcurrentResolvers(settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doStart() {
|
||||
final int concurrentConnects = DISCOVERY_ZEN_PING_UNICAST_CONCURRENT_CONNECTS_SETTING.get(settings);
|
||||
logger.debug("using concurrent_connects [{}], resolve_timeout [{}]", concurrentConnects, resolveTimeout);
|
||||
logger.debug("using max_concurrent_resolvers [{}], resolver timeout [{}]", concurrentConnects, resolveTimeout);
|
||||
final ThreadFactory threadFactory = EsExecutors.daemonThreadFactory(settings, "[unicast_configured_hosts_resolver]");
|
||||
executorService.set(EsExecutors.newScaling(nodeName + "/" + "unicast_configured_hosts_resolver",
|
||||
0, concurrentConnects, 60, TimeUnit.SECONDS, threadFactory, transportService.getThreadPool().getThreadContext()));
|
||||
|
@ -22,6 +22,7 @@ package org.elasticsearch.discovery.zen;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.Property;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.transport.TransportAddress;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
@ -33,7 +34,7 @@ import static java.util.Collections.emptyList;
|
||||
|
||||
/**
|
||||
* An implementation of {@link UnicastHostsProvider} that reads hosts/ports
|
||||
* from the "discovery.zen.ping.unicast.hosts" node setting. If the port is
|
||||
* from the "discovery.seed_hosts" node setting. If the port is
|
||||
* left off an entry, a default port of 9300 is assumed.
|
||||
*
|
||||
* An example unicast hosts setting might look as follows:
|
||||
@ -43,20 +44,31 @@ public class SettingsBasedHostsProvider implements UnicastHostsProvider {
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(SettingsBasedHostsProvider.class);
|
||||
|
||||
public static final Setting<List<String>> DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING =
|
||||
Setting.listSetting("discovery.zen.ping.unicast.hosts", emptyList(), Function.identity(), Setting.Property.NodeScope);
|
||||
public static final Setting<List<String>> LEGACY_DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING =
|
||||
Setting.listSetting("discovery.zen.ping.unicast.hosts", emptyList(), Function.identity(), Property.NodeScope, Property.Deprecated);
|
||||
|
||||
public static final Setting<List<String>> DISCOVERY_SEED_HOSTS_SETTING =
|
||||
Setting.listSetting("discovery.seed_hosts", emptyList(), Function.identity(), Property.NodeScope);
|
||||
|
||||
// these limits are per-address
|
||||
public static final int LIMIT_FOREIGN_PORTS_COUNT = 1;
|
||||
public static final int LIMIT_LOCAL_PORTS_COUNT = 5;
|
||||
private static final int LIMIT_FOREIGN_PORTS_COUNT = 1;
|
||||
private static final int LIMIT_LOCAL_PORTS_COUNT = 5;
|
||||
|
||||
private final List<String> configuredHosts;
|
||||
|
||||
private final int limitPortCounts;
|
||||
|
||||
public SettingsBasedHostsProvider(Settings settings, TransportService transportService) {
|
||||
if (DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING.exists(settings)) {
|
||||
configuredHosts = DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING.get(settings);
|
||||
if (LEGACY_DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING.exists(settings)) {
|
||||
if (DISCOVERY_SEED_HOSTS_SETTING.exists(settings)) {
|
||||
throw new IllegalArgumentException("it is forbidden to set both ["
|
||||
+ DISCOVERY_SEED_HOSTS_SETTING.getKey() + "] and ["
|
||||
+ LEGACY_DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING.getKey() + "]");
|
||||
}
|
||||
configuredHosts = LEGACY_DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING.get(settings);
|
||||
// we only limit to 1 address, makes no sense to ping 100 ports
|
||||
limitPortCounts = LIMIT_FOREIGN_PORTS_COUNT;
|
||||
} else if (DISCOVERY_SEED_HOSTS_SETTING.exists(settings)) {
|
||||
configuredHosts = DISCOVERY_SEED_HOSTS_SETTING.get(settings);
|
||||
// we only limit to 1 address, makes no sense to ping 100 ports
|
||||
limitPortCounts = LIMIT_FOREIGN_PORTS_COUNT;
|
||||
} else {
|
||||
@ -72,5 +84,4 @@ public class SettingsBasedHostsProvider implements UnicastHostsProvider {
|
||||
public List<TransportAddress> buildDynamicHosts(HostsResolver hostsResolver) {
|
||||
return hostsResolver.resolveHosts(configuredHosts, limitPortCounts);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -96,10 +96,17 @@ public class UnicastZenPing implements ZenPing {
|
||||
private static final Logger logger = LogManager.getLogger(UnicastZenPing.class);
|
||||
|
||||
public static final String ACTION_NAME = "internal:discovery/zen/unicast";
|
||||
public static final Setting<Integer> DISCOVERY_ZEN_PING_UNICAST_CONCURRENT_CONNECTS_SETTING =
|
||||
Setting.intSetting("discovery.zen.ping.unicast.concurrent_connects", 10, 0, Property.NodeScope);
|
||||
public static final Setting<TimeValue> DISCOVERY_ZEN_PING_UNICAST_HOSTS_RESOLVE_TIMEOUT =
|
||||
Setting.positiveTimeSetting("discovery.zen.ping.unicast.hosts.resolve_timeout", TimeValue.timeValueSeconds(5), Property.NodeScope);
|
||||
|
||||
public static final Setting<Integer> LEGACY_DISCOVERY_ZEN_PING_UNICAST_CONCURRENT_CONNECTS_SETTING =
|
||||
Setting.intSetting("discovery.zen.ping.unicast.concurrent_connects", 10, 0, Property.NodeScope, Property.Deprecated);
|
||||
public static final Setting<TimeValue> LEGACY_DISCOVERY_ZEN_PING_UNICAST_HOSTS_RESOLVE_TIMEOUT =
|
||||
Setting.positiveTimeSetting("discovery.zen.ping.unicast.hosts.resolve_timeout", TimeValue.timeValueSeconds(5),
|
||||
Property.NodeScope, Property.Deprecated);
|
||||
|
||||
public static final Setting<Integer> DISCOVERY_SEED_RESOLVER_MAX_CONCURRENT_RESOLVERS_SETTING =
|
||||
Setting.intSetting("discovery.seed_resolver.max_concurrent_resolvers", 10, 0, Property.NodeScope);
|
||||
public static final Setting<TimeValue> DISCOVERY_SEED_RESOLVER_TIMEOUT_SETTING =
|
||||
Setting.positiveTimeSetting("discovery.seed_resolver.timeout", TimeValue.timeValueSeconds(5), Property.NodeScope);
|
||||
|
||||
private final ThreadPool threadPool;
|
||||
private final TransportService transportService;
|
||||
@ -132,12 +139,11 @@ public class UnicastZenPing implements ZenPing {
|
||||
this.hostsProvider = unicastHostsProvider;
|
||||
this.contextProvider = contextProvider;
|
||||
|
||||
final int concurrentConnects = DISCOVERY_ZEN_PING_UNICAST_CONCURRENT_CONNECTS_SETTING.get(settings);
|
||||
|
||||
resolveTimeout = DISCOVERY_ZEN_PING_UNICAST_HOSTS_RESOLVE_TIMEOUT.get(settings);
|
||||
final int concurrentConnects = getMaxConcurrentResolvers(settings);
|
||||
resolveTimeout = getResolveTimeout(settings);
|
||||
nodeName = Node.NODE_NAME_SETTING.get(settings);
|
||||
logger.debug(
|
||||
"using concurrent_connects [{}], resolve_timeout [{}]",
|
||||
"using max_concurrent_resolvers [{}], resolver timeout [{}]",
|
||||
concurrentConnects,
|
||||
resolveTimeout);
|
||||
|
||||
@ -663,4 +669,28 @@ public class UnicastZenPing implements ZenPing {
|
||||
protected Version getVersion() {
|
||||
return Version.CURRENT; // for tests
|
||||
}
|
||||
|
||||
public static int getMaxConcurrentResolvers(Settings settings) {
|
||||
if (LEGACY_DISCOVERY_ZEN_PING_UNICAST_CONCURRENT_CONNECTS_SETTING.exists(settings)) {
|
||||
if (DISCOVERY_SEED_RESOLVER_MAX_CONCURRENT_RESOLVERS_SETTING.exists(settings)) {
|
||||
throw new IllegalArgumentException("it is forbidden to set both ["
|
||||
+ DISCOVERY_SEED_RESOLVER_MAX_CONCURRENT_RESOLVERS_SETTING.getKey() + "] and ["
|
||||
+ LEGACY_DISCOVERY_ZEN_PING_UNICAST_CONCURRENT_CONNECTS_SETTING.getKey() + "]");
|
||||
}
|
||||
return LEGACY_DISCOVERY_ZEN_PING_UNICAST_CONCURRENT_CONNECTS_SETTING.get(settings);
|
||||
}
|
||||
return DISCOVERY_SEED_RESOLVER_MAX_CONCURRENT_RESOLVERS_SETTING.get(settings);
|
||||
}
|
||||
|
||||
public static TimeValue getResolveTimeout(Settings settings) {
|
||||
if (LEGACY_DISCOVERY_ZEN_PING_UNICAST_HOSTS_RESOLVE_TIMEOUT.exists(settings)) {
|
||||
if (DISCOVERY_SEED_RESOLVER_TIMEOUT_SETTING.exists(settings)) {
|
||||
throw new IllegalArgumentException("it is forbidden to set both ["
|
||||
+ DISCOVERY_SEED_RESOLVER_TIMEOUT_SETTING.getKey() + "] and ["
|
||||
+ LEGACY_DISCOVERY_ZEN_PING_UNICAST_HOSTS_RESOLVE_TIMEOUT.getKey() + "]");
|
||||
}
|
||||
return LEGACY_DISCOVERY_ZEN_PING_UNICAST_HOSTS_RESOLVE_TIMEOUT.get(settings);
|
||||
}
|
||||
return DISCOVERY_SEED_RESOLVER_TIMEOUT_SETTING.get(settings);
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ public interface DiscoveryPlugin {
|
||||
* Returns providers of unicast host lists for zen discovery.
|
||||
*
|
||||
* The key of the returned map is the name of the host provider
|
||||
* (see {@link org.elasticsearch.discovery.DiscoveryModule#DISCOVERY_HOSTS_PROVIDER_SETTING}), and
|
||||
* (see {@link org.elasticsearch.discovery.DiscoveryModule#DISCOVERY_SEED_PROVIDERS_SETTING}), and
|
||||
* the value is a supplier to construct the host provider when it is selected for use.
|
||||
*
|
||||
* @param transportService Use to form the {@link org.elasticsearch.common.transport.TransportAddress} portion
|
||||
|
@ -718,7 +718,7 @@ public class BootstrapChecksTests extends AbstractBootstrapCheckTestCase {
|
||||
final NodeValidationException e = expectThrows(NodeValidationException.class,
|
||||
() -> BootstrapChecks.check(zen2Context, true, checks));
|
||||
assertThat(e, hasToString(containsString("the default discovery settings are unsuitable for production use; at least one " +
|
||||
"of [discovery.zen.ping.unicast.hosts, discovery.zen.hosts_provider, cluster.initial_master_nodes] must be configured")));
|
||||
"of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured")));
|
||||
|
||||
CheckedConsumer<Settings.Builder, NodeValidationException> ensureChecksPass = b ->
|
||||
{
|
||||
@ -727,8 +727,11 @@ public class BootstrapChecksTests extends AbstractBootstrapCheckTestCase {
|
||||
BootstrapChecks.check(context, true, checks);
|
||||
};
|
||||
|
||||
ensureChecksPass.accept(Settings.builder().putList(DiscoveryModule.DISCOVERY_HOSTS_PROVIDER_SETTING.getKey()));
|
||||
ensureChecksPass.accept(Settings.builder().putList(SettingsBasedHostsProvider.DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING.getKey()));
|
||||
ensureChecksPass.accept(Settings.builder().putList(ClusterBootstrapService.INITIAL_MASTER_NODES_SETTING.getKey()));
|
||||
ensureChecksPass.accept(Settings.builder().putList(DiscoveryModule.DISCOVERY_SEED_PROVIDERS_SETTING.getKey()));
|
||||
ensureChecksPass.accept(Settings.builder().putList(SettingsBasedHostsProvider.DISCOVERY_SEED_HOSTS_SETTING.getKey()));
|
||||
ensureChecksPass.accept(Settings.builder().putList(DiscoveryModule.LEGACY_DISCOVERY_HOSTS_PROVIDER_SETTING.getKey()));
|
||||
ensureChecksPass.accept(Settings.builder().putList(SettingsBasedHostsProvider.LEGACY_DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING
|
||||
.getKey()));
|
||||
}
|
||||
}
|
||||
|
@ -48,8 +48,8 @@ import static org.elasticsearch.cluster.coordination.ClusterBootstrapService.BOO
|
||||
import static org.elasticsearch.cluster.coordination.ClusterBootstrapService.INITIAL_MASTER_NODES_SETTING;
|
||||
import static org.elasticsearch.cluster.coordination.ClusterBootstrapService.UNCONFIGURED_BOOTSTRAP_TIMEOUT_SETTING;
|
||||
import static org.elasticsearch.common.settings.Settings.builder;
|
||||
import static org.elasticsearch.discovery.DiscoveryModule.DISCOVERY_HOSTS_PROVIDER_SETTING;
|
||||
import static org.elasticsearch.discovery.zen.SettingsBasedHostsProvider.DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING;
|
||||
import static org.elasticsearch.discovery.DiscoveryModule.DISCOVERY_SEED_PROVIDERS_SETTING;
|
||||
import static org.elasticsearch.discovery.zen.SettingsBasedHostsProvider.DISCOVERY_SEED_HOSTS_SETTING;
|
||||
import static org.elasticsearch.node.Node.NODE_NAME_SETTING;
|
||||
import static org.hamcrest.Matchers.allOf;
|
||||
import static org.hamcrest.Matchers.containsInAnyOrder;
|
||||
@ -125,11 +125,11 @@ public class ClusterBootstrapServiceTests extends ESTestCase {
|
||||
}
|
||||
|
||||
public void testDoesNothingByDefaultIfHostsProviderConfigured() {
|
||||
testDoesNothingWithSettings(builder().putList(DISCOVERY_HOSTS_PROVIDER_SETTING.getKey()));
|
||||
testDoesNothingWithSettings(builder().putList(DISCOVERY_SEED_PROVIDERS_SETTING.getKey()));
|
||||
}
|
||||
|
||||
public void testDoesNothingByDefaultIfUnicastHostsConfigured() {
|
||||
testDoesNothingWithSettings(builder().putList(DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING.getKey()));
|
||||
testDoesNothingWithSettings(builder().putList(DISCOVERY_SEED_HOSTS_SETTING.getKey()));
|
||||
}
|
||||
|
||||
public void testDoesNothingByDefaultIfMasterNodesConfigured() {
|
||||
|
@ -143,7 +143,7 @@ public class DiscoveryModuleTests extends ESTestCase {
|
||||
}
|
||||
|
||||
public void testHostsProvider() {
|
||||
Settings settings = Settings.builder().put(DiscoveryModule.DISCOVERY_HOSTS_PROVIDER_SETTING.getKey(), "custom").build();
|
||||
Settings settings = Settings.builder().put(DiscoveryModule.DISCOVERY_SEED_PROVIDERS_SETTING.getKey(), "custom").build();
|
||||
AtomicBoolean created = new AtomicBoolean(false);
|
||||
DummyHostsProviderPlugin plugin = () -> Collections.singletonMap("custom", () -> {
|
||||
created.set(true);
|
||||
@ -153,11 +153,32 @@ public class DiscoveryModuleTests extends ESTestCase {
|
||||
assertTrue(created.get());
|
||||
}
|
||||
|
||||
public void testUnknownHostsProvider() {
|
||||
Settings settings = Settings.builder().put(DiscoveryModule.DISCOVERY_HOSTS_PROVIDER_SETTING.getKey(), "dne").build();
|
||||
public void testLegacyHostsProvider() {
|
||||
Settings settings = Settings.builder().put(DiscoveryModule.LEGACY_DISCOVERY_HOSTS_PROVIDER_SETTING.getKey(), "custom").build();
|
||||
AtomicBoolean created = new AtomicBoolean(false);
|
||||
DummyHostsProviderPlugin plugin = () -> Collections.singletonMap("custom", () -> {
|
||||
created.set(true);
|
||||
return hostsResolver -> Collections.emptyList();
|
||||
});
|
||||
newModule(settings, Collections.singletonList(plugin));
|
||||
assertTrue(created.get());
|
||||
assertWarnings("[discovery.zen.hosts_provider] setting was deprecated in Elasticsearch and will be removed in a future release! " +
|
||||
"See the breaking changes documentation for the next major version.");
|
||||
}
|
||||
|
||||
public void testLegacyAndNonLegacyProvidersRejected() {
|
||||
Settings settings = Settings.builder().putList(DiscoveryModule.DISCOVERY_SEED_PROVIDERS_SETTING.getKey())
|
||||
.putList(DiscoveryModule.LEGACY_DISCOVERY_HOSTS_PROVIDER_SETTING.getKey()).build();
|
||||
IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () ->
|
||||
newModule(settings, Collections.emptyList()));
|
||||
assertEquals("Unknown zen hosts providers [dne]", e.getMessage());
|
||||
assertEquals("it is forbidden to set both [discovery.seed_providers] and [discovery.zen.hosts_provider]", e.getMessage());
|
||||
}
|
||||
|
||||
public void testUnknownHostsProvider() {
|
||||
Settings settings = Settings.builder().put(DiscoveryModule.DISCOVERY_SEED_PROVIDERS_SETTING.getKey(), "dne").build();
|
||||
IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () ->
|
||||
newModule(settings, Collections.emptyList()));
|
||||
assertEquals("Unknown seed providers [dne]", e.getMessage());
|
||||
}
|
||||
|
||||
public void testDuplicateHostsProvider() {
|
||||
@ -165,14 +186,14 @@ public class DiscoveryModuleTests extends ESTestCase {
|
||||
DummyHostsProviderPlugin plugin2 = () -> Collections.singletonMap("dup", () -> null);
|
||||
IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () ->
|
||||
newModule(Settings.EMPTY, Arrays.asList(plugin1, plugin2)));
|
||||
assertEquals("Cannot register zen hosts provider [dup] twice", e.getMessage());
|
||||
assertEquals("Cannot register seed provider [dup] twice", e.getMessage());
|
||||
}
|
||||
|
||||
public void testSettingsHostsProvider() {
|
||||
DummyHostsProviderPlugin plugin = () -> Collections.singletonMap("settings", () -> null);
|
||||
IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () ->
|
||||
newModule(Settings.EMPTY, Arrays.asList(plugin)));
|
||||
assertEquals("Cannot register zen hosts provider [settings] twice", e.getMessage());
|
||||
assertEquals("Cannot register seed provider [settings] twice", e.getMessage());
|
||||
}
|
||||
|
||||
public void testMultiHostsProvider() {
|
||||
@ -191,7 +212,7 @@ public class DiscoveryModuleTests extends ESTestCase {
|
||||
created3.set(true);
|
||||
return hostsResolver -> Collections.emptyList();
|
||||
});
|
||||
Settings settings = Settings.builder().putList(DiscoveryModule.DISCOVERY_HOSTS_PROVIDER_SETTING.getKey(),
|
||||
Settings settings = Settings.builder().putList(DiscoveryModule.DISCOVERY_SEED_PROVIDERS_SETTING.getKey(),
|
||||
"provider1", "provider3").build();
|
||||
newModule(settings, Arrays.asList(plugin1, plugin2, plugin3));
|
||||
assertTrue(created1.get());
|
||||
|
@ -24,8 +24,8 @@ import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ESIntegTestCase;
|
||||
|
||||
import static org.elasticsearch.discovery.DiscoveryModule.DISCOVERY_HOSTS_PROVIDER_SETTING;
|
||||
import static org.elasticsearch.discovery.zen.SettingsBasedHostsProvider.DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING;
|
||||
import static org.elasticsearch.discovery.DiscoveryModule.DISCOVERY_SEED_PROVIDERS_SETTING;
|
||||
import static org.elasticsearch.discovery.zen.SettingsBasedHostsProvider.DISCOVERY_SEED_HOSTS_SETTING;
|
||||
|
||||
@ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.TEST, numDataNodes = 0, numClientNodes = 0)
|
||||
public class SettingsBasedHostsProviderIT extends ESIntegTestCase {
|
||||
@ -36,13 +36,13 @@ public class SettingsBasedHostsProviderIT extends ESIntegTestCase {
|
||||
|
||||
// super.nodeSettings enables file-based discovery, but here we disable it again so we can test the static list:
|
||||
if (randomBoolean()) {
|
||||
builder.putList(DISCOVERY_HOSTS_PROVIDER_SETTING.getKey());
|
||||
builder.putList(DISCOVERY_SEED_PROVIDERS_SETTING.getKey());
|
||||
} else {
|
||||
builder.remove(DISCOVERY_HOSTS_PROVIDER_SETTING.getKey());
|
||||
builder.remove(DISCOVERY_SEED_PROVIDERS_SETTING.getKey());
|
||||
}
|
||||
|
||||
// super.nodeSettings sets this to an empty list, which disables any search for other nodes, but here we want this to happen:
|
||||
builder.remove(DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING.getKey());
|
||||
builder.remove(DISCOVERY_SEED_HOSTS_SETTING.getKey());
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
@ -56,7 +56,7 @@ public class SettingsBasedHostsProviderIT extends ESIntegTestCase {
|
||||
|
||||
int extraNodes = randomIntBetween(1, 5);
|
||||
internalCluster().startNodes(extraNodes,
|
||||
Settings.builder().putList(DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING.getKey(), seedNodeAddress).build());
|
||||
Settings.builder().putList(DISCOVERY_SEED_HOSTS_SETTING.getKey(), seedNodeAddress).build());
|
||||
|
||||
ensureStableCluster(extraNodes + 1);
|
||||
}
|
||||
|
@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.elasticsearch.discovery.zen;
|
||||
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.transport.TransportAddress;
|
||||
import org.elasticsearch.common.util.set.Sets;
|
||||
import org.elasticsearch.discovery.zen.UnicastHostsProvider.HostsResolver;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static java.util.Collections.emptyList;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
public class SettingsBasedHostsProviderTests extends ESTestCase {
|
||||
|
||||
private class AssertingHostsResolver implements HostsResolver {
|
||||
private final Set<String> expectedHosts;
|
||||
private final int expectedPortCount;
|
||||
|
||||
private boolean resolvedHosts;
|
||||
|
||||
AssertingHostsResolver(int expectedPortCount, String... expectedHosts) {
|
||||
this.expectedPortCount = expectedPortCount;
|
||||
this.expectedHosts = Sets.newHashSet(expectedHosts);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TransportAddress> resolveHosts(List<String> hosts, int limitPortCounts) {
|
||||
assertEquals(expectedPortCount, limitPortCounts);
|
||||
assertEquals(expectedHosts, Sets.newHashSet(hosts));
|
||||
resolvedHosts = true;
|
||||
return emptyList();
|
||||
}
|
||||
|
||||
boolean getResolvedHosts() {
|
||||
return resolvedHosts;
|
||||
}
|
||||
}
|
||||
|
||||
public void testScansPortsByDefault() {
|
||||
final AssertingHostsResolver hostsResolver = new AssertingHostsResolver(5, "::1", "127.0.0.1");
|
||||
final TransportService transportService = mock(TransportService.class);
|
||||
when(transportService.getLocalAddresses()).thenReturn(Arrays.asList("::1", "127.0.0.1"));
|
||||
new SettingsBasedHostsProvider(Settings.EMPTY, transportService).buildDynamicHosts(hostsResolver);
|
||||
assertTrue(hostsResolver.getResolvedHosts());
|
||||
}
|
||||
|
||||
public void testGetsHostsFromSetting() {
|
||||
final AssertingHostsResolver hostsResolver = new AssertingHostsResolver(1, "bar", "foo");
|
||||
new SettingsBasedHostsProvider(Settings.builder()
|
||||
.putList(SettingsBasedHostsProvider.DISCOVERY_SEED_HOSTS_SETTING.getKey(), "foo", "bar")
|
||||
.build(), null).buildDynamicHosts(hostsResolver);
|
||||
assertTrue(hostsResolver.getResolvedHosts());
|
||||
}
|
||||
|
||||
public void testGetsHostsFromLegacySetting() {
|
||||
final AssertingHostsResolver hostsResolver = new AssertingHostsResolver(1, "bar", "foo");
|
||||
new SettingsBasedHostsProvider(Settings.builder()
|
||||
.putList(SettingsBasedHostsProvider.LEGACY_DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING.getKey(), "foo", "bar")
|
||||
.build(), null).buildDynamicHosts(hostsResolver);
|
||||
assertTrue(hostsResolver.getResolvedHosts());
|
||||
assertWarnings("[discovery.zen.ping.unicast.hosts] setting was deprecated in Elasticsearch and will be removed in a future " +
|
||||
"release! See the breaking changes documentation for the next major version.");
|
||||
}
|
||||
|
||||
public void testForbidsBothSettingsAtTheSameTime() {
|
||||
expectThrows(IllegalArgumentException.class, () -> new SettingsBasedHostsProvider(Settings.builder()
|
||||
.putList(SettingsBasedHostsProvider.LEGACY_DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING.getKey())
|
||||
.putList(SettingsBasedHostsProvider.DISCOVERY_SEED_HOSTS_SETTING.getKey())
|
||||
.build(), null));
|
||||
}
|
||||
}
|
@ -90,6 +90,7 @@ import java.util.stream.IntStream;
|
||||
|
||||
import static java.util.Collections.emptyMap;
|
||||
import static java.util.Collections.emptySet;
|
||||
import static org.elasticsearch.discovery.zen.SettingsBasedHostsProvider.DISCOVERY_SEED_HOSTS_SETTING;
|
||||
import static org.elasticsearch.gateway.GatewayService.STATE_NOT_RECOVERED_BLOCK;
|
||||
import static org.hamcrest.Matchers.empty;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
@ -172,7 +173,7 @@ public class UnicastZenPingTests extends ESTestCase {
|
||||
final ClusterState stateMismatch = ClusterState.builder(new ClusterName("mismatch")).version(randomNonNegativeLong()).build();
|
||||
|
||||
final Settings hostsSettings = Settings.builder()
|
||||
.putList("discovery.zen.ping.unicast.hosts",
|
||||
.putList(DISCOVERY_SEED_HOSTS_SETTING.getKey(),
|
||||
NetworkAddress.format(new InetSocketAddress(handleA.address.address().getAddress(), handleA.address.address().getPort())),
|
||||
NetworkAddress.format(new InetSocketAddress(handleB.address.address().getAddress(), handleB.address.address().getPort())),
|
||||
NetworkAddress.format(new InetSocketAddress(handleC.address.address().getAddress(), handleC.address.address().getPort())),
|
||||
@ -306,7 +307,7 @@ public class UnicastZenPingTests extends ESTestCase {
|
||||
new InetSocketAddress(handleC.address.address().getAddress(), handleC.address.address().getPort()))});
|
||||
|
||||
final Settings hostsSettings = Settings.builder()
|
||||
.putList("discovery.zen.ping.unicast.hosts", "UZP_A", "UZP_B", "UZP_C")
|
||||
.putList(DISCOVERY_SEED_HOSTS_SETTING.getKey(), "UZP_A", "UZP_B", "UZP_C")
|
||||
.put("cluster.name", "test")
|
||||
.build();
|
||||
|
||||
@ -590,11 +591,11 @@ public class UnicastZenPingTests extends ESTestCase {
|
||||
final boolean useHosts = randomBoolean();
|
||||
final Settings.Builder hostsSettingsBuilder = Settings.builder().put("cluster.name", "test");
|
||||
if (useHosts) {
|
||||
hostsSettingsBuilder.putList("discovery.zen.ping.unicast.hosts",
|
||||
hostsSettingsBuilder.putList(DISCOVERY_SEED_HOSTS_SETTING.getKey(),
|
||||
NetworkAddress.format(new InetSocketAddress(handleB.address.address().getAddress(), handleB.address.address().getPort()))
|
||||
);
|
||||
} else {
|
||||
hostsSettingsBuilder.put("discovery.zen.ping.unicast.hosts", (String) null);
|
||||
hostsSettingsBuilder.put(DISCOVERY_SEED_HOSTS_SETTING.getKey(), (String) null);
|
||||
}
|
||||
final Settings hostsSettings = hostsSettingsBuilder.build();
|
||||
|
||||
@ -655,7 +656,7 @@ public class UnicastZenPingTests extends ESTestCase {
|
||||
|
||||
final Settings hostsSettings = Settings.builder()
|
||||
.put("cluster.name", "test")
|
||||
.put("discovery.zen.ping.unicast.hosts", (String) null) // use nodes for simplicity
|
||||
.put(DISCOVERY_SEED_HOSTS_SETTING.getKey(), (String) null) // use nodes for simplicity
|
||||
.build();
|
||||
|
||||
final ClusterState state = ClusterState.builder(new ClusterName("test")).version(randomNonNegativeLong()).build();
|
||||
|
@ -195,8 +195,8 @@ import static org.elasticsearch.client.Requests.syncedFlushRequest;
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS;
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS;
|
||||
import static org.elasticsearch.common.util.CollectionUtils.eagerPartition;
|
||||
import static org.elasticsearch.discovery.DiscoveryModule.DISCOVERY_HOSTS_PROVIDER_SETTING;
|
||||
import static org.elasticsearch.discovery.zen.SettingsBasedHostsProvider.DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING;
|
||||
import static org.elasticsearch.discovery.DiscoveryModule.DISCOVERY_SEED_PROVIDERS_SETTING;
|
||||
import static org.elasticsearch.discovery.zen.SettingsBasedHostsProvider.DISCOVERY_SEED_HOSTS_SETTING;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||
import static org.elasticsearch.test.XContentTestUtils.convertToMap;
|
||||
import static org.elasticsearch.test.XContentTestUtils.differenceBetweenMapsIgnoringArrayOrder;
|
||||
@ -1816,8 +1816,8 @@ public abstract class ESIntegTestCase extends ESTestCase {
|
||||
.put(IndicesStore.INDICES_STORE_DELETE_SHARD_TIMEOUT.getKey(), new TimeValue(1, TimeUnit.SECONDS))
|
||||
// randomly enable low-level search cancellation to make sure it does not alter results
|
||||
.put(SearchService.LOW_LEVEL_CANCELLATION_SETTING.getKey(), randomBoolean())
|
||||
.putList(DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING.getKey()) // empty list disables a port scan for other nodes
|
||||
.putList(DISCOVERY_HOSTS_PROVIDER_SETTING.getKey(), "file");
|
||||
.putList(DISCOVERY_SEED_HOSTS_SETTING.getKey()) // empty list disables a port scan for other nodes
|
||||
.putList(DISCOVERY_SEED_PROVIDERS_SETTING.getKey(), "file");
|
||||
if (rarely()) {
|
||||
// Sometimes adjust the minimum search thread pool size, causing
|
||||
// QueueResizingEsThreadPoolExecutor to be used instead of a regular
|
||||
|
@ -63,7 +63,7 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
import static org.elasticsearch.cluster.coordination.ClusterBootstrapService.INITIAL_MASTER_NODES_SETTING;
|
||||
import static org.elasticsearch.discovery.zen.SettingsBasedHostsProvider.DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING;
|
||||
import static org.elasticsearch.discovery.zen.SettingsBasedHostsProvider.DISCOVERY_SEED_HOSTS_SETTING;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.lessThanOrEqualTo;
|
||||
@ -202,7 +202,7 @@ public abstract class ESSingleNodeTestCase extends ESTestCase {
|
||||
// turning on the real memory circuit breaker leads to spurious test failures. As have no full control over heap usage, we
|
||||
// turn it off for these tests.
|
||||
.put(HierarchyCircuitBreakerService.USE_REAL_MEMORY_USAGE_SETTING.getKey(), false)
|
||||
.putList(DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING.getKey()) // empty list disables a port scan for other nodes
|
||||
.putList(DISCOVERY_SEED_HOSTS_SETTING.getKey()) // empty list disables a port scan for other nodes
|
||||
.putList(INITIAL_MASTER_NODES_SETTING.getKey(), nodeName)
|
||||
.put(nodeSettings()) // allow test cases to provide their own settings or override these
|
||||
.build();
|
||||
|
@ -47,7 +47,7 @@ import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static org.elasticsearch.discovery.zen.SettingsBasedHostsProvider.DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING;
|
||||
import static org.elasticsearch.discovery.zen.SettingsBasedHostsProvider.DISCOVERY_SEED_HOSTS_SETTING;
|
||||
|
||||
/**
|
||||
* A alternative zen discovery which allows using mocks for things like pings, as well as
|
||||
@ -76,7 +76,7 @@ public class TestZenDiscovery extends ZenDiscovery {
|
||||
ClusterSettings clusterSettings, UnicastHostsProvider hostsProvider,
|
||||
AllocationService allocationService, GatewayMetaState gatewayMetaState) {
|
||||
// we don't get the latest setting which were updated by the extra settings for the plugin. TODO: fix.
|
||||
Settings fixedSettings = Settings.builder().put(settings).putList(DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING.getKey()).build();
|
||||
Settings fixedSettings = Settings.builder().put(settings).putList(DISCOVERY_SEED_HOSTS_SETTING.getKey()).build();
|
||||
return Collections.singletonMap("test-zen", () -> {
|
||||
if (USE_ZEN2.get(settings)) {
|
||||
return new Coordinator("test_node", fixedSettings, clusterSettings, transportService, namedWriteableRegistry,
|
||||
@ -99,7 +99,7 @@ public class TestZenDiscovery extends ZenDiscovery {
|
||||
public Settings additionalSettings() {
|
||||
return Settings.builder()
|
||||
.put(DiscoveryModule.DISCOVERY_TYPE_SETTING.getKey(), TEST_ZEN_DISCOVERY_TYPE)
|
||||
.putList(DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING.getKey())
|
||||
.putList(DISCOVERY_SEED_HOSTS_SETTING.getKey())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ import java.util.stream.Collectors;
|
||||
import static org.elasticsearch.cluster.node.DiscoveryNode.Role.DATA;
|
||||
import static org.elasticsearch.cluster.node.DiscoveryNode.Role.INGEST;
|
||||
import static org.elasticsearch.cluster.node.DiscoveryNode.Role.MASTER;
|
||||
import static org.elasticsearch.discovery.DiscoveryModule.DISCOVERY_HOSTS_PROVIDER_SETTING;
|
||||
import static org.elasticsearch.discovery.DiscoveryModule.DISCOVERY_SEED_PROVIDERS_SETTING;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertFileExists;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertFileNotExists;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
@ -162,8 +162,8 @@ public class InternalTestClusterTests extends ESTestCase {
|
||||
.put(
|
||||
NodeEnvironment.MAX_LOCAL_STORAGE_NODES_SETTING.getKey(),
|
||||
2 * ((masterNodes ? InternalTestCluster.DEFAULT_HIGH_NUM_MASTER_NODES : 0) + maxNumDataNodes + numClientNodes))
|
||||
.put(DiscoveryModule.DISCOVERY_HOSTS_PROVIDER_SETTING.getKey(), "file")
|
||||
.putList(SettingsBasedHostsProvider.DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING.getKey())
|
||||
.put(DiscoveryModule.DISCOVERY_SEED_PROVIDERS_SETTING.getKey(), "file")
|
||||
.putList(SettingsBasedHostsProvider.DISCOVERY_SEED_HOSTS_SETTING.getKey())
|
||||
.put(NetworkModule.TRANSPORT_TYPE_KEY, getTestTransportType());
|
||||
if (autoManageMinMasterNodes == false) {
|
||||
assert minNumDataNodes == maxNumDataNodes;
|
||||
@ -239,8 +239,8 @@ public class InternalTestClusterTests extends ESTestCase {
|
||||
NodeEnvironment.MAX_LOCAL_STORAGE_NODES_SETTING.getKey(),
|
||||
2 + (masterNodes ? InternalTestCluster.DEFAULT_HIGH_NUM_MASTER_NODES : 0) + maxNumDataNodes + numClientNodes)
|
||||
.put(NetworkModule.TRANSPORT_TYPE_KEY, getTestTransportType())
|
||||
.putList(DISCOVERY_HOSTS_PROVIDER_SETTING.getKey(), "file")
|
||||
.putList(SettingsBasedHostsProvider.DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING.getKey())
|
||||
.putList(DISCOVERY_SEED_PROVIDERS_SETTING.getKey(), "file")
|
||||
.putList(SettingsBasedHostsProvider.DISCOVERY_SEED_HOSTS_SETTING.getKey())
|
||||
.build();
|
||||
}
|
||||
|
||||
@ -337,8 +337,8 @@ public class InternalTestClusterTests extends ESTestCase {
|
||||
.put(NodeEnvironment.MAX_LOCAL_STORAGE_NODES_SETTING.getKey(), numNodes)
|
||||
.put(NetworkModule.TRANSPORT_TYPE_KEY, getTestTransportType())
|
||||
.put(DiscoverySettings.INITIAL_STATE_TIMEOUT_SETTING.getKey(), 0)
|
||||
.putList(DISCOVERY_HOSTS_PROVIDER_SETTING.getKey(), "file")
|
||||
.putList(SettingsBasedHostsProvider.DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING.getKey())
|
||||
.putList(DISCOVERY_SEED_PROVIDERS_SETTING.getKey(), "file")
|
||||
.putList(SettingsBasedHostsProvider.DISCOVERY_SEED_HOSTS_SETTING.getKey())
|
||||
.build();
|
||||
}
|
||||
|
||||
@ -420,8 +420,8 @@ public class InternalTestClusterTests extends ESTestCase {
|
||||
return Settings.builder()
|
||||
.put(NodeEnvironment.MAX_LOCAL_STORAGE_NODES_SETTING.getKey(), 2)
|
||||
.put(NetworkModule.TRANSPORT_TYPE_KEY, getTestTransportType())
|
||||
.putList(DISCOVERY_HOSTS_PROVIDER_SETTING.getKey(), "file")
|
||||
.putList(SettingsBasedHostsProvider.DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING.getKey())
|
||||
.putList(DISCOVERY_SEED_PROVIDERS_SETTING.getKey(), "file")
|
||||
.putList(SettingsBasedHostsProvider.DISCOVERY_SEED_HOSTS_SETTING.getKey())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
@ -98,8 +98,8 @@ import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.elasticsearch.discovery.DiscoveryModule.DISCOVERY_HOSTS_PROVIDER_SETTING;
|
||||
import static org.elasticsearch.discovery.zen.SettingsBasedHostsProvider.DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING;
|
||||
import static org.elasticsearch.discovery.DiscoveryModule.DISCOVERY_SEED_PROVIDERS_SETTING;
|
||||
import static org.elasticsearch.discovery.zen.SettingsBasedHostsProvider.DISCOVERY_SEED_HOSTS_SETTING;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||
import static org.hamcrest.Matchers.empty;
|
||||
@ -194,8 +194,8 @@ public abstract class CcrIntegTestCase extends ESTestCase {
|
||||
builder.put(ScriptService.SCRIPT_MAX_COMPILATIONS_RATE.getKey(), "2048/1m");
|
||||
// wait short time for other active shards before actually deleting, default 30s not needed in tests
|
||||
builder.put(IndicesStore.INDICES_STORE_DELETE_SHARD_TIMEOUT.getKey(), new TimeValue(1, TimeUnit.SECONDS));
|
||||
builder.putList(DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING.getKey()); // empty list disables a port scan for other nodes
|
||||
builder.putList(DISCOVERY_HOSTS_PROVIDER_SETTING.getKey(), "file");
|
||||
builder.putList(DISCOVERY_SEED_HOSTS_SETTING.getKey()); // empty list disables a port scan for other nodes
|
||||
builder.putList(DISCOVERY_SEED_PROVIDERS_SETTING.getKey(), "file");
|
||||
builder.put(NetworkModule.TRANSPORT_TYPE_KEY, getTestTransportType());
|
||||
builder.put(XPackSettings.SECURITY_ENABLED.getKey(), false);
|
||||
builder.put(XPackSettings.MONITORING_ENABLED.getKey(), false);
|
||||
|
@ -59,7 +59,7 @@ import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.elasticsearch.discovery.zen.SettingsBasedHostsProvider.DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING;
|
||||
import static org.elasticsearch.discovery.zen.SettingsBasedHostsProvider.DISCOVERY_SEED_HOSTS_SETTING;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
||||
@ -300,8 +300,8 @@ public class LicensingTests extends SecurityIntegTestCase {
|
||||
.put(TestZenDiscovery.USE_MOCK_PINGS.getKey(), false)
|
||||
.put(DiscoveryModule.DISCOVERY_TYPE_SETTING.getKey(), "test-zen")
|
||||
.put(TestZenDiscovery.USE_ZEN2.getKey(), getUseZen2())
|
||||
.putList(DiscoveryModule.DISCOVERY_HOSTS_PROVIDER_SETTING.getKey())
|
||||
.putList(DISCOVERY_ZEN_PING_UNICAST_HOSTS_SETTING.getKey(), unicastHostsList);
|
||||
.putList(DiscoveryModule.DISCOVERY_SEED_PROVIDERS_SETTING.getKey())
|
||||
.putList(DISCOVERY_SEED_HOSTS_SETTING.getKey(), unicastHostsList);
|
||||
if (getUseZen2() == false) {
|
||||
nodeSettings.put(ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.getKey(),
|
||||
ElectMasterService.DISCOVERY_ZEN_MINIMUM_MASTER_NODES_SETTING.get(internalCluster().getInstance(Settings.class)));
|
||||
|
@ -44,6 +44,7 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
import static org.elasticsearch.discovery.zen.SettingsBasedHostsProvider.DISCOVERY_SEED_HOSTS_SETTING;
|
||||
import static org.elasticsearch.test.SecuritySettingsSource.addSSLSettingsForNodePEMFiles;
|
||||
import static org.elasticsearch.test.SecuritySettingsSource.addSSLSettingsForPEMFiles;
|
||||
import static org.elasticsearch.xpack.security.test.SecurityTestUtils.writeFile;
|
||||
@ -101,7 +102,7 @@ public class ServerTransportFilterIntegrationTests extends SecurityIntegTestCase
|
||||
.put("node.name", "my-test-node")
|
||||
.put("network.host", "localhost")
|
||||
.put("cluster.name", internalCluster().getClusterName())
|
||||
.put("discovery.zen.ping.unicast.hosts", unicastHost)
|
||||
.put(DISCOVERY_SEED_HOSTS_SETTING.getKey(), unicastHost)
|
||||
.put("xpack.security.enabled", true)
|
||||
.put("xpack.security.audit.enabled", false)
|
||||
.put("xpack.security.transport.ssl.enabled", true)
|
||||
@ -146,7 +147,7 @@ public class ServerTransportFilterIntegrationTests extends SecurityIntegTestCase
|
||||
.put("node.name", "my-test-node")
|
||||
.put(SecurityField.USER_SETTING.getKey(), "test_user:" + SecuritySettingsSourceField.TEST_PASSWORD)
|
||||
.put("cluster.name", internalCluster().getClusterName())
|
||||
.put("discovery.zen.ping.unicast.hosts", unicastHost)
|
||||
.put(DISCOVERY_SEED_HOSTS_SETTING.getKey(), unicastHost)
|
||||
.put("xpack.security.enabled", true)
|
||||
.put("xpack.security.audit.enabled", false)
|
||||
.put("xpack.security.transport.ssl.enabled", true)
|
||||
|
@ -17,6 +17,7 @@ import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.elasticsearch.discovery.zen.SettingsBasedHostsProvider.DISCOVERY_SEED_HOSTS_SETTING;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
|
||||
// TODO delete this test?
|
||||
@ -38,13 +39,13 @@ public class IPHostnameVerificationTests extends SecurityIntegTestCase {
|
||||
|
||||
// The default Unicast test behavior is to use 'localhost' with the port number. For this test we need to use IP
|
||||
List<String> newUnicastAddresses = new ArrayList<>();
|
||||
for (String address : settings.getAsList("discovery.zen.ping.unicast.hosts")) {
|
||||
for (String address : settings.getAsList(DISCOVERY_SEED_HOSTS_SETTING.getKey())) {
|
||||
newUnicastAddresses.add(address.replace("localhost", "127.0.0.1"));
|
||||
}
|
||||
|
||||
Settings.Builder settingsBuilder = Settings.builder()
|
||||
.put(settings)
|
||||
.putList("discovery.zen.ping.unicast.hosts", newUnicastAddresses);
|
||||
.putList(DISCOVERY_SEED_HOSTS_SETTING.getKey(), newUnicastAddresses);
|
||||
|
||||
try {
|
||||
//Use a cert with a CN of "Elasticsearch Test Node" and IPv4+IPv6 ip addresses as SubjectAlternativeNames
|
||||
|
@ -28,6 +28,7 @@ import java.time.Clock;
|
||||
import java.util.Arrays;
|
||||
|
||||
import static java.util.Collections.emptyMap;
|
||||
import static org.elasticsearch.discovery.zen.SettingsBasedHostsProvider.DISCOVERY_SEED_HOSTS_SETTING;
|
||||
import static org.elasticsearch.xpack.watcher.actions.ActionBuilders.indexAction;
|
||||
import static org.elasticsearch.xpack.watcher.input.InputBuilders.httpInput;
|
||||
import static org.elasticsearch.xpack.watcher.input.InputBuilders.searchInput;
|
||||
@ -48,7 +49,7 @@ public class WatcherExecutorServiceBenchmark {
|
||||
.put("cluster.name", "bench")
|
||||
.put("network.host", "localhost")
|
||||
.put("script.disable_dynamic", false)
|
||||
.put("discovery.zen.ping.unicast.hosts", "localhost")
|
||||
.put(DISCOVERY_SEED_HOSTS_SETTING.getKey(), "localhost")
|
||||
.put("http.cors.enabled", true)
|
||||
.put("cluster.routing.allocation.disk.threshold_enabled", false)
|
||||
// .put("recycler.page.limit.heap", "60%")
|
||||
|
@ -248,7 +248,7 @@ cat >> $ESCONFIG/elasticsearch.yml <<- EOF
|
||||
node.name: "node-master"
|
||||
node.master: true
|
||||
node.data: false
|
||||
discovery.zen.ping.unicast.hosts: ["127.0.0.1:9301"]
|
||||
discovery.seed_hosts: ["127.0.0.1:9301"]
|
||||
cluster.initial_master_nodes: ["node-master"]
|
||||
|
||||
xpack.security.transport.ssl.key: $ESCONFIG/certs/node-master/node-master.key
|
||||
@ -335,7 +335,7 @@ cat >> $ESCONFIG/elasticsearch.yml <<- EOF
|
||||
node.name: "node-data"
|
||||
node.master: false
|
||||
node.data: true
|
||||
discovery.zen.ping.unicast.hosts: ["127.0.0.1:9300"]
|
||||
discovery.seed_hosts: ["127.0.0.1:9300"]
|
||||
|
||||
xpack.security.transport.ssl.key: $ESCONFIG/certs/node-data/node-data.key
|
||||
xpack.security.transport.ssl.certificate: $ESCONFIG/certs/node-data/node-data.crt
|
||||
|
Loading…
x
Reference in New Issue
Block a user