Skip to main content
This final lesson shows how to add a new worker node to a Citus cluster, verify the node and shard distribution, rebalance shards onto the new machine, and run queries that join tables across shards.

1) Add the new worker node from the coordinator

Run the following on the coordinator (control plane) with psql to add worker3 to the cluster:
The coordinator returns the new node id:
This confirms the cluster now knows about the new worker.

2) Inspect shard distribution for the users table

Query the citus_shards catalog on the coordinator to see how many shards for the users table exist on each worker:
The raw output from the coordinator shows the current shard counts:
Summary of shard distribution: As shown, worker3 was added and already hosts some shards, but the distribution is not yet balanced across all workers.
To even out shard placement across the cluster, run a rebalance operation (for example, rebalance_table_shards) so shards move onto the new node(s). After the rebalance completes, re-run the shard-count query above to confirm an even distribution.

3) Rebalance shards onto the new node

A typical rebalance step for a table named users is:
Rebalancing will redistribute shards among workers to achieve a more even shard count and storage usage. Depending on cluster size and data volume, rebalance can take time and consume I/O/CPU on workers.
Running a rebalance on a production cluster may increase load and affect query latency. Schedule rebalances during maintenance windows or throttle them if your Citus deployment supports that.

4) Verify shard distribution again

After rebalance completes, run the same citus_shards query from step 2 to verify shards are distributed evenly:
Confirm the output matches your expected balance (for example, equal or near-equal shard counts across worker1, worker2, and worker3).

5) Running cross-shard joins

After adding nodes and rebalancing, you can run queries that join tables which live on different shards. The coordinator will plan and dispatch the distributed query across workers. Example:
Citus will route parts of this query to the appropriate workers holding the relevant shards and aggregate the results on the coordinator.

Watch Video

Practice Lab