数据库
存储和数据库决定录像能保存多久、事件索引是否可靠,以及升级/恢复时能否保留历史。Securex NVR 的配置数据、数据库、录像媒体和缓存应分别理解,不要只做“容器整体备份”却忽略外部挂载。
数据类型
# Conceptual storage layout
/config -> configuration and database
/media -> recordings, clips, snapshots or exported media
/cache -> transient segments / model cache (deployment dependent)容量规划
录像容量主要由码率 × 摄像头数量 × 保留时间决定。AI 数据库和缩略图通常远小于录像,但大量事件、语义索引、人脸/车牌模型也会增长。NAS 写入还要考虑网络带宽、延迟和断线恢复。
文件系统与权限
- 媒体目录必须对容器用户可写。
- 网络存储建议先在宿主机稳定挂载,再映射到容器。
- 不要把 SQLite/数据库文件放在不支持可靠锁/同步语义的网络文件系统上,除非明确验证。
备份
- 备份 config、数据库和自定义模型/标签。
- 录像是否备份按业务需要决定,通常体积很大。
- 升级前至少保留最近一次可用配置和数据库副本。
异常
| 现象 | 检查 |
|---|---|
| 录像突然停止 | 磁盘满、只读挂载、NAS 掉线、inode 耗尽。 |
| Review 空白但文件还在 | 数据库/索引损坏或时间范围/时区问题。 |
| 重启后配置丢失 | /config 没有持久化挂载或覆盖错目录。 |
Database
Storage and database design determine recording retention, event-index reliability, and whether history survives upgrades/restores. Treat configuration, database, media, and caches as different data classes.
Data classes
# Conceptual storage layout
/config -> configuration and database
/media -> recordings, clips, snapshots or exported media
/cache -> transient segments / model cache (deployment dependent)Capacity planning
Recording capacity is driven mainly by bitrate × camera count × retention time. Databases and thumbnails are smaller, while semantic indexes and enrichment models add their own growth.
Filesystem and permissions
- Media paths must be writable by the container.
- Mount network storage reliably on the host before mapping it into the container.
- Avoid placing SQLite/database files on filesystems with weak locking semantics unless verified.
Backups
- Back up config, database, custom models, and labels.
- Recording backups are optional and often very large.
- Keep a known-good config/database copy before upgrades.
Failures
| Symptom | Check |
|---|---|
| Recording stops | Disk full, read-only mount, NAS outage, inode exhaustion. |
| Media exists but Review is empty | Database/index or time-range/timezone issue. |
| Config disappears after restart | /config was not persisted or the wrong path was mounted. |
Base de datos
El almacenamiento y la base de datos determinan retención, fiabilidad del índice y recuperación. Trate configuración, BD, medios y caché como tipos distintos de datos.
Tipos de datos
# Conceptual storage layout
/config -> configuration and database
/media -> recordings, clips, snapshots or exported media
/cache -> transient segments / model cache (deployment dependent)Capacidad
La grabación depende sobre todo de bitrate × cámaras × tiempo de retención. Índices y modelos también crecen.
FS y permisos
- Las rutas deben ser escribibles.
- Monte el NAS establemente en el host antes de pasarlo al contenedor.
- Evite SQLite en sistemas de archivos con bloqueo no fiable.
Copias
- Copie config, BD, modelos y etiquetas.
- Las grabaciones son opcionales y grandes.
- Guarde una copia buena antes de actualizar.
Fallos
| Síntoma | Revisar |
|---|---|
| Deja de grabar | Disco lleno, RO, NAS, inodes. |
| Archivos existen pero Review vacío | BD/índice/fecha-zona horaria. |
| Config desaparece | /config no persistido. |
