wissel.net

Usability - Productivity - Business - The web - Singapore & Twins

Force Domino directory replication to all servers


When cleaning up a domain and reconfiguring servers, domains and routes one critical success factor is the distribution of changes to all servers. In a well maintained domain the replicator task will take care of that. However that might take hours and if the domain you are working on is well maintained, there is little need for a clean-up in the first place .
To be independent from replication schedules and other quirks I got an agent at hand that helps me there. You can copy that agent to your Domino Directory and take a few easy steps:
  1. Create a local replica of the Domino directory
  2. Copy the agent into it
  3. Make sure you have a Notes client that can reach ALL servers
  4. Make sure you have enough otherwise to do (or run this agent from a VMWare)
The code is pretty simple.The script is designed so you can use it for any database (admin4.nsf being a hot candidate) you need to forcefully push out.
Update::Agent code now available in the downloads section.
 
'Replicate with all Servers: Option Public Option Declare Sub Initialize Dim db As NotesDatabase Dim nab As NotesDatabase Dim nLog As NotesLog Dim s As New NotesSession Set nab = s .CurrentDatabase 'The error log, not essential but handy --- use your own mechanism to get one 'Suggestion: The managers of the DB get a mail log Set nlog = New NotesLog ( "Replicate with all servers" ) Call nlog .OpenAgentLog nlog .LogErrors = True nlog .LogActions = True 'Here we set the database to be replicated -- for now it is the NAB, but it is just one statement. Set db = s .CurrentDatabase 'Call the main function Call ReplicateLocalDB (nab , db , nlog ) 'Close our log Call nlog . Close End Sub Function getAdminServer (db As NotesDatabase , nlog As NotesLog ) As String Dim acl As NotesACL On Error Goto Err_getAdminServer Set acl = db .ACL getAdminServer = acl .AdministrationServer Exit_getAdminServer : Exit Function Err_getAdminServer : Call nlog .LogError ( Err , Error$ & " in getAdminServer in line " & Cstr ( Erl ) ) getAdminServer = "" Resume Exit_getAdminServer End Function Sub ReplicateWithOneServer (db As NotesDatabase , serverName As String ,nlog As Noteslog ) On Error Goto Err_ReplicateWithOneServer Call db .Replicate (serverName ) Exit_ReplicateWithOneServer : Exit Sub Err_ReplicateWithOneServer : Call nlog .LogError ( Err , Error$ & " in ReplicateWithOneServer line " & Cstr ( Erl ) & ", Server: " & serverName ) Print Error$ 'Mostly: Timeout or no replica found Resume Exit_ReplicateWithOneServer End Sub Sub ReplicateLocalDB (nab As NotesDatabase , db As NotesDatabase , nlog As NotesLog ) Dim v As NotesView Dim adminServer As String Dim curServer As String Dim doc As NotesDocument On Error Goto Err_ReplicateLocalDB If db .Server < > "" Then Msgbox "Please run this from a local replica!" Exit Sub End If 'Find the admin server to give the first shot to it adminServer = getAdminServer (db , nlog ) 'Now Replicate the admin server Call ReplicateWithOneServer (db , adminServer ,nlog ) 'Get the view with all servers, Set v = nab .GetView ( "($Servers)" ) Set doc = v .GetFirstDocument Do Until doc Is Nothing If doc .HasItem ( "ServerName" ) Then curServer = doc .GetItemValue ( "ServerName" ) (0 ) Call ReplicateWithOneServer (db , curServer ,nlog ) End If Set doc = v .GetNextDocument (doc ) Loop Exit_ReplicateLocalDB : Exit Sub Err_ReplicateLocalDB : Call nlog .LogError ( Err , Error$ & " in ReplicateLocalDB line " & Cstr ( Erl ) ) Resume Exit_ReplicateLocalDB End Sub
This LotusScript was converted to HTML using the ls2html routine,
provided by Julian Robichaux at nsftools.com.

Posted by on 27 September 2006 | Comments (5) | categories: Show-N-Tell Thursday

Comments

  1. posted by Slawek on Tuesday 03 October 2006 AD:
    If you dont want to wait for this agent to finish you could run it in the background UI thread. I dont see any UI calls. And you could even print out progress on the status bar every so often.
    -- Slawek
  2. posted by Dave Harris on Wednesday 04 October 2006 AD:
    Stephan,

    Any particular reason why you have two objects representing the NAB/current db?
  3. posted by Stephan H. Wissel on Friday 06 October 2006 AD:
    @David:
    There are 2 DB objects so I could easily change one of them to replicate a different database. One object allways is the NAB, the other just happened to be the same database.

    @Slawek:
    How would you get it into the background (other than a scheduled local agent)?

    Emoticon smile.gif stw
  4. posted by Martin on Wednesday 18 October 2006 AD:
    Why don't you just setup your LocalDomainServers group as Server only group and use command repl LocalDomainServers names.nsf? Isn't is easier?
  5. posted by Stephan H. Wissel on Thursday 19 October 2006 AD:
    Hi Martin,
    I use the local script when I want to make sure, that I don't interfere with the regular replication schedule as well as in situation where I don't have access to the server console (like they add me as editor++ in the ACL of a database but not in the admin group).
    Emoticon smile.gif stw