wiki:keepalived

Version 8 (modified by krit, 2 years ago) (diff)

--

Keepalived active stand by

On master site ip 10.7.168.221, file /etc/keepalived/keepalived.conf. All config in /etc/keepalived can be found here

root@n4:/etc/keepalived# pwd
/etc/keepalived
root@n4:/etc/keepalived# more keepalived.conf 
vrrp_script chk_service_health {
    #script /etc/keepalived/check_proc.sh
    #script /etc/keepalived/check_ping.sh
    weight 10
    # how often script run in period 10 sec
    interval 5
    # How long to wait for the script to return (5 seconds).
    timeout 5
    # How many times the script must return successfully in order for the host to be considered healthy.
    rise 3
    # How many times the script must return unsuccessfully (or time out) in order for the host to be considered unhealthy
    fall 3
}

vrrp_instance VI_1 {
        #state BACKUP
        state MASTER
        interface ens3
        virtual_router_id 51
        priority 201
        advert_int 10
        authentication {
              auth_type PASS
              auth_pass 1234
        }
        unicast_src_ip 10.7.168.221
        unicast_peer {
             10.7.168.58
        }
        virtual_ipaddress {
             10.7.168.200/24
        }
        track_script {
            chk_service_health
        }
        notify /etc/keepalived/keepalived_notify.sh
        notify_master /etc/keepalived/keepalived_notify_master.sh
        notify_backup /etc/keepalived/keepalived_notify_backup.sh
}

At user directory /home/ubuntu, pls see files check_containner.sh, notifyFile_3.sh, stop_notifyFile_3.sh use for start/stop docker. For sync with unison, we need to place file default.prf in ./unison/default.prf user folder /home/ubuntu/.unison

ubuntu@n4:~$ tree -L 2
├── check_containner.sh
├── default.prf
├── notifyFile_3.sh
├── omd-labs-docker
│   ├── Dockerfile.omd-labs-debian
│   ├── Makefile.omd-labs-debian
│   ├── README.md
│   ├── ansible_dropin
│   ├── hooks
│   ├── run.sh
│   ├── scripts
│   └── site
└── stop_notifyFile_3.sh

For standby site (backup site) config can be found here

Attachments (8)

Download all attachments as: .zip