You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@celeborn.apache.org by "RexXiong (via GitHub)" <gi...@apache.org> on 2024/05/06 06:00:04 UTC

[PR] [CELEBORN-1398] Support return leader ip to client. [celeborn]

RexXiong opened a new pull request, #2489:
URL: https://github.com/apache/celeborn/pull/2489

   <!--
   Thanks for sending a pull request!  Here are some tips for you:
     - Make sure the PR title start w/ a JIRA ticket, e.g. '[CELEBORN-XXXX] Your PR title ...'.
     - Be sure to keep the PR description updated to reflect all changes.
     - Please write your PR title to summarize what this PR proposes.
     - If possible, provide a concise example to reproduce the issue for a faster review.
   -->
   
   ### What changes were proposed in this pull request?
   As title
   
   
   ### Why are the changes needed?
   Currently, if accessing services of a Celeborn cluster across Kubernetes clusters, one may encounter DNS resolution issues. However, connectivity may be achieved through IP addresses when combined with the Kubernetes setting hostNetwork=true for clients from different clusters. At present, the `celeborn.network.bind.preferIpAddress` configuration is only effective on worker nodes. This PR will enable the feature of returning the leader's IP when accessing the master node.
   
   ### Does this PR introduce _any_ user-facing change?
   No
   
   
   ### How was this patch tested?
   Pass GA
   


-- 
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: issues-unsubscribe@celeborn.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CELEBORN-1398] Support return leader ip to client [celeborn]

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #2489:
URL: https://github.com/apache/celeborn/pull/2489#discussion_r1590987917


##########
common/src/main/scala/org/apache/celeborn/common/util/Utils.scala:
##########
@@ -432,6 +432,29 @@ object Utils extends Logging {
     }
   }
 
+  private def getIpHostAddressPair(host: String): (String, String) = {
+    try {
+      val inetAddress = InetAddress.getByName(host)
+      val hostAddress = inetAddress.getHostAddress
+      if (host.equals(hostAddress)) {
+        (hostAddress, inetAddress.getCanonicalHostName)
+      } else {
+        (hostAddress, host)
+      }
+    } catch {
+      case _: Throwable => (host, host) // return original input
+    }
+  }
+
+  // Convert address (ip:port or host:port) to (ip:port, host:port) pair
+  def addressToIpHostAddressPair(address: String): (String, String) = {
+    val hostPort = Utils.parseHostPort(address)
+    val internalIpHostAddressPair = Utils.getIpHostAddressPair(hostPort._1)
+    (
+      internalIpHostAddressPair._1 + ":" + hostPort._2,
+      internalIpHostAddressPair._2 + ":" + hostPort._2)

Review Comment:
   ```suggestion
       val (host, port) = Utils.parseHostPort(address)
       val (_ip, _host) = Utils.getIpHostAddressPair(host)
       (_ip + ":" + port, _host + ":" + port)
   ```
   
   note: you may want to change the var name of `_ip`, `_host`



-- 
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: issues-unsubscribe@celeborn.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CELEBORN-1398] Support return leader ip to client [celeborn]

Posted by "RexXiong (via GitHub)" <gi...@apache.org>.
RexXiong commented on PR #2489:
URL: https://github.com/apache/celeborn/pull/2489#issuecomment-2099882553

   Thanks. merge to main(v0.5.0) & branch-0.4(v0.4.1)


-- 
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: issues-unsubscribe@celeborn.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CELEBORN-1398] Support return leader ip to client [celeborn]

Posted by "RexXiong (via GitHub)" <gi...@apache.org>.
RexXiong closed pull request #2489: [CELEBORN-1398] Support return leader ip to client
URL: https://github.com/apache/celeborn/pull/2489


-- 
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: issues-unsubscribe@celeborn.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CELEBORN-1398] Support return leader ip to client. [celeborn]

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #2489:
URL: https://github.com/apache/celeborn/pull/2489#discussion_r1590625847


