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:
Stop the
findface-security
service.sudo systemctl stop findface-security.service
Create a backup of the Tarantool-based biometric database in any directory of your choice, for example,
/tmp/dump
.Tip
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
Prepare the
tnt_schema.lua
file containing the new database structure.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
Open the Tarantool configuration file. Make sure that there is a line
dofile("/etc/ffsecurity/tnt_schema.lua")
before theFindFace.start
section andmeta_scheme=meta_scheme
is defined in theFindFace.start
parameters.sudo vi /etc/tarantool/instances.enabled/<shard_00N>.lua dofile("/etc/ffsecurity/tnt_schema.lua") FindFace.start("127.0.0.1", 8101, { license_ntls_server="127.0.0.1:3133", facen_size=576, meta_scheme = meta_scheme })
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}/*
Restore the Tarantool database from the backup.
Important
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 "http://127.0.0.1:18411/v2/galleries/${x%%.json}"; done for x in *.json; do sudo findface-storage-api-restore -config /etc/findface-sf-api.ini < "$x"; done
Restart the
findface-security
service.sudo systemctl stop findface-security.service