Wednesday, May 4, 2016

Tibco EMS Fault Tolerant Setup


Step By Step How to Setup TIBCO EMS In Fault Tolerant Mode


In order to prevent application failure and to keep the systems running smoothly, systems are often configured and setup in a fault tolerant mode with a primary and secondary node so that if application on the primary server fails, secondary server immediately takes over the control to keep everything running transparently.
TIBCO EMS Servers are also configured in FT mode (Fault Tolerant Mode) so that secondary server may take over the control once primary server is down. In this step by step tutorial, I will teach you how you can configure TIBCO EMS Servers in Fault Tolerant mode.
In real scenarios, FT configurations are done with EMS Servers running in separate machines but in this example case, I will setup two EMS Servers on the same machine and will configure them to run in FT mode.
Step 1: Configure EMS Daemons in FT mode
In order to achieve EMS Fault Tolerance, our first task is to do the necessary configuration changes in the file tibemsd.conf
This configuration file is used by the EMS Daemon. In order to run two daemons, we need to have one separate tibemsd.conf file for both. We create two copies of this configuration file and name them astibemsd.conf and tibemsd-1.conf respectively.
We need to have separate ports for the two EMS Server daemons. For the first, let’s use 7222 port and for the second one, we use 7224 port.
In the first configuration file (tibemsd.conf), make following changes:
  • Listen port should be set as tcp://7222
  • In Fault Tolerant setup section, for ft_active, specify the port of other/secondary EMS Server i.e. specify tcp://7224
  • Routing should be turned on by setting routing as Enabled.
For the second configuration file (tibemsd-1.conf), do the following configuration changes:
  • Set Listen Port as tcp://7224
  • In Fault Tolerant section, for ft_active, specify tcp://7222 (ie.e. Listen port of the primary EM Server)
  • Enable routing the same way as done for the primary server.

Step 2: Configure Fault Tolerant Factory
Second step in configuring EM Servers in FT mode is to make changes in the file factories.conf .
Configure factories for both queues and topics with the below changes in the configuration file:

[FTTopicConnectionFactory]
type                  = topic
url                   = tcp://localhost:7222,tcp://localhost:7224
[FTQueueConnectionFactory]
type                  = queue
url                   = tcp://localhost:7222,tcp://localhost:7224

Step 3: Run Primary and Secondary EMS Server
Once we are done with the configuration of our FT Pair of EMS Servers, we need to start the two servers.
Run the primary EMS Server by following command:
tibemsd.exe -config C:\tibco\EMSConfig\tibco\cfgmgmt\ems\data\tibemsd.conf

As seen in below screenshot, server has started successfully:
tibco ems ft primary server start

Now run the following command to start the secondary server:
tibemsd.exe -config C:\tibco\EMSConfig\tibco\cfgmgmt\ems\data\tibemsd-1.conf
As you can see below, secondary EMS Server has started and is in standby mode for the primary server:
tibco ems ft standby secondary server start

Step 4: Test TIBCO EMS Servers working in FT mode
In this step, we will create a TIBCO Process and will send the request to a queue on the primary server when the server is up. In that case the request will be successfully received by the queue on primary server. In second time, we will stop primary server and send the request to same server again. Now, secondary server will pick the request and request will not fail.
The EMS Connection configuration is shown in the diagram below. This connection is to the primary server:
tibco ems connection to primary server

As you can see in the diagram below, when I ran a test process to send the request to the primary server using the above connection, process has run successfully:
ems queue sender to primary server test

Now, stop the primary server by using shutdown command.
Now if we run the same process again in order to send the request to a queue on primary server, request will be processed successfully by the secondary EM Server which was in standby mode.

No comments:

Post a Comment