Modify Biometric Database Structure

Sometimes it may be necessary to apply a new structural schema to your Tarantool-based biometric database, for example, when updating to the latest version of the product, or when you want to enhance the default database structure with additional parameters, advanced face metadata, and so on.

To modify the database structure, do the following:

  1. Stop the findface-security service.

    sudo systemctl stop findface-security.service
  2. Create a backup of the Tarantool-based biometric database in any directory of your choice, for example, /tmp/dump.


    See Backup and Restore Data Storages for details.

    mkdir -p /tmp/dump
    cd /tmp/dump
    sudo findface-storage-api-dump -config /etc/findface-sf-api.ini
  3. Prepare the tnt_schema.lua file containing the new database structure.

  4. Modify the database structure by applying the new tnt_schema.lua file.

    sudo findface-security make_tnt_schema | sudo tee /etc/ffsecurity/tnt_schema.lua
  5. Open the Tarantool configuration file. Make sure that there is a line dofile("/etc/ffsecurity/tnt_schema.lua") before the FindFace.start section and meta_scheme=meta_scheme is defined in the FindFace.start parameters.

    sudo vi /etc/tarantool/instances.enabled/<shard_00N>.lua
    FindFace.start("", 8101, {
        meta_scheme = meta_scheme
  6. Remove the Tarantool database (default database or shards).

    sudo rm -f /opt/ntech/var/lib/tarantool/default/{index,snapshots,xlogs}/*
    sudo rm -f /opt/ntech/var/lib/tarantool/shard-001/{index,snapshots,xlogs}/*
    sudo rm -f /opt/ntech/var/lib/tarantool/shard-00N/{index,snapshots,xlogs}/*
  7. Restore the Tarantool database from the backup.


    If some fields were removed from the new database structure, you have to first manually delete the corresponding data from the backup copy.

    cd /tmp/dump
    for x in *.json; do curl -X POST "${x%%.json}"; done
    for x in *.json; do sudo findface-storage-api-restore -config /etc/findface-sf-api.ini < "$x"; done
  8. Restart the findface-security service.

    sudo systemctl stop findface-security.service