Forum Discussion
Daniel_Ao_10370
Nimbostratus
May 30, 2009Question about ConfigSync
I have setup two LTM in redundant pair mode. I found the I must manually sync config using ConfigSync tool. Is there any way to synchronize configuration automatically?
hwidjaja_37598
Altostratus
May 30, 2009I think you need to create a script and use a cron job to periodically synchronize the configuration.
As an example, this script will detect which unit got the latest config (PULL/PUSH Mode). You can add it to the cronjob on both unit. It will initiate ConfigSync from the active unit only.
!/usr/bin/perl
use BigDB;
use strict;
my ($LockFile) = "/tmp/autocs.lck";
my ($bigpipe) = "/bin/bigpipe";
my ($Status);
Exit when lock file is exist,
to prevent launching duplicate process
if (-f $LockFile){
print "Another process is currently running ... \n";
exit 0;
}
Creating lock file
open (fil, ">$LockFile") || die "error creating lock file $LockFile";
close (fil);
Open BigDB
my ($hBigDB, $Status) = &bigdb_open;
&CheckErr('Error: bigdb_open');
If Configsync.State is not Synchronized and the script is run
from active unit then do ConfigSync
if (
&BigDB("Configsync.State") !~ /synchronized/i
&& system("/usr/bin/failover_status | grep -vi active >/dev/null")
){
If LocalConfigTime is bigger than PeerConfigTime then Push Mode
Else Pull Mode
if (
&BigDB("Configsync.LocalConfigTime") > &BigDB("Configsync.PeerConfigTime")
) {
system "$bigpipe config sync";
} else {
system "$bigpipe config sync pull";
}
}
close bigdb
&bigdb_close;
Remove lock file
unlink $LockFile;
exit 0;
sub BigDB {
my ($Key) = @_;
my ($Val, $Status) = &bigdb_fetch($hBigDB, $Key);
&CheckErr("Error: BigDB ($Key)");
return ($Val);
}
sub CheckErr {
if ($Status) {
print $_[0];
exit $Status;
}
}
Make sure you have reviewed and tested the script before deploying to your production unit. Use it at your own risk.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects