Appearance
Redis keys
Redis only holds live state that can be rebuilt. PostgreSQL is the source of truth. That is why the installer turns persistence off: after a Redis restart, nodes report their sessions and stats again within about 30 seconds.
Rules every key follows:
- Prefix
bs:. - Every key has a TTL or one clear owner that deletes it.
- No
KEYS *. Scans useSCAN. - Operations that must be atomic (connection slots) are Lua scripts.
- One Redis instance, shared by every control replica. Redis Cluster is not supported.
bs-nodenever talks to Redis. Nodes report over the node channel, and the control writes these keys.
Source
This list follows the code in core/internal/control.
Connection slots
Owned by internal/control/slots. Changed only through Lua scripts. Scores always come from the control clock, never from the node.
| Key | Type | What it holds |
|---|---|---|
bs:conns | sorted set | Every live session id, scored by its expiry. A sweeper removes expired ones every 5 seconds. |
bs:sess:{sid} | hash | One session: line, node, account, IP, content, state (pending or active), kind, format, start, user agent, country, ASN, bytes. |
bs:line:{lid}:conns | sorted set | Sessions of one line, scored by expiry. Used for max_connections. |
bs:node:{id}:conns | sorted set | Sessions on one node, used to pick the least loaded node. |
bs:acct:{id}:conns | sorted set | VOD sessions using one provider source account. |
bs:dedup:{lid}:{ip}:{st} | string | Session to reuse for the same line, IP and content (seeks, reconnects, app probes). |
A pending slot lives 15 seconds after the redirect. An active slot lives 30 seconds after the last heartbeat.
Nodes and streams
Owned by internal/control/nodes.
| Key | TTL | What it holds |
|---|---|---|
bs:node:{id}:live | 30 s | Latest node stats. Missing means the node sent nothing for 30 seconds. |
bs:node:{id}:streams | 2 min | Latest per stream stats on that node. |
bs:node:{id}:archive | 3 min | TV archive window per stream on the node (bytes, from, to, recording, error). |
bs:node:{id}:sstatus | 1 h | Last stream_status per stream (state, error). |
bs:node:{id}:points | 25 h | One stats point per minute, at most 1440, for the 24 hour chart. |
bs:node:{id}:points:m | 55 s | Guard so only one point is written per minute. |
bs:stream:{id}:logs | 24 h | Last 500 log lines of a stream from every node (redacted). |
bs:node:{id}:owner | 45 s, renewed | Which control replica holds the node's channel. Other replicas use it to show the node online and to send it commands. |
bs:nodecmd:{replica} | pub/sub | Commands for nodes connected to that replica, sent by the other replicas. |
bs:nodereply:{req} | 30 s | Result of a forwarded command, popped by the replica that asked. |
Client API
Owned by internal/control/clientapi.
| Key | TTL | What it holds |
|---|---|---|
bs:cfail:{prefix} | 10 min | Failed client logins of an IPv4 address or an IPv6 /64. At max_failed_logins_per_ip the IP is blocked for 15 minutes. |
bs:pl:{line_id} | 10 min | Playlist downloads running for a line (max 2). |
bs:epgq:{line_id} | 1 min | player_api EPG queries running for a line (max 2, else 429). |
bs:catalog_rev | none | Catalog revision. The cache flush bumps it, and the client API drops its in-memory catalog cache when it moves. |
The catalog cache itself lives in the control's memory and data dir, not in Redis.
Rate limits and security
| Key | What it holds |
|---|---|
bs:rl:{scope}:{subject} | Sliding window counters. Scopes: api:u, api:k, api:ip (admin API, 600 per minute), auth (login and 2FA, 10 per minute per IP), auth-refresh (token refresh, 60 per minute per IP), setup (setup code check and setup, 10 per minute), reauth (password check before a backup restore, 5 per 15 minutes per user), enroll (node enroll, 10 per minute per IP), client (client API, 100 per 5 seconds per IP), ai. |
bs:login:fail:u:{username}, bs:login:fail:ip:{ip} | Failed panel logins, for lockout. |
bs:totp:used:{user}:{code} | A TOTP code already used (90 s), so it cannot be replayed. |
bs:nonce:{key}:{nonce} | A request signing nonce already used (10 min). |
bs:apikey:{id}:grace | The old secret of a rotated API key during its grace time. |
Other
| Key | What it holds |
|---|---|
bs:events | Pub/sub channel for change events between control processes (catalog, lines, nodes, blocks, settings, EPG). |
bs:cache:{target}:* | Cached payloads, today bs:cache:dashboard:{scope} (5 s). The cache flush endpoint removes only these, with SCAN and UNLINK. |
bs:epg:refresh:{source_id} | Lock so one EPG import runs per source. |
bs:backups:sched:{minute} | Lock so a scheduled backup runs once per minute slot (2 min). |
bs:geoip:update | Lock so one GeoIP database update runs at a time (15 min, deleted when done). |
bs:leader:{job} | Which control replica runs a scheduled job: backups, license, epg, tmdb, certificates (30 s, renewed while it runs). |