Skip to content

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 use SCAN.
  • Operations that must be atomic (connection slots) are Lua scripts.
  • One Redis instance, shared by every control replica. Redis Cluster is not supported.
  • bs-node never 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.

KeyTypeWhat it holds
bs:connssorted setEvery live session id, scored by its expiry. A sweeper removes expired ones every 5 seconds.
bs:sess:{sid}hashOne session: line, node, account, IP, content, state (pending or active), kind, format, start, user agent, country, ASN, bytes.
bs:line:{lid}:connssorted setSessions of one line, scored by expiry. Used for max_connections.
bs:node:{id}:connssorted setSessions on one node, used to pick the least loaded node.
bs:acct:{id}:connssorted setVOD sessions using one provider source account.
bs:dedup:{lid}:{ip}:{st}stringSession 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.

KeyTTLWhat it holds
bs:node:{id}:live30 sLatest node stats. Missing means the node sent nothing for 30 seconds.
bs:node:{id}:streams2 minLatest per stream stats on that node.
bs:node:{id}:archive3 minTV archive window per stream on the node (bytes, from, to, recording, error).
bs:node:{id}:sstatus1 hLast stream_status per stream (state, error).
bs:node:{id}:points25 hOne stats point per minute, at most 1440, for the 24 hour chart.
bs:node:{id}:points:m55 sGuard so only one point is written per minute.
bs:stream:{id}:logs24 hLast 500 log lines of a stream from every node (redacted).
bs:node:{id}:owner45 s, renewedWhich 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/subCommands for nodes connected to that replica, sent by the other replicas.
bs:nodereply:{req}30 sResult of a forwarded command, popped by the replica that asked.

Client API ​

Owned by internal/control/clientapi.

KeyTTLWhat it holds
bs:cfail:{prefix}10 minFailed 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 minPlaylist downloads running for a line (max 2).
bs:epgq:{line_id}1 minplayer_api EPG queries running for a line (max 2, else 429).
bs:catalog_revnoneCatalog 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 ​

KeyWhat 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}:graceThe old secret of a rotated API key during its grace time.

Other ​

KeyWhat it holds
bs:eventsPub/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:updateLock 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).

Bitstream documentation