Use DBCatalogManager

Overview

DBCatalogManager is a Trino catalog management implementation that stores catalog configurations in an ADPG/PostgreSQL database rather than in .properties files. Keeping catalog metadata in a database has several benefits, including improved collaboration, version control, synchronization, and enhanced security.

The implementation allows you to manage Trino catalogs dynamically using the CREATE CATALOG/DROP CATALOG commands. It allows updating catalog properties without having to restart the Trino service. DBCatalogManager provides encryption capabilities to store sensitive configuration properties in the encrypted form.

By default, DBCatalogManager is preconfigured to work with the ADPG service of an ADH cluster. DBCatalogManager can connect to the ADPG service out-of-the-box, without any configurations; it also can initialize all the necessary DB objects (database, user, role) on the ADPG side. For more details on using DBCatalogManager with the ADPG service, see ADPG connection example.

Enable DBCatalogManager

You can enable DBCatalogManager using ADCM. For this, select the DB value for the catalog.management parameter (Clusters → <clusterName> → Services → Trino → Components → Trino Coordinator → Trino catalog management) and restart the Trino service.

TIP
When you enable DBCatalogManager and restart the Trino service afterwards, ADCM asks whether to initialize necessary DB entities (database, user, role) in ADPG automatically.

Once enabled, you can create new catalogs using the CREATE CATALOG command, and Trino will store catalog configurations in the database specified by the Postgres JDBC URL parameter (by default, the DB name is catalog).

DBCatalogManager stores catalog configurations in tables belonging to the trino schema. For example, to view these tables using psql, use the commands:

\c catalog
\dt trino.*

Sample output:

                    List of relations
 Schema |             Name             | Type  |  Owner
--------+------------------------------+-------+---------
 trino  | catalog                      | table | catalog
 trino  | catalog_property             | table | catalog
 trino  | catalog_scheduler_job_launch | table | catalog

Configuration

ADCM provides a list of settings for tuning the DBCatalogManager behavior. Their description is below.

Trino catalog management
Parameter Description Default value

catalog.management

Catalog manager type

static

Postgres JDBC URL

JDBC connection URL of the Postgres catalog store

jdbc:postgresql://{{ groups['adpg.adpg'][0] | d(omit) }}:5432/catalog

Postgres username

Postgres catalog store JDBC connection username

catalog

Postgres password

Postgres catalog store JDBC connection password

 — 

Enable cleanup

Defines whether the cleanup of the old version catalogs is enabled

true

Encryption password

Password for the properties encryption

 — 

RegEx pattern

Regular expression pattern for defining properties to be encrypted

 — 

Cleanup old version catalogs

Old version catalogs cleanup interval. Minimal value is 10d

30d

Time to live of old version catalogs

Time-to-live (TTL) of old version catalogs. Minimal value is 1d

365d

Catalog versioning and cleanup

Running DROP CATALOG with DBCatalogManager does not remove the catalog data immediately but marks the catalog as inactive, so that subsequent SHOW CATALOGS operations will not include the catalog in the results.

Such inactive catalogs can be retained in the database for a configurable period of time specified by the Time to live of old version catalogs ADCM property. After that, catalogs exceeding the time-to-live value get removed by a scheduled job running at regular intervals and specified by the Cleanup old version catalogs property.

Encryption

DBCatalogManager allows encrypting specific catalog configuration fields before writing to the database. To specify the fields, use the RegEx pattern property in ADCM. Its value should be a regular expression matching one or more configuration property keys that have to be encrypted. For example, the following expression can be used to encrypt passwords:

.*password

Migration

You can migrate existing catalog configurations stored in .properties files to ADPG. For this, use the command:

MIGRATE CATALOG [IF NOT EXISTS] ALL | <catalog name>

An example of migrating a single catalog and all available catalogs is below:

MIGRATE CATALOG IF NOT EXISTS test_trino_catalog
MIGRATE CATALOG IF NOT EXISTS ALL

ADPG connection example

The following steps show how to use DBCatalogManager with the ADPG service running in the same ADH cluster. The example assumes that both Trino and ADPG services use default settings, which allows establishing the connection without any manipulations on the ADPG side. If you need to use a different DB user, password, or database for connecting to ADPG, specify them using the corresponding settings.

  1. In ADCM, enable DBCatalogManager using the catalog.management parameter (Clusters → <clusterName> → Services → Trino → Components → Trino Coordinator → Trino catalog management) and restart the Trino service. When running the Restart action, ensure that the Init DB credentials option is selected.

  2. Create a new Trino catalog. For this, connect to Trino Coordinator and run the command:

    CREATE CATALOG test_trino_catalog USING memory
    WITH ("memory.max-data-per-node"='128MB');
  3. Ensure that the catalog has been created:

    SHOW CATALOGS;

    The output:

    information_schema
    test_trino_catalog
  4. Check the ADPG database for new writes. For example, by using psql, query the tables belonging to the trino schema:

    \c catalog
    SELECT * FROM trino.catalog;

    Sample output:

     id |        name        | connector_name |         date_from          | date_to | is_active
    ----+--------------------+----------------+----------------------------+---------+-----------
      1 | test_trino_catalog | memory         | 2025-06-03 21:12:11.193509 |         | t
  5. To migrate an existing catalog stored as a .properties file (for example, /etc/trino/catalogs/hive-adh.properties), use the command:

    MIGRATE CATALOG "hive-adh"

    Ensure that the catalog becomes available:

    SHOW CATALOGS;

    The output:

    Catalog           |
    ------------------+
    hive-adh          |
    system            |
    test_trino_catalog|

    Check the new record in ADPG:

    \c catalog
    SELECT * FROM trino.catalog;

    The output:

     id |        name        | connector_name |         date_from          | date_to | is_active
    ----+--------------------+----------------+----------------------------+---------+-----------
      1 | test_trino_catalog | memory         | 2025-06-03 21:12:11.193509 |         | t
      2 | hive-adh           | hive           | 2025-06-03 22:10:43.222419 |         | t
Found a mistake? Seleсt text and press Ctrl+Enter to report it