Configuration

The service allowed two variant of configuration:

  1. use the Configurator service

  2. use the configuration file

The service reads settings from the configuration file by default.

You can specify the –luna-config option for pulling settings from the Configurator service, see configurator.

Auto reload configuration

The service supports an auto-reload of configurations. You can enable this feature by specifying a config-reload option in the command line. The service periodically checks new settings. If current settings and new pulled settings are the same the service will not perform any actions. You can specify the check period in the pulling-time command line argument (10 seconds by default).

If a configuration fetching has failed, the service will work without applying any changes to the existing configurations.

If check connections with the new configuration have failed, the service will retry pulling new configuration after pulling-time seconds. The service will shut down after 10 failed attempts.

Warning

Service can work incorrectly while the new settings are being applied. It is strongly recommended not to send requests to the service when you change important settings (database credentials, work plugins list, and others).

During configuration reload any existing HTTP connections to the service will be closed.

If descriptor caching enabled and critical descriptor caching settings updated, the cache will be dropped. The critical descriptor caching settings are:

  1. matcher thread count

  2. faces database settings

  3. default face descriptor version

In other cases, the cache will not be dropped, unless critical errors have occurred during reinitialization.

Configuration file for administrator

Warning

The Platform limits parameter enables you to configure various limits:

  • References and candidates limits in the request.

  • Limit of the candidates returned in the response for each reference.

  • Limit for the number of items for some filters.


[LUNA_CONFIGURATOR]
#: load configs from LUNA Configurator
USE_CONFIGURATOR = 0
#: LUNA Configurator protocol, IP address, and port
LUNA_CONFIGURATOR_ORIGIN = http://127.0.0.1:5070
#: API version of the LUNA Configurator
LUNA_CONFIGURATOR_API  = 1


[LUNA_PYTHON_MATCHER_LOGGER]

#: folder, where logs are saved
FOLDER_WITH_LOGS = ./
#: level of debug print, by priority: "ERROR", "WARNING", "INFO", "DEBUG"
LOG_LEVEL = INFO
#: time format used in log records: "LOCAL" or "UTC"
LOG_TIME = LOCAL
#: maximum log file size in megabytes before performing rotation (0 - without rotation)
MAX_LOG_FILE_SIZE = 1024
#: send log to stdout
LOG_TO_STDOUT = 1
#: send log to file
LOG_TO_FILE = 0
#: allow multiline stack trace in logs
MULTILINE_STACK_TRACE = 1


[INFLUX_MONITORING]

#: send data for monitoring to InfluxDB
SEND_DATA_FOR_MONITORING = 1
#: [string] InfluxDB 2.x workspace
ORGANIZATION = luna
#: [string] InfluxDB 2.x authentication token
TOKEN = kofqt4Pfqjn6o0RBtMDQqVoJLgHoxxDUmmhiAZ7JS6VmEnrqZXQhxDhad8AX9tmiJH6CjM7Y1U8p5eSEocGzIA==
#: [string] InfluxDB 2.x bucket name
BUCKET = luna_monitoring
#: InfluxDB IP address
HOST = 127.0.0.1
#: InfluxDB port
PORT = 8086
#: use HTTPS to connect to InfluxDB
USE_SSL = 0
#: frequency of sending monitoring data to InfluxDB (in seconds)
FLUSHING_PERIOD = 1


[LUNA_FACES_DB]

#: [string] type of database: "postgres" or "oracle"; "postgres" type is used by default
DB_TYPE = postgres
#: [string] database username
DB_USER = luna
#: [string] database password
DB_PASSWORD = luna
#: [string] database IP address
DB_HOST = 127.0.0.1
#: [integer] database listener port, 5432 - default for "postgres" type, 1521 - default for "oracle" type
DB_PORT = 5432
#: [string] database name for "postgres" type, SID name for "oracle" type
DB_NAME = luna_faces


[LUNA_FACES_DB.DB_SETTINGS]

#: [integer] database connection pool size
CONNECTION_POOL_SIZE = 5


[LUNA_ATTRIBUTES_DB]

#: [string] Redis database username
USER =
#: [string] Redis database password
PASSWORD =
#: [string] Redis database IP address
HOST = 127.0.0.1
#: [integer] Redis database listener port
PORT = 6379
#: [integer] Redis database number (0-15)
NUMBER = 0

[LUNA_ATTRIBUTES_DB.SENTINEL]
#: [string] sentinel master name
MASTER_NAME = luna_attributes
#: [list(string)] list of Redis Sentinel listeners (example [127.0.0.1:26379, 10.0.4.1:26379])
SENTINELS = []
#: [string] sentinel username
USER =
#: [string] sentinel password
PASSWORD =


[ADDITIONAL_SERVICES_USAGE]

#: [integer] send events to LUNA Events for storing
LUNA_EVENTS = 1


[LUNA_EVENTS_DB]

#: [string] type of database: "postgres"
DB_TYPE = postgres
#: [string] database username
DB_USER = luna
#: [string] database password
DB_PASSWORD = luna
#: [string] database IP address
DB_HOST = 127.0.0.1
#: [integer] database listener port, 5432 - default for "postgres" type
DB_PORT = 5432
#: [string] database name
DB_NAME = luna_events


[LUNA_EVENTS_DB.DB_SETTINGS]

#: [integer] database connection pool size
CONNECTION_POOL_SIZE = 10


[LUNA_PYTHON_MATCHER_ADDRESS]

#: [string] LUNA Python Matcher protocol, IP address, and port
ORIGIN = http://127.0.0.1:5100
#: [integer] API version of the LUNA Python Matcher
API_VERSION = 1


[LUNA_PROXY_TO_PYTHON_MATCHER_TIMEOUTS]

#: [integer] timeout for reading portion of data from peer
SOCK_READ = 300
#: [integer] HTTP request timeout (total)
REQUEST =  300

[DESCRIPTORS_CACHE]

#: [integer] use cache to speed up some requests
CACHE_ENABLED = 1
#: [integer] updating cache interval in seconds
UPDATING_CACHE_INTERVAL = 2

[DESCRIPTORS_CACHE.RPC_SETTINGS]
#: [integer] number of connections between lpm and cached matcher processes
POOL_SIZE = 100

[DESCRIPTORS_CACHE.RPC_SETTINGS.TIMEOUTS]
#: [integer] connect timeout in seconds
CONNECT_TIMEOUT = 20
#: [integer] request timeout in seconds
REQUEST_TIMEOUT = 60
#: [integer] response timeout in seconds
RESPONSE_TIMEOUT = 60


[DESCRIPTORS_CACHE.MATCHING_SETTINGS]
#: [integer] thread count for matching by the cache; nonnegative value; 0 - autoselect
THREAD_COUNT = 0
#: [integer] number of workers that process cached matcher queue
TASKS_COUNT = 10
#: [integer] maximum number of match requests within single batch in cached matcher
BATCH_SIZE = 20

[DESCRIPTORS_CACHE.CACHED_DATA.FACES_LISTS]
#: [[string]] lists that should not be cached (omit to disable)
EXCLUDE = []
#: [[string]] lists that should be cached (omit to disable)
INCLUDE =

[OTHER]

#: [integer] default face descriptor version
DEFAULT_FACE_DESCRIPTOR_VERSION = 62
#: [integer] default human body descriptor version
DEFAULT_HUMAN_DESCRIPTOR_VERSION = 110
#: [string] time format used in database records: "LOCAL" or "UTC"
STORAGE_TIME = LOCAL
#: list of active plugins
LUNA_PYTHON_MATCHER_ACTIVE_PLUGINS = []

# Luna Matcher Proxy settings:

[LUNA_MATCHER_PROXY_LOGGER]

#: folder, where logs are saved
FOLDER_WITH_LOGS = ./
#: level of debug print, by priority: "ERROR", "WARNING", "INFO", "DEBUG"
LOG_LEVEL = INFO
#: time format used in log records: "LOCAL" or "UTC"
LOG_TIME = LOCAL
#: maximum log file size in megabytes before performing rotation (0 - without rotation)
MAX_LOG_FILE_SIZE = 1024
#: send log to stdout
LOG_TO_STDOUT = 0
#: send log to file
LOG_TO_FILE = 1
#: allow multiline stack trace in logs
MULTILINE_STACK_TRACE = 1


[PLATFORM_LIMITS.MATCH]

