Playbook · DGX Spark cluster
Ray joins the two Sparks into one pool that Python programs can send work to. vLLM can also use it to reach the second Spark.
A Ray cluster runs whatever code it is sent. Ray says anyone who can reach its dashboard, jobs or client services can run code on your machines. Never expose them, and set up the protections below before you start it.
Checked on 26 November 2026 against: Ray's security, token authentication, on-premise cluster, ports and CLI documentation (latest release then: 2.60.1) and NVIDIA's vLLM playbook for two Sparks. We have not yet run this playbook start to finish on our own hardware.
Watch, then follow
Decide before you start. Here's what to decide for Ray on two DGX Sparks, and what it splits for you.
The AI stack. We're at the bottom of the stack: two machines, working over their own cable.
Pick the head node. One Spark is the head. It also manages the cluster. If the head fails, the whole cluster fails.
CPUs, GPUs, memory. Ray counts each Spark's CPUs and GPUs. You can offer it fewer, to leave room for other work. By default it sets seventy percent of available memory for scheduling, and thirty for its object store. On a DGX Spark the processor and GPU share that memory, so leave room for your model.
pip, or containers. With pip, you keep the versions matching on both Sparks yourself. With containers, one image holds the software. Pass in the token, and give them enough shared memory.
Shared, and not shared. Ray places tasks and actors, and moves their objects between the Sparks when needed. It doesn't pool the two memories, and it doesn't move an ordinary program.
Fit first, then choose. Each task or actor asks for resources. A task asks for one CPU unless you say otherwise. Ray keeps only the nodes that could fit it. One task can't combine two Sparks. Then a strategy picks one of them.
DEFAULT or SPREAD. The default strategy doesn't promise an even split. By our reading, a small batch may stay on one Spark. Spread tries to put tasks on different nodes. A strict spread placement group requires separate nodes.
Splitting data work. Ray Data cuts a dataset into blocks, and works on them in parallel. Files need to be reachable from the nodes that read them, such as a shared filesystem at the same path.
Requests are not load. Those CPU numbers are requests, not measurements. Ray doesn't stop a task using more. So watch the real load on each Spark as well.
Ready to set up. Keep it private, whatever you choose. Part two sets the cluster up.
10 steps
Set up, check, stop. Now set up Ray on two DGX Sparks. First, the safety warning.
Ray runs code. Anyone who can reach Ray's dashboard, jobs or client services can run code on your Sparks. Never expose them. Block Ray's ports from every network except the cluster link. Turn on token authentication. It adds to that protection, and doesn't replace it.
Install the same version. Make a Python environment on both Sparks. Switch it on. Install the same Ray version on both, with matching Python versions.
One token for both. Make the token on the first Spark. This prints it, so keep your screen private. Make a private folder on the second Spark. Copy the token across, over the cluster link. Then make the copy readable only by you.
Start the head. On the first Spark, turn token mode on. Then start the head on its cluster link address, with the dashboard on localhost.
Join the worker. On the second Spark, turn token mode on there too. Then join the head, using the second Spark's own link address.
Check both joined. Check the listening ports, so you know what your firewall must block. Then ask for the status. You want two active nodes, and two GPUs if you offered both.
See where work ran. Run the small example from the written page. It counts tasks by host name. Compare default with spread. The counts needn't be equal. Ray's task list can also show which node ran each task.
Stop the worker first. Finish your jobs first. Stopping ends all Ray processes on that machine. Run it on the worker. Then run it on the head.
Checked, and private. The written page covers vLLM, undoing the setup, and problems.
11 steps
Written from the makers' own documents, linked below. The sections on decisions, settings and sharing work were checked on 27 November 2026 against Ray 2.60.1's documentation. We have not run these steps on hardware.
Is this the one?
Python work cut into many tasks, Ray's own libraries, or a guide or tool that asks for Ray.
Python code can place work on either Spark. NVIDIA's two-Spark vLLM playbook uses it to split a model.
More software to keep at matching versions, many network ports, and a head node that the cluster depends on. You may not need it: vLLM can split a model across two machines without Ray.
Compare all five in the cluster method chooser.
Before you start
Two DGX Sparks on the same current DGX OS, with the cable link set up and tested as in the cluster setup guide. In the commands, my-spark is the first Spark, spark-two the second, and USER your user name. Replace words in capitals with your own values. Nothing on this page has been run by us on hardware.
Python 3 with venv on both, the same Python version on both. Ray publishes ARM64 Linux packages. Token authentication needs Ray 2.52.0 or later.
If you only want to split one model, compare the split-model page first.
Security first
Ray expects a controlled network and trusted code. Security has to come from outside Ray.
A shared token stops casual access. Ray says it adds to network isolation and does not replace it. It is sent unencrypted over plain HTTP.
The dashboard listens on localhost by default. Keep it so, and use an SSH tunnel.
Never forward or publish the Ray ports. Run only code you trust.
Newer Ray releases change the default for tokens, and Ray's documentation describes changes in 2.59 and 2.61. Setting RAY_AUTH_MODE=token yourself on both nodes avoids relying on the default.
How it fits together
Decide first
Settle these six before you type a start command. Ray does not let you change a node’s resource amounts after it has started there, so changing your mind means stopping and starting that node.
The head runs the ordinary node processes and extra ones that manage the whole cluster. Ray says that if the head node fails, the entire cluster fails. If a worker fails, the tasks and actors running on it fail, and Ray's fault tolerance settings decide what can be recovered elsewhere. By default the script of a submitted job runs on the head.
Our advice: two DGX Sparks have the same hardware, so make the head the one you leave running, sign in to and tunnel to. Keep it the same one each time.
NVIDIA lists a 20-core Arm processor and 128 GB of unified memory in each DGX Spark. By default Ray counts the CPUs and GPUs it finds on the machine or in the container. --num-cpus and --num-gpus replace those counts. They are numbers for Ray's bookkeeping: they do not reserve or fence off any hardware. Giving a node zero CPUs stops it taking tasks or actors that ask for a CPU. By Ray's default rules that includes an actor with no stated request.
Our advice: keep the automatic counts if Ray is the only heavy work. If a Spark also runs something else, such as a database, a desktop or another model server, offer Ray fewer CPUs. If another program owns that Spark's GPU, start the node with --num-gpus=0. Do not set the head to zero CPUs on a two-Spark cluster unless you mean to use only one Spark for CPU work.
# example only: add to the head or worker start command
--num-cpus=CPUS-FOR-RAY --num-gpus=GPUS-FOR-RAY
By default Ray sets two figures when it starts on a node: schedulable memory at 70% of the memory available at that moment, and the object store at 30% of it. The object store is shared memory that holds task results and objects you put there. On Linux Ray also caps it at 200 GB and at 95% of the size of /dev/shm. When it fills, Ray spills objects to disk.
Ray does not manage how much GPU memory each task takes: that is your job. On a DGX Spark the processor and the GPU share one memory.
Our reasoning: a loaded model, Ray's workers and the object store therefore draw on the same 128 GB. And because Ray measures available memory as it starts, starting it before or after another program loads can give different figures. If a model server will take most of the memory, consider a smaller --object-store-memory. We have no tested value to give you.
Give each node its cluster link address with --node-ip-address. Nodes talk to each other in both directions, on a few fixed ports and several random ones. A firewall rule for the cluster link between the two Sparks is easier to get right than a list of single ports. If you need a port list, fix each random port with its option first. Every other network should be blocked.
Decide these before the first start: token authentication on, the dashboard on localhost or turned off, no Ray port reachable from outside the pair, and only code you trust. Ray can also encrypt its gRPC traffic with TLS, which is off by default. It needs certificates you make yourself, has a speed cost, and does not replace network isolation. This guide does not set TLS up.
The steps on this page. Little to learn. You keep Ray, Python and your packages the same on both Sparks yourself.
One image on both keeps the software together. NVIDIA's vLLM playbook uses them. The token, shared memory and file mounts must be passed in.
Our advice: do not mix the two in one cluster. Ray lists different Ray versions as a reason a node cannot connect.
If you use containers, check two options. vLLM's run_cluster.sh, as we read it on 27 November 2026, uses --network host and --shm-size 10.24g. The second matters because the object store lives in /dev/shm: a container's shared memory size limits it. NVIDIA's playbook downloads an older pinned copy of the script, so read the one you actually run.
Our advice: use the pip steps to learn Ray and to run your own Python. To serve a model with vLLM, follow NVIDIA's container playbook and add the protections.
Settings
Options with -- go on ray start, listed in Ray's command line reference. Names starting RAY_ are environment variables: set them on each node before Ray starts. Defaults are as the documents described them for Ray 2.60.1. Check them for your version.
| Setting | What it controls | Default | When to change it |
|---|---|---|---|
--head, --address | Starts the head, or joins a worker to it | Neither: you choose | Always: one of them on each node |
--node-ip-address | The address this node uses | The CLI reference states none | Set it to the cluster link address |
--num-cpus | Logical CPUs offered to Ray | CPUs found | To leave room for other work |
--num-gpus | Logical GPUs offered to Ray | GPUs found | 0 if another program owns the GPU |
--resources | Your own countable resources, as JSON | None added | To limit or steer particular work |
--object-store-memory | Object store size, in bytes | 30% of available memory, with caps | Lower to leave memory for a model; raise if objects spill |
--object-spilling-directory | Where overflowing objects are written | Ray's temporary directory | To pick a drive with room |
--temp-dir | Ray's logs and session files | /tmp/ray | If that place is short of room |
| Setting | What it controls | Default | When to change it |
|---|---|---|---|
--port | Head's cluster service port (GCS) | 6379 | If something else uses it |
--include-dashboard | Whether the dashboard runs | On | false if unused. Job submission and ray list need the dashboard |
--dashboard-host | Where the dashboard listens | localhost | Leave it. Use an SSH tunnel |
--dashboard-port | Dashboard and job submission port | 8265 | If it is taken |
--ray-client-server-port | Ray Client port on the head | 10001 | If it is taken |
--min-worker-port, --max-worker-port | Ports for worker processes | 10002 to 19999 | To fit firewall rules; too narrow a range limits workers |
--dashboard-agent-listen-port | Dashboard agent, HTTP, each node | 52365 | If it is taken |
--node-manager-port, --object-manager-port, --runtime-env-agent-port, --dashboard-agent-grpc-port, --metrics-export-port | Other services on each node | Random | To write exact firewall rules |
| Setting | What it controls | Default | When to change it |
|---|---|---|---|
RAY_AUTH_MODE | Token authentication | Differs by release. In 2.60.1 a worker does not turn it on by itself | Set token on every node and client |
RAY_AUTH_TOKEN_PATH | Which token file is used | ~/.ray/auth_token is used if no token variable is set | If you keep more than one token |
RAY_USE_TLS | TLS on gRPC channels | 0, off | If your network rules require it |
--disable-usage-stats | Ray's usage reports to its makers | Asks in a terminal; on if it cannot ask, unless set before | Add it on the head to send none |
RAY_memory_usage_threshold | When Ray's memory monitor kills a worker to free memory | 0.95 of the node's memory | Rarely; read Ray's page first |
RAY_memory_monitor_refresh_ms | How often it checks; 0 stops its killing | 250 | NVIDIA's vLLM playbook sets 0 in its containers |
RAY_scheduler_spread_threshold | How busy a node must look before the default strategy ranks it lower | 0.5 | Most clusters never need to |
With the memory monitor off, Ray no longer steps in when a node runs short of memory; Linux may then end a process itself. Ray's resource isolation option changes how the monitor works, and has its own rules.
See for yourself
Set the cluster up first, with the steps below. Then save this short example of ours as where_ran.py on the head:
import collections, socket, time
import ray
ray.init(address="auto")
@ray.remote(num_cpus=1)
def work(i):
time.sleep(2)
return socket.gethostname()
def count(task):
return collections.Counter(ray.get([task.remote(i) for i in range(60)]))
print("script ran on:", socket.gethostname())
print("DEFAULT:", count(work))
print("SPREAD: ", count(work.options(scheduling_strategy="SPREAD")))
source ~/ray-env/bin/activate
export RAY_AUTH_MODE=token
python where_ran.py
It prints the script's own Spark, then a count of tasks for each host name under each strategy. We have not run it on hardware, so we show no counts. They need not be equal and can change between runs. If only one name appears under SPREAD, check ray status and what else is using CPUs. The tasks only sleep, yet Ray counts one logical CPU for each while it runs.
With ray[default] and the dashboard running, Ray's state commands also report on work. Match the node ID of a task to a node:
ray list nodes
ray list tasks --detail
ray summary tasks
Set up
Pick one version from Ray's release list, and use it on both:
python3 -m venv ~/ray-env
source ~/ray-env/bin/activate
pip install "ray[default]==VERSION"
ray --version
python --version
On the first Spark only. The second command copies it over the cluster link.
The token is a password to run code on your cluster, and the first command prints it. The copy replaces any token file already on the second Spark. Do not paste it into chats, tickets, screenshots or a code repository. Ray says tokens do not expire.
ray get-auth-token --generate
ssh USER@SECOND-SPARK-LINK-ADDRESS 'mkdir -p ~/.ray && chmod 700 ~/.ray'
scp ~/.ray/auth_token USER@SECOND-SPARK-LINK-ADDRESS:.ray/auth_token
ssh USER@SECOND-SPARK-LINK-ADDRESS 'chmod 600 .ray/auth_token'
chmod 600 ~/.ray/auth_token
source ~/ray-env/bin/activate
export RAY_AUTH_MODE=token
ray start --head --port=6379 \
--node-ip-address=FIRST-SPARK-LINK-ADDRESS \
--dashboard-host=localhost
If you do not need the dashboard, Ray's option --include-dashboard=false turns it off. Without a dashboard, job submission through it is not available.
On the second Spark. The worker does not turn authentication on by itself, so the first setting matters.
source ~/ray-env/bin/activate
export RAY_AUTH_MODE=token
ray start --address=FIRST-SPARK-LINK-ADDRESS:6379 \
--node-ip-address=SECOND-SPARK-LINK-ADDRESS
sudo ss -ltnp
Ray needs the nodes to reach each other on many ports: 6379 on the head, worker ports 10002 to 19999 by default, and others that are chosen at random. The head also uses 10001 for Ray Client and 8265 for the dashboard. An address option does not prove every one of them is limited to the cable. Block them from every other network.
Check
On the first Spark, with the environment active and RAY_AUTH_MODE=token set:
ray status
Success is two active nodes. Check that the resources list the GPUs you expect, two in all. If a GPU is missing, fix that before you go on. Then prove a task runs on each node. Save this as two_nodes.py:
import socket, time
import ray
ray.init(address="auto")
@ray.remote(num_gpus=1)
def where():
time.sleep(5)
return socket.gethostname()
print(sorted(ray.get([where.remote(), where.remote()])))
python two_nodes.py
It should print both names, such as ['my-spark', 'spark-two']. If other work already holds a GPU, the script waits.
For the dashboard, open a tunnel from your computer, then browse to http://localhost:8265. It asks for the token.
ssh -N -L 8265:localhost:8265 USER@my-spark.local
vLLM on Ray
vLLM must be installed with the same versions inside the same Ray environment on both nodes. Containers are the usual way. NVIDIA’s two-Spark vLLM playbook does it with vLLM's run_cluster.sh script: it downloads a pinned copy, changes it to install Ray inside the NVIDIA container, and starts a head container and a worker container. The server is then started once, on the head:
vllm serve ORG/MODEL --tensor-parallel-size 2 \
--distributed-executor-backend ray \
--host localhost
--host localhost keeps the server to this Spark. Without it, vLLM listens on every network the Spark is on, with no password. To reach it from your computer, open an SSH tunnel and use http://localhost:8000/v1:
ssh -N -L 8000:localhost:8000 USER@my-spark.local
Those containers are a separate Ray cluster from the one set up above: run one or the other, not both.
Add the protections yourself. When we read it on 26 November, the playbook's start commands did not turn token authentication on, and its multi-switch section gives a dashboard address that uses the head's network address. Do not open the dashboard to your network. The script passes extra Docker options through, so a token setting and a read-only mount of the token file can be added to both nodes, using Ray's token settings. We have not tested that combination.
vLLM also says traffic between nodes is unencrypted and could be abused to run code, so the private link still matters.
Stop and undo
ray stop ends all Ray processes on that machine, including any other Ray work you have there.
To stop: finish or cancel your jobs, stop the worker first, then the head. For the playbook's containers, stop each container instead.
ray stop
To undo: remove the environment and the token on both Sparks. Close any firewall openings you made.
Deleting is final. If you use the same token file for another Ray setup, keep it.
deactivate
rm -r ~/ray-env
rm ~/.ray/auth_token
Problems
| What you see | What to try |
|---|---|
| Unable to connect to GCS | Ray lists: head not running, different Ray versions, wrong address, or a firewall. Check port 6379 over the link. |
| Authentication token not found or invalid | The same token file on both, and RAY_AUTH_MODE=token in the shell that runs the command. |
Only one node in ray status | Read the worker's output. Check its --node-ip-address and the two-way firewall. |
| No GPU listed | Check nvidia-smi on that node, then Ray's start log. |
More: cluster problems by symptom.
Next
Server AI Hub is our app for looking after a DGX Spark. You do not need it to follow this playbook. It is coming soon to the App Store and the Microsoft Store.
Sources
Read on 26 November 2026, and again on 27 November 2026 for decisions, settings and sharing work. These projects change often; if their pages differ from this one, follow them.
General guidance only, in our own words. Back up before you start; you use these steps at your own risk. NVIDIA, DGX, DGX Spark, ConnectX and CUDA are trademarks of NVIDIA Corporation; Kubernetes, K3s, Ray, PyTorch, vLLM, SGLang, NGINX, Docker and other names belong to their owners. 6ixLabs is not affiliated with or endorsed by NVIDIA or any of these projects.