Configure external PostgreSQL database for metrics service with containerized installer
Configure external PostgreSQL database for metrics service with containerized installer
Configure metrics service to use an external PostgreSQL database to leverage enterprise database management, backup, and high availability infrastructure.
Before you begin
External PostgreSQL 15 or later database server accessible from metrics service
Database administrator credentials with CREATE DATABASE and CREATE USER privileges
Network connectivity to database server (port 5432 default)
Firewall rules configured to allow connections from metrics service hosts
Ansible Automation Platform 2.7 containerized installer downloaded and extracted
Inventory file access with permission to modify [automationmetrics] group and variables
Root or sudo access to metrics service host
About this task
This procedure configures metrics service to use an external PostgreSQL database instead of installer-managed databases when deploying with the Ansible Automation Platform 2.7 containerized installer. By using enterprise database infrastructure, you eliminate installer-managed PostgreSQL processes (saving approximately 2 GB memory and 2 vCPU per database instance), reduce database provisioning time by approximately 50% (5 minutes versus 10 minutes), and enable centralized database management with unified backup, restore, and high availability for all Ansible Automation Platform components.
Procedure
Create metrics_service database
Create the metrics_service database with UTF-8 encoding to support internationalization and ensure compatibility with Django migrations.
Why UTF-8 encoding: Django ORM requires UTF-8 encoding for proper handling of internationalized strings and special characters in metric data.
Create database users
Create two database users. The metrics_service user has full database privileges for schema management. The ms_awx_readonly user has SELECT-only privileges for secure data collection from automation controller.
-- metrics service user (ALL privileges)
CREATE USER metrics_service WITH PASSWORD '<SECURE_PASSWORD>';
GRANT ALL PRIVILEGES ON DATABASE metrics_service TO metrics_service;
\c metrics_service
GRANT ALL ON SCHEMA public TO metrics_service;
-- Read-only user for controller database
\c postgres
CREATE USER ms_awx_readonly WITH PASSWORD '<READONLY_PASSWORD>';
\c awx
GRANT SELECT ON ALL TABLES IN SCHEMA public TO ms_awx_readonly;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO ms_awx_readonly;
Important
Change awx to match your actual database name for automation controller. Common alternative names: automationcontroller, tower, awx_production.
Expand
User
Database
Privileges
Purpose
metrics_service
metrics_service
ALL
Django migrations, schema management, metrics data storage
ms_awx_readonly
awx (controller database)
SELECT ON ALL TABLES IN SCHEMA public
Read-only metrics collection from controller
Note
Security note: The ms_awx_readonly user has only SELECT privileges, preventing any writes to automation controller data. This ensures metrics service cannot modify controller operations.
Configure pg_hba.conf
Add authentication rules to allow metrics service host to connect to both databases using secure scram-sha-256 authentication.
We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.
Making open source more inclusive
Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.
About Red Hat Documentation
We help Red Hat users innovate and achieve their goals with our products and services with content they can trust. Explore our recent updates.