Database

Creation and Initialization

Starting from the Callisto version, the database on the XiVO PBX and all mediaservers is started inside a docker container based on custom image. On first startup the database will be initialized and the required structure and data will be created inside a host mounted folder /var/lib/postgresql/11/main/.

Custom database configuration

The database image contains a default postgres configuration and some specific defaults required by our application:

  • the postgres default configuration is located in /var/lib/postgresql/11/main/postgresql.conf
  • and our custom defaults are in /var/lib/postgresql/11/main/conf.d/00-xivo-default.conf.

Warning

Do not change these files!

If you need to change some parameters, create another file in /var/lib/postgresql/11/main/conf.d/ prefixed with a number like 01 or upper and with a .conf extension. This file will be loaded after all defaults and can override any parameter.

Sample configuration

Here is an example to increase the default number of concurrent connection to the database:

/var/lib/postgresql/11/main/conf.d/10-custom-max-connection.conf:

max_connections = 300

Apply the configuration

Run this command to reload postgres configuration:

xivo-dcomp reload-db

It will not restart db container despite the message “Killing xivo_db_1”.

Files path summary table

File Path Comment
postgresql.conf /var/lib/postgresql/11/main/ Please, do not edit this file but use overriding mechanism explained in Custom database configuration
conf.d files /var/lib/postgresql/11/main/conf.d/ Files are handled in Lexicographical order
pg_hba.conf /var/lib/postgresql/11/main/ Configure connection authorization in this file
postgresql-11-main.log /var/log/postgresql/ Database log file.

Connections to database and replication schema

This schema shows required database connections between different types of servers. These connections must be authorized in pg_hba.conf file. It is being done automatically or it is described in installation or upgrade documentation.

It also shows how asterisk database is replicated. Only configuration tables are replicated between asterisk databases and only event tables (cel and queue_log) are replicated to stats database.

../../../_images/db_connections.png