Skip to content

Cluster Mode

Cluster Mode enables distributed computing. Plugin, detection, decode, and encode will automatically be assigned to the best suitable machine in a cluster.

TIP

Scrypted NVR users recording to NAS storage are encouraged to use Cluster Mode instead for optimal reliability and performance. The NAS should run the server, and the existing hardware should become a Cluster Mode client to handle detections and transcoding.

A Scrypted installation can operate in either server or client mode. There can only be one server machine but there may be multiple client machines. The server machine will ingest the camera streams, while client machines will perform detection. Machines in a cluster can be a mix of operating systems and architectures. For example, you can use a NAS saving video Unraid (server) with a Mac Mini performing detection (client).

Cluster Mode Networking

Cluster servers and clients must be on the same network with no NAT or firewall between them.

Cluster Server Setup

The Cluster server will ingest the camera streams and save them to the NVR storage.

Create and edit Scrypted .env configuration file:

sh
# open this file in the Docker host shell
nano ~/.scrypted/volume/.env
sh
# open this file in the LXC Console
nano ~/.scrypted/volume/.env
sh
nano ~/.scrypted/volume/.env
sh
touch ~/.scrypted/volume/.env
open -a TextEdit ~/.scrypted/volume/.env
notepad %USERPROFILE%\.scrypted\volume\.env

Paste the following into the editor, and make the necessary changes.

sh
# Set worker type. There can only be one server.
SCRYPTED_CLUSTER_MODE=server
# This is the IP of this machine.
SCRYPTED_CLUSTER_ADDRESS=192.168.2.130
SCRYPTED_CLUSTER_SECRET=swordfish
SCRYPTED_CLUSTER_LABELS=storage

Restart the server.

Upon successful configuration, Cluster workers, including the server itself, will be listed within the Plugins page in the Scrypted Management Console sidebar.

WARNING

Compute plugins like OpenVINO will fail to load until a Cluster Client is set up and connected in the next section.

Cluster Client Setup

A Cluster client will perform video decoding and detection.

When adding a client, install Scrypted as usual. Account creation is not necessary. Once the server is running, create and edit Scrypted .env configuration file:

Create and edit Scrypted .env configuration file:

sh
# open this file in the Docker host shell
nano ~/.scrypted/volume/.env
sh
# open this file in the LXC Console
nano ~/.scrypted/volume/.env
sh
nano ~/.scrypted/volume/.env
sh
touch ~/.scrypted/volume/.env
open -a TextEdit ~/.scrypted/volume/.env
notepad %USERPROFILE%\.scrypted\volume\.env

Paste the following into the editor, and make the necessary changes.

sh
# Set worker type. There can be multiple clients.
SCRYPTED_CLUSTER_MODE=client
# this is the IP of the server machine,
# matching the SCRYPTED_CLUSTER_ADDRESS in the prior section.
SCRYPTED_CLUSTER_SERVER=192.168.2.130
SCRYPTED_CLUSTER_SECRET=swordfish
# designate this server as available for decode and detection workloads
SCRYPTED_CLUSTER_LABELS=compute,transcode,@scrypted/openvino
# if this is a mac, delete the previous line and
# use @scrypted/coreml label instead
# SCRYPTED_CLUSTER_LABELS=compute,transcode,@scrypted/coreml

Restart the client.

INFO

Cluster clients are not accessible at https port 10443 like the server. All connected clients can be viewed and managed from the primary server.

Plugins in the sidebar will show connected workers and their running processes.

Server Settings in the sidebar will show Cluster Settings.

Optional Properties

sh
# Custom name for the worker
SCRYPTED_CLUSTER_WORKER_NAME=my-worker-name