@@ -347,9 +347,13 @@ class ClusterFormationTasks {
347
347
348
348
Task writeConfig = project. tasks. create(name : name, type : DefaultTask , dependsOn : setup)
349
349
writeConfig. doFirst {
350
- String unicastTransportUri = node. config. unicastTransportUri(seedNode, node, project. ant)
351
- if (unicastTransportUri != null ) {
352
- esConfig[' discovery.zen.ping.unicast.hosts' ] = " \" ${ unicastTransportUri} \" "
350
+ if (node. nodeVersion. onOrAfter(" 7.0.0-SNAPSHOT" )) {
351
+ esConfig[' discovery.zen.hosts_provider' ] = ' file'
352
+ } else {
353
+ String unicastTransportUri = node. config. unicastTransportUri(seedNode, node, project. ant)
354
+ if (unicastTransportUri != null ) {
355
+ esConfig[' discovery.zen.ping.unicast.hosts' ] = " \" ${ unicastTransportUri} \" "
356
+ }
353
357
}
354
358
File configFile = new File (node. pathConf, ' elasticsearch.yml' )
355
359
logger. info(" Configuring ${ configFile} " )
@@ -703,6 +707,22 @@ class ClusterFormationTasks {
703
707
}
704
708
}
705
709
}
710
+
711
+ nodes. forEach {node ->
712
+ if (node. nodeVersion. onOrAfter(" 7.0.0-SNAPSHOT" )) {
713
+ Collection<String > unicastHosts = new HashSet<> ()
714
+ nodes. forEach { otherNode ->
715
+ String unicastHost = node. config. unicastTransportUri(otherNode, node, project. ant)
716
+ if (unicastHost != null ) {
717
+ unicastHosts. add(unicastHost)
718
+ }
719
+ }
720
+ node. pathConf. toPath(). resolve(" unicast_hosts.txt" ). setText(
721
+ String . join(" \n " , unicastHosts)
722
+ )
723
+ }
724
+ }
725
+
706
726
if (ant. properties. containsKey(" failed${ name} " . toString())) {
707
727
waitFailed(project, nodes, logger, " Failed to start elasticsearch: timed out after ${ waitSeconds} seconds" )
708
728
}
0 commit comments