Skip to content

Commit cb3db75

Browse files
authored
[Fix][Zeta] improve the local mode hazelcast connection (#6521)
1 parent c0487a9 commit cb3db75

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Diff for: seatunnel-core/seatunnel-starter/src/main/java/org/apache/seatunnel/core/starter/seatunnel/command/ClientExecuteCommand.java

+6-3
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
import java.nio.file.Path;
4949
import java.time.Duration;
5050
import java.time.LocalDateTime;
51+
import java.util.Collections;
5152
import java.util.Random;
5253
import java.util.concurrent.CompletableFuture;
5354
import java.util.concurrent.Executors;
@@ -79,19 +80,21 @@ public void execute() throws CommandExecuteException {
7980
SeaTunnelConfig seaTunnelConfig = ConfigProvider.locateAndGetSeaTunnelConfig();
8081
try {
8182
String clusterName = clientCommandArgs.getClusterName();
83+
ClientConfig clientConfig = ConfigProvider.locateAndGetClientConfig();
8284
if (clientCommandArgs.getMasterType().equals(MasterType.LOCAL)) {
8385
clusterName =
8486
creatRandomClusterName(
8587
StringUtils.isNotEmpty(clusterName)
8688
? clusterName
8789
: Constant.DEFAULT_SEATUNNEL_CLUSTER_NAME);
8890
instance = createServerInLocal(clusterName, seaTunnelConfig);
91+
int port = instance.getCluster().getLocalMember().getSocketAddress().getPort();
92+
clientConfig
93+
.getNetworkConfig()
94+
.setAddresses(Collections.singletonList("localhost:" + port));
8995
}
9096
if (StringUtils.isNotEmpty(clusterName)) {
9197
seaTunnelConfig.getHazelcastConfig().setClusterName(clusterName);
92-
}
93-
ClientConfig clientConfig = ConfigProvider.locateAndGetClientConfig();
94-
if (StringUtils.isNotEmpty(clusterName)) {
9598
clientConfig.setClusterName(clusterName);
9699
}
97100
engineClient = new SeaTunnelClient(clientConfig);

0 commit comments

Comments
 (0)