diff --git a/docs/content/configuration/index.md b/docs/content/configuration/index.md index 5a75b16036c..7bc4849aed2 100644 --- a/docs/content/configuration/index.md +++ b/docs/content/configuration/index.md @@ -653,6 +653,7 @@ These coordinator static configurations can be defined in the `coordinator/runti |Property|Description|Default| |--------|-----------|-------| |`druid.host`|The host for the current node. This is used to advertise the current processes location as reachable from another node and should generally be specified such that `http://${druid.host}/` could actually talk to this process|InetAddress.getLocalHost().getCanonicalHostName()| +|`druid.bindOnHost`|Indicating whether the node's internal jetty server bind on `druid.host`. Default is false, which means binding to all interfaces.|false| |`druid.plaintextPort`|This is the port to actually listen on; unless port mapping is used, this will be the same port as is on `druid.host`|8081| |`druid.tlsPort`|TLS port for HTTPS connector, if [druid.enableTlsPort](../operations/tls-support.html) is set then this config will be used. If `druid.host` contains port then that port will be ignored. This should be a non-negative Integer.|8281| |`druid.service`|The name of the service. This is used as a dimension when emitting metrics and alerts to differentiate between the various services|druid/coordinator| @@ -816,6 +817,7 @@ These overlord static configurations can be defined in the `overlord/runtime.pro |Property|Description|Default| |--------|-----------|-------| |`druid.host`|The host for the current node. This is used to advertise the current processes location as reachable from another node and should generally be specified such that `http://${druid.host}/` could actually talk to this process|InetAddress.getLocalHost().getCanonicalHostName()| +|`druid.bindOnHost`|Indicating whether the node's internal jetty server bind on `druid.host`. Default is false, which means binding to all interfaces.|false| |`druid.plaintextPort`|This is the port to actually listen on; unless port mapping is used, this will be the same port as is on `druid.host`|8090| |`druid.tlsPort`|TLS port for HTTPS connector, if [druid.enableTlsPort](../operations/tls-support.html) is set then this config will be used. If `druid.host` contains port then that port will be ignored. This should be a non-negative Integer.|8290| |`druid.service`|The name of the service. This is used as a dimension when emitting metrics and alerts to differentiate between the various services|druid/overlord| @@ -1025,6 +1027,7 @@ These MiddleManager and Peon configurations can be defined in the `middleManager |Property|Description|Default| |--------|-----------|-------| |`druid.host`|The host for the current node. This is used to advertise the current processes location as reachable from another node and should generally be specified such that `http://${druid.host}/` could actually talk to this process|InetAddress.getLocalHost().getCanonicalHostName()| +|`druid.bindOnHost`|Indicating whether the node's internal jetty server bind on `druid.host`. Default is false, which means binding to all interfaces.|false| |`druid.plaintextPort`|This is the port to actually listen on; unless port mapping is used, this will be the same port as is on `druid.host`|8091| |`druid.tlsPort`|TLS port for HTTPS connector, if [druid.enableTlsPort](../operations/tls-support.html) is set then this config will be used. If `druid.host` contains port then that port will be ignored. This should be a non-negative Integer.|8291| |`druid.service`|The name of the service. This is used as a dimension when emitting metrics and alerts to differentiate between the various services|druid/middlemanager| @@ -1149,6 +1152,7 @@ These Broker configurations can be defined in the `broker/runtime.properties` fi |Property|Description|Default| |--------|-----------|-------| |`druid.host`|The host for the current node. This is used to advertise the current processes location as reachable from another node and should generally be specified such that `http://${druid.host}/` could actually talk to this process|InetAddress.getLocalHost().getCanonicalHostName()| +|`druid.bindOnHost`|Indicating whether the node's internal jetty server bind on `druid.host`. Default is false, which means binding to all interfaces.|false| |`druid.plaintextPort`|This is the port to actually listen on; unless port mapping is used, this will be the same port as is on `druid.host`|8082| |`druid.tlsPort`|TLS port for HTTPS connector, if [druid.enableTlsPort](../operations/tls-support.html) is set then this config will be used. If `druid.host` contains port then that port will be ignored. This should be a non-negative Integer.|8282| |`druid.service`|The name of the service. This is used as a dimension when emitting metrics and alerts to differentiate between the various services|druid/broker| @@ -1280,6 +1284,7 @@ These Historical configurations can be defined in the `historical/runtime.proper |Property|Description|Default| |--------|-----------|-------| |`druid.host`|The host for the current node. This is used to advertise the current processes location as reachable from another node and should generally be specified such that `http://${druid.host}/` could actually talk to this process|InetAddress.getLocalHost().getCanonicalHostName()| +|`druid.bindOnHost`|Indicating whether the node's internal jetty server bind on `druid.host`. Default is false, which means binding to all interfaces.|false| |`druid.plaintextPort`|This is the port to actually listen on; unless port mapping is used, this will be the same port as is on `druid.host`|8083| |`druid.tlsPort`|TLS port for HTTPS connector, if [druid.enableTlsPort](../operations/tls-support.html) is set then this config will be used. If `druid.host` contains port then that port will be ignored. This should be a non-negative Integer.|8283| |`druid.service`|The name of the service. This is used as a dimension when emitting metrics and alerts to differentiate between the various services|druid/historical| diff --git a/extensions-core/lookups-cached-global/src/test/java/org/apache/druid/query/lookup/NamespaceLookupExtractorFactoryTest.java b/extensions-core/lookups-cached-global/src/test/java/org/apache/druid/query/lookup/NamespaceLookupExtractorFactoryTest.java index 9c108185dc5..7f121b7a365 100644 --- a/extensions-core/lookups-cached-global/src/test/java/org/apache/druid/query/lookup/NamespaceLookupExtractorFactoryTest.java +++ b/extensions-core/lookups-cached-global/src/test/java/org/apache/druid/query/lookup/NamespaceLookupExtractorFactoryTest.java @@ -524,7 +524,7 @@ public class NamespaceLookupExtractorFactoryTest public void configure(Binder binder) { JsonConfigProvider.bindInstance( - binder, Key.get(DruidNode.class, Self.class), new DruidNode("test-inject", null, null, null, true, false) + binder, Key.get(DruidNode.class, Self.class), new DruidNode("test-inject", null, false, null, null, true, false) ); } } diff --git a/extensions-core/lookups-cached-global/src/test/java/org/apache/druid/server/lookup/namespace/cache/OffHeapNamespaceExtractionCacheManagerTest.java b/extensions-core/lookups-cached-global/src/test/java/org/apache/druid/server/lookup/namespace/cache/OffHeapNamespaceExtractionCacheManagerTest.java index 9c9e4cecbc9..699f688542d 100644 --- a/extensions-core/lookups-cached-global/src/test/java/org/apache/druid/server/lookup/namespace/cache/OffHeapNamespaceExtractionCacheManagerTest.java +++ b/extensions-core/lookups-cached-global/src/test/java/org/apache/druid/server/lookup/namespace/cache/OffHeapNamespaceExtractionCacheManagerTest.java @@ -49,7 +49,7 @@ public class OffHeapNamespaceExtractionCacheManagerTest public void configure(Binder binder) { JsonConfigProvider.bindInstance( - binder, Key.get(DruidNode.class, Self.class), new DruidNode("test-inject", null, null, null, true, false) + binder, Key.get(DruidNode.class, Self.class), new DruidNode("test-inject", null, false, null, null, true, false) ); } } diff --git a/extensions-core/lookups-cached-global/src/test/java/org/apache/druid/server/lookup/namespace/cache/OnHeapNamespaceExtractionCacheManagerTest.java b/extensions-core/lookups-cached-global/src/test/java/org/apache/druid/server/lookup/namespace/cache/OnHeapNamespaceExtractionCacheManagerTest.java index de1c7425d10..9f8330c3aab 100644 --- a/extensions-core/lookups-cached-global/src/test/java/org/apache/druid/server/lookup/namespace/cache/OnHeapNamespaceExtractionCacheManagerTest.java +++ b/extensions-core/lookups-cached-global/src/test/java/org/apache/druid/server/lookup/namespace/cache/OnHeapNamespaceExtractionCacheManagerTest.java @@ -49,7 +49,7 @@ public class OnHeapNamespaceExtractionCacheManagerTest public void configure(Binder binder) { JsonConfigProvider.bindInstance( - binder, Key.get(DruidNode.class, Self.class), new DruidNode("test-inject", null, null, null, true, false) + binder, Key.get(DruidNode.class, Self.class), new DruidNode("test-inject", null, false, null, null, true, false) ); } } diff --git a/indexing-hadoop/src/main/java/org/apache/druid/indexer/HadoopDruidIndexerConfig.java b/indexing-hadoop/src/main/java/org/apache/druid/indexer/HadoopDruidIndexerConfig.java index b1b2f7fc894..2cf53584878 100644 --- a/indexing-hadoop/src/main/java/org/apache/druid/indexer/HadoopDruidIndexerConfig.java +++ b/indexing-hadoop/src/main/java/org/apache/druid/indexer/HadoopDruidIndexerConfig.java @@ -109,7 +109,7 @@ public class HadoopDruidIndexerConfig public void configure(Binder binder) { JsonConfigProvider.bindInstance( - binder, Key.get(DruidNode.class, Self.class), new DruidNode("hadoop-indexer", null, null, null, true, false) + binder, Key.get(DruidNode.class, Self.class), new DruidNode("hadoop-indexer", null, false, null, null, true, false) ); JsonConfigProvider.bind(binder, "druid.hadoop.security.kerberos", HadoopKerberosConfig.class); } diff --git a/indexing-hadoop/src/main/java/org/apache/druid/indexer/updater/HadoopDruidConverterConfig.java b/indexing-hadoop/src/main/java/org/apache/druid/indexer/updater/HadoopDruidConverterConfig.java index 9d25dce5fae..9d0a30625ee 100644 --- a/indexing-hadoop/src/main/java/org/apache/druid/indexer/updater/HadoopDruidConverterConfig.java +++ b/indexing-hadoop/src/main/java/org/apache/druid/indexer/updater/HadoopDruidConverterConfig.java @@ -64,7 +64,7 @@ public class HadoopDruidConverterConfig public void configure(Binder binder) { JsonConfigProvider.bindInstance( - binder, Key.get(DruidNode.class, Self.class), new DruidNode("hadoop-converter", null, null, null, true, false) + binder, Key.get(DruidNode.class, Self.class), new DruidNode("hadoop-converter", null, false, null, null, true, false) ); } } diff --git a/indexing-hadoop/src/test/java/org/apache/druid/indexer/path/DatasourcePathSpecTest.java b/indexing-hadoop/src/test/java/org/apache/druid/indexer/path/DatasourcePathSpecTest.java index 3d0922e6801..6256effb4ef 100644 --- a/indexing-hadoop/src/test/java/org/apache/druid/indexer/path/DatasourcePathSpecTest.java +++ b/indexing-hadoop/src/test/java/org/apache/druid/indexer/path/DatasourcePathSpecTest.java @@ -172,7 +172,7 @@ public class DatasourcePathSpecTest JsonConfigProvider.bindInstance( binder, Key.get(DruidNode.class, Self.class), - new DruidNode("dummy-node", null, null, null, true, false) + new DruidNode("dummy-node", null, false, null, null, true, false) ); } } diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/overlord/SingleTaskBackgroundRunnerTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/overlord/SingleTaskBackgroundRunnerTest.java index 753972bfdcd..9f30ff97414 100644 --- a/indexing-service/src/test/java/org/apache/druid/indexing/overlord/SingleTaskBackgroundRunnerTest.java +++ b/indexing-service/src/test/java/org/apache/druid/indexing/overlord/SingleTaskBackgroundRunnerTest.java @@ -68,7 +68,7 @@ public class SingleTaskBackgroundRunnerTest public void setup() throws IOException { final TestUtils utils = new TestUtils(); - final DruidNode node = new DruidNode("testServer", "testHost", 1000, null, true, false); + final DruidNode node = new DruidNode("testServer", "testHost", false, 1000, null, true, false); final TaskConfig taskConfig = new TaskConfig( temporaryFolder.newFile().toString(), null, diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/overlord/TaskLifecycleTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/overlord/TaskLifecycleTest.java index af814d9f849..f2366056ac2 100644 --- a/indexing-service/src/test/java/org/apache/druid/indexing/overlord/TaskLifecycleTest.java +++ b/indexing-service/src/test/java/org/apache/druid/indexing/overlord/TaskLifecycleTest.java @@ -638,7 +638,7 @@ public class TaskLifecycleTest tb, taskConfig, emitter, - new DruidNode("dummy", "dummy", 10000, null, true, false), + new DruidNode("dummy", "dummy", false, 10000, null, true, false), new ServerConfig() ); } diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/overlord/hrtr/HttpRemoteTaskRunnerTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/overlord/hrtr/HttpRemoteTaskRunnerTest.java index 86194f13dc6..56ec10a6be6 100644 --- a/indexing-service/src/test/java/org/apache/druid/indexing/overlord/hrtr/HttpRemoteTaskRunnerTest.java +++ b/indexing-service/src/test/java/org/apache/druid/indexing/overlord/hrtr/HttpRemoteTaskRunnerTest.java @@ -129,7 +129,7 @@ public class HttpRemoteTaskRunnerTest taskRunner.start(); DiscoveryDruidNode druidNode1 = new DiscoveryDruidNode( - new DruidNode("service", "host1", 8080, null, true, false), + new DruidNode("service", "host1", false, 8080, null, true, false), NodeType.MIDDLE_MANAGER, ImmutableMap.of( WorkerNodeService.DISCOVERY_SERVICE_KEY, new WorkerNodeService("ip1", 2, "0") @@ -137,7 +137,7 @@ public class HttpRemoteTaskRunnerTest ); DiscoveryDruidNode druidNode2 = new DiscoveryDruidNode( - new DruidNode("service", "host2", 8080, null, true, false), + new DruidNode("service", "host2", false, 8080, null, true, false), NodeType.MIDDLE_MANAGER, ImmutableMap.of( WorkerNodeService.DISCOVERY_SERVICE_KEY, new WorkerNodeService("ip2", 2, "0") @@ -221,7 +221,7 @@ public class HttpRemoteTaskRunnerTest taskRunner.start(); DiscoveryDruidNode druidNode1 = new DiscoveryDruidNode( - new DruidNode("service", "host1", 8080, null, true, false), + new DruidNode("service", "host1", false, 8080, null, true, false), NodeType.MIDDLE_MANAGER, ImmutableMap.of( WorkerNodeService.DISCOVERY_SERVICE_KEY, new WorkerNodeService("ip1", 2, "0") @@ -229,7 +229,7 @@ public class HttpRemoteTaskRunnerTest ); DiscoveryDruidNode druidNode2 = new DiscoveryDruidNode( - new DruidNode("service", "host2", 8080, null, true, false), + new DruidNode("service", "host2", false, 8080, null, true, false), NodeType.MIDDLE_MANAGER, ImmutableMap.of( WorkerNodeService.DISCOVERY_SERVICE_KEY, new WorkerNodeService("ip2", 2, "0") @@ -324,7 +324,7 @@ public class HttpRemoteTaskRunnerTest taskRunner.start(); DiscoveryDruidNode druidNode = new DiscoveryDruidNode( - new DruidNode("service", "host", 1234, null, true, false), + new DruidNode("service", "host", false, 1234, null, true, false), NodeType.MIDDLE_MANAGER, ImmutableMap.of( WorkerNodeService.DISCOVERY_SERVICE_KEY, new WorkerNodeService("ip1", 2, "0") @@ -458,7 +458,7 @@ public class HttpRemoteTaskRunnerTest Task task2 = NoopTask.create("task-id-2", 0); DiscoveryDruidNode druidNode = new DiscoveryDruidNode( - new DruidNode("service", "host", 1234, null, true, false), + new DruidNode("service", "host", false, 1234, null, true, false), NodeType.MIDDLE_MANAGER, ImmutableMap.of( WorkerNodeService.DISCOVERY_SERVICE_KEY, new WorkerNodeService("ip1", 2, "0") @@ -621,7 +621,7 @@ public class HttpRemoteTaskRunnerTest Task task2 = NoopTask.create("task-id-2", 0); DiscoveryDruidNode druidNode = new DiscoveryDruidNode( - new DruidNode("service", "host", 1234, null, true, false), + new DruidNode("service", "host", false, 1234, null, true, false), NodeType.MIDDLE_MANAGER, ImmutableMap.of( WorkerNodeService.DISCOVERY_SERVICE_KEY, new WorkerNodeService("ip1", 2, "0") @@ -788,7 +788,7 @@ public class HttpRemoteTaskRunnerTest AtomicInteger ticks = new AtomicInteger(); DiscoveryDruidNode druidNode1 = new DiscoveryDruidNode( - new DruidNode("service", "host1", 8080, null, true, false), + new DruidNode("service", "host1", false, 8080, null, true, false), NodeType.MIDDLE_MANAGER, ImmutableMap.of( WorkerNodeService.DISCOVERY_SERVICE_KEY, new WorkerNodeService("ip1", 1, "0") @@ -832,7 +832,7 @@ public class HttpRemoteTaskRunnerTest } DiscoveryDruidNode druidNode2 = new DiscoveryDruidNode( - new DruidNode("service", "host2", 8080, null, true, false), + new DruidNode("service", "host2", false, 8080, null, true, false), NodeType.MIDDLE_MANAGER, ImmutableMap.of( WorkerNodeService.DISCOVERY_SERVICE_KEY, new WorkerNodeService("ip2", 1, "0") @@ -865,7 +865,7 @@ public class HttpRemoteTaskRunnerTest } DiscoveryDruidNode druidNode3 = new DiscoveryDruidNode( - new DruidNode("service", "host3", 8080, null, true, false), + new DruidNode("service", "host3", false, 8080, null, true, false), NodeType.MIDDLE_MANAGER, ImmutableMap.of( WorkerNodeService.DISCOVERY_SERVICE_KEY, new WorkerNodeService("ip2", 1, "0") diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/overlord/http/OverlordTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/overlord/http/OverlordTest.java index f34dcd10bf8..3a4c210c200 100644 --- a/indexing-service/src/test/java/org/apache/druid/indexing/overlord/http/OverlordTest.java +++ b/indexing-service/src/test/java/org/apache/druid/indexing/overlord/http/OverlordTest.java @@ -166,7 +166,7 @@ public class OverlordTest setupServerAndCurator(); curator.start(); curator.blockUntilConnected(); - druidNode = new DruidNode("hey", "what", 1234, null, true, false); + druidNode = new DruidNode("hey", "what", false, 1234, null, true, false); ServiceEmitter serviceEmitter = new NoopServiceEmitter(); taskMaster = new TaskMaster( new TaskQueueConfig(null, new Period(1), null, new Period(10)), diff --git a/indexing-service/src/test/java/org/apache/druid/indexing/worker/WorkerTaskMonitorTest.java b/indexing-service/src/test/java/org/apache/druid/indexing/worker/WorkerTaskMonitorTest.java index 3e69c836298..8303f5d3173 100644 --- a/indexing-service/src/test/java/org/apache/druid/indexing/worker/WorkerTaskMonitorTest.java +++ b/indexing-service/src/test/java/org/apache/druid/indexing/worker/WorkerTaskMonitorTest.java @@ -73,7 +73,7 @@ public class WorkerTaskMonitorTest private static final String basePath = "/test/druid"; private static final String tasksPath = StringUtils.format("%s/indexer/tasks/worker", basePath); private static final String statusPath = StringUtils.format("%s/indexer/status/worker", basePath); - private static final DruidNode DUMMY_NODE = new DruidNode("dummy", "dummy", 9000, null, true, false); + private static final DruidNode DUMMY_NODE = new DruidNode("dummy", "dummy", false, 9000, null, true, false); private TestingCluster testingCluster; private CuratorFramework cf; diff --git a/integration-tests/src/main/java/org/apache/druid/testing/guice/DruidTestModule.java b/integration-tests/src/main/java/org/apache/druid/testing/guice/DruidTestModule.java index d849f91844f..1e239ae57db 100644 --- a/integration-tests/src/main/java/org/apache/druid/testing/guice/DruidTestModule.java +++ b/integration-tests/src/main/java/org/apache/druid/testing/guice/DruidTestModule.java @@ -57,7 +57,7 @@ public class DruidTestModule implements Module // Bind DruidNode instance to make Guice happy. This instance is currently unused. binder.bind(DruidNode.class).annotatedWith(Self.class).toInstance( - new DruidNode("integration-tests", "localhost", 9191, null, null, true, false) + new DruidNode("integration-tests", "localhost", false, 9191, null, null, true, false) ); } diff --git a/server/src/main/java/org/apache/druid/segment/realtime/firehose/ServiceAnnouncingChatHandlerProvider.java b/server/src/main/java/org/apache/druid/segment/realtime/firehose/ServiceAnnouncingChatHandlerProvider.java index f40fd1b40ce..df2f08ab1e9 100644 --- a/server/src/main/java/org/apache/druid/segment/realtime/firehose/ServiceAnnouncingChatHandlerProvider.java +++ b/server/src/main/java/org/apache/druid/segment/realtime/firehose/ServiceAnnouncingChatHandlerProvider.java @@ -123,6 +123,6 @@ public class ServiceAnnouncingChatHandlerProvider implements ChatHandlerProvider private DruidNode makeDruidNode(String key) { - return new DruidNode(key, node.getHost(), node.getPlaintextPort(), node.getTlsPort(), node.isEnablePlaintextPort(), node.isEnableTlsPort()); + return new DruidNode(key, node.getHost(), node.isBindOnHost(), node.getPlaintextPort(), node.getTlsPort(), node.isEnablePlaintextPort(), node.isEnableTlsPort()); } } diff --git a/server/src/main/java/org/apache/druid/server/DruidNode.java b/server/src/main/java/org/apache/druid/server/DruidNode.java index 1090a22640c..8454dc67394 100644 --- a/server/src/main/java/org/apache/druid/server/DruidNode.java +++ b/server/src/main/java/org/apache/druid/server/DruidNode.java @@ -47,6 +47,13 @@ public class DruidNode @NotNull private String host; + /** + * This property indicates whether the druid node's internal jetty server bind on {@link DruidNode#host}. + * Default is false, which means binding to all interfaces. + */ + @JsonProperty + private boolean bindOnHost = false; + /** * This property is now deprecated, this is present just so that JsonConfigurator does not fail if this is set. * Please use {@link DruidNode#plaintextPort} instead, which if set will be used and hence this has -1 as default value. @@ -73,13 +80,14 @@ public class DruidNode public DruidNode( String serviceName, String host, + boolean bindOnHost, Integer plaintextPort, Integer tlsPort, boolean enablePlaintextPort, boolean enableTlsPort ) { - this(serviceName, host, plaintextPort, null, tlsPort, enablePlaintextPort, enableTlsPort); + this(serviceName, host, bindOnHost, plaintextPort, null, tlsPort, enablePlaintextPort, enableTlsPort); } /** @@ -103,6 +111,7 @@ public class DruidNode public DruidNode( @JacksonInject @Named("serviceName") @JsonProperty("service") String serviceName, @JsonProperty("host") String host, + @JsonProperty("bindOnHost") boolean bindOnHost, @JsonProperty("plaintextPort") Integer plaintextPort, @JacksonInject @Named("servicePort") @JsonProperty("port") Integer port, @JacksonInject @Named("tlsServicePort") @JsonProperty("tlsPort") Integer tlsPort, @@ -113,6 +122,7 @@ public class DruidNode init( serviceName, host, + bindOnHost, plaintextPort != null ? plaintextPort : port, tlsPort, enablePlaintextPort == null ? true : enablePlaintextPort.booleanValue(), @@ -120,7 +130,7 @@ public class DruidNode ); } - private void init(String serviceName, String host, Integer plainTextPort, Integer tlsPort, boolean enablePlaintextPort, boolean enableTlsPort) + private void init(String serviceName, String host, boolean bindOnHost, Integer plainTextPort, Integer tlsPort, boolean enablePlaintextPort, boolean enableTlsPort) { Preconditions.checkNotNull(serviceName); @@ -178,6 +188,7 @@ public class DruidNode this.serviceName = serviceName; this.host = host; + this.bindOnHost = bindOnHost; } public String getServiceName() @@ -190,6 +201,11 @@ public class DruidNode return host; } + public boolean isBindOnHost() + { + return bindOnHost; + } + public int getPlaintextPort() { return plaintextPort; @@ -212,7 +228,7 @@ public class DruidNode public DruidNode withService(String service) { - return new DruidNode(service, host, plaintextPort, tlsPort, enablePlaintextPort, enableTlsPort); + return new DruidNode(service, host, bindOnHost, plaintextPort, tlsPort, enablePlaintextPort, enableTlsPort); } public String getServiceScheme() @@ -278,6 +294,7 @@ public class DruidNode } DruidNode druidNode = (DruidNode) o; return port == druidNode.port && + bindOnHost == druidNode.bindOnHost && plaintextPort == druidNode.plaintextPort && enablePlaintextPort == druidNode.enablePlaintextPort && tlsPort == druidNode.tlsPort && @@ -298,6 +315,7 @@ public class DruidNode return "DruidNode{" + "serviceName='" + serviceName + '\'' + ", host='" + host + '\'' + + ", bindOnHost=" + bindOnHost + ", port=" + port + ", plaintextPort=" + plaintextPort + ", enablePlaintextPort=" + enablePlaintextPort + diff --git a/server/src/main/java/org/apache/druid/server/initialization/jetty/JettyServerModule.java b/server/src/main/java/org/apache/druid/server/initialization/jetty/JettyServerModule.java index 269bb2c554e..78b17446912 100644 --- a/server/src/main/java/org/apache/druid/server/initialization/jetty/JettyServerModule.java +++ b/server/src/main/java/org/apache/druid/server/initialization/jetty/JettyServerModule.java @@ -223,6 +223,9 @@ public class JettyServerModule extends JerseyServletModule HttpConfiguration httpConfiguration = new HttpConfiguration(); httpConfiguration.setRequestHeaderSize(config.getMaxRequestHeaderSize()); final ServerConnector connector = new ServerConnector(server, new HttpConnectionFactory(httpConfiguration)); + if (node.isBindOnHost()) { + connector.setHost(node.getHost()); + } connector.setPort(node.getPlaintextPort()); serverConnectors.add(connector); } @@ -304,6 +307,9 @@ public class JettyServerModule extends JerseyServletModule new SslConnectionFactory(sslContextFactory, HTTP_1_1_STRING), new HttpConnectionFactory(httpsConfiguration) ); + if (node.isBindOnHost()) { + connector.setHost(node.getHost()); + } connector.setPort(node.getTlsPort()); serverConnectors.add(connector); } else { diff --git a/server/src/test/java/org/apache/druid/client/HttpServerInventoryViewTest.java b/server/src/test/java/org/apache/druid/client/HttpServerInventoryViewTest.java index 80681576775..683d52c8522 100644 --- a/server/src/test/java/org/apache/druid/client/HttpServerInventoryViewTest.java +++ b/server/src/test/java/org/apache/druid/client/HttpServerInventoryViewTest.java @@ -167,7 +167,7 @@ public class HttpServerInventoryViewTest ); DiscoveryDruidNode druidNode = new DiscoveryDruidNode( - new DruidNode("service", "host", 8080, null, true, false), + new DruidNode("service", "host", false, 8080, null, true, false), NodeType.HISTORICAL, ImmutableMap.of( DataNodeService.DISCOVERY_SERVICE_KEY, new DataNodeService("tier", 1000, ServerType.HISTORICAL, 0) diff --git a/server/src/test/java/org/apache/druid/client/cache/CacheMonitorTest.java b/server/src/test/java/org/apache/druid/client/cache/CacheMonitorTest.java index f6bb3165ac6..2eee29cba36 100644 --- a/server/src/test/java/org/apache/druid/client/cache/CacheMonitorTest.java +++ b/server/src/test/java/org/apache/druid/client/cache/CacheMonitorTest.java @@ -43,7 +43,7 @@ public class CacheMonitorTest public void configure(Binder binder) { JsonConfigProvider.bindInstance( - binder, Key.get(DruidNode.class, Self.class), new DruidNode("test-inject", null, null, null, true, false) + binder, Key.get(DruidNode.class, Self.class), new DruidNode("test-inject", null, false, null, null, true, false) ); } } @@ -62,7 +62,7 @@ public class CacheMonitorTest public void configure(Binder binder) { JsonConfigProvider.bindInstance( - binder, Key.get(DruidNode.class, Self.class), new DruidNode("test-inject", null, null, null, true, false) + binder, Key.get(DruidNode.class, Self.class), new DruidNode("test-inject", null, false, null, null, true, false) ); binder.bind(Cache.class).toInstance(MapCache.create(0)); } diff --git a/server/src/test/java/org/apache/druid/curator/discovery/CuratorDruidLeaderSelectorTest.java b/server/src/test/java/org/apache/druid/curator/discovery/CuratorDruidLeaderSelectorTest.java index 3c452d3a607..9b06fabfe74 100644 --- a/server/src/test/java/org/apache/druid/curator/discovery/CuratorDruidLeaderSelectorTest.java +++ b/server/src/test/java/org/apache/druid/curator/discovery/CuratorDruidLeaderSelectorTest.java @@ -59,7 +59,7 @@ public class CuratorDruidLeaderSelectorTest extends CuratorTestBase CuratorDruidLeaderSelector leaderSelector1 = new CuratorDruidLeaderSelector( curator, - new DruidNode("s1", "h1", 8080, null, true, false), + new DruidNode("s1", "h1", false, 8080, null, true, false), latchPath ); leaderSelector1.registerListener( @@ -91,7 +91,7 @@ public class CuratorDruidLeaderSelectorTest extends CuratorTestBase CuratorDruidLeaderSelector leaderSelector2 = new CuratorDruidLeaderSelector( curator, - new DruidNode("s2", "h2", 8080, null, true, false), + new DruidNode("s2", "h2", false, 8080, null, true, false), latchPath ); leaderSelector2.registerListener( @@ -131,7 +131,7 @@ public class CuratorDruidLeaderSelectorTest extends CuratorTestBase CuratorDruidLeaderSelector leaderSelector3 = new CuratorDruidLeaderSelector( curator, - new DruidNode("s3", "h3", 8080, null, true, false), + new DruidNode("s3", "h3", false, 8080, null, true, false), latchPath ); leaderSelector3.registerListener( diff --git a/server/src/test/java/org/apache/druid/curator/discovery/CuratorDruidNodeAnnouncerAndDiscoveryTest.java b/server/src/test/java/org/apache/druid/curator/discovery/CuratorDruidNodeAnnouncerAndDiscoveryTest.java index daac842dd57..e4f577ed02f 100644 --- a/server/src/test/java/org/apache/druid/curator/discovery/CuratorDruidNodeAnnouncerAndDiscoveryTest.java +++ b/server/src/test/java/org/apache/druid/curator/discovery/CuratorDruidNodeAnnouncerAndDiscoveryTest.java @@ -80,25 +80,25 @@ public class CuratorDruidNodeAnnouncerAndDiscoveryTest extends CuratorTestBase ); DiscoveryDruidNode node1 = new DiscoveryDruidNode( - new DruidNode("s1", "h1", 8080, null, true, false), + new DruidNode("s1", "h1", false, 8080, null, true, false), NodeType.COORDINATOR, ImmutableMap.of() ); DiscoveryDruidNode node2 = new DiscoveryDruidNode( - new DruidNode("s2", "h2", 8080, null, true, false), + new DruidNode("s2", "h2", false, 8080, null, true, false), NodeType.COORDINATOR, ImmutableMap.of() ); DiscoveryDruidNode node3 = new DiscoveryDruidNode( - new DruidNode("s3", "h3", 8080, null, true, false), + new DruidNode("s3", "h3", false, 8080, null, true, false), NodeType.OVERLORD, ImmutableMap.of() ); DiscoveryDruidNode node4 = new DiscoveryDruidNode( - new DruidNode("s4", "h4", 8080, null, true, false), + new DruidNode("s4", "h4", false, 8080, null, true, false), NodeType.OVERLORD, ImmutableMap.of() ); diff --git a/server/src/test/java/org/apache/druid/discovery/DruidLeaderClientTest.java b/server/src/test/java/org/apache/druid/discovery/DruidLeaderClientTest.java index b9f00c07b08..40576e211f8 100644 --- a/server/src/test/java/org/apache/druid/discovery/DruidLeaderClientTest.java +++ b/server/src/test/java/org/apache/druid/discovery/DruidLeaderClientTest.java @@ -79,7 +79,7 @@ public class DruidLeaderClientTest extends BaseJettyTest @Override protected Injector setupInjector() { - final DruidNode node = new DruidNode("test", "localhost", null, null, true, false); + final DruidNode node = new DruidNode("test", "localhost", false, null, null, true, false); discoveryDruidNode = new DiscoveryDruidNode(node, NodeType.PEON, ImmutableMap.of()); Injector injector = Initialization.makeInjectorWithModules( @@ -193,7 +193,7 @@ public class DruidLeaderClientTest extends BaseJettyTest DruidNodeDiscovery druidNodeDiscovery = EasyMock.createMock(DruidNodeDiscovery.class); DiscoveryDruidNode dummyNode = new DiscoveryDruidNode( - new DruidNode("test", "dummyhost", 64231, null, true, false), + new DruidNode("test", "dummyhost", false, 64231, null, true, false), NodeType.PEON, ImmutableMap.of() ); diff --git a/server/src/test/java/org/apache/druid/discovery/DruidNodeDiscoveryProviderTest.java b/server/src/test/java/org/apache/druid/discovery/DruidNodeDiscoveryProviderTest.java index 5c13dacc1ef..d361df528e8 100644 --- a/server/src/test/java/org/apache/druid/discovery/DruidNodeDiscoveryProviderTest.java +++ b/server/src/test/java/org/apache/druid/discovery/DruidNodeDiscoveryProviderTest.java @@ -86,7 +86,7 @@ public class DruidNodeDiscoveryProviderTest Assert.assertTrue(lookupNodeDiscovery.getAllNodes().isEmpty()); DiscoveryDruidNode node1 = new DiscoveryDruidNode( - new DruidNode("s1", "h1", 8080, null, true, false), + new DruidNode("s1", "h1", false, 8080, null, true, false), NodeType.HISTORICAL, ImmutableMap.of( DataNodeService.DISCOVERY_SERVICE_KEY, new DataNodeService("tier", 1000, ServerType.HISTORICAL, 0), @@ -94,21 +94,21 @@ public class DruidNodeDiscoveryProviderTest ); DiscoveryDruidNode node2 = new DiscoveryDruidNode( - new DruidNode("s2", "h2", 8080, null, true, false), + new DruidNode("s2", "h2", false, 8080, null, true, false), NodeType.HISTORICAL, ImmutableMap.of( DataNodeService.DISCOVERY_SERVICE_KEY, new DataNodeService("tier", 1000, ServerType.HISTORICAL, 0)) ); DiscoveryDruidNode node3 = new DiscoveryDruidNode( - new DruidNode("s3", "h3", 8080, null, true, false), + new DruidNode("s3", "h3", false, 8080, null, true, false), NodeType.HISTORICAL, ImmutableMap.of( LookupNodeService.DISCOVERY_SERVICE_KEY, new LookupNodeService("tier")) ); DiscoveryDruidNode node4 = new DiscoveryDruidNode( - new DruidNode("s4", "h4", 8080, null, true, false), + new DruidNode("s4", "h4", false, 8080, null, true, false), NodeType.PEON, ImmutableMap.of( DataNodeService.DISCOVERY_SERVICE_KEY, new DataNodeService("tier", 1000, ServerType.HISTORICAL, 0), @@ -116,35 +116,35 @@ public class DruidNodeDiscoveryProviderTest ); DiscoveryDruidNode node5 = new DiscoveryDruidNode( - new DruidNode("s5", "h5", 8080, null, true, false), + new DruidNode("s5", "h5", false, 8080, null, true, false), NodeType.PEON, ImmutableMap.of( DataNodeService.DISCOVERY_SERVICE_KEY, new DataNodeService("tier", 1000, ServerType.HISTORICAL, 0)) ); DiscoveryDruidNode node6 = new DiscoveryDruidNode( - new DruidNode("s6", "h6", 8080, null, true, false), + new DruidNode("s6", "h6", false, 8080, null, true, false), NodeType.PEON, ImmutableMap.of( LookupNodeService.DISCOVERY_SERVICE_KEY, new LookupNodeService("tier")) ); DiscoveryDruidNode node7 = new DiscoveryDruidNode( - new DruidNode("s7", "h7", 8080, null, true, false), + new DruidNode("s7", "h7", false, 8080, null, true, false), NodeType.BROKER, ImmutableMap.of( LookupNodeService.DISCOVERY_SERVICE_KEY, new LookupNodeService("tier")) ); DiscoveryDruidNode node7Clone = new DiscoveryDruidNode( - new DruidNode("s7", "h7", 8080, null, true, false), + new DruidNode("s7", "h7", false, 8080, null, true, false), NodeType.BROKER, ImmutableMap.of( LookupNodeService.DISCOVERY_SERVICE_KEY, new LookupNodeService("tier")) ); DiscoveryDruidNode node8 = new DiscoveryDruidNode( - new DruidNode("s8", "h8", 8080, null, true, false), + new DruidNode("s8", "h8", false, 8080, null, true, false), NodeType.COORDINATOR, ImmutableMap.of() ); diff --git a/server/src/test/java/org/apache/druid/initialization/InitializationTest.java b/server/src/test/java/org/apache/druid/initialization/InitializationTest.java index 1f31a25fbb9..f53a07819a9 100644 --- a/server/src/test/java/org/apache/druid/initialization/InitializationTest.java +++ b/server/src/test/java/org/apache/druid/initialization/InitializationTest.java @@ -141,7 +141,7 @@ public class InitializationTest public void configure(Binder binder) { JsonConfigProvider.bindInstance( - binder, Key.get(DruidNode.class, Self.class), new DruidNode("test-inject", null, null, null, true, false) + binder, Key.get(DruidNode.class, Self.class), new DruidNode("test-inject", null, false, null, null, true, false) ); } } diff --git a/server/src/test/java/org/apache/druid/query/lookup/LookupListeningAnnouncerConfigTest.java b/server/src/test/java/org/apache/druid/query/lookup/LookupListeningAnnouncerConfigTest.java index 1c653d4869c..a199a6ece11 100644 --- a/server/src/test/java/org/apache/druid/query/lookup/LookupListeningAnnouncerConfigTest.java +++ b/server/src/test/java/org/apache/druid/query/lookup/LookupListeningAnnouncerConfigTest.java @@ -50,7 +50,7 @@ public class LookupListeningAnnouncerConfigTest public void configure(Binder binder) { JsonConfigProvider.bindInstance( - binder, Key.get(DruidNode.class, Self.class), new DruidNode("test-inject", null, null, null, true, false) + binder, Key.get(DruidNode.class, Self.class), new DruidNode("test-inject", null, false, null, null, true, false) ); binder.bind(Key.get( String.class, diff --git a/server/src/test/java/org/apache/druid/segment/realtime/firehose/ServiceAnnouncingChatHandlerProviderTest.java b/server/src/test/java/org/apache/druid/segment/realtime/firehose/ServiceAnnouncingChatHandlerProviderTest.java index 8815ff524d5..4c69ef5bf44 100644 --- a/server/src/test/java/org/apache/druid/segment/realtime/firehose/ServiceAnnouncingChatHandlerProviderTest.java +++ b/server/src/test/java/org/apache/druid/segment/realtime/firehose/ServiceAnnouncingChatHandlerProviderTest.java @@ -88,6 +88,7 @@ public class ServiceAnnouncingChatHandlerProviderTest extends EasyMockSupport Capture captured = Capture.newInstance(); EasyMock.expect(node.getHost()).andReturn(TEST_HOST); + EasyMock.expect(node.isBindOnHost()).andReturn(false); EasyMock.expect(node.getPlaintextPort()).andReturn(TEST_PORT); EasyMock.expect(node.isEnablePlaintextPort()).andReturn(true); EasyMock.expect(node.isEnableTlsPort()).andReturn(false); @@ -116,6 +117,7 @@ public class ServiceAnnouncingChatHandlerProviderTest extends EasyMockSupport captured.reset(); resetAll(); EasyMock.expect(node.getHost()).andReturn(TEST_HOST); + EasyMock.expect(node.isBindOnHost()).andReturn(false); EasyMock.expect(node.getPlaintextPort()).andReturn(TEST_PORT); EasyMock.expect(node.isEnablePlaintextPort()).andReturn(true); EasyMock.expect(node.getTlsPort()).andReturn(-1); diff --git a/server/src/test/java/org/apache/druid/server/AsyncManagementForwardingServletTest.java b/server/src/test/java/org/apache/druid/server/AsyncManagementForwardingServletTest.java index 58ddd5c55f3..c2269e441b7 100644 --- a/server/src/test/java/org/apache/druid/server/AsyncManagementForwardingServletTest.java +++ b/server/src/test/java/org/apache/druid/server/AsyncManagementForwardingServletTest.java @@ -124,7 +124,7 @@ public class AsyncManagementForwardingServletTest extends BaseJettyTest { return Initialization.makeInjectorWithModules(GuiceInjectors.makeStartupInjector(), ImmutableList.of((binder) -> { JsonConfigProvider.bindInstance( - binder, Key.get(DruidNode.class, Self.class), new DruidNode("test", "localhost", null, null, true, false) + binder, Key.get(DruidNode.class, Self.class), new DruidNode("test", "localhost", false, null, null, true, false) ); binder.bind(JettyServerInitializer.class).to(ProxyJettyServerInit.class).in(LazySingleton.class); LifecycleModule.register(binder, Server.class); diff --git a/server/src/test/java/org/apache/druid/server/AsyncQueryForwardingServletTest.java b/server/src/test/java/org/apache/druid/server/AsyncQueryForwardingServletTest.java index 49cb2a9608c..262ad92df7b 100644 --- a/server/src/test/java/org/apache/druid/server/AsyncQueryForwardingServletTest.java +++ b/server/src/test/java/org/apache/druid/server/AsyncQueryForwardingServletTest.java @@ -118,7 +118,7 @@ public class AsyncQueryForwardingServletTest extends BaseJettyTest JsonConfigProvider.bindInstance( binder, Key.get(DruidNode.class, Self.class), - new DruidNode("test", "localhost", null, null, true, false) + new DruidNode("test", "localhost", false, null, null, true, false) ); binder.bind(JettyServerInitializer.class).to(ProxyJettyServerInit.class).in(LazySingleton.class); binder.bind(AuthorizerMapper.class).toInstance( diff --git a/server/src/test/java/org/apache/druid/server/DruidNodeTest.java b/server/src/test/java/org/apache/druid/server/DruidNodeTest.java index d08bba0fddb..158d58b3b53 100644 --- a/server/src/test/java/org/apache/druid/server/DruidNodeTest.java +++ b/server/src/test/java/org/apache/druid/server/DruidNodeTest.java @@ -47,135 +47,135 @@ public class DruidNodeTest DruidNode node; - node = new DruidNode(service, null, null, null, true, false); + node = new DruidNode(service, null, false, null, null, true, false); Assert.assertEquals(DruidNode.getDefaultHost(), node.getHost()); Assert.assertEquals(-1, node.getPlaintextPort()); // Hosts which report only ipv6 will have getDefaultHost() report something like fe80::6e40:8ff:fe93:9230 // but getHostAndPort() reports [fe80::6e40:8ff:fe93:9230] Assert.assertEquals(HostAndPort.fromString(DruidNode.getDefaultHost()).toString(), node.getHostAndPort()); - node = new DruidNode(service, "2001:db8:85a3::8a2e:370:7334", -1, null, true, false); + node = new DruidNode(service, "2001:db8:85a3::8a2e:370:7334", false, -1, null, true, false); Assert.assertEquals("2001:db8:85a3::8a2e:370:7334", node.getHost()); Assert.assertEquals(-1, node.getPlaintextPort()); Assert.assertEquals("[2001:db8:85a3::8a2e:370:7334]", node.getHostAndPort()); - node = new DruidNode(service, "abc:123", null, null, true, false); + node = new DruidNode(service, "abc:123", false, null, null, true, false); Assert.assertEquals("abc", node.getHost()); Assert.assertEquals(123, node.getPlaintextPort()); Assert.assertEquals("abc:123", node.getHostAndPort()); - node = new DruidNode(service, "2001:db8:85a3::8a2e:370:7334", null, null, true, false); + node = new DruidNode(service, "2001:db8:85a3::8a2e:370:7334", false, null, null, true, false); Assert.assertEquals("2001:db8:85a3::8a2e:370:7334", node.getHost()); Assert.assertTrue(8080 <= node.getPlaintextPort()); - node = new DruidNode(service, "[2001:db8:85a3::8a2e:370:7334]", null, null, true, false); + node = new DruidNode(service, "[2001:db8:85a3::8a2e:370:7334]", false, null, null, true, false); Assert.assertEquals("2001:db8:85a3::8a2e:370:7334", node.getHost()); Assert.assertTrue(8080 <= node.getPlaintextPort()); - node = new DruidNode(service, "abc", null, null, true, false); + node = new DruidNode(service, "abc", false, null, null, true, false); Assert.assertEquals("abc", node.getHost()); Assert.assertTrue(8080 <= node.getPlaintextPort()); - node = new DruidNode(service, "abc", 123, null, true, false); + node = new DruidNode(service, "abc", false, 123, null, true, false); Assert.assertEquals("abc", node.getHost()); Assert.assertEquals(123, node.getPlaintextPort()); Assert.assertEquals("abc:123", node.getHostAndPort()); - node = new DruidNode(service, "abc:123", 123, null, true, false); + node = new DruidNode(service, "abc:123", false, 123, null, true, false); Assert.assertEquals("abc", node.getHost()); Assert.assertEquals(123, node.getPlaintextPort()); Assert.assertEquals("abc:123", node.getHostAndPort()); - node = new DruidNode(service, "[2001:db8:85a3::8a2e:370:7334]:123", null, null, true, false); + node = new DruidNode(service, "[2001:db8:85a3::8a2e:370:7334]:123", false, null, null, true, false); Assert.assertEquals("2001:db8:85a3::8a2e:370:7334", node.getHost()); Assert.assertEquals(123, node.getPlaintextPort()); Assert.assertEquals("[2001:db8:85a3::8a2e:370:7334]:123", node.getHostAndPort()); - node = new DruidNode(service, "2001:db8:85a3::8a2e:370:7334", 123, null, true, false); + node = new DruidNode(service, "2001:db8:85a3::8a2e:370:7334", false, 123, null, true, false); Assert.assertEquals("2001:db8:85a3::8a2e:370:7334", node.getHost()); Assert.assertEquals(123, node.getPlaintextPort()); Assert.assertEquals("[2001:db8:85a3::8a2e:370:7334]:123", node.getHostAndPort()); - node = new DruidNode(service, "[2001:db8:85a3::8a2e:370:7334]", 123, null, true, false); + node = new DruidNode(service, "[2001:db8:85a3::8a2e:370:7334]", false, 123, null, true, false); Assert.assertEquals("2001:db8:85a3::8a2e:370:7334", node.getHost()); Assert.assertEquals(123, node.getPlaintextPort()); Assert.assertEquals("[2001:db8:85a3::8a2e:370:7334]:123", node.getHostAndPort()); - node = new DruidNode(service, null, 123, null, true, false); + node = new DruidNode(service, null, false, 123, null, true, false); Assert.assertEquals(DruidNode.getDefaultHost(), node.getHost()); Assert.assertEquals(123, node.getPlaintextPort()); - node = new DruidNode(service, null, 123, 123, true, false); + node = new DruidNode(service, null, false, 123, 123, true, false); Assert.assertEquals(DruidNode.getDefaultHost(), node.getHost()); Assert.assertEquals(123, node.getPlaintextPort()); Assert.assertEquals(-1, node.getTlsPort()); - node = new DruidNode(service, "host", 123, 123, true, false); + node = new DruidNode(service, "host", false, 123, 123, true, false); Assert.assertEquals("host", node.getHost()); Assert.assertEquals(123, node.getPlaintextPort()); Assert.assertEquals(-1, node.getTlsPort()); - node = new DruidNode(service, "host:123", null, 123, true, false); + node = new DruidNode(service, "host:123", false, null, 123, true, false); Assert.assertEquals("host", node.getHost()); Assert.assertEquals(123, node.getPlaintextPort()); Assert.assertEquals(-1, node.getTlsPort()); - node = new DruidNode("test", "host:123", null, 214, true, true); + node = new DruidNode("test", "host:123", false, null, 214, true, true); Assert.assertEquals("host", node.getHost()); Assert.assertEquals(123, node.getPlaintextPort()); Assert.assertEquals(214, node.getTlsPort()); - node = new DruidNode("test", "host", 123, 214, true, true); + node = new DruidNode("test", "host", false, 123, 214, true, true); Assert.assertEquals("host", node.getHost()); Assert.assertEquals(123, node.getPlaintextPort()); Assert.assertEquals(214, node.getTlsPort()); - node = new DruidNode("test", "host:123", 123, 214, true, true); + node = new DruidNode("test", "host:123", false, 123, 214, true, true); Assert.assertEquals("host", node.getHost()); Assert.assertEquals(123, node.getPlaintextPort()); Assert.assertEquals(214, node.getTlsPort()); - node = new DruidNode("test", null, 123, 214, true, true); + node = new DruidNode("test", null, false, 123, 214, true, true); Assert.assertEquals(DruidNode.getDefaultHost(), node.getHost()); Assert.assertEquals(123, node.getPlaintextPort()); Assert.assertEquals(214, node.getTlsPort()); - node = new DruidNode("test", "host:123", null, 214, false, true); + node = new DruidNode("test", "host:123", false, null, 214, false, true); Assert.assertEquals("host", node.getHost()); Assert.assertEquals(-1, node.getPlaintextPort()); Assert.assertEquals(214, node.getTlsPort()); - node = new DruidNode("test", "host:123", null, 123, false, true); + node = new DruidNode("test", "host:123", false, null, 123, false, true); Assert.assertEquals("host", node.getHost()); Assert.assertEquals(-1, node.getPlaintextPort()); Assert.assertEquals(123, node.getTlsPort()); - node = new DruidNode("test", null, null, 123, false, true); + node = new DruidNode("test", null, false, null, 123, false, true); Assert.assertEquals(DruidNode.getDefaultHost(), node.getHost()); Assert.assertEquals(-1, node.getPlaintextPort()); Assert.assertEquals(123, node.getTlsPort()); - node = new DruidNode("test", null, -1, 123, false, true); + node = new DruidNode("test", null, false, -1, 123, false, true); Assert.assertEquals(DruidNode.getDefaultHost(), node.getHost()); Assert.assertEquals(-1, node.getPlaintextPort()); Assert.assertEquals(123, node.getTlsPort()); - node = new DruidNode("test", "host", -1, 123, false, true); + node = new DruidNode("test", "host", false, -1, 123, false, true); Assert.assertEquals("host", node.getHost()); Assert.assertEquals(-1, node.getPlaintextPort()); Assert.assertEquals(123, node.getTlsPort()); - node = new DruidNode("test", "host", -1, 123, true, false); + node = new DruidNode("test", "host", false, -1, 123, true, false); Assert.assertEquals("host", node.getHost()); Assert.assertEquals(-1, node.getPlaintextPort()); Assert.assertEquals(-1, node.getTlsPort()); - node = new DruidNode("test", "host:123", 123, null, true, false); + node = new DruidNode("test", "host:123", false, 123, null, true, false); Assert.assertEquals("host", node.getHost()); Assert.assertEquals(123, node.getPlaintextPort()); Assert.assertEquals(-1, node.getTlsPort()); - node = new DruidNode("test", "host:123", null, 123, true, false); + node = new DruidNode("test", "host:123", false, null, 123, true, false); Assert.assertEquals("host", node.getHost()); Assert.assertEquals(123, node.getPlaintextPort()); Assert.assertEquals(-1, node.getTlsPort()); @@ -184,73 +184,73 @@ public class DruidNodeTest @Test(expected = IllegalArgumentException.class) public void testConflictingPorts() { - new DruidNode("test/service", "abc:123", 456, null, true, false); + new DruidNode("test/service", "abc:123", false, 456, null, true, false); } @Test(expected = IllegalArgumentException.class) public void testAtLeastTlsOrPlainTextIsSet() { - new DruidNode("test", "host:123", null, 123, false, false); + new DruidNode("test", "host:123", false, null, 123, false, false); } @Test(expected = IllegalArgumentException.class) public void testSamePlainTextAndTlsPort() { - new DruidNode("test", "host:123", null, 123, true, true); + new DruidNode("test", "host:123", false, null, 123, true, true); } @Test(expected = IllegalArgumentException.class) public void testSamePlainTextAndTlsPort1() { - new DruidNode("test", "host", 123, 123, true, true); + new DruidNode("test", "host", false, 123, 123, true, true); } @Test(expected = IllegalArgumentException.class) public void testNullTlsPort() { - new DruidNode("test", "host:123", null, null, true, true); + new DruidNode("test", "host:123", false, null, null, true, true); } @Test(expected = IllegalArgumentException.class) public void testNullPlainTextAndTlsPort1() { - new DruidNode("test", "host", null, null, true, true); + new DruidNode("test", "host", false, null, null, true, true); } @Test(expected = IllegalArgumentException.class) public void testNullTlsPort1() { - new DruidNode("test", "host:123", 123, null, true, true); + new DruidNode("test", "host:123", false, 123, null, true, true); } @Test(expected = IllegalArgumentException.class) public void testNullPlainTextAndTlsPort() { - new DruidNode("test", null, null, null, true, true); + new DruidNode("test", null, false, null, null, true, true); } @Test(expected = IllegalArgumentException.class) public void testConflictingPlainTextPort() { - new DruidNode("test", "host:123", 321, null, true, true); + new DruidNode("test", "host:123", false, 321, null, true, true); } @Test(expected = IllegalArgumentException.class) public void testInvalidIPv6WithPort() { - new DruidNode("test/service", "[abc:fff]:123", 456, null, true, false); + new DruidNode("test/service", "[abc:fff]:123", false, 456, null, true, false); } @Test(expected = IllegalArgumentException.class) public void testInvalidIPv6() { - new DruidNode("test/service", "abc:fff", 456, null, true, false); + new DruidNode("test/service", "abc:fff", false, 456, null, true, false); } @Test(expected = IllegalArgumentException.class) public void testConflictingPortsNonsense() { - new DruidNode("test/service", "[2001:db8:85a3::8a2e:370:7334]:123", 456, null, true, false); + new DruidNode("test/service", "[2001:db8:85a3::8a2e:370:7334]:123", false, 456, null, true, false); } @Test @@ -259,10 +259,10 @@ public class DruidNodeTest final String serviceName = "serviceName"; final String host = "some.host"; final int port = 9898; - Assert.assertEquals(new DruidNode(serviceName, host, port, null, true, false), new DruidNode(serviceName, host, port, null, true, false)); - Assert.assertNotEquals(new DruidNode(serviceName, host, port, null, true, false), new DruidNode(serviceName, host, -1, null, true, false)); - Assert.assertNotEquals(new DruidNode(serviceName, host, port, null, true, false), new DruidNode(serviceName, "other.host", port, null, true, false)); - Assert.assertNotEquals(new DruidNode(serviceName, host, port, null, true, false), new DruidNode("otherServiceName", host, port, null, true, false)); + Assert.assertEquals(new DruidNode(serviceName, host, false, port, null, true, false), new DruidNode(serviceName, host, false, port, null, true, false)); + Assert.assertNotEquals(new DruidNode(serviceName, host, false, port, null, true, false), new DruidNode(serviceName, host, false, -1, null, true, false)); + Assert.assertNotEquals(new DruidNode(serviceName, host, false, port, null, true, false), new DruidNode(serviceName, "other.host", false, port, null, true, false)); + Assert.assertNotEquals(new DruidNode(serviceName, host, false, port, null, true, false), new DruidNode("otherServiceName", host, false, port, null, true, false)); } @Test @@ -272,11 +272,11 @@ public class DruidNodeTest final String serviceName = "serviceName"; final String host = "some.host"; final int port = 9898; - Assert.assertEquals(new DruidNode(serviceName, host, port, null, true, false).hashCode(), new DruidNode(serviceName, host, port, null, true, false).hashCode()); + Assert.assertEquals(new DruidNode(serviceName, host, false, port, null, true, false).hashCode(), new DruidNode(serviceName, host, false, port, null, true, false).hashCode()); // Potential hash collision if hashCode method ever changes - Assert.assertNotEquals(new DruidNode(serviceName, host, port, null, true, false).hashCode(), new DruidNode(serviceName, host, -1, null, true, false).hashCode()); - Assert.assertNotEquals(new DruidNode(serviceName, host, port, null, true, false).hashCode(), new DruidNode(serviceName, "other.host", port, null, true, false).hashCode()); - Assert.assertNotEquals(new DruidNode(serviceName, host, port, null, true, false).hashCode(), new DruidNode("otherServiceName", host, port, null, true, false).hashCode()); + Assert.assertNotEquals(new DruidNode(serviceName, host, false, port, null, true, false).hashCode(), new DruidNode(serviceName, host, false, -1, null, true, false).hashCode()); + Assert.assertNotEquals(new DruidNode(serviceName, host, false, port, null, true, false).hashCode(), new DruidNode(serviceName, "other.host", false, port, null, true, false).hashCode()); + Assert.assertNotEquals(new DruidNode(serviceName, host, false, port, null, true, false).hashCode(), new DruidNode("otherServiceName", host, false, port, null, true, false).hashCode()); } @@ -284,11 +284,12 @@ public class DruidNodeTest public void testSerde1() throws Exception { DruidNode actual = mapper.readValue( - mapper.writeValueAsString(new DruidNode("service", "host", 1234, null, 5678, true, true)), + mapper.writeValueAsString(new DruidNode("service", "host", true, 1234, null, 5678, true, true)), DruidNode.class ); Assert.assertEquals("service", actual.getServiceName()); Assert.assertEquals("host", actual.getHost()); + Assert.assertTrue(actual.isBindOnHost()); Assert.assertTrue(actual.isEnablePlaintextPort()); Assert.assertTrue(actual.isEnableTlsPort()); Assert.assertEquals(1234, actual.getPlaintextPort()); @@ -299,11 +300,12 @@ public class DruidNodeTest public void testSerde2() throws Exception { DruidNode actual = mapper.readValue( - mapper.writeValueAsString(new DruidNode("service", "host", 1234, null, 5678, null, false)), + mapper.writeValueAsString(new DruidNode("service", "host", false, 1234, null, 5678, null, false)), DruidNode.class ); Assert.assertEquals("service", actual.getServiceName()); Assert.assertEquals("host", actual.getHost()); + Assert.assertFalse(actual.isBindOnHost()); Assert.assertTrue(actual.isEnablePlaintextPort()); Assert.assertFalse(actual.isEnableTlsPort()); Assert.assertEquals(1234, actual.getPlaintextPort()); @@ -314,11 +316,12 @@ public class DruidNodeTest public void testSerde3() throws Exception { DruidNode actual = mapper.readValue( - mapper.writeValueAsString(new DruidNode("service", "host", 1234, null, 5678, false, true)), + mapper.writeValueAsString(new DruidNode("service", "host", true, 1234, null, 5678, false, true)), DruidNode.class ); Assert.assertEquals("service", actual.getServiceName()); Assert.assertEquals("host", actual.getHost()); + Assert.assertTrue(actual.isBindOnHost()); Assert.assertFalse(actual.isEnablePlaintextPort()); Assert.assertTrue(actual.isEnableTlsPort()); Assert.assertEquals(-1, actual.getPlaintextPort()); @@ -331,6 +334,7 @@ public class DruidNodeTest String json = "{\n" + " \"service\":\"service\",\n" + " \"host\":\"host\",\n" + + " \"bindOnHost\":true,\n" + " \"plaintextPort\":1234,\n" + " \"tlsPort\":5678,\n" + " \"enablePlaintextPort\":true,\n" @@ -339,7 +343,7 @@ public class DruidNodeTest DruidNode actual = mapper.readValue(json, DruidNode.class); - Assert.assertEquals(new DruidNode("service", "host", 1234, null, 5678, true, true), actual); + Assert.assertEquals(new DruidNode("service", "host", true, 1234, null, 5678, true, true), actual); Assert.assertEquals("https", actual.getServiceScheme()); Assert.assertEquals("host:1234", actual.getHostAndPort()); @@ -360,7 +364,7 @@ public class DruidNodeTest DruidNode actual = mapper.readValue(json, DruidNode.class); - Assert.assertEquals(new DruidNode("service", "host", 1234, null, 5678, true, false), actual); + Assert.assertEquals(new DruidNode("service", "host", false, 1234, null, 5678, true, false), actual); Assert.assertEquals("http", actual.getServiceScheme()); Assert.assertEquals("host:1234", actual.getHostAndPort()); @@ -380,7 +384,7 @@ public class DruidNodeTest DruidNode actual = mapper.readValue(json, DruidNode.class); - Assert.assertEquals(new DruidNode("service", "host", 1234, null, 5678, null, false), actual); + Assert.assertEquals(new DruidNode("service", "host", false, 1234, null, 5678, null, false), actual); Assert.assertEquals("http", actual.getServiceScheme()); Assert.assertEquals("host:1234", actual.getHostAndPort()); @@ -400,7 +404,7 @@ public class DruidNodeTest DruidNode actual = mapper.readValue(json, DruidNode.class); - Assert.assertEquals(new DruidNode("service", "host", null, 1234, 5678, null, false), actual); + Assert.assertEquals(new DruidNode("service", "host", false, null, 1234, 5678, null, false), actual); Assert.assertEquals("http", actual.getServiceScheme()); Assert.assertEquals("host:1234", actual.getHostAndPort()); diff --git a/server/src/test/java/org/apache/druid/server/coordinator/CuratorDruidCoordinatorTest.java b/server/src/test/java/org/apache/druid/server/coordinator/CuratorDruidCoordinatorTest.java index ed1064bd600..81f73bea5e3 100644 --- a/server/src/test/java/org/apache/druid/server/coordinator/CuratorDruidCoordinatorTest.java +++ b/server/src/test/java/org/apache/druid/server/coordinator/CuratorDruidCoordinatorTest.java @@ -190,7 +190,7 @@ public class CuratorDruidCoordinatorTest extends CuratorTestBase Execs.singleThreaded("coordinator_test_load_queue_peon_dest-%d"), druidCoordinatorConfig ); - druidNode = new DruidNode("hey", "what", 1234, null, true, false); + druidNode = new DruidNode("hey", "what", false, 1234, null, true, false); loadManagementPeons = new ConcurrentHashMap<>(); scheduledExecutorFactory = (corePoolSize, nameFormat) -> Executors.newSingleThreadScheduledExecutor(); leaderAnnouncerLatch = new CountDownLatch(1); diff --git a/server/src/test/java/org/apache/druid/server/coordinator/DruidCoordinatorTest.java b/server/src/test/java/org/apache/druid/server/coordinator/DruidCoordinatorTest.java index 862c4040197..0a871daaaed 100644 --- a/server/src/test/java/org/apache/druid/server/coordinator/DruidCoordinatorTest.java +++ b/server/src/test/java/org/apache/druid/server/coordinator/DruidCoordinatorTest.java @@ -160,7 +160,7 @@ public class DruidCoordinatorTest extends CuratorTestBase druidCoordinatorConfig ); loadQueuePeon.start(); - druidNode = new DruidNode("hey", "what", 1234, null, true, false); + druidNode = new DruidNode("hey", "what", false, 1234, null, true, false); loadManagementPeons = new ConcurrentHashMap<>(); scheduledExecutorFactory = new ScheduledExecutorFactory() { diff --git a/server/src/test/java/org/apache/druid/server/initialization/JettyBindOnHostTest.java b/server/src/test/java/org/apache/druid/server/initialization/JettyBindOnHostTest.java new file mode 100644 index 00000000000..7ef39f50b5a --- /dev/null +++ b/server/src/test/java/org/apache/druid/server/initialization/JettyBindOnHostTest.java @@ -0,0 +1,88 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.druid.server.initialization; + +import com.google.common.collect.ImmutableList; +import com.google.inject.Binder; +import com.google.inject.Injector; +import com.google.inject.Key; +import com.google.inject.Module; +import org.apache.commons.io.IOUtils; +import org.apache.druid.guice.GuiceInjectors; +import org.apache.druid.guice.Jerseys; +import org.apache.druid.guice.JsonConfigProvider; +import org.apache.druid.guice.LazySingleton; +import org.apache.druid.guice.LifecycleModule; +import org.apache.druid.guice.annotations.Self; +import org.apache.druid.initialization.Initialization; +import org.apache.druid.server.DruidNode; +import org.apache.druid.server.initialization.jetty.JettyServerInitializer; +import org.apache.druid.server.security.AuthTestUtils; +import org.apache.druid.server.security.AuthorizerMapper; +import org.eclipse.jetty.server.Server; +import org.junit.Assert; +import org.junit.Test; + +import java.net.HttpURLConnection; +import java.net.URL; +import java.nio.charset.StandardCharsets; + +public class JettyBindOnHostTest extends BaseJettyTest +{ + @Override + protected Injector setupInjector() + { + return Initialization.makeInjectorWithModules( + GuiceInjectors.makeStartupInjector(), + ImmutableList.of( + new Module() + { + @Override + public void configure(Binder binder) + { + JsonConfigProvider.bindInstance( + binder, + Key.get(DruidNode.class, Self.class), + new DruidNode("test", "localhost", true, null, null, true, false) + ); + binder.bind(JettyServerInitializer.class).to(JettyServerInit.class).in(LazySingleton.class); + Jerseys.addResource(binder, DefaultResource.class); + binder.bind(AuthorizerMapper.class).toInstance(AuthTestUtils.TEST_AUTHORIZER_MAPPER); + LifecycleModule.register(binder, Server.class); + } + } + ) + ); + } + + @Test + public void testBindOnHost() throws Exception + { + Assert.assertEquals("localhost", server.getURI().getHost()); + + final URL url = new URL("http://localhost:" + port + "/default"); + final HttpURLConnection get = (HttpURLConnection) url.openConnection(); + Assert.assertEquals(DEFAULT_RESPONSE_CONTENT, IOUtils.toString(get.getInputStream(), StandardCharsets.UTF_8)); + + final HttpURLConnection post = (HttpURLConnection) url.openConnection(); + post.setRequestMethod("POST"); + Assert.assertEquals(DEFAULT_RESPONSE_CONTENT, IOUtils.toString(post.getInputStream(), StandardCharsets.UTF_8)); + } +} diff --git a/server/src/test/java/org/apache/druid/server/initialization/JettyQosTest.java b/server/src/test/java/org/apache/druid/server/initialization/JettyQosTest.java index 4316efb9b03..0ecb53ed03f 100644 --- a/server/src/test/java/org/apache/druid/server/initialization/JettyQosTest.java +++ b/server/src/test/java/org/apache/druid/server/initialization/JettyQosTest.java @@ -71,7 +71,7 @@ public class JettyQosTest extends BaseJettyTest public void configure(Binder binder) { JsonConfigProvider.bindInstance( - binder, Key.get(DruidNode.class, Self.class), new DruidNode("test", "localhost", null, null, true, false) + binder, Key.get(DruidNode.class, Self.class), new DruidNode("test", "localhost", false, null, null, true, false) ); binder.bind(JettyServerInitializer.class).to(JettyServerInit.class).in(LazySingleton.class); Jerseys.addResource(binder, SlowResource.class); diff --git a/server/src/test/java/org/apache/druid/server/initialization/JettyTest.java b/server/src/test/java/org/apache/druid/server/initialization/JettyTest.java index 00b1f4b0860..0c2cd8aba62 100644 --- a/server/src/test/java/org/apache/druid/server/initialization/JettyTest.java +++ b/server/src/test/java/org/apache/druid/server/initialization/JettyTest.java @@ -87,7 +87,7 @@ public class JettyTest extends BaseJettyTest public void configure(Binder binder) { JsonConfigProvider.bindInstance( - binder, Key.get(DruidNode.class, Self.class), new DruidNode("test", "localhost", null, null, true, false) + binder, Key.get(DruidNode.class, Self.class), new DruidNode("test", "localhost", false, null, null, true, false) ); binder.bind(JettyServerInitializer.class).to(JettyServerInit.class).in(LazySingleton.class); diff --git a/server/src/test/java/org/apache/druid/server/lookup/cache/LookupNodeDiscoveryTest.java b/server/src/test/java/org/apache/druid/server/lookup/cache/LookupNodeDiscoveryTest.java index 14479275635..be6d607f42e 100644 --- a/server/src/test/java/org/apache/druid/server/lookup/cache/LookupNodeDiscoveryTest.java +++ b/server/src/test/java/org/apache/druid/server/lookup/cache/LookupNodeDiscoveryTest.java @@ -53,21 +53,21 @@ public class LookupNodeDiscoveryTest .andReturn(druidNodeDiscovery); DiscoveryDruidNode node1 = new DiscoveryDruidNode( - new DruidNode("s1", "h1", 8080, null, true, false), + new DruidNode("s1", "h1", false, 8080, null, true, false), NodeType.HISTORICAL, ImmutableMap.of( LookupNodeService.DISCOVERY_SERVICE_KEY, new LookupNodeService("tier1")) ); DiscoveryDruidNode node2 = new DiscoveryDruidNode( - new DruidNode("s2", "h2", 8080, null, true, false), + new DruidNode("s2", "h2", false, 8080, null, true, false), NodeType.PEON, ImmutableMap.of( LookupNodeService.DISCOVERY_SERVICE_KEY, new LookupNodeService("tier1")) ); DiscoveryDruidNode node3 = new DiscoveryDruidNode( - new DruidNode("s3", "h3", 8080, null, true, false), + new DruidNode("s3", "h3", false, 8080, null, true, false), NodeType.PEON, ImmutableMap.of( LookupNodeService.DISCOVERY_SERVICE_KEY, new LookupNodeService("tier2")) diff --git a/server/src/test/java/org/apache/druid/server/metrics/MetricsModuleTest.java b/server/src/test/java/org/apache/druid/server/metrics/MetricsModuleTest.java index 9b4625af5c8..bd50406aaed 100644 --- a/server/src/test/java/org/apache/druid/server/metrics/MetricsModuleTest.java +++ b/server/src/test/java/org/apache/druid/server/metrics/MetricsModuleTest.java @@ -47,7 +47,7 @@ public class MetricsModuleTest public void configure(Binder binder) { JsonConfigProvider.bindInstance( - binder, Key.get(DruidNode.class, Self.class), new DruidNode("test-inject", null, null, null, true, false) + binder, Key.get(DruidNode.class, Self.class), new DruidNode("test-inject", null, false, null, null, true, false) ); } }) @@ -72,7 +72,7 @@ public class MetricsModuleTest public void configure(Binder binder) { JsonConfigProvider.bindInstance( - binder, Key.get(DruidNode.class, Self.class), new DruidNode("test-inject", null, null, null, true, false) + binder, Key.get(DruidNode.class, Self.class), new DruidNode("test-inject", null, false, null, null, true, false) ); binder.bind(Key.get( String.class, diff --git a/server/src/test/java/org/apache/druid/server/router/TieredBrokerHostSelectorTest.java b/server/src/test/java/org/apache/druid/server/router/TieredBrokerHostSelectorTest.java index 8d2a3947ac7..2ef2b850542 100644 --- a/server/src/test/java/org/apache/druid/server/router/TieredBrokerHostSelectorTest.java +++ b/server/src/test/java/org/apache/druid/server/router/TieredBrokerHostSelectorTest.java @@ -74,19 +74,19 @@ public class TieredBrokerHostSelectorTest druidNodeDiscoveryProvider = EasyMock.createStrictMock(DruidNodeDiscoveryProvider.class); node1 = new DiscoveryDruidNode( - new DruidNode("hotBroker", "hotHost", 8080, null, true, false), + new DruidNode("hotBroker", "hotHost", false, 8080, null, true, false), NodeType.BROKER, ImmutableMap.of() ); node2 = new DiscoveryDruidNode( - new DruidNode("coldBroker", "coldHost1", 8080, null, true, false), + new DruidNode("coldBroker", "coldHost1", false, 8080, null, true, false), NodeType.BROKER, ImmutableMap.of() ); node3 = new DiscoveryDruidNode( - new DruidNode("coldBroker", "coldHost2", 8080, null, true, false), + new DruidNode("coldBroker", "coldHost2", false, 8080, null, true, false), NodeType.BROKER, ImmutableMap.of() ); diff --git a/services/src/main/java/org/apache/druid/cli/CreateTables.java b/services/src/main/java/org/apache/druid/cli/CreateTables.java index 5e8c4451f45..ce48a8bf66f 100644 --- a/services/src/main/java/org/apache/druid/cli/CreateTables.java +++ b/services/src/main/java/org/apache/druid/cli/CreateTables.java @@ -106,7 +106,7 @@ public class CreateTables extends GuiceRunnable JsonConfigProvider.bindInstance( binder, Key.get(DruidNode.class, Self.class), - new DruidNode("tools", "localhost", -1, null, true, false) + new DruidNode("tools", "localhost", false, -1, null, true, false) ); } ); diff --git a/services/src/main/java/org/apache/druid/cli/InsertSegment.java b/services/src/main/java/org/apache/druid/cli/InsertSegment.java index 34f4974236e..16bf5a03dd4 100644 --- a/services/src/main/java/org/apache/druid/cli/InsertSegment.java +++ b/services/src/main/java/org/apache/druid/cli/InsertSegment.java @@ -77,7 +77,7 @@ public class InsertSegment extends GuiceRunnable new QueryableModule(), new QueryRunnerFactoryModule(), binder -> JsonConfigProvider.bindInstance( - binder, Key.get(DruidNode.class, Self.class), new DruidNode("tools", "localhost", -1, null, true, false) + binder, Key.get(DruidNode.class, Self.class), new DruidNode("tools", "localhost", false, -1, null, true, false) ) ); } diff --git a/services/src/main/java/org/apache/druid/cli/ResetCluster.java b/services/src/main/java/org/apache/druid/cli/ResetCluster.java index a6de4443c15..b6dc6ba2d5d 100644 --- a/services/src/main/java/org/apache/druid/cli/ResetCluster.java +++ b/services/src/main/java/org/apache/druid/cli/ResetCluster.java @@ -88,7 +88,7 @@ public class ResetCluster extends GuiceRunnable JsonConfigProvider.bindInstance( binder, Key.get(DruidNode.class, Self.class), - new DruidNode("tools", "localhost", -1, null, true, false) + new DruidNode("tools", "localhost", false, -1, null, true, false) ); JsonConfigProvider.bind(binder, "druid.indexer.task", TaskConfig.class); }, diff --git a/sql/src/test/java/org/apache/druid/sql/avatica/DruidAvaticaHandlerTest.java b/sql/src/test/java/org/apache/druid/sql/avatica/DruidAvaticaHandlerTest.java index dee3d2fc6e1..ff8dd2a5877 100644 --- a/sql/src/test/java/org/apache/druid/sql/avatica/DruidAvaticaHandlerTest.java +++ b/sql/src/test/java/org/apache/druid/sql/avatica/DruidAvaticaHandlerTest.java @@ -192,7 +192,7 @@ public class DruidAvaticaHandlerTest extends CalciteTestBase ); final DruidAvaticaHandler handler = new DruidAvaticaHandler( druidMeta, - new DruidNode("dummy", "dummy", 1, null, true, false), + new DruidNode("dummy", "dummy", false, 1, null, true, false), new AvaticaMonitor() ); final int port = ThreadLocalRandom.current().nextInt(9999) + 10000; @@ -798,7 +798,7 @@ public class DruidAvaticaHandlerTest extends CalciteTestBase final DruidAvaticaHandler handler = new DruidAvaticaHandler( smallFrameDruidMeta, - new DruidNode("dummy", "dummy", 1, null, true, false), + new DruidNode("dummy", "dummy", false, 1, null, true, false), new AvaticaMonitor() ); final int port = ThreadLocalRandom.current().nextInt(9999) + 20000;