Production-grade highly available monitoring infrastructure using PostgreSQL 16, Patroni, etcd, Keepalived, HAProxy and Zabbix 7.0.
- Overview
- Features
- Architecture
- Topology
- Technology Stack
- Tested Environment
- Deployment Order
- Deployment Workflow
- Documentation
- Repository Structure
- Example Configuration Files
- High Availability Workflow
- Tested Failover Scenarios
- Security Considerations
- Lessons Learned
- Future Improvements
- Screenshots
- Production Limitations
- Disclaimer
- Author
This project demonstrates a complete high availability architecture for Zabbix monitoring infrastructure with automatic PostgreSQL failover, frontend redundancy and distributed cluster management.
The environment was built and tested on Ubuntu 24.04 servers.
The repository contains:
- Deployment documentation
- Example production-style configuration files
- Architecture diagrams
- Failover testing procedures
- Troubleshooting notes
- Operational lessons learned
- PostgreSQL High Availability
- Patroni automatic failover
- etcd distributed consensus
- Keepalived Virtual IP failover
- Zabbix HA nodes
- HAProxy frontend load balancing
- Production-style architecture
- Multi-node redundancy
The architecture consists of a 3-node PostgreSQL HA cluster managed by Patroni and ETCD, with Keepalived providing VIP failover and HAProxy balancing Zabbix frontend traffic.
| Component | Count |
|---|---|
| PostgreSQL Nodes | 3 |
| Zabbix Nodes | 2 |
| Virtual IP | 1 |
| HAProxy Load Balancer | 1 |
| Technology | Purpose |
|---|---|
| PostgreSQL 16 | Database |
| Patroni | PostgreSQL HA management |
| etcd | Distributed consensus |
| Keepalived | Virtual IP failover |
| Zabbix 7.0 | Monitoring platform |
| HAProxy | Frontend load balancing |
| Ubuntu 24.04 | Operating system |
| Component | Version |
|---|---|
| Ubuntu | 24.04 |
| PostgreSQL | 16 |
| Patroni | 4.x |
| ETCD | 3.x |
| Zabbix | 7.0 |
| HAProxy | 3.2 |
The environment should be deployed in the following order:
- Prepare Ubuntu 24.04 servers
- Configure network connectivity and hostname resolution
- Install and configure ETCD cluster
- Install PostgreSQL 16 on database nodes
- Configure Patroni cluster management
- Configure PostgreSQL replication and failover
- Configure Keepalived Virtual IP
- Validate PostgreSQL high availability
- Install Zabbix server nodes
- Configure Zabbix HA
- Configure HAProxy frontend load balancing
- Perform failover testing and validation
Ubuntu Preparation
↓
ETCD Cluster Installation
↓
PostgreSQL Installation
↓
Patroni Configuration
↓
Keepalived VIP
↓
Zabbix HA Nodes
↓
HAProxy Load Balancer
↓
Failover Validation
| Section | Description |
|---|---|
| prerequisites.md | Infrastructure and deployment requirements |
| etcd-installation.md | Distributed consensus configuration |
| postgresql-installation.md | PostgreSQL setup and replication |
| patroni-installation.md | PostgreSQL cluster management |
| keepalived.md | VIP failover |
| zabbix-ha.md | Zabbix HA configuration |
| haproxy.md | Frontend load balancing |
| failover-testing.md | HA scenario validation |
| troubleshooting.md | Common issues and fixes |
| lessons-learned.md | Operational observations |
production-zabbix-ha-stack/
│
├── configs/ Example configuration files
├── diagrams/ Architecture diagrams
├── docs/ Deployment documentation
├── images/ Screenshots and validation images
├── scripts/ Helper scripts
└── README.md
The repository includes sanitized example configuration files for:
- ETCD
- PostgreSQL
- Patroni
- Keepalived
- HAProxy
- Zabbix HA
All sensitive information has been removed or replaced with placeholders.
- Patroni manages PostgreSQL cluster leadership
- etcd stores distributed cluster state
- Keepalived moves the VIP between database nodes
- Zabbix HA switches active server automatically
- HAProxy distributes frontend traffic
- PostgreSQL primary node failure
- Patroni leader re-election
- Keepalived VIP migration
- Zabbix HA failover
- Frontend redundancy validation
- SCRAM-SHA-256 authentication is recommended over MD5
- PostgreSQL access should be restricted to trusted networks
- PostgreSQL should not be exposed publicly
- Firewall rules should limit database access
- Strong passwords should be used for replication users
- Proper PostgreSQL replication configuration is critical
- VIP migration timing impacts reconnect behavior
- Patroni and etcd provide reliable HA orchestration
- HA testing is essential before production deployment
- Operational visibility improves troubleshooting
- Docker deployment
- Kubernetes support
- Ansible automation
- Prometheus/Grafana integration
- TLS encryption between nodes
- Automated failover testing
This repository demonstrates a production-style HA environment for educational and lab purposes.
Before using in real production environments, consider implementing:
- TLS encryption between nodes
- Backup and disaster recovery strategy
- Monitoring for ETCD and Patroni
- Secret management solution
- Multi-node HAProxy redundancy
- Automated configuration management
This project is intended for educational and production-lab environments.
Review all security settings before using in production.
Soroush Mehmandoust



