2016年6月14日 星期二

Keepalived 設定筆記

Global definitions synopsis

global_defs{
  notification_email{
    email
    email
  }
  notification_email_from
    email smtp_server host
    smtp_connect_timeout num
    lvs_id
}


Keyword:Definition  Type 

  • global_defs: identify the global def configuration block
  • notification_email: email accounts that will receive the notification mail List
  • notification_email_from: email to use when processing “MAIL FROM:” SMTP command   List
  • smtp_server: remote SMTP server to use for sending mail notifications alphanum
  • smtp_connection_timeout: specify a timeout for SMTP stream processing numerical
  • lvs_id: specify the name of the LVS director alphanum 

VRRP Instance definitions synopsis

vrrp_sync_group string {
  group{
    string
    string
  }
  notify_master /path_to_script/script_master.sh
               (or notify_master “/path_to_script/script_master.sh ”)
  notify_backup /path_to_script/script_backup.sh
               (or notify_backup “/path_to_script/script_backup.sh
”)
  notify_fault /path_to_script/script_fault.sh
               (or notify_fault “/path_to_script/script_fault.sh
”)
}


vrrp_instance string {
  state MASTER|BACKUP
  interface string
  mcast_src_ip @IP
  lvs_sync_daemon_interface string
  virtual_router_id num
  priority num
  advert_int num
  smtp_alert
  authentication {
    auth_type PASS|AH
    auth_pass string
  }

  virtual_ipaddress {   # Block limited to 20 IP addresses
    @IP
    @IP
    @IP
  }
  virtual_ipaddress_excluded { # Unlimited IP addresses number
    @IP
    @IP
    @IP
  }
  notify_master /path_to_script/script_master.sh
                (or notify_master “/path_to_script/script_master.sh
”)
   notify_backup /path_to_script/script_backup.sh
                (or notify_backup “/path_to_script/script_backup.sh
”)
   notify_fault /path_to_script/script_fault.sh
                (or notify_fault “/path_to_script/script_fault.sh
”)
}

Keyword:Definition  Type 
  • vrrp_instance :identify a VRRP instance definition block
  • State :specify the instance state in standard use
  • Interface :specify the network interface for the instance to run on string
  • mcast_src_ip :specify the src IP address value for VRRP adverts IP header
  • lvs_sync_daemon_inteface :specify the network interface for the LVS sync_daemon to run on string
  • Virtual_router_id :specify to which VRRP router id the instance belongs numerical
  • Priority :specify the instance priority in the VRRP router numerical
  • advert_int :specify the advertisement interval in seconds (set to 1)  numerical
  • smtp_alert :Activate the SMTP notification for MASTER state transition
  • authentication :identify a VRRP authentication definition block
  • auth_type :specify which kind of authentication to use (PASS|AH)
  • auth_pass :specify the password string to use string
  • virtual_ipaddress :identify a VRRP VIP definition block
  • virtual_ipaddress_excluded :identify a VRRP VIP excluded definition block (not protocol VIPs)
  • notify_master :specify a shell script to be executed during transition to master state path
  • notify_backup :specify a shell script to be executed during transition to backup state path
  • notify_fault :specify a shell script to be executed during transition to fault state path
  • vrrp_sync_group :Identify the VRRP synchronization instances group string 


Master 設定
global_defs {
   notification_email {
      user@example.com
   }

   notification_email_from mail@example.org
   smtp_server 192.168.200.1
   smtp_connect_timeout 30
   router_id LVS_DEVEL
}


vrrp_instance VI_1 {
    state MASTER #狀態為 MASTER
    interface eth1
    virtual_router_id 51
    priority 101   #MASTER 權重高於 BACKUP
    advert_int 1
    mcast_src_ip 192.168.10.101 #vrrp IP

    authentication {
        auth_type PASS #認證方式
        auth_pass 1111
    }

    #VIP
    virtual_ipaddress {
        192.168.10.100 #virtual IP
    }
}

Backup 設定
global_defs {
   notification_email {
       user@example.com
   }

   notification_email_from mail@example.org
   smtp_server 192.168.200.1
   smtp_connect_timeout 30
   router_id LVS_DEVEL
}

vrrp_instance VI_1 {
    state BACKUP #狀態為 BACKUP
    interface eth1
    virtual_router_id 51
    priority 100  #權重低於 MASTER
    advert_int 1
    mcast_src_ip 192.168.10.102 #vrrp IP

    authentication {
        auth_type PASS
        auth_pass 1111
    }

    #VIP
    virtual_ipaddress {
        192.168.10.100 #virtual IP
    }
}

沒有留言: