Controling which server replica is opened

Hi…hoping that someone might be able to point me in the right direction and/or to some documentation on this “issue” we’ve had since implementing our Notes infrastructure (back in R4…now R8).

We have a hub-spoke environment for replication.

SERVER-A - USEast Hub (no end user access)

SERVER-B - USWest App

SERVER-C - UK App

SERVER-D - Germany App

SERVER-E - USEast App

When access to databases are needed in each region; we’ll create on the hub (SERVER-A) and then create a replica on any regional server where access is needed.

Of course, if a user who has never opened that replica and goes to File, Application (Database) Open - picks the server in their region and finds the database - it will open the replica in their region.

Our “issue” is: User in USEast sends a link to another user in USEast who has never opened the database before. The “Hint” on the link is SERVER-E (the USEast Apps server). When the user clicks this link; Notes will sometimes go to the specified server which the link is supposed to open, but more often the Notes client will go out and try to find the database…opening the database on the first accessible server alphabetically; in this case SERVER-B.

In addition to this, if a user has already opened the database on the wrong server; now has the icon for the replica of a server out of their region, no matter what replica hint is listed in a link - the database replica from the server they already have will open.

Is there any way to control which database replica is opened?

The behavior we would prefer is that the Notes client opens the application server which is in the same region as the users mail server - rather than just choosing to open the first server in alphabetical order. More often than not, the users don’t ever understand what server they are “suppose” to access, how to see which replica they are opening, or even how to switch it…

We have some applications which we only want to reside on one regional server, so there is sometimes a need for a user in the UK to open an application on the USWest server, etc…

We also have a fair number of traveling users who may, for example, chose to open the UK server while they are in the UK; or may want to continue to access the USEast over the WAN while in the UK.

Thanks for any pointers. This “issue” has been a thorn in my side for 9 years now but I’ve just learned to live with it…

thanks, Brian

Subject: One (not great) way to encourage the correct server is used …

As you note, this has been a problem for a long time.

I do not have a great solution, but here is something we did to try and help (a little).

We have applications on our main mail server (called “MAILHUBServer”), on our main application server (“APPServer”) and on several remote servers around the USA. The best replica to open depends on where they are (both the users and the apps).

We have a single point (a page in a Notes database) where we encourage our users to go when they are looking for a database to open. It is like a catalog with information about our commanly used applications (there are about 30).

When the user clicks the link, it triggers two bits of code. The agent called has logic to determine the best server to use.

1)Formula code in link

targetdbname := " ";

@SetEnvironment(“DatabaseToOpen”;targetdbname);

@Command([ToolsRunMacro];“(Open Appropriate Database)”)

  1. The agent being called

Option Public

Sub Initialize

Dim session As New NotesSession	

targetdbname = session.GetEnvironmentString( "DatabaseToOpen" )



msgstring = "Searching for database: " & targetdbname & Chr(13) & Chr(13)

Print "Searching for database: " & targetdbname



'Overview:

'1. Get the user's mail server 

'2. Determine the database's default server (APPServer or MAILHUBServer)

'3. Find out if the mail server is MAILHUBServer.  If yes, open the database on the default server in Atlanta.

'4. If user is on a remote mail server, find out if the database has a replica on that server.  If so, open it.  If not, open default.



'step 1 - get user's mail server (common name)

Dim nam As NotesName		

Dim mailserver As String

mailserver = session.GetEnvironmentString("MailServer", True)

Set nam = session.CreateName(mailserver)

mailservercn = nam.Common	

Dim msstring As String

msstring = Ucase$(mailservercn)

Dim colstring As String



msgstring = msgstring & "Mail server: " &  msstring & Chr(13) & Chr(13)

Print "User's mail server: " &  msstring



Dim catalogdb As New NotesDatabase( "", "" )

Set catalogdb = session.GetDatabase(mailserver,"Catalog.nsf")	

Dim catalogview As notesview

Set catalogview = catalogdb.GetView("ByTitle")



Dim vc As NotesViewEntryCollection

catalogview.AutoUpdate = False

Set vc = catalogview.GetAllEntriesByKey(targetdbname)

Set entry = vc.GetFirstEntry



If entry Is Nothing Then

	Msgbox "Entry not found in catalog",0,"Error"

	Print targetdbname & " NOT found in catalog.  Aborting agent."

	Exit Sub

Else

	Print targetdbname & " found in catalog.  Determining server locations available ..."

End If	



msgstring = msgstring & "Replicas of the database were found on the following servers:" & Chr(13)



thefileserver = ""



Do While entry.ColumnValues(0) = targetdbname		

	colstring = Ucase$(entry.ColumnValues(1))

	Print colstring & "..."

	msgstring = msgstring & entry.ColumnValues(1) 

	If colstring = msstring And Not msstring = "MAILHUBServer" Then			

		msgstring = msgstring & "  -  This is the mail server and should be used." & Chr(13)			

		Print "  -  This is the mail server and should be used." 

		theserver = msstring

		thefilepath = entry.ColumnValues(3)

		Exit Do  ' no reason to keep looking

	Elseif colstring = "APPServer" Then		

		'if we have not encountered a replica on the mail server, use this server

		If theserver = mailserver Then

			msgstring = msgstring & "  -  APPServer is the default server for this database (but should not be used)." & Chr(13)				

			Print "  -  APPServer is default, but should not be used." 

		Else

			msgstring = msgstring & "  -  ATLAPPS is the default server for this database." & Chr(13)				

			Print "  -  APPServer is the default server for this database." 

			theserver = "APPServer"

			thefilepath = entry.ColumnValues(3)

		End If

		

	Elseif colstring = "MAILHUBServer" & Not theserver = "APPServer" Then

		If theserver = "" Then

			msgstring = msgstring & "  -  MAILHUBServer should be used if the database does not reside on the mail server (" & msstring & ") or APPServer." & Chr(13)

			Print "  -  MAILHUBServer should be used if the database does not reside on the mail server (" & msstring & ") or APPServer."

			server = "MAILHUBServer"	

			thefilepath = entry.ColumnValues(3)	

		Else

			msgstring = msgstring & "  -  MAILHUBServer should not be used." & Chr(13)

			Print "MAILHUBServer should not be used."

		End If

	Else

		msgstring = msgstring & "  -  This remote server should not be used." & Chr(13)	

		Print "This remote server should not be used."

	End If

	Set entry = vc.GetNextEntry(entry)

	If entry Is Nothing Then Exit Do

Loop



msgstring = Chr(13) & msgstring & Chr(13) & "Database to open: " & theserver & " " & thefilepath

Print "Database to open: " & theserver & " " & thefilepath



'For debugging, if needed:

'Msgbox msgstring,0,"Agent Results"



'Now we know what database replica to open:

Dim uiw As New NotesUIWorkspace

Call uiw.OpenDatabase( theserver, thefilepath)

End Sub

Subject: Thanks for the suggestion!

I’ll give it a try…

-Brian