This is an automated email from the ASF dual-hosted git repository.
adoroszlai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/master by this push:
new 0f620f18ba2 HDDS-15513. Bind cluster services to localhost for
MiniOzoneCluster (#10468)
0f620f18ba2 is described below
commit 0f620f18ba2c9152771a580da7d35ba57b43530e
Author: Rishabh Patel <[email protected]>
AuthorDate: Tue Jun 9 23:53:14 2026 -0700
HDDS-15513. Bind cluster services to localhost for MiniOzoneCluster (#10468)
---
.../src/main/java/org/apache/ozone/test/GenericTestUtils.java | 4 ----
.../main/java/org/apache/hadoop/ozone/MiniOzoneClusterImpl.java | 7 +++++++
.../java/org/apache/hadoop/ozone/UniformDatanodesFactory.java | 8 +++++---
3 files changed, 12 insertions(+), 7 deletions(-)
diff --git
a/hadoop-hdds/test-utils/src/main/java/org/apache/ozone/test/GenericTestUtils.java
b/hadoop-hdds/test-utils/src/main/java/org/apache/ozone/test/GenericTestUtils.java
index fb9cf0812d2..accb3595b85 100644
---
a/hadoop-hdds/test-utils/src/main/java/org/apache/ozone/test/GenericTestUtils.java
+++
b/hadoop-hdds/test-utils/src/main/java/org/apache/ozone/test/GenericTestUtils.java
@@ -428,10 +428,6 @@ public static synchronized int getFreePort() {
public static String localhostWithFreePort() {
return HOST_ADDRESS + ":" + getFreePort();
}
-
- public static String anyHostWithFreePort() {
- return "0.0.0.0:" + getFreePort();
- }
}
/**
diff --git
a/hadoop-ozone/mini-cluster/src/main/java/org/apache/hadoop/ozone/MiniOzoneClusterImpl.java
b/hadoop-ozone/mini-cluster/src/main/java/org/apache/hadoop/ozone/MiniOzoneClusterImpl.java
index 1200b1e4d56..78c6be6630d 100644
---
a/hadoop-ozone/mini-cluster/src/main/java/org/apache/hadoop/ozone/MiniOzoneClusterImpl.java
+++
b/hadoop-ozone/mini-cluster/src/main/java/org/apache/hadoop/ozone/MiniOzoneClusterImpl.java
@@ -710,6 +710,13 @@ protected void configureSCM(boolean isHA) throws
IOException {
localhostWithFreePort());
conf.set(ScmConfigKeys.OZONE_SCM_HTTP_ADDRESS_KEY,
localhostWithFreePort());
+ // Bind SCM servers to 127.0.0.1 instead of the default 0.0.0.0.
+ // Without this, the bind address (0.0.0.0) leaks into OZONE_SCM_NAMES
+ // via updateListenAddress/getSCMAddresses, causing DataNodes to connect
+ // to 0.0.0.0 which gets routed to unreachable addresses on VPN.
+ conf.set(ScmConfigKeys.OZONE_SCM_CLIENT_BIND_HOST_KEY, "127.0.0.1");
+ conf.set(ScmConfigKeys.OZONE_SCM_BLOCK_CLIENT_BIND_HOST_KEY,
"127.0.0.1");
+ conf.set(ScmConfigKeys.OZONE_SCM_DATANODE_BIND_HOST_KEY, "127.0.0.1");
conf.set(HddsConfigKeys.HDDS_SCM_WAIT_TIME_AFTER_SAFE_MODE_EXIT,
"3s");
conf.setInt(ScmConfigKeys.OZONE_SCM_RATIS_PORT_KEY, getFreePort());
diff --git
a/hadoop-ozone/mini-cluster/src/main/java/org/apache/hadoop/ozone/UniformDatanodesFactory.java
b/hadoop-ozone/mini-cluster/src/main/java/org/apache/hadoop/ozone/UniformDatanodesFactory.java
index 7e0a1003115..b4a22c67dff 100644
---
a/hadoop-ozone/mini-cluster/src/main/java/org/apache/hadoop/ozone/UniformDatanodesFactory.java
+++
b/hadoop-ozone/mini-cluster/src/main/java/org/apache/hadoop/ozone/UniformDatanodesFactory.java
@@ -18,6 +18,7 @@
package org.apache.hadoop.ozone;
import static
org.apache.hadoop.hdds.HddsConfigKeys.HDDS_DATANODE_CLIENT_ADDRESS_KEY;
+import static
org.apache.hadoop.hdds.HddsConfigKeys.HDDS_DATANODE_HOST_NAME_KEY;
import static
org.apache.hadoop.hdds.HddsConfigKeys.HDDS_DATANODE_HTTP_ADDRESS_KEY;
import static
org.apache.hadoop.hdds.HddsConfigKeys.HDDS_INITIAL_HEARTBEAT_INTERVAL;
import static
org.apache.hadoop.hdds.HddsConfigKeys.HDDS_RECON_INITIAL_HEARTBEAT_INTERVAL;
@@ -33,8 +34,8 @@
import static
org.apache.hadoop.ozone.OzoneConfigKeys.HDDS_CONTAINER_RATIS_IPC_PORT;
import static
org.apache.hadoop.ozone.OzoneConfigKeys.HDDS_CONTAINER_RATIS_SERVER_PORT;
import static
org.apache.hadoop.ozone.OzoneConfigKeys.HDDS_RATIS_LEADER_FIRST_ELECTION_MINIMUM_TIMEOUT_DURATION_KEY;
-import static
org.apache.ozone.test.GenericTestUtils.PortAllocator.anyHostWithFreePort;
import static org.apache.ozone.test.GenericTestUtils.PortAllocator.getFreePort;
+import static
org.apache.ozone.test.GenericTestUtils.PortAllocator.localhostWithFreePort;
import java.io.IOException;
import java.nio.file.Files;
@@ -123,8 +124,9 @@ public OzoneConfiguration apply(OzoneConfiguration conf)
throws IOException {
}
private void configureDatanodePorts(ConfigurationTarget conf) {
- conf.set(HDDS_DATANODE_HTTP_ADDRESS_KEY, anyHostWithFreePort());
- conf.set(HDDS_DATANODE_CLIENT_ADDRESS_KEY, anyHostWithFreePort());
+ conf.set(HDDS_DATANODE_HOST_NAME_KEY, "127.0.0.1");
+ conf.set(HDDS_DATANODE_HTTP_ADDRESS_KEY, localhostWithFreePort());
+ conf.set(HDDS_DATANODE_CLIENT_ADDRESS_KEY, localhostWithFreePort());
conf.setInt(HDDS_CONTAINER_IPC_PORT, getFreePort());
conf.setInt(HDDS_CONTAINER_RATIS_IPC_PORT, getFreePort());
conf.setInt(HDDS_CONTAINER_RATIS_ADMIN_PORT, getFreePort());
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]