mirror of
https://github.com/openwrt/packages.git
synced 2026-01-10 11:44:48 +00:00
keepalived: high-availability files and data sync
add new package keepalived-sync to synchronize files and data between master and backup node. The master node uses SSH over rsync to send and the backup node will use inotifywatch to watch received files. The master node can track rsync.sh script to send configuration file on a backup node based on the vrrp_script configuration of the same script. The backup node will have a keepalived-inotify service, which would watch for newly received files and it would call hotplug event. Each service can keep its respective script under the keepalived hotplug directory and executes commands to stop, start service or update any config in real-time. Whenever a switchover will happen, the backup node would have the latest config and data files from the master node. Hotplug events can be used to apply config when files are received. Signed-off-by: Jaymin Patel <jem.patel@gmail.com>
This commit is contained in:
@@ -256,6 +256,21 @@ print_track_bfd_indent() {
|
||||
printf '\n' >> "$KEEPALIVED_CONF"
|
||||
}
|
||||
|
||||
print_unicast_peer_indent() {
|
||||
local section="$1"
|
||||
local curr_track_elem="$2"
|
||||
local indent="$3"
|
||||
local name address
|
||||
|
||||
config_get name "$section" name
|
||||
[ "$name" != "$curr_track_elem" ] && return 0
|
||||
|
||||
config_get address "$section" address
|
||||
[ -z "$address" ] && return 0
|
||||
|
||||
printf '%b%s\n' "${indent}" "$address">> "$KEEPALIVED_CONF"
|
||||
}
|
||||
|
||||
static_routes() {
|
||||
local route
|
||||
config_get route "$1" route
|
||||
@@ -403,7 +418,13 @@ vrrp_instance() {
|
||||
# Handle simple lists of strings (with no spaces in between)
|
||||
for opt in unicast_peer; do
|
||||
config_get "$opt" "$1" "$opt"
|
||||
print_list_indent "$opt"
|
||||
eval optval=\$$opt
|
||||
[ -z "$optval" ] && continue
|
||||
printf '%b%s {\n' "${INDENT_1}" "$opt" >> "$KEEPALIVED_CONF"
|
||||
for t in $optval; do
|
||||
config_foreach print_unicast_peer_indent peer "$t" "$INDENT_2"
|
||||
done
|
||||
printf '%b}\n' "${INDENT_1}" >> "$KEEPALIVED_CONF"
|
||||
done
|
||||
unset optval
|
||||
|
||||
|
||||
Reference in New Issue
Block a user