Advanced HAProxy Configs for Big Data, NoSQL, Web and Infrastructure technologies
Advanced HAProxy configurations for Multi-Master, Active-Standby (Hadoop, HBase, Presto) and Peer-to-Peer technologies (Elasticsearch, SolrCloud etc).
Designed both for production-grade High Availability and also to make scripting and monitoring easier when connecting to APIs.
Forked as a submodule from the Advanced Nagios Plugins Collection, these configurations contain specialised Health Checks for each system based on experience and code from the Advanced Nagios Plugins Collection and DevOps Python Tools github repos.
-Recommended to run with High Availability HAProxy using VRRP to create full production-grade High Availability load balancer solutions.*
Hari Sekhon
Cloud & Big Data Contractor, United Kingdom
(ex-Cloudera, former Hortonworks Consultant)
(you're welcome to connect with me on LinkedIn)
Features
Each config comes pre-tuned with:
- Specialised Health Checks per technology's API
- Load Balancing algorithm selected best suited per technology (depending on Active/Passive, Peer-to-Peer etc)
- Various buffer sizes, keepalives, connection limits and server retries already tuned (many via shared global config
10-global.cfg
) - ACL protections - limits access to private IP addresses - safer by default but easy to disable if you need to serve the internet
- Additional logging
- Optional Stats Admin UI (excellent for admin, monitoring and debugging - password protected, change the default password from 'test' in
20-stats.cfg
if you source that config)
You should use an expert consultant to fine tune to your needs but these should be extremely close to your finished production configurations. In most cases all you need to do is put in your addresses for the backend servers.
Usage
Configurations are split by service in the form of <service>.cfg
for mix-and-match convenience and must be combined with 10-global.cfg
settings like so:
$ haproxy -f 10-global.cfg -f elasticsearch.cfg
For multiple services just add those service configurations to the command line options:
$ haproxy -f 10-global.cfg -f elasticsearch.cfg -f solrcloud.cfg
Some technologies default to the same port number (eg. Ambari and Presto both use port 8080), so if running both on the same HAProxy host then just modify one of the frontend listening port numbers.
If you want to add a Stats Admin UI then include the 20-stats.cfg
configuration (remember to change the default password test
):
$ haproxy -f 10-global.cfg -f 20-stats.cfg -f elasticsearch.cfg ...
Shortcut
To shorten the command line you can simply use the run.sh
script instead:
./run.sh elasticsearch.cfg
and easily with multiple configs
./run.sh elasticsearch.cfg solrcloud.cfg ...
Backend Server Addresses (set these to your cluster hosts)
-In most cases all you'll need to do is add your server addresses in to the backend config and then start HAProxy*.
Common backend server addresses have been pre-populated for convenience including:
<service>
- generic service name matching the proxied technology - could be resolved by DNS to multiple IPs to be balanced across192.168.99.100
- the common Docker Machine / MiniKube / MiniShift IP addressdocker
- convenient to use DNS or/etc/hosts
to point this to your Docker host
These addresses are used in Continuous Integration tests run on this repo from the Advanced Nagios Plugins Collection.
More Configs
See the untested/
directory for a few more including SSL config versions I haven't got round to testing yet but should work.
Tests
Forked as a submodule from the Advanced Nagios Plugins Collection. These HAProxy configs are tested against Docker containers as part of CI tests in that repo.
Related Repositories
-
find_active_server.py
from the DevOps Python Tools repo and its related adjacent programs for on-the-fly command line determination of active masters or first responding peers across many of these same technologies -
DevOps Bash Tools - 1000+ DevOps Bash Scripts, Advanced
.bashrc
,.vimrc
,.screenrc
,.tmux.conf
,.gitconfig
, CI configs & Utility Code Library - AWS, GCP, Kubernetes, Docker, Kafka, Hadoop, SQL, BigQuery, Hive, Impala, PostgreSQL, MySQL, LDAP, DockerHub, Jenkins, Spotify API & MP3 tools, Git tricks, GitHub API, GitLab API, BitBucket API, Code & build linting, package management for Linux / Mac / Python / Perl / Ruby / NodeJS / Golang, and lots more random goodies -
SQL Scripts - 100+ SQL Scripts - PostgreSQL, MySQL, AWS Athena, Google BigQuery
-
Jenkins - Advanced Jenkinsfile & Jenkins Groovy Shared Library
-
GitHub-Actions - GitHub Actions master template & GitHub Actions Shared Workflows library
-
Templates - dozens of Code & Config templates - AWS, GCP, Docker, Jenkins, Terraform, Vagrant, Puppet, Python, Bash, Go, Perl, Java, Scala, Groovy, Maven, SBT, Gradle, Make, GitHub Actions Workflows, CircleCI, Jenkinsfile, Makefile, Dockerfile, docker-compose.yml, M4 etc.
-
Kubernetes configs - Kubernetes YAML configs - Best Practices, Tips & Tricks are baked right into the templates for future deployments
-
Terraform - Terraform templates for AWS / GCP / Azure / GitHub management
-
DevOps Python Tools - 80+ DevOps CLI tools for AWS, GCP, Hadoop, HBase, Spark, Log Anonymizer, Ambari Blueprints, AWS CloudFormation, Linux, Docker, Spark Data Converters & Validators (Avro / Parquet / JSON / CSV / INI / XML / YAML), Elasticsearch, Solr, Travis CI, Pig, IPython
-
DevOps Perl Tools - 25+ DevOps CLI tools for Hadoop, HDFS, Hive, Solr/SolrCloud CLI, Log Anonymizer, Nginx stats & HTTP(S) URL watchers for load balanced web farms, Dockerfiles & SQL ReCaser (MySQL, PostgreSQL, AWS Redshift, Snowflake, Apache Drill, Hive, Impala, Cassandra CQL, Microsoft SQL Server, Oracle, Couchbase N1QL, Dockerfiles, Pig Latin, Neo4j, InfluxDB), Ambari FreeIPA Kerberos, Datameer, Linux...
-
The Advanced Nagios Plugins Collection - 450+ programs for Nagios monitoring your Hadoop & NoSQL clusters. Covers every Hadoop vendor's management API and every major NoSQL technology (HBase, Cassandra, MongoDB, Elasticsearch, Solr, Riak, Redis etc.) as well as message queues (Kafka, RabbitMQ), continuous integration (Jenkins, Travis CI) and traditional infrastructure (SSL, Whois, DNS, Linux)
-
Nagios Plugin Kafka - Kafka API pub/sub Nagios Plugin written in Scala with Kerberos support
-
Dockerfiles - 50+ DockerHub public images for Docker & Kubernetes - Hadoop, Kafka, ZooKeeper, HBase, Cassandra, Solr, SolrCloud, Presto, Apache Drill, Nifi, Spark, Mesos, Consul, Riak, OpenTSDB, Jython, Advanced Nagios Plugins & DevOps Tools repos on Alpine, CentOS, Debian, Fedora, Ubuntu, Superset, H2O, Serf, Alluxio / Tachyon, FakeS3
-
HashiCorp Packer templates - Linux automated bare-metal installs and portable virtual machines OVA format appliances using HashiCorp Packer, Redhat Kickstart, Debian Preseed and Ubuntu AutoInstaller / Cloud-Init
-
Diagrams-as-Code - Cloud & Open Source architecture diagrams with Python & D2 source code provided - automatically regenerated via GitHub Actions CI/CD - AWS, GCP, Kubernetes, Jenkins, ArgoCD, Traefik, Kong API Gateway, Nginx, Redis, PostgreSQL, Kafka, Spark, web farms, event processing...