You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "xiaochen-zhou (via GitHub)" <gi...@apache.org> on 2025/06/26 00:57:33 UTC
[PR] [Feature][Core] Support show cluster members information in seatunnel-cluster scripts [seatunnel]
xiaochen-zhou opened a new pull request, #9502:
URL: https://github.com/apache/seatunnel/pull/9502
### Purpose of this pull request
Support show cluster members information in `seatunnel-cluster` scripts
```shell
seatunnel-cluster.sh -cn cluster --member
Member ID Address Role Version
c36ffd44-7cc8-4873-8141-c23efcfce9d4 [localhost]:5801 ACTIVE MASTER 5.1.0
f2dfaced-25d3-45bd-8974-d1351e45373f [localhost]:5802 MASTER 5.1.0
322453e5-9f1a-4398-8c7d-5f9db4be1c54 [localhost]:5803 WORKER 5.1.0
f4e7370e-c7a6-4add-9120-5f9b5e67c159 [localhost]:5804 WORKER 5.1.0
ae369bdf-2abd-47e5-bd5e-ad54526ee9c8 [localhost]:5805 WORKER 5.1.0
```
### Does this PR introduce _any_ user-facing change?
Yes
### How was this patch tested?
Add e2e tests
### Check list
* [ ] If any new Jar binary package adding in your PR, please add License Notice according
[New License Guide](https://github.com/apache/seatunnel/blob/dev/docs/en/contribution/new-license.md)
* [ ] If necessary, please update the documentation to describe the new feature. https://github.com/apache/seatunnel/tree/dev/docs
* [ ] If you are contributing the connector code, please check that the following files are updated:
1. Update [plugin-mapping.properties](https://github.com/apache/seatunnel/blob/dev/plugin-mapping.properties) and add new connector information in it
2. Update the pom file of [seatunnel-dist](https://github.com/apache/seatunnel/blob/dev/seatunnel-dist/pom.xml)
3. Add ci label in [label-scope-conf](https://github.com/apache/seatunnel/blob/dev/.github/workflows/labeler/label-scope-conf.yml)
4. Add e2e testcase in [seatunnel-e2e](https://github.com/apache/seatunnel/tree/dev/seatunnel-e2e/seatunnel-connector-v2-e2e/)
5. Update connector [plugin_config](https://github.com/apache/seatunnel/blob/dev/config/plugin_config)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature][Core] Support show cluster members information in seatunnel-cluster scripts [seatunnel]
Posted by "xiaochen-zhou (via GitHub)" <gi...@apache.org>.
xiaochen-zhou commented on code in PR #9502:
URL: https://github.com/apache/seatunnel/pull/9502#discussion_r2238348509
##########
seatunnel-core/seatunnel-starter/src/main/bin/seatunnel-cluster.sh:
##########
@@ -78,6 +78,8 @@ do
ROLE_FLAG=false
elif [[ "${i}" == "-h" || "${i}" == "--help" ]]; then
HELP=true
+ elif [[ "${i}" == "-m" || "${i}" == "--member" ]]; then
+ SHOW_MEMBER=true
Review Comment:
> I can't found the code of use the variable.
It's not being used right now, but I think setting a flag and comparing it with no-op might be a good idea and could come in handy later.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature][Core] Support show cluster members information in seatunnel-cluster scripts [seatunnel]
Posted by "Hisoka-X (via GitHub)" <gi...@apache.org>.
Hisoka-X commented on code in PR #9502:
URL: https://github.com/apache/seatunnel/pull/9502#discussion_r2234572422
##########
seatunnel-core/seatunnel-starter/src/test/java/org/apache/seatunnel/core/starter/seatunnel/command/ServerExecuteCommandTest.java:
##########
@@ -34,4 +43,31 @@ public void testJavaVersionCheck() {
Assertions.assertTrue(ServerExecuteCommand.isAllocatingThreadGetName());
System.setProperty("java.version", realVersion);
}
+
+ @Test
+ @DisabledOnJre(value = JRE.JAVA_11, disabledReason = "the test case only works on Java 8")
Review Comment:
why it only workes on java 8?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature][Core] Support show cluster members information in seatunnel-cluster scripts [seatunnel]
Posted by "Hisoka-X (via GitHub)" <gi...@apache.org>.
Hisoka-X commented on code in PR #9502:
URL: https://github.com/apache/seatunnel/pull/9502#discussion_r2234792125
##########
seatunnel-core/seatunnel-starter/src/main/bin/seatunnel-cluster.sh:
##########
@@ -78,6 +78,8 @@ do
ROLE_FLAG=false
elif [[ "${i}" == "-h" || "${i}" == "--help" ]]; then
HELP=true
+ elif [[ "${i}" == "-m" || "${i}" == "--member" ]]; then
+ SHOW_MEMBER=true
Review Comment:
I can't found the code of use the variable.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature][Core] Support show cluster members information in seatunnel-cluster scripts [seatunnel]
Posted by "xiaochen-zhou (via GitHub)" <gi...@apache.org>.
xiaochen-zhou commented on code in PR #9502:
URL: https://github.com/apache/seatunnel/pull/9502#discussion_r2234957218
##########
seatunnel-core/seatunnel-starter/src/main/bin/seatunnel-cluster.sh:
##########
@@ -78,6 +78,8 @@ do
ROLE_FLAG=false
elif [[ "${i}" == "-h" || "${i}" == "--help" ]]; then
HELP=true
+ elif [[ "${i}" == "-m" || "${i}" == "--member" ]]; then
+ SHOW_MEMBER=true
Review Comment:
> I can't found the code of use the variable.
It's not being used right now, but I think setting a flag and comparing it with no-op might be a good idea and could come in handy later.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature][Core] Support show cluster members information in seatunnel-cluster scripts [seatunnel]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #9502:
URL: https://github.com/apache/seatunnel/pull/9502#discussion_r2167991796
##########
seatunnel-core/seatunnel-starter/src/main/java/org/apache/seatunnel/core/starter/seatunnel/command/ServerExecuteCommand.java:
##########
@@ -97,4 +112,69 @@ static boolean isAllocatingThreadGetName() {
return !SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_1_8);
}
}
+
+ @VisibleForTesting
+ public Set<Member> showClusterMembers() {
+ HazelcastClientInstanceImpl client = null;
+ try {
+ String clusterName = serverCommandArgs.getClusterName();
+ if (StringUtils.isBlank(clusterName)) {
+ throw new SeaTunnelEngineException(
+ "Cluster name is required. Please specify it using -cn or --cluster option.");
+ }
+ ClientConfig clientConfig = ConfigProvider.locateAndGetClientConfig();
+ clientConfig.setClusterName(clusterName);
+ client =
+ ((HazelcastClientProxy) HazelcastClient.newHazelcastClient(clientConfig))
+ .client;
+ if (!client.getLifecycleService().isRunning()) {
+ throw new SeaTunnelEngineException(
+ String.format(
+ "cluster: %s is not running, Please start the cluster first.",
+ clusterName));
+ }
+ Set<Member> members = client.getCluster().getMembers();
+ if (members.isEmpty()) {
+ System.out.println("No active members found in the cluster.");
+ return members;
+ }
+
+ Collection<Member> memberList = client.getClientClusterService().getMemberList();
+
+ Member masterMember = client.getClientClusterService().getMasterMember();
+ System.out.printf(
+ "%-36s %-20s %-20s %-10s\n", "Member ID", "Address", "Role", "Version");
+
+ for (Member member : members) {
+ System.out.printf(
+ "%-36s %-20s %-20s %-10s\n",
+ member.getUuid(),
+ member.getAddress(),
+ getRole(masterMember.getAddress(), member),
+ member.getVersion());
Review Comment:
Consider using the logger (e.g., log.info) instead of System.out.printf for consistent logging practices in production code.
```suggestion
log.info(
String.format(
"%-36s %-20s %-20s %-10s",
"Member ID", "Address", "Role", "Version"));
for (Member member : members) {
log.info(
String.format(
"%-36s %-20s %-20s %-10s",
member.getUuid(),
member.getAddress(),
getRole(masterMember.getAddress(), member),
member.getVersion()));
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature][Core] Support show cluster members information in seatunnel-cluster scripts [seatunnel]
Posted by "xiaochen-zhou (via GitHub)" <gi...@apache.org>.
xiaochen-zhou commented on code in PR #9502:
URL: https://github.com/apache/seatunnel/pull/9502#discussion_r2244238215
##########
seatunnel-core/seatunnel-starter/src/main/bin/seatunnel-cluster.sh:
##########
@@ -78,6 +78,8 @@ do
ROLE_FLAG=false
elif [[ "${i}" == "-h" || "${i}" == "--help" ]]; then
HELP=true
+ elif [[ "${i}" == "-m" || "${i}" == "--member" ]]; then
+ :
Review Comment:
>
Done.
##########
seatunnel-core/seatunnel-starter/src/main/bin/seatunnel-cluster.sh:
##########
@@ -78,6 +78,8 @@ do
ROLE_FLAG=false
elif [[ "${i}" == "-h" || "${i}" == "--help" ]]; then
HELP=true
+ elif [[ "${i}" == "-m" || "${i}" == "--member" ]]; then
+ :
Review Comment:
>
Done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature][Core] Support show cluster members information in seatunnel-cluster scripts [seatunnel]
Posted by "corgy-w (via GitHub)" <gi...@apache.org>.
corgy-w merged PR #9502:
URL: https://github.com/apache/seatunnel/pull/9502
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature][Core] Support show cluster members information in seatunnel-cluster scripts [seatunnel]
Posted by "xiaochen-zhou (via GitHub)" <gi...@apache.org>.
xiaochen-zhou commented on code in PR #9502:
URL: https://github.com/apache/seatunnel/pull/9502#discussion_r2234747069
##########
seatunnel-core/seatunnel-starter/src/test/java/org/apache/seatunnel/core/starter/seatunnel/command/ServerExecuteCommandTest.java:
##########
@@ -34,4 +43,31 @@ public void testJavaVersionCheck() {
Assertions.assertTrue(ServerExecuteCommand.isAllocatingThreadGetName());
System.setProperty("java.version", realVersion);
}
+
+ @Test
+ @DisabledOnJre(value = JRE.JAVA_11, disabledReason = "the test case only works on Java 8")
Review Comment:
> why it only workes on java 8?
Sorry, my mistakes. I updated the code.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature][Core] Support show cluster members information in seatunnel-cluster scripts [seatunnel]
Posted by "xiaochen-zhou (via GitHub)" <gi...@apache.org>.
xiaochen-zhou commented on code in PR #9502:
URL: https://github.com/apache/seatunnel/pull/9502#discussion_r2244238768
##########
seatunnel-core/seatunnel-starter/src/main/bin/seatunnel-cluster.sh:
##########
@@ -78,6 +78,8 @@ do
ROLE_FLAG=false
elif [[ "${i}" == "-h" || "${i}" == "--help" ]]; then
HELP=true
+ elif [[ "${i}" == "-m" || "${i}" == "--member" ]]; then
+ :
Review Comment:
>
Done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature][Core] Support show cluster members information in seatunnel-cluster scripts [seatunnel]
Posted by "Hisoka-X (via GitHub)" <gi...@apache.org>.
Hisoka-X commented on code in PR #9502:
URL: https://github.com/apache/seatunnel/pull/9502#discussion_r2239856012
##########
seatunnel-core/seatunnel-starter/src/main/bin/seatunnel-cluster.sh:
##########
@@ -78,6 +78,8 @@ do
ROLE_FLAG=false
elif [[ "${i}" == "-h" || "${i}" == "--help" ]]; then
HELP=true
+ elif [[ "${i}" == "-m" || "${i}" == "--member" ]]; then
+ SHOW_MEMBER=true
Review Comment:
Please remove it, when we need use it we can add it later.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature][Core] Support show cluster members information in seatunnel-cluster scripts [seatunnel]
Posted by "xiaochen-zhou (via GitHub)" <gi...@apache.org>.
xiaochen-zhou commented on code in PR #9502:
URL: https://github.com/apache/seatunnel/pull/9502#discussion_r2234957218
##########
seatunnel-core/seatunnel-starter/src/main/bin/seatunnel-cluster.sh:
##########
@@ -78,6 +78,8 @@ do
ROLE_FLAG=false
elif [[ "${i}" == "-h" || "${i}" == "--help" ]]; then
HELP=true
+ elif [[ "${i}" == "-m" || "${i}" == "--member" ]]; then
+ SHOW_MEMBER=true
Review Comment:
> I can't found the code of use the variable.
It's not being used right now, but I think setting a flag and comparing it with no-op might be a good idea and could come in handy later.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature][Core] Support show cluster members information in seatunnel-cluster scripts [seatunnel]
Posted by "Hisoka-X (via GitHub)" <gi...@apache.org>.
Hisoka-X commented on code in PR #9502:
URL: https://github.com/apache/seatunnel/pull/9502#discussion_r2241466136
##########
seatunnel-core/seatunnel-starter/src/main/bin/seatunnel-cluster.sh:
##########
@@ -78,6 +78,8 @@ do
ROLE_FLAG=false
elif [[ "${i}" == "-h" || "${i}" == "--help" ]]; then
HELP=true
+ elif [[ "${i}" == "-m" || "${i}" == "--member" ]]; then
+ :
Review Comment:
```suggestion
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org