Library for identifying the status of Hot-Standby servers.

This library can be used in applications with two servers (Hot-Standby) to identify on screen each server’s status.

Operation:

The active server is detected by a script in the Constructor event of HotStandbyStatus XObject.

Set WshNetwork = CreateObject(“WScript.Network”)
ActiveServer = WshNetwork.ComputerName

The logic for detecting the other server’s status is based on the synchronism between each server’s databases. To activate this resource, EnableSynchronization property must be enabled.

In a nutshell, the library records data every 5 seconds in a table in the local database and queries the equivalent table in the other server to check its synchronization. According to this Query’s result, the other server’s status is defined:

  • If it doesn’t return any data, the server has failed (turned off or out of the network).
  • If it returns an ‘old’ record, the server is in maintenance (disabled).
  • If it returns a current record (considering the delay time to perform the synchronism), the server is running (standby).

NOTE: the library only works with an SQL Server (or SQL Server Express), which must be previously installed and configured in both servers.


Settings:

Before setting up the library, insert two Databases in the application: one to record locally (DB1), and another one to allow querying the back-up server (DB2).

To use the library, insert a HotStandbyStatus object into the database, and set these properties as follows:

  • DBLocal: link it to the local Database
  • DBStandby: link it to the back-up Database
  • ServerName1: type Server 1’s name
  • ServarName2: type Server 2’s name
  • OldRecordTime: time (in seconds) before the record’s timestamp is deemed ‘old’

Then, insert HotStandbyViewer object onto screen and link Source property to the HotStandbyStatus object that was previously configured.

Notes:

  • The back-up server status can take some seconds to be updated, because it depends on how long the Query takes to be completed.
  • You will need to invert the Databases’ settings in the secondary server. That is, in the secondary server, the DB1 object must connect to the secondary server’s database and the DB2 object must connect to the main server’s database.

The figures below show you how to set up the database objects in the secondary server.

Attached to this article are both the library and a demo application.

Attachments:

ServerStatusEN.zip

Print Friendly, PDF & Email

Este artigo foi útil? Was this helpful?

Classificação média - Average rating 0 / 5. Count: 0

Leave a Reply

Your email address will not be published.Required fields are marked *