Database configuration#
For LUNA PLATFORM to work correctly, you must configure the databases as follows:
- Configure InfluxDB.
- Compile the VLMatch library and transfer it to the DBMS.
- Create database user.
- Install PostGIS for Events database.
VLMatch is a function for performing descriptor matching calculations. The VLMatch library is compiled for a specific version of the database. Do not use a library created for a different version of the database. For example, a library created for PostgreSQL version 16 cannot be used for PostgreSQL version 12.
Storages will automatically add VLMatch functions to the PostgreSQL DBMS and activate Postgis.
The sections below provide commands for PostgreSQL. For Oracle, only the VLMatch library compilation commands are given (see "VLMatch library compilation for Oracle" in the "Additional information" section).
Configuring InfluxDB#
If InfluxDB is already deployed in your Kubernetes cluster, make sure the following information is set correctly:
-
Username and password
-
Bucket and organization name
-
Administrator Token
Important: The above data must be specified in the LUNA PLATFORM settings dump file in order for services to access InfluxDB. However, Configurator service settings cannot be specified in the dump file, so they must be specified in the Configurator service Helm chart as follows:
env:
- name: VL_SETTINGS.LUNA_MONITORING.STORAGE_TYPE
value: "influx"
- name: VL_SETTINGS.LUNA_MONITORING.SEND_DATA_FOR_MONITORING
value: "1"
- name: VL_SETTINGS.LUNA_MONITORING.ORGANIZATION
value: "luna"
- name: VL_SETTINGS.LUNA_MONITORING.TOKEN
value: "12345678"
- name: VL_SETTINGS.LUNA_MONITORING.BUCKET
value: "luna_monitoring"
- name: VL_SETTINGS.LUNA_MONITORING.HOST
value: "influxdb"
- name: VL_SETTINGS.LUNA_MONITORING.PORT
value: "8086"
- name: VL_SETTINGS.LUNA_MONITORING.USE_SSL
value: "0"
- name: VL_SETTINGS.LUNA_MONITORING.FLUSHING_PERIOD
value: "1"
InfluxDB settings can also be specified in environment variables in the Helm chart of each service.
VLMatch library compilation#
Note: The following instructions provide an example for PostgreSQL 16 DBMS on Almalinux 8.
All files required to compile the user-defined extension (UDx) into VLMatch can be found in the following directory:
/var/lib/luna/current/extras/VLMatch/postgres/
To compile the VLMatch UDx function, you need to:
- Install the RPM repository:
dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
- Install PostgreSQL:
dnf install postgresql16-server
- Install development environment:
dnf install postgresql16-devel
- Install the gcc package:
dnf install gcc-c++
-
Install CMAKE. Version 3.5 or higher is required.
-
Open the make.sh script in a text editor. It includes the paths to the currently used PostgreSQL version. Change the following values (if necessary):
SDK_HOME
specifies the path to the PostgreSQL home directory. The default is /usr/pgsql-16/include/server
.
LIB_ROOT
specifies the path to the PostgreSQL library root directory. The default is /usr/pgsql-16/lib
.
- Open the
make.sh
script directory and run it:
cd /var/lib/luna/current/extras/VLMatch/postgres/
chmod +x make.sh
./make.sh
Move the generated VLMatchSource.so
file to the PostgreSQL DBMS in the \srv
directory.
Create database user#
This section provides sample commands for creating a user using the PostgreSQL DBMS as an example.
Create a database user.
psql -U postgres -c 'create role luna;'
Assign a password to the user.
psql -U postgres -c "ALTER USER luna WITH PASSWORD 'luna';"
Note: Note that the username and password are specified in LUNA PLATFORM settings to connect services to the database.
Storages will automatically create the necessary databases and grant all necessary rights according to the user name from the Storages configuration file.
Install PostGIS for Events database#
The Events service requires a PostGIS extension to work with coordinates.
Since PostGIS is an extension for PostgreSQL, its version usually corresponds to the version of PostgreSQL with which it is compatible.
Install the extension yourself for the PostgreSQL version you are using, using official documentation.
PostgreSQL 16 requires PostGIS version 3.4.