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 =
|
final ServiceInstance serviceInstance =
|
||||||
ServiceInstance.builder()
|
ServiceInstance.builder()
|
||||||
.name(config.getServiceName().replace('/', ':'))
|
.name(config.getServiceName().replace('/', ':'))
|
||||||
|
.address(addressFromHost(config.getHost()))
|
||||||
.port(config.getPort())
|
.port(config.getPort())
|
||||||
.build();
|
.build();
|
||||||
final ServiceDiscovery serviceDiscovery =
|
final ServiceDiscovery serviceDiscovery =
|
||||||
|
@ -361,6 +362,16 @@ public class Initialization
|
||||||
return String.format("%s/%s", basePath, PROP_SUBPATH);
|
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.
|
* Validate and Resolve Properties.
|
||||||
* Resolve zpaths with props like druid.zk.paths.*Path using druid.zk.paths.base value.
|
* 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")
|
@Config("druid.service")
|
||||||
public abstract String getServiceName();
|
public abstract String getServiceName();
|
||||||
|
|
||||||
|
@Config("druid.host")
|
||||||
|
public abstract String getHost();
|
||||||
|
|
||||||
@Config("druid.port")
|
@Config("druid.port")
|
||||||
public abstract int getPort();
|
public abstract int getPort();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue