Understanding Ray and Distributed Computing
Linux
What is a Ray Cluster?
A Ray cluster is a group of computers working together as one giant machine. When you have a massive task, like training a complex Artificial Intelligence model or processing huge amounts of data, a single computer might not be fast enough. Ray solves this by splitting the heavy workload into smaller pieces and sharing them across multiple computers in your network.
In this system, there is always one "head node" and several "worker nodes." The head node acts as the manager, receiving your code and deciding which worker should handle which part of the task. The worker nodes do the actual heavy lifting and report their results back to the head node. This setup makes sure all your computer power is used efficiently without you having to manually manage every single machine.
By putting a Ray cluster on "bare-metal" servers, you are installing it directly onto physical hardware instead of using cloud machines. This gives you maximum speed, complete control over your hardware, and avoids unexpected cloud computing bills. The Ray Cluster Launcher makes this process easy by using a single configuration file to connect all your machines automatically.
Prerequisites
- Supported Operating System: All servers must run Linux (x86_64 or ARM/aarch64). While Ray supports macOS and Windows (in beta) for local development, multi-node Ray clusters are officially only supported on Linux.
- Networked Servers: Multiple physical servers connected to the same secure, private local network.
- SSH Access: Passwordless SSH access to all servers using a dedicated, cluster-specific private key (do not use your personal key).
- Matching Python: The exact same Python version must be installed on your local computer, the head node, and all worker nodes.
- Security: A strong firewall protecting your network from the outside, while allowing internal communication between the servers on specific ports (like TCP 6379, 8265, and 10001). This is critical because Ray allows remote code execution and does not have built-in passwords.
Step-by-Step Installation
Install Ray on Your Local Computer
pip install -U "ray[default]"
Generate the Setup File
python -c "import ray, os, shutil; shutil.copy(os.path.join(os.path.dirname(ray.__file__), 'autoscaler/local/example-full.yaml'), 'my-cluster.yaml')"
Edit the Configuration File
# Name of your cluster
cluster_name: my-bare-metal-cluster
# Tell Ray exactly how many worker nodes to start
min_workers: 2
max_workers: 2
provider:
type: local
head_ip: 10.0.0.100 # The IP address of your main manager server
worker_ips: [10.0.0.101, 10.0.0.102] # The IP addresses of your worker servers
auth:
ssh_user: ubuntu # The username used to log into the servers
# Use a dedicated SSH key for safety
ssh_private_key: ~/.ssh/ray_cluster_key
# Tell Ray to install itself on all servers when they turn on
setup_commands:
- pip install -U "ray[default]"
Launch the Cluster
ray up my-cluster.yaml
Connect and Test
ray attach my-cluster.yaml
python -c '
import ray
# Connect to the existing cluster
ray.init(address="auto")
# Print the total CPUs and resources from all connected servers
print("Cluster Resources:", ray.cluster_resources())
'
Stop the Cluster
ray down my-cluster.yaml
CTCservers Recommended Tutorials
Web, Network
Step-by-Step Guide: Install AMD ROCm on Ubuntu with RX 6600 GPU
Learn how to quickly and easily set up AMD ROCm on Ubuntu for your RX 6600 GPU, enabling powerful machine learning, AI workloads, and GPU-accelerated computing right on your system.
Web, Network, Linux, Mysql, Ubuntu
LAMP Setup Guide 2026: Ubuntu & Debian | CTCservers
Install a secure LAMP stack on Debian or Ubuntu. Follow our step-by-step guide to configure Linux, Apache, MySQL, and PHP for your web server.
Web, Network, Ubuntu
Deploy Phi-3 with Ollama on Ubuntu GPU | CTCservers
Learn how to easily deploy the Phi-3 LLM on an Ubuntu 24.04 GPU server using Ollama and WebUI. Follow our step-by-step tutorial for seamless AI hosting.
Discover CTCservers Dedicated Server Locations
CTCservers servers are available around the world, providing diverse options for hosting websites. Each region offers unique advantages, making it easier to choose a location that best suits your specific hosting needs.