#: [integer] array filter limit. The maximum number of items provided in candidates' filters. The limit is set for part of the filters only.
ARRAY_FILTER_LIMIT = 1000
#: [integer] reference limit
REFERENCE_LIMIT = 30
#: [integer] candidate limit
CANDIDATE_LIMIT = 30
#: [integer] The maximum number of matching results for the candidates' list returned in the response.
RESULT_CANDIDATE_LIMIT = 100


[PLATFORM_LIMITS.CROSS_MATCH]

#: [integer] short array filter limit. The maximum number of items provided in filters. The limit is set for part of the filters only.
SHORT_ARRAY_FILTER_LIMIT = 1000
#: [integer] array filter limit. The maximum number of items provided in filters. The limit is set for part of the filters only.
ARRAY_FILTER_LIMIT = 20000
#: [integer] The maximum number of matching results for the candidates' list returned in the response.
RESULT_CANDIDATE_LIMIT = 20000
#: [integer] general limit
GENERAL_LIMIT = 100000

[LUNA_PYTHON_MATCHER_HTTP_SETTINGS]
#: web server http settings

#: [integer] service request timeout (in seconds)
REQUEST_TIMEOUT = 60
#: [integer] service response timeout (in seconds)
RESPONSE_TIMEOUT = 600
#: [integer] max request size (in bytes), default 1gb
REQUEST_MAX_SIZE = 1073741824
#: [integer] service http keep-alive timeout (in seconds)
KEEP_ALIVE_TIMEOUT = 15


[LUNA_MATCHER_PROXY_HTTP_SETTINGS]
#: web server http settings

#: [integer] service request timeout (in seconds)
REQUEST_TIMEOUT = 60
#: [integer] service response timeout (in seconds)
RESPONSE_TIMEOUT = 600
#: [integer] max request size (in bytes), default 1gb
REQUEST_MAX_SIZE = 1073741824
#: [integer] service http keep-alive timeout (in seconds)
KEEP_ALIVE_TIMEOUT = 15


[LUNA_SERVICE_METRICS]

#: [int] whether to enable /metrics path and statistics collection
ENABLED = 0
# [string] statistics data format (prometheus is the only option yet)
METRICS_FORMAT = prometheus


[LUNA_SERVICE_METRICS.EXTRA_LABELS]

Matching using CORE Indexed Matcher

RabbitMQ is used as a message queue for CORE Indexed Matcher. The RabbitMQ parameters must be specified in the [QUEUE_SETTINGS] section.

The INDEXED_MATCHER parameter must be set to “1” for the CORE Indexed Matcher utilization.

Use the [LUNA_MATCHER_CLUSTERS.*] section to configure usage of the CORE Indexed Matcher. Set the number of cluster instead of “*”

You must specify the following parameters:

  • CLUSTER_TYPE - the type of the used matcher: only core-indexed-matcher available at the moment;

  • ROUTING_KEY - the routing key set for the Matcher in RabbitMQ;

  • RABBIT_EXCHANGE - the exchange set for the Matcher in RabbitMQ.

Extended administrator configuration

Common config with global variables.

luna_python_matcher.configs.config_common.DATABASE_NUMBER = 0

todo remove after LUNA-3773

luna_python_matcher.configs.config_common.DEFAULT_CROSS_MATCH_LIMIT = 5

default cross match limit

luna_python_matcher.configs.config_common.DEFAULT_GEO_POSITION_DELTA = 0.01

default filter longitude/latitude delta in degrees

luna_python_matcher.configs.config_common.DEFAULT_MATCHING_COST = 100.0

Default matcher matching cost

luna_python_matcher.configs.config_common.DEFAULT_MATCH_LIMIT = 3

default match limit

luna_python_matcher.configs.config_common.GET_DESCRIPTORS_PER_REQUEST_LIMIT = 100000

cross match limit for getting descriptors from database

luna_python_matcher.configs.config_common.IDS_SIGNIFICANT_COUNT = 1000

if event_ids or external_ids candidate filter size will be greater than specified value, so the event reference will mimic to descriptor reference to speed up matching request

Type:

for bodies matching request with event reference

luna_python_matcher.configs.config_common.NODB_MATCHING_TOOL_BATCH_SIZE = 100000

descriptors load batch size

luna_python_matcher.configs.config_common.NODB_MATCHING_TOOL_ENABLED = None

whether to enable no-db matching (experimental)

luna_python_matcher.configs.config_common.RESPONSE_TIMEOUT = 600

How long a response can take to process (sec)