Skip to content

RemoteOptions

Defined in: packages/sharding/src/remote.ts:17

Where, and how, a coordinator listens for hosts.

optional allowInsecure?: boolean

Defined in: packages/sharding/src/remote.ts:35

Listen on a non-loopback address without TLS: frames (shard messages and worker output) travel unencrypted and unsigned. Only for a network you fully trust, or when a TLS proxy in front terminates the connection. Default false.


optional clientAddress?: (request, peer) => string

Defined in: packages/sharding/src/remote.ts:72

The client address the per-address limits count by. Default: the peer address of the TCP connection. Behind a TLS proxy every peer is the proxy, so return the client address the proxy forwards (only from a header your proxy sets and overwrites).

Request

string | undefined

string


optional connectionsPerSecond?: number

Defined in: packages/sharding/src/remote.ts:65

New connections one client address may open per second; more are refused. Default 10.


optional helloTimeout?: number

Defined in: packages/sharding/src/remote.ts:54

Milliseconds a new connection has to authenticate before it is closed. Default 3,000.


optional hostname?: string

Defined in: packages/sharding/src/remote.ts:24

Interface to bind. Default 127.0.0.1, which only this machine can reach. Any other address needs tls or allowInsecure.


optional hosts?: string[]

Defined in: packages/sharding/src/remote.ts:41

The host IDs that make up the deployment. Clusters are placed on them in this order, and an unlisted host is refused. Without it, the hosts that have joined when spawn() starts are used, sorted by ID.


optional joinTimeout?: number

Defined in: packages/sharding/src/remote.ts:45

Milliseconds to wait for the hosts to join before spawn() fails. Default 60,000.


optional lease?: number

Defined in: packages/sharding/src/remote.ts:52

Fencing lease in milliseconds. A host that hears nothing from the coordinator for this long kills its workers; the coordinator waits twice as long before it treats the host as lost and restarts its clusters, so a shard never runs in two places. Default 15,000.


optional local?: boolean

Defined in: packages/sharding/src/remote.ts:74

Also run clusters on the coordinator’s own machine. Default false: clusters run on the hosts only.


optional maxUnauthenticated?: number

Defined in: packages/sharding/src/remote.ts:61

Most connections that may be waiting to authenticate at once. When full, the one that has waited longest is closed to make room: a host answers the challenge within a round trip, a connection that holds a slot idle does not. Default 16.


optional maxUnauthenticatedPerAddress?: number

Defined in: packages/sharding/src/remote.ts:63

The same limit for one client address (see clientAddress). Default 4.


optional minHosts?: number

Defined in: packages/sharding/src/remote.ts:43

How many hosts must join before clusters are placed when hosts is not set. Default 1.


optional moveClusters?: boolean

Defined in: packages/sharding/src/remote.ts:82

When a host is lost, restart its clusters on the connected host (or local) running the fewest, once the lost host has certainly fenced itself (two leases after the coordinator dropped it). They stay there when the host comes back. Default true; false restarts them on the same host only, so they wait for it.


port: number

Defined in: packages/sharding/src/remote.ts:19

TCP port. 0 picks a free one (read it from ClusterManager#remotePort).


secret: string

Defined in: packages/sharding/src/remote.ts:26

Shared secret, at least 16 characters. Hosts prove they know it; it never crosses the wire.


optional tls?: object

Defined in: packages/sharding/src/remote.ts:28

TLS for wss://. Required to listen on a non-loopback address unless allowInsecure is set.

cert: string

key: string