# How to connect to Ray cluster?

**URL:** <https://discuss.ray.io/t/how-to-connect-to-ray-cluster/2838>\
**Category:** Kubernetes\
**Created:** [July 9, 2021, 5:24am UTC](https://discuss.ray.io/t/how-to-connect-to-ray-cluster/2838 "2021-07-09T05:24:30Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![trickster](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/trickster/32/1273_2.png) [@trickster](https://discuss.ray.io/u/trickster)\
**Post date:** [July 9, 2021, 5:24am UTC](https://discuss.ray.io/t/how-to-connect-to-ray-cluster/2838/1 "2021-07-09T05:24:31Z")

</div>

I am new to Ray. I am trying to create a private cluster on-prem.

I installed ray on host1 and started as master, host2 joined a node.

I can connect to the cluster from master (host1) without any problem and could use all the resources from master and worker. But when I try to connect from python from worker node, it takes a long time to connect

```auto
ray.init(address='***')
2021-07-09 14:14:06,484	INFO worker.py:735 -- Connecting to existing Ray cluster at address: 

In [3]: /worker/lib/python3.9/site-packages/jupyter_console/ptshell.py:783: UserWarning: The kernel did not respond to an is_complete_request. Setting `use_kernel_is_complete` to False.
  warn('The kernel did not respond to an is_complete_request. '

```

The kernel stops responding. Can I only run the job from master node?

This has been addressed here, but I just want to make sure if I am using it correctly.

> [@What is the correct way to connect to a Ray cluster?](https://discuss.ray.io/t/what-is-the-correct-way-to-connect-to-a-ray-cluster/245/2):
>
> hey @mauricio, unfortunately you’ll have to run your scripts on the cluster head node for now! We’re currently working on a client interface for your ideal workflow (with the ssh tunnel), but this is still work in progress. ray submit and ray rsync-up are my current typical commands for execution.

---

<div class="post-metadata">

**Author:** ![rliaw](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/rliaw/32/24_2.png) [@rliaw](https://discuss.ray.io/u/rliaw)\
**Post date:** [July 13, 2021, 12:11am UTC](https://discuss.ray.io/t/how-to-connect-to-ray-cluster/2838/2 "2021-07-13T00:11:06Z")

</div>

Is it possible that the redis port is not open? or that you have to use a private IP address?

Alternatively, this should be doable with the Ray Client: [https://docs.ray.io/en/master/cluster/ray-client.html](https://docs.ray.io/en/master/cluster/ray-client.html)

Note that the address port will be different from the Ray Init command you’re currently using.

---

<div class="post-metadata">

**Author:** ![trickster](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/trickster/32/1273_2.png) [@trickster](https://discuss.ray.io/u/trickster)\
**Post date:** [July 13, 2021, 2:18am UTC](https://discuss.ray.io/t/how-to-connect-to-ray-cluster/2838/3 "2021-07-13T02:18:43Z")

</div>

I can connect to Redis from workers. What port should I be using to connect to cluster in client mode?

---

<div class="post-metadata">

**Author:** ![trickster](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/trickster/32/1273_2.png) [@trickster](https://discuss.ray.io/u/trickster)\
**Post date:** [July 13, 2021, 2:20am UTC](https://discuss.ray.io/t/how-to-connect-to-ray-cluster/2838/4 "2021-07-13T02:20:35Z")

</div>

I found out 10001 is the port. I could connect from the workers successfully, does ray support connecting from arbitrary servers, I could connect to redis from arbitrary machines but not as ray client?

---

<div class="post-metadata">

**Author:** ![rliaw](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/rliaw/32/24_2.png) [@rliaw](https://discuss.ray.io/u/rliaw)\
**Post date:** [July 13, 2021, 4:19am UTC](https://discuss.ray.io/t/how-to-connect-to-ray-cluster/2838/5 "2021-07-13T04:19:53Z")

</div>

Using the client would allow you to connect from any machine that has port access.

---

<div class="post-metadata">

**Author:** ![trickster](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/trickster/32/1273_2.png) [@trickster](https://discuss.ray.io/u/trickster)\
**Post date:** [July 13, 2021, 6:00am UTC](https://discuss.ray.io/t/how-to-connect-to-ray-cluster/2838/6 "2021-07-13T06:00:34Z")

</div>

Got it, I figured out. This is truly amazing. Keep up the good work

---

<div class="post-metadata">

**Author:** ![rliaw](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/rliaw/32/24_2.png) [@rliaw](https://discuss.ray.io/u/rliaw)\
**Post date:** [July 13, 2021, 6:51am UTC](https://discuss.ray.io/t/how-to-connect-to-ray-cluster/2838/7 "2021-07-13T06:51:03Z")

</div>

Thanks for the kind words 🙂

What are you doing with Ray, if you don’t mind me asking?

---

<div class="post-metadata">

**Author:** ![trickster](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/trickster/32/1273_2.png) [@trickster](https://discuss.ray.io/u/trickster)\
**Post date:** [July 13, 2021, 7:13am UTC](https://discuss.ray.io/t/how-to-connect-to-ray-cluster/2838/8 "2021-07-13T07:13:23Z")

</div>

Creating a on-prem cluster for every day data pipelines. It’s so trivial to parallelize them for any general purpose python lib. Spark cluster is little hard to setup (yarn/mesos)
