Ручная очистка базы данных от старых данных

Совет

Для настройки автоматического удаления старых данных см. Основные настройки.

Для ручного удаления старых данных из базы данных FindFace Multi используйте утилиту cleanup. Вы можете выборочно удалить следующие данные:

  • события с совпадениями (лица, силуэты, транспортные средства) и связанные эпизоды,

  • события без совпадений (лица, силуэты, транспортные средства) и связанные эпизоды,

  • полные кадры событий с совпадениями (лица, силуэты, транспортные средства),

  • полные кадры событий без совпадений (лица, силуэты, транспортные средства),

  • скриншоты счетчиков,

  • кластерные события (лица, силуэты, транспортные средства),

  • журнал действий пользователей,

  • события внешних VMS.

Утилита очистки работает в контейнере findface-multi-findface-multi-legacy-1. Для того чтобы вызвать справку cleanup, выполните следующую команду:

sudo docker exec -it findface-multi-findface-multi-legacy-1 /opt/findface-security/bin/python3 /tigre_prototype/manage.py cleanup --help

usage: manage.py cleanup [-h] [--as-configured]
                         [--face-events-max-fullframe-unmatched-age FACE_EVENTS_MAX_FULLFRAME_UNMATCHED_AGE]
                         [--face-events-max-fullframe-matched-age FACE_EVENTS_MAX_FULLFRAME_MATCHED_AGE]
                         [--face-events-max-unmatched-age FACE_EVENTS_MAX_UNMATCHED_AGE]
                         [--face-events-max-matched-age FACE_EVENTS_MAX_MATCHED_AGE]
                         [--body-events-max-fullframe-unmatched-age BODY_EVENTS_MAX_FULLFRAME_UNMATCHED_AGE]
                         [--body-events-max-fullframe-matched-age BODY_EVENTS_MAX_FULLFRAME_MATCHED_AGE]
                         [--body-events-max-unmatched-age BODY_EVENTS_MAX_UNMATCHED_AGE]
                         [--body-events-max-matched-age BODY_EVENTS_MAX_MATCHED_AGE]
                         [--car-events-max-fullframe-unmatched-age CAR_EVENTS_MAX_FULLFRAME_UNMATCHED_AGE]
                         [--car-events-max-fullframe-matched-age CAR_EVENTS_MAX_FULLFRAME_MATCHED_AGE]
                         [--car-events-max-unmatched-age CAR_EVENTS_MAX_UNMATCHED_AGE]
                         [--car-events-max-matched-age CAR_EVENTS_MAX_MATCHED_AGE]
                         [--car-cluster-events-max-age CAR_CLUSTER_EVENTS_MAX_AGE]
                         [--body-cluster-events-max-age BODY_CLUSTER_EVENTS_MAX_AGE]
                         [--face-cluster-events-max-age FACE_CLUSTER_EVENTS_MAX_AGE]
                         [--car-cluster-events-keep-best-max-age CAR_CLUSTER_EVENTS_KEEP_BEST_MAX_AGE]
                         [--body-cluster-events-keep-best-max-age BODY_CLUSTER_EVENTS_KEEP_BEST_MAX_AGE]
                         [--face-cluster-events-keep-best-max-age FACE_CLUSTER_EVENTS_KEEP_BEST_MAX_AGE]
                         [--area-activations-max-age AREA_ACTIVATIONS_MAX_AGE]
                         [--audit-logs-max-age AUDIT_LOGS_MAX_AGE]
                         [--counter-records-max-age COUNTER_RECORDS_MAX_AGE]
                         [--external-vms-events-max-age EXTERNAL_VMS_EVENTS_MAX_AGE]
                         [--external-vms-send-events-status-max-age EXTERNAL_VMS_SEND_EVENTS_STATUS_MAX_AGE]
                         [--remote-monitoring-events-max-age REMOTE_MONITORING_EVENTS_MAX_AGE]
                         [--configuration CONFIGURATION] [--version]
                         [-v {0,1,2,3}] [--settings SETTINGS]
                         [--pythonpath PYTHONPATH] [--traceback] [--no-color]
                         [--force-color] [--skip-checks]

Delete FFSecurity entities

