mirror of
https://github.com/Graylog2/graylog2-server.git
synced 2026-03-13 09:32:21 +08:00
DataNode: make the cluster name configurable (#17143)
* make the cluster name configurable * added changelog * precise, that it's the data node we talk about in the CL Co-authored-by: Matthias Oesterheld <33032967+moesterheld@users.noreply.github.com> --------- Co-authored-by: Matthias Oesterheld <33032967+moesterheld@users.noreply.github.com>
This commit is contained in:
@@ -176,6 +176,9 @@ public class Configuration extends BaseConfiguration {
|
||||
@Parameter(value = "hostname")
|
||||
private String hostname = null;
|
||||
|
||||
@Parameter(value = "clustername")
|
||||
private String clustername = "datanode-cluster";
|
||||
|
||||
@Parameter(value = "http_publish_uri", validator = URIAbsoluteValidator.class)
|
||||
private URI httpPublishUri;
|
||||
|
||||
@@ -248,7 +251,6 @@ public class Configuration extends BaseConfiguration {
|
||||
* This is a pointer to a directory holding configuration files (and certificates) for the datanode itself.
|
||||
* We treat it as read only for the datanode and should never persist anything in it.
|
||||
* Use {@link DatanodeDirectories} to obtain a reference to this directory.
|
||||
*
|
||||
*/
|
||||
@Nullable
|
||||
public Path getDatanodeConfigurationLocation() {
|
||||
@@ -357,6 +359,10 @@ public class Configuration extends BaseConfiguration {
|
||||
return datanodeHttpPort;
|
||||
}
|
||||
|
||||
public String getClustername() {
|
||||
return clustername;
|
||||
}
|
||||
|
||||
public static class NodeIdFileValidator implements Validator<String> {
|
||||
@Override
|
||||
public void validate(String name, String path) throws ValidationException {
|
||||
|
||||
@@ -95,9 +95,9 @@ public class OpensearchConfigurationProvider implements Provider<OpensearchConfi
|
||||
try {
|
||||
ImmutableMap.Builder<String, String> opensearchProperties = ImmutableMap.builder();
|
||||
|
||||
if(localConfiguration.getInitialManagerNodes() != null && !localConfiguration.getInitialManagerNodes().isBlank()) {
|
||||
if (localConfiguration.getInitialManagerNodes() != null && !localConfiguration.getInitialManagerNodes().isBlank()) {
|
||||
opensearchProperties.put("cluster.initial_master_nodes", localConfiguration.getInitialManagerNodes());
|
||||
} else if(isPreflight()) {
|
||||
} else if (isPreflight()) {
|
||||
final var nodeList = String.join(",", nodeService.allActive(Node.Type.DATANODE).values().stream().map(Node::getHostname).collect(Collectors.toSet()));
|
||||
opensearchProperties.put("cluster.initial_master_nodes", nodeList);
|
||||
}
|
||||
@@ -118,7 +118,7 @@ public class OpensearchConfigurationProvider implements Provider<OpensearchConfi
|
||||
localConfiguration.getHostname(),
|
||||
localConfiguration.getOpensearchHttpPort(),
|
||||
localConfiguration.getOpensearchTransportPort(),
|
||||
"datanode-cluster",
|
||||
localConfiguration.getClustername(),
|
||||
localConfiguration.getDatanodeNodeName(),
|
||||
List.of(),
|
||||
localConfiguration.getOpensearchDiscoverySeedHosts(),
|
||||
|
||||
Reference in New Issue
Block a user