All Projects → kvz → Nsfailover

kvz / Nsfailover

Let's Make DNS Outage Suck Less

Programming Languages

shell
77523 projects
bash
514 projects

Projects that are alternatives of or similar to Nsfailover

Bond Cni
Bond-cni is for fail-over and high availability of networking in cloudnative orchestration
Stars: ✭ 36 (-62.11%)
Mutual labels:  high-availability, failover
pg keeper
Simplified clustering module for PostgreSQL
Stars: ✭ 32 (-66.32%)
Mutual labels:  failover, high-availability
pg-dock
pg-dock cluster managment
Stars: ✭ 19 (-80%)
Mutual labels:  failover, high-availability
Appactive
AppActive: A middleware to build an application with multiple active architectures(阿里巴巴开源的一款标准通用且功能强大的构建应用多活架构的开源中间件)
Stars: ✭ 241 (+153.68%)
Mutual labels:  failover, high-availability
Paf
PostgreSQL Automatic Failover: High-Availibility for Postgres, based on Pacemaker and Corosync.
Stars: ✭ 288 (+203.16%)
Mutual labels:  high-availability, failover
Ansible Role Patroni
🐘 Ansible Role for Patroni
Stars: ✭ 40 (-57.89%)
Mutual labels:  high-availability, failover
Gauntlet
🔖 Guides, Articles, Podcasts, Videos and Notes to Build Reliable Large-Scale Distributed Systems.
Stars: ✭ 336 (+253.68%)
Mutual labels:  failover, high-availability
Postgresql cluster
PostgreSQL High-Availability Cluster (based on "Patroni" and "DCS(etcd)"). Automating deployment with Ansible.
Stars: ✭ 294 (+209.47%)
Mutual labels:  high-availability, failover
Patroni
A template for PostgreSQL High Availability with Etcd, Consul, ZooKeeper, or Kubernetes
Stars: ✭ 4,434 (+4567.37%)
Mutual labels:  high-availability, failover
Spilo
Highly available elephant herd: HA PostgreSQL cluster using Docker
Stars: ✭ 776 (+716.84%)
Mutual labels:  high-availability
Thanos
Highly available Prometheus setup with long term storage capabilities. A CNCF Incubating project.
Stars: ✭ 9,820 (+10236.84%)
Mutual labels:  high-availability
Pg auto failover
Postgres extension and service for automated failover and high-availability
Stars: ✭ 564 (+493.68%)
Mutual labels:  high-availability
Agola
Agola: CI/CD Redefined
Stars: ✭ 783 (+724.21%)
Mutual labels:  high-availability
Kube Aws
[EOL] A command-line tool to declaratively manage Kubernetes clusters on AWS
Stars: ✭ 1,146 (+1106.32%)
Mutual labels:  high-availability
Kubeadm Ha
Kubernetes high availiability deploy based on kubeadm, loadbalancer included (English/中文 for v1.15 - v1.20+)
Stars: ✭ 614 (+546.32%)
Mutual labels:  high-availability
Zlb
This is the repository of ZEVENET Load Balancer (next generation of Zen Load Balancer)
Stars: ✭ 90 (-5.26%)
Mutual labels:  high-availability
Promxy
An aggregating proxy to enable HA prometheus
Stars: ✭ 562 (+491.58%)
Mutual labels:  high-availability
Haipproxy
💖 High available distributed ip proxy pool, powerd by Scrapy and Redis
Stars: ✭ 4,993 (+5155.79%)
Mutual labels:  high-availability
Drc
MySQL active-active replication solution.
Stars: ✭ 92 (-3.16%)
Mutual labels:  high-availability
Mod cluster
mod_cluster is an intelligent native Apache httpd-based and pure-Java Undertow-based load-balancer
Stars: ✭ 88 (-7.37%)
Mutual labels:  high-availability

nsfailover

Build Status Gittip donate button Flattr donate button PayPayl donate button BitCoin donate button

Together with EC2 Premium support I've established that:

"Unfortunately the Linux DNS resolver doesn't seem to have direct support for detecting and doing failovers for DNS servers so you may need to write your own solution as you mentioned. " - Amazon Web Services Jan 22, 2013 01:13 AM PST

Read a longer introduction on my blog which was featured on Hacker News.

This simple program makes DNS outages suck less.

nsfailover

Every minute (or whatever), nsfailover.sh checks to see if the primary configured nameserver can resolve google.com. If it cannot, it writes the secondary, or even tertary server to function as the primary server in /etc/resolv.conf.

This way, requests are stalled for max a minute, and then all following requests are fast, even if the primary stays down.

Install

sudo curl -q https://raw.github.com/kvz/nsfailover/master/nsfailover.sh -o /usr/bin/nsfailover.sh && sudo chmod +x $_

Example

crontab -e
* * * * * NS_1=172.16.0.23 nsfailover.sh 2>&1 |logger -t cron-nsfailover

Config

nsfailover is configured through environment variables. Here they are with their defaults:

LOG_LEVEL="6" # 7 = debug, 0 = emergency
NS_1="" # Primary Nameserver (172.16.0.23 for Amazon EC2). You need to set this yourself
NS_2="8.8.8.8" # Secundary Nameserver: Google
NS_3="4.2.2.2" # Tertiary Nameserver: Level3
NS_ATTEMPTS="1" # http://linux.die.net/man/5/resolv.conf
NS_ENABLE="no" # Set to no to disable
NS_FILE="/etc/resolv.conf" # Where to write resolving conf
NS_SEARCH="" # Domain to search hosts in (compute-1.internal for Amazon EC2)
NS_TESTDOMAIN="google.com" # Use this to determine if NS is healthy
NS_TIMEOUT="3" # http://linux.die.net/man/5/resolv.conf
NS_WRITEPROTECT="no" # Use this to write-protect /etc/resolv.conf

You can use environment variables in many ways: at the top of a script or crontab, export from another script, or pass them straight to the program:

NS_ENABLE="no" ./nsfailover.sh # <-- silly, but works :)

Notes

nsfailover

  • only rewrites /etc/resolv.conf if it has changes
  • makes a backup to e.g. /etc/resolv.conf.bak-20130327114321
  • needs to run as root

Tips

  • Prefix your cronjob with timeout -s 9 50s so there can never be an overlap. More tips in my Lock your Cronjobs article.

Versioning

This project implements the Semantic Versioning guidelines.

Releases will be numbered with the following format:

<major>.<minor>.<patch>

And constructed with the following guidelines:

  • Breaking backward compatibility bumps the major (and resets the minor and patch)
  • New additions without breaking backward compatibility bumps the minor (and resets the patch)
  • Bug fixes and misc changes bumps the patch

For more information on SemVer, please visit http://semver.org.

License

Copyright (c) 2013 Kevin van Zonneveld, http://kvz.io
Licensed under MIT: http://kvz.io/licenses/LICENSE-MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].