Forum Discussion

Daniel_Ao_10370's avatar
Daniel_Ao_10370
Icon for Nimbostratus rankNimbostratus
May 30, 2009

Question 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?

2 Replies

  • I 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.
  • The reason I don't like doing this is twofold:

     

     

    1) You expose yourself to a configsync kicking off right in the middle of someone making changes. Probably wouldn't be catastrophic, but there is potential for config corruption.

     

     

    2) You could, depending on the frequency of the automated configsync, lose the ability to roll back any changes you made that end up being incorrect for some reason.

     

     

    Denny