Automatic detection of local database version

After executing the ibatyr init command, the database configuration file /etc/ibatyr/db_profile is automatically populated.

Settings are determined for databases:

  • PostgreSQL 11

  • PostgreSQL 15.

For example, for PostgreSQL 15 it looks like:

PSQL_VERSION=15
PSQL_BIN_DIR=/usr/lib/postgresql/15/bin
PSQL_LIB_DIR=/usr/lib/postgresql/15/lib
PSQL_SHARE_DIR=/usr/share/postgresql/15
PSQL_CONF_PATH=/etc/postgresql/15/main/postgresql.conf
PSQL_DATA_DIR=/var/lib/postgresql/15/main
PSQL_HBA_PATH=/etc/postgresql/15/main/pg_hba.conf
PSQL_TSEARCH_DIR=/usr/share/postgresql/15/tsearch_data
PSQL_HYPERSCAN=hyperscan.so.15
PSQL_SERVICE=postgresql

Description of file parameters */etc/ibatyr/db_profile*

PSQL_VERSION=15 - indicates the installed version of the PostgreSQL database.

PSQL_BIN_DIR=/usr/lib/postgresql/15/bin - path to executable files, including the server daemon (postgres), client utility (psql) and other programs (pg_dump, pg_restore, pg_ctl).

PSQL_LIB_DIR=/usr/lib/postgresql/15/lib — directory with dynamic libraries for PostgreSQL. These files contain functions and modules that are used by the server and third-party extensions.

PSQL_SHARE_DIR=/usr/share/postgresql/15 - directory with PostgreSQL shared data. It includes help files, SQL scripts, localizations and configuration templates.

PSQL_CONF_PATH=/etc/postgresql/15/main/postgresql.conf — main server configuration file. It contains PostgreSQL settings that affect the performance and behavior of the server. For example, network parameters, memory, logging.

PSQL_DATA_DIR=/var/lib/postgresql/15/main is the directory in which the database cluster is initialized. It stores all the data: tables, indexes, system catalogs, transaction logs (WAL) and other files created during initialization using the initdb utility.

PSQL_HBA_PATH=/etc/postgresql/15/main/pg_hba.conf - configuration file for user authentication (HBA - host-based authentication). Defines which users and hosts can connect to the server and what authentication methods are used (passwords, certificates).

PSQL_TSEARCH_DIR=/usr/share/postgresql/15/tsearch_data - directory with data for text search, including dictionaries and rules for PostgreSQL full-text search.

PSQL_HYPERSCAN=hyperscan.so.15 - Points to the Hyperscan dynamic library, which is used in PostgreSQL for high-performance regular expression matching. This library is used in extensions or functions that require fast analysis of text data.

PSQL_SERVICE=postgresql is the name of the PostgreSQL system service. Used to manage the server through the systemctl or service system utilities (start, stop, restart).

Changing a file

When changing the local database or database version, we recommend making a copy of the db_profile file to preserve the old settings. Add the database version to the name and make a backup. Then delete the original file manually because it is not deleted automatically.

After changing the file, restart the server:

ibatyr restart

When executing the ibatyr init command, the system will create a new db_profile file with the current settings.

Remote database

If the standard paths do not change when transferring the database to remote hosting, the db_profile file can be left unchanged.

If the database is different - for example, the version of PostgreSQL is different - specify the correct settings in the db_profile file manually. This is due to the fact that when working with a remote server, the system cannot automatically determine all paths and settings, as it does for a local database.

After making changes to the file, restart the server:

ibatyr restart

Standard database settings

Use these settings when modifying the db_profile file.

Note

It is important to specify the correct version of Hyperscan because it depends on your database version.

PostgreSQL 11

PSQL_VERSION=11
PSQL_BIN_DIR=/usr/lib/postgresql/11/bin
PSQL_LIB_DIR=/usr/lib/postgresql/11/lib
PSQL_SHARE_DIR=/usr/share/postgresql/11
PSQL_CONF_PATH=/etc/postgresql/11/main/postgresql.conf
PSQL_DATA_DIR=/var/lib/postgresql/11/main
PSQL_HBA_PATH=/etc/postgresql/11/main/pg_hba.conf
PSQL_TSEARCH_DIR=/usr/share/postgresql/11/tsearch_data
PSQL_HYPERSCAN=hyperscan.so.11
PSQL_SERVICE=postgresql