##########
master/src/main/java/org/apache/celeborn/service/deploy/master/clustermeta/ha/HARaftServer.java:
##########
@@ -492,11 +494,19 @@ public void updateServerRole() {
     }
   }
 
+  public Pair<String, String> addressToIpHostAddressPair(String address) {

Review Comment:
   a little bit confusing, can u add java docs and test for this method?



-- 
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: issues-unsubscribe@celeborn.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CELEBORN-1398] Support return leader ip to client. [celeborn]

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #2489:
URL: https://github.com/apache/celeborn/pull/2489#discussion_r1590627106


##########
common/src/main/java/org/apache/celeborn/common/client/MasterNotLeaderException.java:
##########
@@ -22,6 +22,7 @@
 import javax.annotation.Nullable;
 
 import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.Pair;
 
 public class MasterNotLeaderException extends IOException {

Review Comment:
   the change in this class should be safe, but better to have a manual test to ensure that 0.4 client works well with main branch service



-- 
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: issues-unsubscribe@celeborn.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CELEBORN-1398] Support return leader ip to client [celeborn]

Posted by "RexXiong (via GitHub)" <gi...@apache.org>.
RexXiong commented on code in PR #2489:
URL: https://github.com/apache/celeborn/pull/2489#discussion_r1591765740


##########
common/src/main/java/org/apache/celeborn/common/client/MasterNotLeaderException.java:
##########
@@ -22,6 +22,7 @@
 import javax.annotation.Nullable;
 
 import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.Pair;
 
 public class MasterNotLeaderException extends IOException {

Review Comment:
   Yes, it's compatible with 0.4~



-- 
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: issues-unsubscribe@celeborn.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CELEBORN-1398] Support return leader ip to client [celeborn]

Posted by "RexXiong (via GitHub)" <gi...@apache.org>.
RexXiong commented on code in PR #2489:
URL: https://github.com/apache/celeborn/pull/2489#discussion_r1591730278


##########
common/src/main/scala/org/apache/celeborn/common/util/Utils.scala:
##########
@@ -432,6 +432,29 @@ object Utils extends Logging {
     }
   }
 
+  private def getIpHostAddressPair(host: String): (String, String) = {
+    try {
+      val inetAddress = InetAddress.getByName(host)
+      val hostAddress = inetAddress.getHostAddress
+      if (host.equals(hostAddress)) {
+        (hostAddress, inetAddress.getCanonicalHostName)
+      } else {
+        (hostAddress, host)
+      }
+    } catch {
+      case _: Throwable => (host, host) // return original input
+    }
+  }
+
+  // Convert address (ip:port or host:port) to (ip:port, host:port) pair
+  def addressToIpHostAddressPair(address: String): (String, String) = {
+    val hostPort = Utils.parseHostPort(address)
+    val internalIpHostAddressPair = Utils.getIpHostAddressPair(hostPort._1)
+    (
+      internalIpHostAddressPair._1 + ":" + hostPort._2,
+      internalIpHostAddressPair._2 + ":" + hostPort._2)

Review Comment:
   Thanks, 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: issues-unsubscribe@celeborn.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CELEBORN-1398] Support return leader ip to client [celeborn]

Posted by "RexXiong (via GitHub)" <gi...@apache.org>.
RexXiong commented on code in PR #2489:
URL: https://github.com/apache/celeborn/pull/2489#discussion_r1591770571


##########
master/src/main/java/org/apache/celeborn/service/deploy/master/clustermeta/ha/HARaftServer.java:
##########
@@ -492,11 +494,19 @@ public void updateServerRole() {
     }
   }
 
+  public Pair<String, String> addressToIpHostAddressPair(String address) {

Review Comment:
   Move to Utils and add doc for this. Seems impossible mock object for Scala,so I do manual test for both Scenario.



-- 
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: issues-unsubscribe@celeborn.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org