optional arguments:
  -h, --help            show this help message and exit
  --as-configured       Apply config age options for events, counter records
                        and clusters. Can't be used with other arguments.
  --face-events-max-fullframe-unmatched-age FACE_EVENTS_MAX_FULLFRAME_UNMATCHED_AGE
                        face events max fullframe unmatched age to clean up
                        (in seconds)
  --face-events-max-fullframe-matched-age FACE_EVENTS_MAX_FULLFRAME_MATCHED_AGE
                        face events max fullframe matched age to clean up (in
                        seconds)
  --face-events-max-unmatched-age FACE_EVENTS_MAX_UNMATCHED_AGE
                        face events max unmatched age to clean up (in seconds)
  --face-events-max-matched-age FACE_EVENTS_MAX_MATCHED_AGE
                        face events max matched age to clean up (in seconds)
  --body-events-max-fullframe-unmatched-age BODY_EVENTS_MAX_FULLFRAME_UNMATCHED_AGE
                        body events max fullframe unmatched age to clean up
                        (in seconds)
  --body-events-max-fullframe-matched-age BODY_EVENTS_MAX_FULLFRAME_MATCHED_AGE
                        body events max fullframe matched age to clean up (in
                        seconds)
  --body-events-max-unmatched-age BODY_EVENTS_MAX_UNMATCHED_AGE
                        body events max unmatched age to clean up (in seconds)
  --body-events-max-matched-age BODY_EVENTS_MAX_MATCHED_AGE
                        body events max matched age to clean up (in seconds)
  --car-events-max-fullframe-unmatched-age CAR_EVENTS_MAX_FULLFRAME_UNMATCHED_AGE
                        car events max fullframe unmatched age to clean up (in
                        seconds)
  --car-events-max-fullframe-matched-age CAR_EVENTS_MAX_FULLFRAME_MATCHED_AGE
                        car events max fullframe matched age to clean up (in
                        seconds)
  --car-events-max-unmatched-age CAR_EVENTS_MAX_UNMATCHED_AGE
                        car events max unmatched age to clean up (in seconds)
  --car-events-max-matched-age CAR_EVENTS_MAX_MATCHED_AGE
                        car events max matched age to clean up (in seconds)
  --car-cluster-events-max-age CAR_CLUSTER_EVENTS_MAX_AGE
                        car cluster events max age to clean up (in seconds)
  --body-cluster-events-max-age BODY_CLUSTER_EVENTS_MAX_AGE
                        body cluster events max age to clean up (in seconds)
  --face-cluster-events-max-age FACE_CLUSTER_EVENTS_MAX_AGE
                        face cluster events max age to clean up (in seconds)
  --car-cluster-events-keep-best-max-age CAR_CLUSTER_EVENTS_KEEP_BEST_MAX_AGE
                        car cluster events keep best max age to clean up (in
                        seconds)
  --body-cluster-events-keep-best-max-age BODY_CLUSTER_EVENTS_KEEP_BEST_MAX_AGE
                        body cluster events keep best max age to clean up (in
                        seconds)
  --face-cluster-events-keep-best-max-age FACE_CLUSTER_EVENTS_KEEP_BEST_MAX_AGE
                        face cluster events keep best max age to clean up (in
                        seconds)
  --area-activations-max-age AREA_ACTIVATIONS_MAX_AGE
                        area activations max age to clean up (in seconds)
  --audit-logs-max-age AUDIT_LOGS_MAX_AGE
                        audit logs max age to clean up (in seconds)
  --counter-records-max-age COUNTER_RECORDS_MAX_AGE
                        counter records max age to clean up (in seconds)
  --external-vms-events-max-age EXTERNAL_VMS_EVENTS_MAX_AGE
                        external vms events max age to clean up (in seconds)
  --external-vms-send-events-status-max-age EXTERNAL_VMS_SEND_EVENTS_STATUS_MAX_AGE
                        external vms send events status max age to clean up
                        (in seconds)
  --remote-monitoring-events-max-age REMOTE_MONITORING_EVENTS_MAX_AGE
                        remote monitoring events max age to clean up (in
                        seconds)
  --configuration CONFIGURATION
                        The name of the configuration class to load, e.g.
                        "Development". If this isn't provided, the
                        DJANGO_CONFIGURATION environment variable will be
                        used.
  --version             show program's version number and exit
  -v {0,1,2,3}, --verbosity {0,1,2,3}
                        Verbosity level; 0=minimal output, 1=normal output,
                        2=verbose output, 3=very verbose output
  --settings SETTINGS   The Python path to a settings module, e.g.
                        "myproject.settings.main". If this isn't provided, the
                        DJANGO_SETTINGS_MODULE environment variable will be
                        used.
  --pythonpath PYTHONPATH
                        A directory to add to the Python path, e.g.
                        "/home/djangoprojects/myproject".
  --traceback           Raise on CommandError exceptions
  --no-color            Don't colorize the command output.
  --force-color         Force colorization of the command output.
  --skip-checks         Skip system checks.

Для полного удаления событий и эпизодов старше определенного количества дней используйте аргументы —*-events-max-matched-age/—*-events-max-unmatched-age. Например, для удаления событий с автомобилями без совпадений старше 5 дней (432000 секунд) выполните команду:

sudo docker exec -it findface-multi-findface-multi-legacy-1 /opt/findface-security/bin/python3 /tigre_prototype/manage.py cleanup --car-events-max-unmatched-age 432000

Для удаления событий распознавания транспортных средств с совпадениями старше 5 дней (432000 секунд) выполните команду:

sudo docker exec -it findface-multi-findface-multi-legacy-1 /opt/findface-security/bin/python3 /tigre_prototype/manage.py cleanup --car-events-max-matched-age 432000

Следующие команды удаляют только полные кадры событий распознавания силуэтов с совпадениями и без:

sudo docker exec -it findface-multi-findface-multi-legacy-1 /opt/findface-security/bin/python3 /tigre_prototype/manage.py cleanup --body-events-max-fullframe-matched-age 432000
sudo docker exec -it findface-multi-findface-multi-legacy-1 /opt/findface-security/bin/python3 /tigre_prototype/manage.py cleanup --body-events-max-fullframe-unmatched-age 432000

Для того чтобы удалить только скриншоты счетчиков, выполните команду:

sudo docker exec -it findface-multi-findface-multi-legacy-1 /opt/findface-security/bin/python3 /tigre_prototype/manage.py cleanup --counter-records-max-age 432000

Для того чтобы удалить только кластерные события с лицами, выполните команду:

sudo docker exec -it findface-multi-findface-multi-legacy-1 /opt/findface-security/bin/python3 /tigre_prototype/manage.py cleanup --face-cluster-events-max-age 432000

Для того чтобы удалить только записи в журнале действий пользователей, выполните команду:

sudo docker exec -it findface-multi-findface-multi-legacy-1 /opt/findface-security/bin/python3 /tigre_prototype/manage.py cleanup --audit-logs-max-age 432000

Важно

Должен быть задан хотя бы один аргумент из указанных.