mirror of https://github.com/apache/druid.git
Initialization: Set service discovery address equal to druid.host (without port if any)
This commit is contained in:
parent
376df4032d
commit
4c4d30cf66
|
@ -278,6 +278,7 @@ public class Initialization
|
|||
final ServiceInstance serviceInstance =
|
||||
ServiceInstance.builder()
|
||||
.name(config.getServiceName().replace('/', ':'))
|
||||
.address(addressFromHost(config.getHost()))
|
||||
.port(config.getPort())
|
||||
.build();
|
||||
final ServiceDiscovery serviceDiscovery =
|
||||
|
@ -361,6 +362,16 @@ public class Initialization
|
|||
return String.format("%s/%s", basePath, PROP_SUBPATH);
|
||||
}
|
||||
|
||||
public static String addressFromHost(final String host)
|
||||
{
|
||||
final int colon = host.indexOf(':');
|
||||
if (colon < 0) {
|
||||
return host;
|
||||
} else {
|
||||
return host.substring(0, colon);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate and Resolve Properties.
|
||||
* Resolve zpaths with props like druid.zk.paths.*Path using druid.zk.paths.base value.
|
||||
|
|
|
@ -28,6 +28,9 @@ public abstract class ServiceDiscoveryConfig extends CuratorConfig
|
|||
@Config("druid.service")
|
||||
public abstract String getServiceName();
|
||||
|
||||
@Config("druid.host")
|
||||
public abstract String getHost();
|
||||
|
||||
@Config("druid.port")
|
||||
public abstract int getPort();
|
||||
|
||||
|
|
Loading…
Reference in New Issue