# Which port should a Java client use to connect to a Ray cluster

**URL:** <https://discuss.ray.io/t/which-port-should-a-java-client-use-to-connect-to-a-ray-cluster/3316>\
**Category:** Ray Clusters\
**Created:** [August 23, 2021, 1:57pm UTC](https://discuss.ray.io/t/which-port-should-a-java-client-use-to-connect-to-a-ray-cluster/3316 "2021-08-23T13:57:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![blshao84](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/blshao84/32/1010_2.png) [@blshao84](https://discuss.ray.io/u/blshao84)\
**Post date:** [August 23, 2021, 1:57pm UTC](https://discuss.ray.io/t/which-port-should-a-java-client-use-to-connect-to-a-ray-cluster/3316/1 "2021-08-23T13:57:49Z")

</div>

Hi, I have a Java client submitting jobs to a ray cluster (python). From this doc, [Cross-language programming — Ray v1.6.0](https://docs.ray.io/en/latest/cross-language.html#cross-language), I added two vm options to my java app, -Dray.address=xxx:6379 -Dray.job.code-search-path=xxx and use Ray.init() to establish the connection. It worked for my local ray cluster but got connection issues when I tried to connect to my real cluster running on top of k8s.

My k8s ray cluster is set up following this doc: [Deploying on Kubernetes — Ray v1.6.0](https://docs.ray.io/en/latest/cluster/kubernetes.html). I understand I have to forward port as I did for 8000 and 8265, however when I try to forward port 6379 using this command: kubectl -n xxx port-forward --address 0.0.0.0 service/xxx-dev-ray-head 6379:6379, I got: error: Service xxx-dev-ray-head does not have a service port 6379. However, from [ray/raycluster.yaml at master · ray-project/ray · GitHub](https://github.com/ray-project/ray/blob/master/deploy/charts/ray/templates/raycluster.yaml#L51) I do see 6379 is specified together with 8000, 8265 and 10001.

Is 6379 the correct port to use for client to connect with k8s ray cluster?

Thanks,  
-BS

---

<div class="post-metadata">

**Author:** ![blshao84](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/blshao84/32/1010_2.png) [@blshao84](https://discuss.ray.io/u/blshao84)\
**Post date:** [August 24, 2021, 2:16am UTC](https://discuss.ray.io/t/which-port-should-a-java-client-use-to-connect-to-a-ray-cluster/3316/2 "2021-08-24T02:16:47Z")

</div>

![image](https://us1.discourse-cdn.com/flex020/uploads/ray/original/2X/0/09ce14b84bd532d01852de9171b4accf699a1ec2.png)  
I figured it out myself … I could achieve that by adding something like above to the template file
