Files
partitioning/QUICKSTART.md

2.7 KiB

Quickstart (PostgreSQL Partitioning Test)

Start Environment

Note

: If docker commands fail with permission errors, run newgrp docker or ensure your user is in the docker group (sudo usermod -aG docker $USER) and log out/in.

cd postgresql/docker
sudo ./run_test_env.sh --pg 16 --zabbix 7.0
# Options: --pg <16|17|18> --zabbix <7.0|7.4>

Verify

# Check status
docker ps

# SQL Shell
docker exec -it zabbix-db-test psql -U zabbix -d zabbix
# Password: zabbix

Reset

docker compose down -v

Partitioning

See ARCHITECTURE.md for details on the implemented declarative partitioning.

AWS RDS / External Database Testing

You can run these partitioning tests against a real AWS RDS (or any external PostgreSQL instance).

1. Configure Credentials

First, create a db_credentials file in the postgresql/ directory. (This file is ignored by Git to keep your passwords safe). Example postgresql/db_credentials:

# Admin credentials
export DB_HOST="your-rds-endpoint.rds.amazonaws.com"
export DB_PORT="5432"
export DB_NAME="postgres"
export DB_USER="postgres"
export DB_PASSWORD="your_admin_password"

# SSL Configuration
export DB_SSL_MODE="verify-full"
export DB_PEM_URL="https://truststore.pki.rds.amazonaws.com/global/global-bundle.pem"
export DB_SSL_ROOT_CERT="./global-bundle.pem"

# Zabbix credentials to be created
export ZBX_DB_NAME="zabbix"
export ZBX_DB_USER="zabbix"
export ZBX_DB_PASSWORD="zabbix_password"

2. Automated Testing

You can run the same automated deployment script, but instruct it to deploy directly to your RDS instance instead of a local Docker container:

cd postgresql/docker
./run_test_env.sh --pg 16 --zabbix 7.0 --rds

If you want to completely clean up the RDS database and start fresh (terminating existing connections and dropping all data), use the --rds-drop flag. You will be prompted to type yes to safely confirm the deletion:

./run_test_env.sh --pg 16 --zabbix 7.0 --rds-drop

3. Manual Setup & Zabbix Integration

If you want to prepare the real database for your Production Zabbix Server manually, you can just run the initialization script directly:

cd postgresql
./setup_rds.sh
# To drop an existing database and start fresh, use:
# ./setup_rds.sh --drop

The script will automatically connect as the postgres user, conditionally download the SSL certificates if needed, and set up the zabbix user and database. Upon success, the script will output the exact block you need to copy into your zabbix_server.conf, e.g.:

DBHost=your-rds-endpoint.rds.amazonaws.com
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix_password
DBPort=5432
DBTLSConnect=verify_full
DBTLSCAFile=/full/path/to/global-bundle.pem