...
Информация |
---|
This manual is for keepalived 1.3.6 As some critical functions are unstable in the version 1.2.15, the version 1.3.6 is recommended. |
Package description
keepalived package is an open source software used to perform high availability and load balancing functions. The first function is carried out by VRRP protocol implementation, and the second one is based on Linux Vitrual Server (IPVS). keepalived is not developed by Eltex and does not include any updates except configuration. A required version for the operating system used is compiled from source codes available in keepalived official repository on GitHub (https://github.com/acassen/keepalived).
Keepalived is used for SoftWLC controllers backup organization, and only VRRP functionality is applied.
Contact Wi-Fi or Broadband Access Service Center to get keepalived package for Ubuntu 14.04.
Installation
To install the package, download it to a server and run the following command:
...
Installation should be carried out on behalf of root super user
Starting/stopping procedure
To start the service, run the following command:
...
Без форматирования |
---|
keepalived start/running, process 2809 |
Configuration
keepalived configuration includes the next files:
File | Description |
/etc/keepalived/keepalived.conf | the main configuration file |
/etc/keepalived/check_ping.sh | a script for EMS status check |
/etc/keepalived/keep_notify.sh | a script ran on state change (when switching to MASTER, BACKUP, FAULT) |
/etc/sysconfig/keepalived | keepalived launch parameters configuration file |
/etc/keepalived/mongo_switch.js | a script for switching replicaSet MongoDB to the state relevant to VRRP |
Main configuration file
The listing of the main configuration file by default
...
The configuration file consists of three main sections: global_defs, vrrp_script, vrrp_instance
. The first and the second sections contain definitions of global parameters and the state checking script's configuration respectively, and the third one describes the VRRP instance itself.
Test script
The current implementation offers the following script as a test one:
...
the script pings a default gateway and returns an output code. Thus, SoftWLC is guaranteed to be accessible for external clients if the script has been executed successfully.
Role change configuration
When the server's state is changed, the keep_notify.sh script is started.
...
Блок кода | ||||||
---|---|---|---|---|---|---|
| ||||||
// Provided by environment var role; if (role != 'master' && role != 'slave') { throw "Role must be either master or slave"; } var thisIsMaster = (role == 'master'); var status = rs.isMaster(); var thisHost = status.me; print("Primary: " + status.ismaster + "; applying configuration ..."); var cfg = rs.conf(); for (var i = 0; i < cfg.members.length; i++) { var member = cfg.members[i]; var self = (member.host == thisHost); if (self ^ thisIsMaster) { // Configuration for slave member.priority = 1; member.votes = 0; print(member.host + ": secondary"); } else { // Configuration for master member.priority = 2; member.votes = 1; print(member.host + ": primary"); } } var result = rs.reconfig(cfg, { force: !status.ismaster }); if (result.ok == 1) { print("Reconfiguration done"); } else { print(result); } |
Keepalived daemon configuration
Parameters for launching etc.
Saving a log to a separate file
By default, keepalived
writes a log to the /var/log/syslog
file. For keepalived debugging, monitoring and managing convenience, separate log filing can be configured. rsyslog
configuration example is introduced below:
...