We can configure EMS servers as primary and backup servers to provide fault tolerance for our environment. The primary and backup servers act as a pair,with the primary server accepting client connections and performing the work of handling messages, and the secondary server acting as a backup in case of failure.When the active server fails, the backup server assumes operation and becomes the new primary active server.When Server 2 becomes the new primary server, Server 1 can restart as a backup server, so that the two servers exchange roles.
backup server detects a failure of the primary in either of two ways:
• Heartbeat Failure —The primary server sends heartbeat messages to the backup server to indicate that it is still operating. When a network failure stops the servers from communicating with each other, the backup server detects the interruption in the steady stream of heartbeats.
• Connection Failure —The backup server can detect the failure of its TCP connection with the primary server. When the primary process terminates unexpectedly, the backup server detects the broken connection.
When the primary server heartbeat stops, the backup server waits for its activation interval (elapsed time since it detected the most recent heartbeat); then the backup server retrieves information from shared storage and assumes the role of primary server. The default heartbeat interval is 3 seconds, and the default activation interval is 10 seconds. The activation interval must be at least twice the heartbeat interval. Both intervals are specified in seconds. We can set these intervals in the server configuration files.
Shared State:-
For the most robust failover protection, the primary server and backup server must share the same state. Server state includes three categories of information:
• persistent message data (for queues and topics)
• client connections of the primary server
• metadata about message delivery
During a failover, the backup server re-reads all shared state information.
Note :The Ems data store should be in SAN or NAS,in actual Production Environment..so that the datastore is accessible by both primary and back up server.
SAN-Storage Area Network
SAN-Storage Area Network
NAS-Network Area storage
But for our case we would use just operating system file system (shared by both primary and Backup server)
Fault Tolerance configuration setup:-
The below configuration setup will help you to run two EMS server instances In Fault Tolerance mode (servers run on different ports Say 7222,7333)
Creating Second server Instance:-
Create a folder called Server2 (say D:/Server2 ). In that copy all the configuration files(*.conf files ) from %TIBCOHOME%/ems/bin/
Now modify this tibemsd.conf (which is in Server2 folder)
Listen =tcp://localhost:7333
and Prepend this path to D:\Server2\ below list in the Sever2 tibemsd.conf
and Prepend this path to D:\Server2\ below list in the Sever2 tibemsd.conf
users=D:\Server2\ users.conf
groups=D:\Server2\groups.conf
topics=D:\Server2\ topics.conf
queues=D:\Server2\ queues.conf
acl_list=D:\Server2\ acl.conf
factories=D:\Server2\ factories.conf
routes=D:\Server2\ routes.conf
bridges=D:\Server2\ bridges.conf
transports=D:\Server2\transports.conf
tibrvcm=D:\Server2\queues.conf
durables=D:\Server2\durables.conf
Now you can run the server on port 7333 from CMD as shown in figure ( make sure that first server which is on port 7222 is stopped)
Starting server:-
Server Status:-
Now we have two servers with same name EMS-SERVER. Now lets us make these two server to run as FT Pair.
Configuring Primary server(Server1)
|
Configuring Secondary server(Server2)
|
open the C:\ProgramData\TIBCO\tibco\cfgmgmt\ems\data\tibemsd.conf
Server = EMS-SERVER
Listen = tcp://localhost:7222 Ft_active = tcp://localhost:7333 |
open the D:\SecondEMSServer\tibemsd.conf
Server = EMS-SERVER
Listen = tcp://localhost:7333
Ft_active = tcp://localhost:7222
|
Now we have created FT pair successfully.
now start the two servers from CMD.
Start Backup server:-
once backup server is started the you can see notification in the primary server
If you stops the primary server (CTRL+C to stop server) then Server2 will became the new primary server.if sever 1 ups at any time it will be in standby mode
Creating JMS Connection
A pair of URL's separated by a comma specifies a pair of fault-tolerant servers.
For example: tcp://host1:7222,tcp://backup1:7333