Code Monkey home page Code Monkey logo

keepalived-examples's Introduction

Keepalived Examples

The config examples of keepalived, e.g. master-backup, master-master.

  • In master-backup mode, if the nginx on master node failed to work, then the backup node will take it over.
  • In master-master mode, if the nginx on any node failed to work, then the other node will take it over.

Get Started

Tested on:

  • Ubuntu 14.04
  • Keepalived 1.2.7
  • Nginx 1.4.6
sudo apt-get install keepalived nginx
sudo cp check_nginx.sh /etc/keepalived/

Master-Backup

The IPs:

master ip: 192.168.33.10
backup ip: 192.168.33.11
virtual ip: 192.168.33.50

On master node:

sudo cp master-backup/master/keepalived.conf /etc/keepalived/
sudo service keepalived start

On backup node:

sudo cp master-backup/backup/keepalived.conf /etc/keepalived/
sudo service keepalived start

Check:

  1. Check logging messages in /var/log/syslog on each node.
  2. Check the virtual ip status with the following command on each node:
ip a
  1. Check priority changes on each node:
  • on master: sudo tcpdump -vvv -n -i eth1 host 192.168.33.10
  • on backup: sudo tcpdump -vvv -n -i eth1 host 192.168.33.11
  1. Stop nginx on master and check 1, 2, 3 again:
sudo service nginx stop
  1. Then start nginx on master and check 1, 2, 3 again:
sudo service nginx start

Master-Master

The IPs:

master ip: 192.168.33.10
backup ip: 192.168.33.11
virtual ip 1: 192.168.33.51
virtual ip 2: 192.168.33.52

And the other steps are similar to master-backup mode, except that you can stop the nginx on any node and the other node will take it over.

Reference

keepalived-examples's People

Contributors

shuaicj avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.