[Support]: Database vacuum constantly running #14583
-
Describe the problem you are havingHi, I've been running frigate for a while now and using the same database for almost a month now. Now I happened to run into an issue where my frigate instance is running out of ram then restarting. I noticed it wasn't recording for around 5 hours and restarting. In portainer logs last output is "Running database vacuum" and it's always the same last output in the logs. Is there a way to solve it or should I just wait for it to finish? I have all recording go to a 2TB HDD. Portainer settings Version0.15.0.4ff0c8a-rpi What browser(s) are you using?No response Frigate config filemqtt:
host: 192.168.8.158
user: mqtt
password: mqtt
enabled: false
#logger:
# Optional: Default log verbosity (default: shown below)
# default: error
# Optional: Component specific logger overrides
# logs:
# frigate.event: debug
database:
path: /config/frigate.db
ffmpeg:
hwaccel_args: preset-rpi-64-h264
output_args:
record: preset-record-generic-audio-copy
go2rtc:
streams:
canera1:
- rtsp://frigate:[email protected]:554/Streaming/Channels/101/
camera2:
- rtsp://frigate:[email protected]:554/Streaming/Channels/101/
- ffmpeg:camera2#audio=aac
camera3:
- rtsp://frigate:[email protected]:554/Streaming/Channels/101/
- ffmpeg:camera3#audio=aac
birdseye:
enabled: true
mode: continuous
width: 1280
height: 720
detectors:
# cpu1:
# type: cpu
coral:
type: edgetpu
cameras:
cam_1:
enabled: true
ffmpeg:
inputs:
- path: rtsp://user:[email protected]:554/Streaming/Channels/102/
roles:
- detect
- path: rtsp://user:[email protected]:554/Streaming/Channels/101/
roles:
- record
detect:
enabled: true
fps: 4
motion:
threshold: 35
contour_area: 10
improve_contrast: true
mask: 0.124,0.312,0.089,0,0,0,0,1,0.266,1
cam_2:
enabled: true
ffmpeg:
inputs:
- path: rtsp://user:[email protected]:554/Streaming/Channels/102/
roles:
- detect
- path: rtsp://user:[email protected]:554/Streaming/Channels/101/
roles:
- record
detect:
enabled: true
fps: 4
motion:
threshold: 35
contour_area: 10
improve_contrast: true
cam_3:
enabled: true
ffmpeg:
inputs:
- path: rtsp://user:[email protected]:554/Streaming/Channels/102/
roles:
- detect
- path: rtsp://user:[email protected]:554/Streaming/Channels/101/
roles:
- record
detect:
enabled: true
fps: 4
stationary:
# Optional: Frequency for confirming stationary objects (default: same as threshold)
# When set to 1, object detection will run to confirm the object still exists on every frame.
# If set to 10, object detection will run to confirm the object still exists on every 10th frame.
#interval: 10
# Optional: Number of frames without a position change for an object to be considered stationary (default: 10x the frame rate or 10s)
threshold: 5
snapshots:
required_zones:
- zone_0
- zone_1
motion:
mask:
- 0,1,0.145,1,0.043,0.456,0.024,0,0,0,0,0
- 0.658,1,1,0,1,1,0.767,1
zones:
zone_0:
coordinates: 979,323,397,99,285,110,840,488
objects:
- car
zone_1:
coordinates: 57,341,203,720,842,720,1114,355,380,79,321,88,39,128
objects:
- person
review:
alerts:
required_zones:
- zone_0
- zone_1
detections:
required_zones:
- zone_0
- zone_1
objects:
track:
- person
- car
motion:
# Optional: The threshold passed to cv2.threshold to determine if a pixel is different enough to be counted as motion. (default: shown below)
# Increasing this value will make motion detection less sensitive and decreasing it will make motion detection more sensitive.
# The value should be between 1 and 255.
threshold: 85
# Optional: Minimum size in pixels in the resized motion image that counts as motion (default: shown below)
# Increasing this value will prevent smaller areas of motion from being detected. Decreasing will
# make motion detection more sensitive to smaller moving objects.
# As a rule of thumb:
# - 10 - high sensitivity
# - 30 - medium sensitivity
# - 50 - low sensitivity
#contour_area: 30
# Optional: The percentage of the image used to detect lightning or other substantial changes where motion detection
# needs to recalibrate. (default: shown below)
# Increasing this value will make motion detection more likely to consider lightning or ir mode changes as valid motion.
# Decreasing this value will make motion detection more likely to ignore large amounts of motion such as a person approaching
# a doorbell camera.
#lightning_threshold: 0.5
snapshots:
enabled: true
timestamp: false
bounding_box: true
retain:
default: 10
review:
alerts:
labels:
- person
detections:
labels:
- car
# Optional: Record configuration
# NOTE: Can be overridden at the camera level
record:
# Optional: Enable recording (default: shown below)
# WARNING: If recording is disabled in the config, turning it on via
# the UI or MQTT later will have no effect.
enabled: true
# Optional: Number of minutes to wait between cleanup runs (default: shown below)
# This can be used to reduce the frequency of deleting recording segments from disk if you want to minimize i/o
# expire_interval: 60
# Optional: Sync recordings with disk on startup and once a day (default: shown below).
# sync_recordings: False
# Optional: Retention settings for recording
retain:
# Optional: Number of days to retain recordings regardless of events (default: shown below)
# NOTE: This should be set to 0 and retention should be defined in events section below
# if you only want to retain recordings of events.
days: 10
# Optional: Mode for retention. Available options are: all, motion, and active_objects
# all - save all recording segments regardless of activity
# motion - save all recordings segments with any detected motion
# active_objects - save all recording segments with active/moving objects
# NOTE: this mode only applies when the days setting above is greater than 0
# mode: all
# Optional: Recording Export Settings
# export:
# Optional: Timelapse Output Args (default: shown below).
# NOTE: The default args are set to fit 24 hours of recording into 1 hour playback.
# See https://stackoverflow.com/a/58268695 for more info on how these args work.
# As an example: if you wanted to go from 24 hours to 30 minutes that would be going
# from 86400 seconds to 1800 seconds which would be 1800 / 86400 = 0.02.
# The -r (framerate) dictates how smooth the output video is.
# So the args would be -vf setpts=0.02*PTS -r 30 in that case.
# timelapse_args: "-vf setpts=0.04*PTS -r 30"
# Optional: Recording Preview Settings
# preview:
# Optional: Quality of recording preview (default: shown below).
# Options are: very_low, low, medium, high, very_high
# quality: medium
# Optional: Event recording settings
# events:
# Optional: Number of seconds before the event to include (default: shown below)
# pre_capture: 5
# Optional: Number of seconds after the event to include (default: shown below)
# post_capture: 5
# Optional: Objects to save recordings for. (default: all tracked objects)
# objects:
# - person
# Optional: Retention settings for recordings of events
# retain:
# Required: Default retention days (default: shown below)
# default: 10
# Optional: Mode for retention. (default: shown below)
# all - save all recording segments for events regardless of activity
# motion - save all recordings segments for events with any detected motion
# active_objects - save all recording segments for event with active/moving objects
#
# NOTE: If the retain mode for the camera is more restrictive than the mode configured
# here, the segments will already be gone by the time this mode is applied.
# For example, if the camera retain mode is "motion", the segments without motion are
# never stored, so setting the mode to "all" here won't bring them back.
# mode: motion
# Optional: Per object retention days
# objects:
# person: 15
version: 0.15-0
camera_groups:
view:
order: 1
icon: LuAirplay
cameras:
- cam_1
- cam_2
- cam_3 Relevant Frigate log output2024-10-25 14:19:48.373151424 [2024-10-25 14:19:48] frigate.util.config INFO : Checking if frigate config needs migration...
2024-10-25 14:19:48.470444230 [2024-10-25 14:19:48] frigate.util.config INFO : frigate config does not need migration...
2024-10-25 14:20:06.489143875 [2024-10-25 14:20:06] frigate.app INFO : Starting Frigate (0.15.0-4ff0c8a)
2024-10-25 14:20:06.636172097 [2024-10-25 14:20:06] peewee_migrate.logs INFO : Starting migrations
2024-10-25 14:20:06.636976773 [2024-10-25 14:20:06] peewee_migrate.logs INFO : There is nothing to migrate
2024-10-25 14:20:06.637786282 [2024-10-25 14:20:06] frigate.app INFO : Running database vacuum Relevant go2rtc log outputN/A FFprobe output from your cameraN/A Frigate statsNo response Install methodDocker Compose docker-compose file or Docker CLI commandN/A Object DetectorCoral Network connectionWired Camera make and modelhikvision DS-2CD2083G2-I Screenshots of the Frigate UI's System metrics pagesNo response Any other information that may be helpfulNo response |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 12 replies
-
What is your docker compose? |
Beta Was this translation helpful? Give feedback.
-
is it possible to run VACUUM periodically instead of just after restarting? my frigate can run for weeks non stop and if the db has grown too big the command would be too long to run after power failure for example. or is there any downside to just remove the vacuuming? if no then i would do that on my fork. |
Beta Was this translation helpful? Give feedback.
Deleting would be the easiest if you're actually okay with that. Alternatively you could just run VACUUM on the host and see if that completes. That is quite a large database to be fair.