diff --git a/core/src/main/java/org/elasticsearch/common/settings/ClusterSettings.java b/core/src/main/java/org/elasticsearch/common/settings/ClusterSettings.java index 1d894481373..0e92c43844c 100644 --- a/core/src/main/java/org/elasticsearch/common/settings/ClusterSettings.java +++ b/core/src/main/java/org/elasticsearch/common/settings/ClusterSettings.java @@ -61,7 +61,6 @@ import org.elasticsearch.discovery.zen.ZenDiscovery; import org.elasticsearch.env.Environment; import org.elasticsearch.env.NodeEnvironment; import org.elasticsearch.gateway.GatewayService; -import org.elasticsearch.gateway.PrimaryShardAllocator; import org.elasticsearch.http.HttpTransportSettings; import org.elasticsearch.index.IndexSettings; import org.elasticsearch.indices.IndexingMemoryController; @@ -345,7 +344,7 @@ public final class ClusterSettings extends AbstractScopedSettings { SearchService.DEFAULT_KEEPALIVE_SETTING, SearchService.KEEPALIVE_INTERVAL_SETTING, SearchService.LOW_LEVEL_CANCELLATION_SETTING, - Node.WRITE_PORTS_FIELD_SETTING, + Node.WRITE_PORTS_FILE_SETTING, Node.NODE_NAME_SETTING, Node.NODE_DATA_SETTING, Node.NODE_MASTER_SETTING, diff --git a/core/src/main/java/org/elasticsearch/node/Node.java b/core/src/main/java/org/elasticsearch/node/Node.java index 103add62809..01ccf68dc36 100644 --- a/core/src/main/java/org/elasticsearch/node/Node.java +++ b/core/src/main/java/org/elasticsearch/node/Node.java @@ -168,7 +168,7 @@ import static java.util.stream.Collectors.toList; public class Node implements Closeable { - public static final Setting WRITE_PORTS_FIELD_SETTING = + public static final Setting WRITE_PORTS_FILE_SETTING = Setting.boolSetting("node.portsfile", false, Property.NodeScope); public static final Setting NODE_DATA_SETTING = Setting.boolSetting("node.data", true, Property.NodeScope); public static final Setting NODE_MASTER_SETTING = @@ -727,13 +727,7 @@ public class Node implements Closeable { injector.getInstance(HttpServerTransport.class).start(); } - // start nodes now, after the http server, because it may take some time - tribeService.startNodes(); - // starts connecting to remote clusters if any cluster is configured - SearchTransportService searchTransportService = injector.getInstance(SearchTransportService.class); - searchTransportService.start(); - - if (WRITE_PORTS_FIELD_SETTING.get(settings)) { + if (WRITE_PORTS_FILE_SETTING.get(settings)) { if (NetworkModule.HTTP_ENABLED.get(settings)) { HttpServerTransport http = injector.getInstance(HttpServerTransport.class); writePortsFile("http", http.boundAddress()); @@ -742,6 +736,12 @@ public class Node implements Closeable { writePortsFile("transport", transport.boundAddress()); } + // start nodes now, after the http server, because it may take some time + tribeService.startNodes(); + // starts connecting to remote clusters if any cluster is configured + SearchTransportService searchTransportService = injector.getInstance(SearchTransportService.class); + searchTransportService.start(); + logger.info("started"); return this; diff --git a/plugins/discovery-azure-classic/src/test/java/org/elasticsearch/discovery/azure/classic/AzureDiscoveryClusterFormationTests.java b/plugins/discovery-azure-classic/src/test/java/org/elasticsearch/discovery/azure/classic/AzureDiscoveryClusterFormationTests.java index 9787dc136e3..09fa16b8ed0 100644 --- a/plugins/discovery-azure-classic/src/test/java/org/elasticsearch/discovery/azure/classic/AzureDiscoveryClusterFormationTests.java +++ b/plugins/discovery-azure-classic/src/test/java/org/elasticsearch/discovery/azure/classic/AzureDiscoveryClusterFormationTests.java @@ -109,7 +109,7 @@ public class AzureDiscoveryClusterFormationTests extends ESIntegTestCase { .put(DiscoveryModule.DISCOVERY_TYPE_SETTING.getKey(), AzureDiscoveryPlugin.AZURE) .put(Environment.PATH_LOGS_SETTING.getKey(), resolve) .put(TransportSettings.PORT.getKey(), 0) - .put(Node.WRITE_PORTS_FIELD_SETTING.getKey(), "true") + .put(Node.WRITE_PORTS_FILE_SETTING.getKey(), "true") .put(AzureComputeService.Management.ENDPOINT_SETTING.getKey(), "https://" + InetAddress.getLoopbackAddress().getHostAddress() + ":" + httpsServer.getAddress().getPort()) .put(Environment.PATH_CONF_SETTING.getKey(), keyStoreFile.getParent().toAbsolutePath()) diff --git a/qa/smoke-test-tribe-node/build.gradle b/qa/smoke-test-tribe-node/build.gradle index 4ddb178068d..009298adc6a 100644 --- a/qa/smoke-test-tribe-node/build.gradle +++ b/qa/smoke-test-tribe-node/build.gradle @@ -52,4 +52,14 @@ integTestCluster { setting 'tribe.two.http.enabled', 'true' setting 'tribe.two.http.port', '40250-40299' setting 'tribe.two.transport.tcp.port', '40250-40399' + + waitCondition = { node, ant -> + File tmpFile = new File(node.cwd, 'wait.success') + // 5 nodes: tribe + clusterOne (1 node + tribe internal node) + clusterTwo (1 node + tribe internal node) + ant.get(src: "http://${node.httpUri()}/_cluster/health?wait_for_nodes=>=5&wait_for_status=yellow", + dest: tmpFile.toString(), + ignoreerrors: true, + retries: 10) + return tmpFile.exists() + } }