瀏覽代碼

Remove last few mentions of Zen discovery (#80410)

We have a few leftover mentions of `zen` discovery, mostly for
historical/BwC reasons, which this commit removes.

Prior to this commit the default value for `discovery.type` was `zen`
but this was not written down anywhere or officially supported: the two
options were to set it to `single-node` or to omit it entirely. This
commit changes the default to `multi-node` and documents this.

Co-authored-by: Adam Locke <adam.locke@elastic.co>
David Turner 3 年之前
父節點
當前提交
8cf4c7b6fb

+ 5 - 26
build-tools/src/main/java/org/elasticsearch/gradle/testclusters/ElasticsearchCluster.java

@@ -329,32 +329,11 @@ public class ElasticsearchCluster implements TestClusterConfiguration, Named {
 
 
             // Can only configure master nodes if we have node names defined
             // Can only configure master nodes if we have node names defined
             if (nodeNames != null) {
             if (nodeNames != null) {
-                if (node.getVersion().onOrAfter("7.0.0")) {
-                    node.defaultConfig.keySet()
-                        .stream()
-                        .filter(name -> name.startsWith("discovery.zen."))
-                        .collect(Collectors.toList())
-                        .forEach(node.defaultConfig::remove);
-                    node.defaultConfig.put("cluster.initial_master_nodes", "[" + nodeNames + "]");
-                    node.defaultConfig.put("discovery.seed_providers", "file");
-                    node.defaultConfig.put("discovery.seed_hosts", "[]");
-                } else {
-                    node.defaultConfig.put("discovery.zen.master_election.wait_for_joins_timeout", "5s");
-                    if (nodes.size() > 1) {
-                        node.defaultConfig.put("discovery.zen.minimum_master_nodes", Integer.toString(nodes.size() / 2 + 1));
-                    }
-                    if (node.getVersion().onOrAfter("6.5.0")) {
-                        node.defaultConfig.put("discovery.zen.hosts_provider", "file");
-                        node.defaultConfig.put("discovery.zen.ping.unicast.hosts", "[]");
-                    } else {
-                        if (firstNode == null) {
-                            node.defaultConfig.put("discovery.zen.ping.unicast.hosts", "[]");
-                        } else {
-                            firstNode.waitForAllConditions();
-                            node.defaultConfig.put("discovery.zen.ping.unicast.hosts", "[\"" + firstNode.getTransportPortURI() + "\"]");
-                        }
-                    }
-                }
+                assert node.getVersion().onOrAfter("7.0.0") : node.getVersion();
+                assert node.defaultConfig.keySet().stream().noneMatch(name -> name.startsWith("discovery.zen."));
+                node.defaultConfig.put("cluster.initial_master_nodes", "[" + nodeNames + "]");
+                node.defaultConfig.put("discovery.seed_providers", "file");
+                node.defaultConfig.put("discovery.seed_hosts", "[]");
             }
             }
             if (firstNode == null) {
             if (firstNode == null) {
                 firstNode = node;
                 firstNode = node;

+ 2 - 0
docs/reference/migration/index.asciidoc

@@ -35,7 +35,9 @@ For more information about {minor-version},
 see the <<release-highlights>> and <<es-release-notes>>.
 see the <<release-highlights>> and <<es-release-notes>>.
 For information about how to upgrade your cluster, see <<setup-upgrade>>.
 For information about how to upgrade your cluster, see <<setup-upgrade>>.
 
 
+* <<migrating-8.1,Migrating to 8.1>>
 * <<migrating-8.0,Migrating to 8.0>>
 * <<migrating-8.0,Migrating to 8.0>>
 
 
 --
 --
+include::migrate_8_1.asciidoc[]
 include::migrate_8_0.asciidoc[]
 include::migrate_8_0.asciidoc[]

+ 69 - 0
docs/reference/migration/migrate_8_1.asciidoc

@@ -0,0 +1,69 @@
+[[migrating-8.1]]
+== Migrating to 8.1
+++++
+<titleabbrev>8.1</titleabbrev>
+++++
+
+This section discusses the changes that you need to be aware of when migrating
+your application to {es} 8.1.
+
+See also <<release-highlights>> and <<es-release-notes>>.
+
+coming[8.1.0]
+
+[discrete]
+[[breaking-changes-8.1]]
+=== Breaking changes
+
+The following changes in {es} 8.1 might affect your applications
+and prevent them from operating normally.
+Before upgrading to 8.0, review these changes and take the described steps
+to mitigate the impact.
+
+NOTE: Breaking changes introduced in minor versions are
+normally limited to security and bug fixes.
+Significant changes in behavior are deprecated in a minor release and
+the old behavior is supported until the next major release.
+To find out if you are using any deprecated functionality,
+enable <<deprecation-logging, deprecation logging>>.
+
+//NOTE: The notable-breaking-changes tagged regions are re-used in the
+//Installation and Upgrade Guide
+
+//tag::notable-breaking-changes[]
+
+// end::notable-breaking-changes[]
+
+[discrete]
+[[deprecated-8.1]]
+=== Deprecations
+
+The following functionality has been deprecated in {es} 8.1
+and will be removed in a future version.
+While this won't have an immediate impact on your applications,
+we strongly encourage you take the described steps to update your code
+after upgrading to 8.1.
+
+NOTE: Significant changes in behavior are deprecated in a minor release and
+the old behavior is supported until the next major release.
+To find out if you are using any deprecated functionality,
+enable <<deprecation-logging, deprecation logging>>.
+
+[discrete]
+[[breaking_8.1_settings_deprecation]]
+==== Settings deprecations
+
+[[deprecate-legacy-discovery-type-setting]]
+.Legacy values for the `discovery.type` setting are deprecated.
+[%collapsible]
+====
+*Details* +
+Legacy values for the `discovery.type` setting are deprecated and will be
+forbidden in a future version.
+
+*Impact* +
+Do not set `discovery.type` to any value except `single-node` or `multi-node`.
+All other values are equivalent to the default discovery type which is
+`multi-node`. Where possible, omit this setting so that {es} uses the default
+discovery type.
+====

+ 6 - 6
docs/reference/modules/discovery/discovery-settings.asciidoc

@@ -34,12 +34,12 @@ setting.
 
 
 `discovery.type`::
 `discovery.type`::
 (<<static-cluster-setting,Static>>)
 (<<static-cluster-setting,Static>>)
-Specifies whether {es} should form a multiple-node cluster. By default, {es}
-discovers other nodes when forming a cluster and allows other nodes to join the
-cluster later. If `discovery.type` is set to `single-node`, {es} forms a
-single-node cluster and suppresses the timeout set by `cluster.publish.timeout`.
-For more information about when you might use this setting, see
-<<single-node-discovery>>.
+Specifies whether {es} should form a multiple-node cluster. Defaults to
+`multi-node`, which means that {es} discovers other nodes when forming a cluster
+and allows other nodes to join the cluster later. If set to `single-node`, {es}
+forms a single-node cluster and suppresses the timeout set by
+`cluster.publish.timeout`. For more information about when you might use this
+setting, see <<single-node-discovery>>.
 
 
 `cluster.initial_master_nodes`::
 `cluster.initial_master_nodes`::
 (<<static-cluster-setting,Static>>)
 (<<static-cluster-setting,Static>>)

+ 5 - 6
docs/reference/setup/bootstrap-checks.asciidoc

@@ -43,12 +43,11 @@ purposes without triggering production mode.
 [[single-node-discovery]]
 [[single-node-discovery]]
 [discrete]
 [discrete]
 === Single-node discovery
 === Single-node discovery
-We recognize that some users need to bind transport to an external interface for
-testing their usage of the transport client. For this situation, we provide the
-discovery type `single-node` (configure it by setting `discovery.type` to
-`single-node`); in this situation, a node will elect itself master and will not
-join a cluster with any other node.
-
+We recognize that some users need to bind the transport to an external
+interface for testing a remote-cluster configuration. For this situation, we
+provide the discovery type `single-node` (configure it by setting
+`discovery.type` to `single-node`); in this situation, a node will elect itself
+master and will not join a cluster with any other node.
 
 
 [discrete]
 [discrete]
 === Forcing the bootstrap checks
 === Forcing the bootstrap checks

+ 1 - 1
qa/os/src/test/java/org/elasticsearch/packaging/test/PackageTests.java

@@ -381,7 +381,7 @@ public class PackageTests extends PackagingTestCase {
 
 
         withCustomConfig(tempConf -> {
         withCustomConfig(tempConf -> {
             // Create a startup problem by adding an invalid YAML line to the config
             // Create a startup problem by adding an invalid YAML line to the config
-            append(tempConf.resolve("elasticsearch.yml"), "discovery.zen.ping.unicast.hosts:15172.30.5.3416172.30.5.35, 172.30.5.17]\n");
+            append(tempConf.resolve("elasticsearch.yml"), "discovery.seed_hosts:15172.30.5.3416172.30.5.35, 172.30.5.17]\n");
 
 
             // Make sure we don't pick up the journal entries for previous ES instances.
             // Make sure we don't pick up the journal entries for previous ES instances.
             Packages.JournaldWrapper journald = new Packages.JournaldWrapper(sh);
             Packages.JournaldWrapper journald = new Packages.JournaldWrapper(sh);

+ 6 - 3
server/src/internalClusterTest/java/org/elasticsearch/discovery/single/SingleNodeDiscoveryIT.java

@@ -31,6 +31,9 @@ import java.nio.file.Path;
 import java.util.Arrays;
 import java.util.Arrays;
 import java.util.function.Function;
 import java.util.function.Function;
 
 
+import static org.elasticsearch.discovery.DiscoveryModule.DISCOVERY_TYPE_SETTING;
+import static org.elasticsearch.discovery.DiscoveryModule.MULTI_NODE_DISCOVERY_TYPE;
+import static org.elasticsearch.discovery.DiscoveryModule.SINGLE_NODE_DISCOVERY_TYPE;
 import static org.hamcrest.Matchers.equalTo;
 import static org.hamcrest.Matchers.equalTo;
 import static org.hamcrest.Matchers.not;
 import static org.hamcrest.Matchers.not;
 
 
@@ -47,7 +50,7 @@ public class SingleNodeDiscoveryIT extends ESIntegTestCase {
     protected Settings nodeSettings(int nodeOrdinal, Settings otherSettings) {
     protected Settings nodeSettings(int nodeOrdinal, Settings otherSettings) {
         return Settings.builder()
         return Settings.builder()
             .put(super.nodeSettings(nodeOrdinal, otherSettings))
             .put(super.nodeSettings(nodeOrdinal, otherSettings))
-            .put("discovery.type", "single-node")
+            .put(DISCOVERY_TYPE_SETTING.getKey(), SINGLE_NODE_DISCOVERY_TYPE)
             .put("transport.port", getPortRange())
             .put("transport.port", getPortRange())
             .build();
             .build();
     }
     }
@@ -59,7 +62,7 @@ public class SingleNodeDiscoveryIT extends ESIntegTestCase {
             @Override
             @Override
             public Settings nodeSettings(int nodeOrdinal, Settings otherSettings) {
             public Settings nodeSettings(int nodeOrdinal, Settings otherSettings) {
                 return Settings.builder()
                 return Settings.builder()
-                    .put("discovery.type", "single-node")
+                    .put(DISCOVERY_TYPE_SETTING.getKey(), SINGLE_NODE_DISCOVERY_TYPE)
                     .put("transport.type", getTestTransportType())
                     .put("transport.type", getTestTransportType())
                     /*
                     /*
                      * We align the port ranges of the two as then with zen discovery these two
                      * We align the port ranges of the two as then with zen discovery these two
@@ -125,7 +128,7 @@ public class SingleNodeDiscoveryIT extends ESIntegTestCase {
             @Override
             @Override
             public Settings nodeSettings(int nodeOrdinal, Settings otherSettings) {
             public Settings nodeSettings(int nodeOrdinal, Settings otherSettings) {
                 return Settings.builder()
                 return Settings.builder()
-                    .put("discovery.type", "zen")
+                    .put(DISCOVERY_TYPE_SETTING.getKey(), MULTI_NODE_DISCOVERY_TYPE)
                     .put("transport.type", getTestTransportType())
                     .put("transport.type", getTestTransportType())
                     .put(Node.INITIAL_STATE_TIMEOUT_SETTING.getKey(), "0s")
                     .put(Node.INITIAL_STATE_TIMEOUT_SETTING.getKey(), "0s")
                     /*
                     /*

+ 3 - 2
server/src/main/java/org/elasticsearch/bootstrap/BootstrapChecks.java

@@ -43,6 +43,7 @@ import java.util.stream.Stream;
 
 
 import static org.elasticsearch.cluster.coordination.ClusterBootstrapService.INITIAL_MASTER_NODES_SETTING;
 import static org.elasticsearch.cluster.coordination.ClusterBootstrapService.INITIAL_MASTER_NODES_SETTING;
 import static org.elasticsearch.discovery.DiscoveryModule.DISCOVERY_SEED_PROVIDERS_SETTING;
 import static org.elasticsearch.discovery.DiscoveryModule.DISCOVERY_SEED_PROVIDERS_SETTING;
+import static org.elasticsearch.discovery.DiscoveryModule.SINGLE_NODE_DISCOVERY_TYPE;
 import static org.elasticsearch.discovery.SettingsBasedSeedHostsProvider.DISCOVERY_SEED_HOSTS_SETTING;
 import static org.elasticsearch.discovery.SettingsBasedSeedHostsProvider.DISCOVERY_SEED_HOSTS_SETTING;
 
 
 /**
 /**
@@ -178,7 +179,7 @@ final class BootstrapChecks {
         final Predicate<TransportAddress> isLoopbackAddress = t -> t.address().getAddress().isLoopbackAddress();
         final Predicate<TransportAddress> isLoopbackAddress = t -> t.address().getAddress().isLoopbackAddress();
         final boolean bound = (Arrays.stream(boundTransportAddress.boundAddresses()).allMatch(isLoopbackAddress)
         final boolean bound = (Arrays.stream(boundTransportAddress.boundAddresses()).allMatch(isLoopbackAddress)
             && isLoopbackAddress.test(boundTransportAddress.publishAddress())) == false;
             && isLoopbackAddress.test(boundTransportAddress.publishAddress())) == false;
-        return bound && "single-node".equals(discoveryType) == false;
+        return bound && SINGLE_NODE_DISCOVERY_TYPE.equals(discoveryType) == false;
     }
     }
 
 
     // the list of checks to execute
     // the list of checks to execute
@@ -742,7 +743,7 @@ final class BootstrapChecks {
     static class DiscoveryConfiguredCheck implements BootstrapCheck {
     static class DiscoveryConfiguredCheck implements BootstrapCheck {
         @Override
         @Override
         public BootstrapCheckResult check(BootstrapContext context) {
         public BootstrapCheckResult check(BootstrapContext context) {
-            if (DiscoveryModule.ZEN2_DISCOVERY_TYPE.equals(DiscoveryModule.DISCOVERY_TYPE_SETTING.get(context.settings())) == false) {
+            if (DiscoveryModule.MULTI_NODE_DISCOVERY_TYPE.equals(DiscoveryModule.DISCOVERY_TYPE_SETTING.get(context.settings())) == false) {
                 return BootstrapCheckResult.success();
                 return BootstrapCheckResult.success();
             }
             }
             if (ClusterBootstrapService.discoveryIsConfigured(context.settings())) {
             if (ClusterBootstrapService.discoveryIsConfigured(context.settings())) {

+ 1 - 1
server/src/main/java/org/elasticsearch/cluster/metadata/Manifest.java

@@ -33,7 +33,7 @@ import java.util.stream.Collectors;
  * Index metadata generation could be obtained by calling {@link #getIndexGenerations()}.
  * Index metadata generation could be obtained by calling {@link #getIndexGenerations()}.
  */
  */
 public class Manifest implements ToXContentFragment {
 public class Manifest implements ToXContentFragment {
-    // TODO revisit missing and unknown constants once Zen2 BWC is ready
+
     private static final long MISSING_GLOBAL_GENERATION = -1L;
     private static final long MISSING_GLOBAL_GENERATION = -1L;
     private static final long MISSING_CURRENT_TERM = 0L;
     private static final long MISSING_CURRENT_TERM = 0L;
     private static final long UNKNOWN_CURRENT_TERM = MISSING_CURRENT_TERM;
     private static final long UNKNOWN_CURRENT_TERM = MISSING_CURRENT_TERM;

+ 25 - 4
server/src/main/java/org/elasticsearch/discovery/DiscoveryModule.java

@@ -10,6 +10,7 @@ package org.elasticsearch.discovery;
 
 
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.Logger;
+import org.elasticsearch.Version;
 import org.elasticsearch.client.Client;
 import org.elasticsearch.client.Client;
 import org.elasticsearch.cluster.ClusterState;
 import org.elasticsearch.cluster.ClusterState;
 import org.elasticsearch.cluster.coordination.Coordinator;
 import org.elasticsearch.cluster.coordination.Coordinator;
@@ -21,6 +22,8 @@ import org.elasticsearch.cluster.service.ClusterApplier;
 import org.elasticsearch.cluster.service.MasterService;
 import org.elasticsearch.cluster.service.MasterService;
 import org.elasticsearch.common.Randomness;
 import org.elasticsearch.common.Randomness;
 import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
 import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
+import org.elasticsearch.common.logging.DeprecationCategory;
+import org.elasticsearch.common.logging.DeprecationLogger;
 import org.elasticsearch.common.network.NetworkService;
 import org.elasticsearch.common.network.NetworkService;
 import org.elasticsearch.common.settings.ClusterSettings;
 import org.elasticsearch.common.settings.ClusterSettings;
 import org.elasticsearch.common.settings.Setting;
 import org.elasticsearch.common.settings.Setting;
@@ -56,16 +59,18 @@ import static org.elasticsearch.node.Node.NODE_NAME_SETTING;
 public class DiscoveryModule {
 public class DiscoveryModule {
     private static final Logger logger = LogManager.getLogger(DiscoveryModule.class);
     private static final Logger logger = LogManager.getLogger(DiscoveryModule.class);
 
 
-    public static final String ZEN2_DISCOVERY_TYPE = "zen";
-
+    public static final String MULTI_NODE_DISCOVERY_TYPE = "multi-node";
     public static final String SINGLE_NODE_DISCOVERY_TYPE = "single-node";
     public static final String SINGLE_NODE_DISCOVERY_TYPE = "single-node";
+    @Deprecated
+    public static final String LEGACY_MULTI_NODE_DISCOVERY_TYPE = "zen";
 
 
     public static final Setting<String> DISCOVERY_TYPE_SETTING = new Setting<>(
     public static final Setting<String> DISCOVERY_TYPE_SETTING = new Setting<>(
         "discovery.type",
         "discovery.type",
-        ZEN2_DISCOVERY_TYPE,
+        MULTI_NODE_DISCOVERY_TYPE,
         Function.identity(),
         Function.identity(),
         Property.NodeScope
         Property.NodeScope
     );
     );
+
     public static final Setting<List<String>> DISCOVERY_SEED_PROVIDERS_SETTING = Setting.listSetting(
     public static final Setting<List<String>> DISCOVERY_SEED_PROVIDERS_SETTING = Setting.listSetting(
         "discovery.seed_providers",
         "discovery.seed_providers",
         Collections.emptyList(),
         Collections.emptyList(),
@@ -159,7 +164,23 @@ public class DiscoveryModule {
             throw new IllegalArgumentException("Unknown election strategy " + ELECTION_STRATEGY_SETTING.get(settings));
             throw new IllegalArgumentException("Unknown election strategy " + ELECTION_STRATEGY_SETTING.get(settings));
         }
         }
 
 
-        if (ZEN2_DISCOVERY_TYPE.equals(discoveryType) || SINGLE_NODE_DISCOVERY_TYPE.equals(discoveryType)) {
+        if (LEGACY_MULTI_NODE_DISCOVERY_TYPE.equals(discoveryType)) {
+            assert Version.CURRENT.major == Version.V_7_0_0.major + 1;
+            DeprecationLogger.getLogger(DiscoveryModule.class)
+                .critical(
+                    DeprecationCategory.SETTINGS,
+                    "legacy-discovery-type",
+                    "Support for setting [{}] to [{}] is deprecated and will be removed in a future version. Set this setting to [{}] "
+                        + "instead.",
+                    DISCOVERY_TYPE_SETTING.getKey(),
+                    LEGACY_MULTI_NODE_DISCOVERY_TYPE,
+                    MULTI_NODE_DISCOVERY_TYPE
+                );
+        }
+
+        if (MULTI_NODE_DISCOVERY_TYPE.equals(discoveryType)
+            || LEGACY_MULTI_NODE_DISCOVERY_TYPE.equals(discoveryType)
+            || SINGLE_NODE_DISCOVERY_TYPE.equals(discoveryType)) {
             coordinator = new Coordinator(
             coordinator = new Coordinator(
                 NODE_NAME_SETTING.get(settings),
                 NODE_NAME_SETTING.get(settings),
                 settings,
                 settings,

+ 16 - 9
server/src/test/java/org/elasticsearch/bootstrap/BootstrapChecksTests.java

@@ -34,7 +34,8 @@ import java.util.concurrent.atomic.AtomicLong;
 import java.util.concurrent.atomic.AtomicReference;
 import java.util.concurrent.atomic.AtomicReference;
 import java.util.function.Consumer;
 import java.util.function.Consumer;
 
 
-import static org.elasticsearch.discovery.DiscoveryModule.ZEN2_DISCOVERY_TYPE;
+import static org.elasticsearch.discovery.DiscoveryModule.MULTI_NODE_DISCOVERY_TYPE;
+import static org.elasticsearch.discovery.DiscoveryModule.SINGLE_NODE_DISCOVERY_TYPE;
 import static org.hamcrest.CoreMatchers.allOf;
 import static org.hamcrest.CoreMatchers.allOf;
 import static org.hamcrest.CoreMatchers.containsString;
 import static org.hamcrest.CoreMatchers.containsString;
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.hamcrest.CoreMatchers.equalTo;
@@ -97,9 +98,12 @@ public class BootstrapChecksTests extends AbstractBootstrapCheckTestCase {
         when(boundTransportAddress.boundAddresses()).thenReturn(transportAddresses.toArray(new TransportAddress[0]));
         when(boundTransportAddress.boundAddresses()).thenReturn(transportAddresses.toArray(new TransportAddress[0]));
         when(boundTransportAddress.publishAddress()).thenReturn(publishAddress);
         when(boundTransportAddress.publishAddress()).thenReturn(publishAddress);
 
 
-        final String discoveryType = randomFrom(ZEN2_DISCOVERY_TYPE, "single-node");
+        final String discoveryType = randomFrom(MULTI_NODE_DISCOVERY_TYPE, SINGLE_NODE_DISCOVERY_TYPE);
 
 
-        assertEquals(BootstrapChecks.enforceLimits(boundTransportAddress, discoveryType), "single-node".equals(discoveryType) == false);
+        assertEquals(
+            BootstrapChecks.enforceLimits(boundTransportAddress, discoveryType),
+            SINGLE_NODE_DISCOVERY_TYPE.equals(discoveryType) == false
+        );
     }
     }
 
 
     public void testEnforceLimitsWhenPublishingToNonLocalAddress() {
     public void testEnforceLimitsWhenPublishingToNonLocalAddress() {
@@ -115,9 +119,12 @@ public class BootstrapChecksTests extends AbstractBootstrapCheckTestCase {
         when(boundTransportAddress.boundAddresses()).thenReturn(transportAddresses.toArray(new TransportAddress[0]));
         when(boundTransportAddress.boundAddresses()).thenReturn(transportAddresses.toArray(new TransportAddress[0]));
         when(boundTransportAddress.publishAddress()).thenReturn(publishAddress);
         when(boundTransportAddress.publishAddress()).thenReturn(publishAddress);
 
 
-        final String discoveryType = randomFrom(ZEN2_DISCOVERY_TYPE, "single-node");
+        final String discoveryType = randomFrom(MULTI_NODE_DISCOVERY_TYPE, SINGLE_NODE_DISCOVERY_TYPE);
 
 
-        assertEquals(BootstrapChecks.enforceLimits(boundTransportAddress, discoveryType), "single-node".equals(discoveryType) == false);
+        assertEquals(
+            BootstrapChecks.enforceLimits(boundTransportAddress, discoveryType),
+            SINGLE_NODE_DISCOVERY_TYPE.equals(discoveryType) == false
+        );
     }
     }
 
 
     public void testExceptionAggregation() {
     public void testExceptionAggregation() {
@@ -754,18 +761,18 @@ public class BootstrapChecksTests extends AbstractBootstrapCheckTestCase {
         final List<BootstrapCheck> checks = Collections.singletonList(new BootstrapChecks.DiscoveryConfiguredCheck());
         final List<BootstrapCheck> checks = Collections.singletonList(new BootstrapChecks.DiscoveryConfiguredCheck());
 
 
         final BootstrapContext zen2Context = createTestContext(
         final BootstrapContext zen2Context = createTestContext(
-            Settings.builder().put(DiscoveryModule.DISCOVERY_TYPE_SETTING.getKey(), ZEN2_DISCOVERY_TYPE).build(),
+            Settings.builder().put(DiscoveryModule.DISCOVERY_TYPE_SETTING.getKey(), MULTI_NODE_DISCOVERY_TYPE).build(),
             Metadata.EMPTY_METADATA
             Metadata.EMPTY_METADATA
         );
         );
 
 
         // not always enforced
         // not always enforced
         BootstrapChecks.check(zen2Context, false, checks);
         BootstrapChecks.check(zen2Context, false, checks);
 
 
-        // not enforced for non-zen2 discovery
+        // not enforced for non-multi-node discovery
         BootstrapChecks.check(
         BootstrapChecks.check(
             createTestContext(
             createTestContext(
                 Settings.builder()
                 Settings.builder()
-                    .put(DiscoveryModule.DISCOVERY_TYPE_SETTING.getKey(), randomFrom("single-node", randomAlphaOfLength(5)))
+                    .put(DiscoveryModule.DISCOVERY_TYPE_SETTING.getKey(), randomFrom(SINGLE_NODE_DISCOVERY_TYPE, randomAlphaOfLength(5)))
                     .build(),
                     .build(),
                 Metadata.EMPTY_METADATA
                 Metadata.EMPTY_METADATA
             ),
             ),
@@ -789,7 +796,7 @@ public class BootstrapChecksTests extends AbstractBootstrapCheckTestCase {
 
 
         CheckedConsumer<Settings.Builder, NodeValidationException> ensureChecksPass = b -> {
         CheckedConsumer<Settings.Builder, NodeValidationException> ensureChecksPass = b -> {
             final BootstrapContext context = createTestContext(
             final BootstrapContext context = createTestContext(
-                b.put(DiscoveryModule.DISCOVERY_TYPE_SETTING.getKey(), ZEN2_DISCOVERY_TYPE).build(),
+                b.put(DiscoveryModule.DISCOVERY_TYPE_SETTING.getKey(), MULTI_NODE_DISCOVERY_TYPE).build(),
                 Metadata.EMPTY_METADATA
                 Metadata.EMPTY_METADATA
             );
             );
             BootstrapChecks.check(context, true, checks);
             BootstrapChecks.check(context, true, checks);

+ 14 - 1
server/src/test/java/org/elasticsearch/discovery/DiscoveryModuleTests.java

@@ -177,7 +177,7 @@ public class DiscoveryModuleTests extends ESTestCase {
     public void testJoinValidator() {
     public void testJoinValidator() {
         BiConsumer<DiscoveryNode, ClusterState> consumer = (a, b) -> {};
         BiConsumer<DiscoveryNode, ClusterState> consumer = (a, b) -> {};
         DiscoveryModule module = newModule(
         DiscoveryModule module = newModule(
-            Settings.builder().put(DiscoveryModule.DISCOVERY_TYPE_SETTING.getKey(), DiscoveryModule.ZEN2_DISCOVERY_TYPE).build(),
+            Settings.builder().put(DiscoveryModule.DISCOVERY_TYPE_SETTING.getKey(), DiscoveryModule.MULTI_NODE_DISCOVERY_TYPE).build(),
             Collections.singletonList(new DiscoveryPlugin() {
             Collections.singletonList(new DiscoveryPlugin() {
                 @Override
                 @Override
                 public BiConsumer<DiscoveryNode, ClusterState> getJoinValidator() {
                 public BiConsumer<DiscoveryNode, ClusterState> getJoinValidator() {
@@ -190,4 +190,17 @@ public class DiscoveryModuleTests extends ESTestCase {
         assertEquals(2, onJoinValidators.size());
         assertEquals(2, onJoinValidators.size());
         assertTrue(onJoinValidators.contains(consumer));
         assertTrue(onJoinValidators.contains(consumer));
     }
     }
+
+    public void testLegacyDiscoveryType() {
+        newModule(
+            Settings.builder()
+                .put(DiscoveryModule.DISCOVERY_TYPE_SETTING.getKey(), DiscoveryModule.LEGACY_MULTI_NODE_DISCOVERY_TYPE)
+                .build(),
+            Collections.emptyList()
+        );
+        assertCriticalWarnings(
+            "Support for setting [discovery.type] to [zen] is deprecated and will be removed in a future version. Set this setting to "
+                + "[multi-node] instead."
+        );
+    }
 }
 }

+ 2 - 2
test/framework/src/main/java/org/elasticsearch/test/InternalTestCluster.java

@@ -140,7 +140,7 @@ import static org.elasticsearch.cluster.coordination.ClusterBootstrapService.INI
 import static org.elasticsearch.core.TimeValue.timeValueMillis;
 import static org.elasticsearch.core.TimeValue.timeValueMillis;
 import static org.elasticsearch.core.TimeValue.timeValueSeconds;
 import static org.elasticsearch.core.TimeValue.timeValueSeconds;
 import static org.elasticsearch.discovery.DiscoveryModule.DISCOVERY_TYPE_SETTING;
 import static org.elasticsearch.discovery.DiscoveryModule.DISCOVERY_TYPE_SETTING;
-import static org.elasticsearch.discovery.DiscoveryModule.ZEN2_DISCOVERY_TYPE;
+import static org.elasticsearch.discovery.DiscoveryModule.MULTI_NODE_DISCOVERY_TYPE;
 import static org.elasticsearch.discovery.FileBasedSeedHostsProvider.UNICAST_HOSTS_FILE;
 import static org.elasticsearch.discovery.FileBasedSeedHostsProvider.UNICAST_HOSTS_FILE;
 import static org.elasticsearch.node.Node.INITIAL_STATE_TIMEOUT_SETTING;
 import static org.elasticsearch.node.Node.INITIAL_STATE_TIMEOUT_SETTING;
 import static org.elasticsearch.test.ESTestCase.assertBusy;
 import static org.elasticsearch.test.ESTestCase.assertBusy;
@@ -2094,7 +2094,7 @@ public final class InternalTestCluster extends TestCluster {
             && prevMasterCount == 0
             && prevMasterCount == 0
             && newMasterCount > 0
             && newMasterCount > 0
             && Arrays.stream(extraSettings)
             && Arrays.stream(extraSettings)
-                .allMatch(s -> DiscoveryNode.isMasterNode(s) == false || ZEN2_DISCOVERY_TYPE.equals(DISCOVERY_TYPE_SETTING.get(s)))
+                .allMatch(s -> DiscoveryNode.isMasterNode(s) == false || MULTI_NODE_DISCOVERY_TYPE.equals(DISCOVERY_TYPE_SETTING.get(s)))
                     ? RandomNumbers.randomIntBetween(random, 0, newMasterCount - 1)
                     ? RandomNumbers.randomIntBetween(random, 0, newMasterCount - 1)
                     : -1;
                     : -1;
 
 

+ 3 - 1
x-pack/plugin/core/src/test/java/org/elasticsearch/license/LicenseServiceTests.java

@@ -43,6 +43,8 @@ import java.util.concurrent.TimeUnit;
 import java.util.function.Consumer;
 import java.util.function.Consumer;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
 
 
+import static org.elasticsearch.discovery.DiscoveryModule.DISCOVERY_TYPE_SETTING;
+import static org.elasticsearch.discovery.DiscoveryModule.SINGLE_NODE_DISCOVERY_TYPE;
 import static org.elasticsearch.license.LicenseService.LICENSE_EXPIRATION_WARNING_PERIOD;
 import static org.elasticsearch.license.LicenseService.LICENSE_EXPIRATION_WARNING_PERIOD;
 import static org.hamcrest.Matchers.equalTo;
 import static org.hamcrest.Matchers.equalTo;
 import static org.hamcrest.Matchers.instanceOf;
 import static org.hamcrest.Matchers.instanceOf;
@@ -138,7 +140,7 @@ public class LicenseServiceTests extends ESTestCase {
         final Settings settings = Settings.builder()
         final Settings settings = Settings.builder()
             .put(baseSettings)
             .put(baseSettings)
             .put("path.home", createTempDir())
             .put("path.home", createTempDir())
-            .put("discovery.type", "single-node") // So we skip TLS checks
+            .put(DISCOVERY_TYPE_SETTING.getKey(), SINGLE_NODE_DISCOVERY_TYPE) // So we skip TLS checks
             .build();
             .build();
 
 
         final ClusterState clusterState = mock(ClusterState.class);
         final ClusterState clusterState = mock(ClusterState.class);

+ 6 - 1
x-pack/plugin/core/src/test/java/org/elasticsearch/license/LicenseTLSTests.java

@@ -19,6 +19,8 @@ import java.net.InetAddress;
 
 
 import static java.util.Collections.emptyMap;
 import static java.util.Collections.emptyMap;
 import static java.util.Collections.emptySet;
 import static java.util.Collections.emptySet;
+import static org.elasticsearch.discovery.DiscoveryModule.DISCOVERY_TYPE_SETTING;
+import static org.elasticsearch.discovery.DiscoveryModule.SINGLE_NODE_DISCOVERY_TYPE;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.verify;
@@ -43,7 +45,10 @@ public class LicenseTLSTests extends AbstractLicenseServiceTestCase {
         verify(clusterService).submitStateUpdateTask(any(String.class), any(ClusterStateUpdateTask.class));
         verify(clusterService).submitStateUpdateTask(any(String.class), any(ClusterStateUpdateTask.class));
 
 
         inetAddress = TransportAddress.META_ADDRESS;
         inetAddress = TransportAddress.META_ADDRESS;
-        settings = Settings.builder().put("xpack.security.enabled", true).put("discovery.type", "single-node").build();
+        settings = Settings.builder()
+            .put("xpack.security.enabled", true)
+            .put(DISCOVERY_TYPE_SETTING.getKey(), SINGLE_NODE_DISCOVERY_TYPE)
+            .build();
         licenseService.stop();
         licenseService.stop();
         licenseState = new XPackLicenseState(() -> 0);
         licenseState = new XPackLicenseState(() -> 0);
         setInitialState(null, licenseState, settings);
         setInitialState(null, licenseState, settings);

+ 3 - 1
x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/action/service/TransportGetServiceAccountCredentialsActionTests.java

@@ -26,6 +26,8 @@ import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.net.UnknownHostException;
 import java.util.Collections;
 import java.util.Collections;
 
 
+import static org.elasticsearch.discovery.DiscoveryModule.DISCOVERY_TYPE_SETTING;
+import static org.elasticsearch.discovery.DiscoveryModule.SINGLE_NODE_DISCOVERY_TYPE;
 import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.verify;
@@ -51,7 +53,7 @@ public class TransportGetServiceAccountCredentialsActionTests extends ESTestCase
         if (randomBoolean()) {
         if (randomBoolean()) {
             builder.put("xpack.security.http.ssl.enabled", true);
             builder.put("xpack.security.http.ssl.enabled", true);
         } else {
         } else {
-            builder.put("discovery.type", "single-node");
+            builder.put(DISCOVERY_TYPE_SETTING.getKey(), SINGLE_NODE_DISCOVERY_TYPE);
         }
         }
         when(transport.boundAddress()).thenReturn(new BoundTransportAddress(new TransportAddress[] { transportAddress }, transportAddress));
         when(transport.boundAddress()).thenReturn(new BoundTransportAddress(new TransportAddress[] { transportAddress }, transportAddress));
         final Settings settings = builder.build();
         final Settings settings = builder.build();