5.1 Replicated HA
5.1.1 Launching the servers
While launching the Enterprise Server, the launch sequence within the two servers is not important. Either server (primary or backup) can be started first. On start up, the servers establish a communication path between each other in order to exchange information regarding proper functioning of all servers. The servers can be launched by using the fmq (bat/sh) script (available in the fmq/bin directory of the installation package), and supplying the %SELECTED_HA_PROFILE% as an argument. Different methods to run HA profiles are described here.
5.1.1.1.1 Console
Windows:
When launching the Primary HA Server in Replicated Mode, the command line would be:
fmq.bat –profile FioranoMQ_HA_rpl/HAPrimary
For Secondary HA server in Replicated Mode, the command line would be:
fmq.bat –profile FioranoMQ_HA_rpl/HASecondary
Unix:
When launching the Primary HA Server in Replicated Mode, the command line would be:
./fmq.sh –profile FioranoMQ_HA_rpl/HAPrimary -nobackground
For Secondary HA server in Replicated Mode, the command line would be:
./fmq.sh –profile FioranoMQ_HA_rpl/HASecondary -nobackground
5.1.1.1.2 Background
Unix:
When launching the Primary HA Server in Replicated Mode, the command line would be:
./fmq.sh –profile FioranoMQ_HA_rpl/HAPrimary
For Secondary HA server in Replicated Mode, the command line would be:
./fmq.sh –profile FioranoMQ_HA_rpl/HASecondary
5.1.1.1.3 Service
HA replicated profiles can be made to run as service. Detailed procedure based on platform is provided here.
Windows:
Any profile present under %FMQ_DIR%/profiles can be made to run as NT service.
Steps for installing HA profile as NT Service:
- Open a command prompt
- Goto to %FMQ_DIR%\bin\service directory
- To install FioranoMQ Kernel as NT service, run the command
install-fmq-service.bat -profile FioranoMQ_HA_rpl/HAPrimary or
install-fmq-service.bat -profile FioranoMQ_HA_rpl/HASecondary
- After installation you should be able to see "FioranoMQ <%PROFILE_NAME%>" NT service installed.
- Start the NT Service. Logs for NT service run can be viewed in %FMQ-DIR%\bin\service\logs%PROFILE_NAME%.log.
Linux:
For enabling Replicated HA profiles as service, there is a script "fmq-linux" available in fmq/bin/service directory of FioranoMQ installation directory. Follow the procedures listed here:
- Set JAVA_HOME at line 8.
- Set the FIORANO_HOME at line 10.
- fmq-linux by default runs FioranoMQ Profile, to run Primary profile change the name of the profile on line 20 to FioranoMQ_HA_shared/HAPrimary. To run Secondary profile, change the name of the profile on line 20 to FioranoMQ_HA_shared/HASecondary.
- Give Executable Permission, "chmod +x fmq-linux".
- To start as a service, type "./fmq-linux start".
- To stop the server, type "./fmq-linux stop".
- To run this as a service with system startup, type "chkconfig --add fmq-linux". This will launch the service whenever the system is started.
SOLARIS:
For enabling Replicated HA profiles as service, there is a script "fmq-solaris" available in fmq/bin/service directory of FioranoMQ installation directory. Follow the procedures listed here:
- Set the FIORANO_HOME at line 9 of fmq-solaris file.
- fmq-solaris by default runs FioranoMQ Profile, to run Primary profile change the name of the profile on line 19 to FioranoMQ_HA_rpl/HAPrimary. To run Secondary profile, change the name of the profile on line 19 to FioranoMQ_HA_rpl/HASecondary.
- Copy the file fmq-solaris in "/etc/init.d".
- Give Executable Permission, "chmod +x fmq-solaris".
- To start as a service, type "./fmq-solaris start".
- To stop the server, type "./fmq-solaris stop".
- To run this as a service with system startup create the links from "/etc/init.d" using the following commands
To start the service at startup:
ln -s fmq-solaris /etc/rc3.d/S86fmq-solaris
Note: If the priority level '86' which is specified in the link already exists in the run level (rc3.d), then select a number which doesn't exist there.
Example: If you want to set the priority 71 then create the link using the following command in "/etc/init.d"
ln -s fmq-solaris /etc/rc3.d/S71fmq-solaris
- Set JAVA_HOME in <FIORANO_HOME>/fiorano_vars.sh
Note: Even if you set JAVA_HOME in your .bashrc or .bash_profile, it won't be set at startup.
So JAVA_HOME must be set in "fiorano_vars.sh" script file.
5.1.2 Stopping the servers
5.1.1.2.1 Console
Windows:
When stopping the Primary HA Server in Replicated Mode with RMIPort 1858, the command line would be:
shutdown-fmq.bat -rmiPort 1858
For Secondary HA server in Replicated Mode with RMIPort 1859, the command line would be:
shutdown-fmq.bat -rmiPort 1859
Note: For shutting down both the Primary and Secondary HA servers in a single request, the command line would be: shutdown-fmq.bat -rmiPort 1858 -ha
This will send a "Shutdown" request to the backup server first and then shuts down the primary server. Any errors during the execution will be logged on to the console.
Unix:
When stopping the Primary HA Server in Replicated Mode with RMIPort 1858, the command line would be:
./shutdown-fmq.sh -rmiPort 1858
For Secondary HA server in Replicated Mode with RMIPort 1859, the command line would be:
./shutdown-fmq.sh -rmiPort 1859
Note: For shutting down both the Primary and Secondary HA servers in a single request, the command line would be: ./shutdown-fmq.sh -rmiPort 1858 -ha
This will send a "Shutdown" request to the backup server first and then shuts down the primary server. Any errors during the execution will be logged on to the console.
5.1.1.2.2 Background
Unix:
When stopping the Primary HA Server in Replicated Mode with RMIPort 1858, the command line would be:
./shutdown-fmq.sh -rmiPort 1858
For Secondary HA server in Replicated Mode with RMIPort 1859, the command line would be:
./shutdown-fmq.sh -rmiPort 1859
Note: For shutting down both the Primary and Secondary HA servers in a single request, the command line would be: ./shutdown-fmq.sh -rmiPort 1858 -ha
This will send a "Shutdown" request to the backup server first and then shuts down the primary server. Any errors during the execution will be logged on to the console.
5.1.1.2.3 Service
Windows:
- To remove FioranoMQ Kernel NT service, run the command
uninstall-fmq-service.bat -profile %PROFILE_NAME%
- Un-Install should stop and remove NT service for given profile from the services list.
Linux:
To remove initially created service type "chkconfig --del fmq-linux". This will remove the previously added service
SOLARIS:
To stop the service at shutdown/reboot type:
ln -s fmq-solaris /etc/rc3.d/K45fmq-solaris
Note: It is recommended to choose low priority level for shutdown.
5.1.3 Determining status of servers
It is easy to determine the status of server while running through console, as status of servers are printed on console. It can also be determined by running ServerStatus.java file available in fmq/samples/JMX directory of FioranoMQ installation directory. Details about running this file are available in readme file in the same directory.
5.1.4 Log details
Just like the base FioranoMQ server, the HA server can log into files, consoles, or use any other custom-made logger. The type of logging is controlled through the Loggers module in Fiorano Studio. Options to log all information on the console or save all logs into a log or error file, is provided through Console-based and File-based logging respectively.
5.1.5 Verifying HA Setup
On starting the Fiorano MQ Server that is part of an HA pair, the server prints debug information about its own state (ACTIVE, PASSIVE, and WAITING). It also prints information about its backup server's state whenever it detects a change.
Example Statements on console:
[Sat Feb 07 14:03:50 IST 2009] Old status of remote server = DEAD
[Sat Feb 07 14:03:50 IST 2009] New status of remote server = WAITING
[Sat Feb 07 14:03:50 IST 2009] Old status of remote server = DEAD
[Sat Feb 07 14:03:50 IST 2009] New status of remote server = WAITING
[Sat Feb 07 14:03:50 IST 2009] Old status of remote server = WAITING
[Sat Feb 07 14:03:50 IST 2009] New status of remote server = PASSIVE TRANSITION STATE
The Console includes statements as shown below:
'Primary Server switched to ACTIVE' or 'Secondary Server switched to PASSIVE', which indicate that the pair has successfully connected. Also, a statement gets printed when the lock is successfully acquired over the LockFile on the active servers console.
Example: Successfully acquired lock on:C:\lockFile.dat.
The figure below illustrates a successfully started Fiorano HA MQ Server:
5.2 Shared HA
5.2.1 Launching the servers
While launching the Enterprise Server, the launch sequence within the two servers is not important. Either server (primary or backup) can be started first. On start up, the servers establish a communication path between each other in order to exchange information regarding proper functioning of all servers. The servers can be launched by using the runContainer script (available in the fmq/bin directory of the installation package), and supplying the %SELECTED_HA_PROFILE% as an argument.
In order to run shared HA profiles we need to specify dbPath as extra command line argument. This is the path where run folder will be created and this must be pointing to the same directory for both the profiles (Primary and Secondary). It would be better if this shared db is on third machine (other than machines where Primary and Secondary profiles are running). For sharing db from third machine, use same method as specified for sharing LockFile. Different methods to run HA profiles are described here. It is supposed that shared db is mounted, for Primary server, on /home/fmq1/shared for Linux machine ( C:\fmq1\share on Windows machine) and, for Secondary server, /home/fmq2/shared on Linux machine ( C:\fmq2\share on Windows machine).
5.1.2.1.1 Console
Windows:
When launching the Primary HA Server in shared Mode, the command line would be:
fmq.bat –profile FioranoMQ_HA_shared/HAPrimary –dbPath C:\fmq1\share
For Secondary HA server in shared Mode, the command line would be:
fmq.bat –profile FioranoMQ_HA_shared/HASecondary –dbPath C:\fmq2\share
Unix:
When launching the Primary HA Server in shared Mode, the command line would be:
./fmq.sh –profile FioranoMQ_HA_shared/HAPrimary –nobackground –dbPath /home/fmq1/share
For Secondary HA server in shared Mode, the command line would be:
./fmq.sh –profile FioranoMQ_HA_shared/HASecondary –nobackground –dbPath /home/fmq2/share
5.1.2.1.2 Background
Unix:
When launching the Primary HA Server in shared Mode, the command line would be:
./fmq.sh –profile FioranoMQ_HA_shared/HAPrimary –dbPath /home/fmq1/share
For Secondary HA server in shared Mode, the command line would be:
./fmq.sh –profile FioranoMQ_HA_shared/HASecondary –dbPath /home/fmq2/share
5.1.2.1.3 Service
Windows
Any profile present under %FMQ_DIR%/profiles can be made to run as NT service.
Steps for installing HA profile as NT Service:
- Open a command prompt
- Goto to %FMQ_DIR%\bin\service directory
- To install FioranoMQ Kernel as NT service, run the command
install-fmq-service.bat -profile FioranoMQ_HA_shared/HAPrimary or
install-fmq-service.bat -profile FioranoMQ_HA_shared/HASecondary
- After installation you should be able to see "FioranoMQ <%PROFILE_NAME%>" NT service installed.
- Start the NT Service. Logs for NT service run can be viewed in %FMQ-DIR%\bin\service\logs%PROFILE_NAME%.log.
Linux:
For enabling Shared HA profiles as service, there is a script "fmq-linux" available in fmq/bin/service directory of FioranoMQ installation directory. Follow the procedures listed here:
- Set JAVA_HOME at line 8.
- Set the FIORANO_HOME at line 10.
- fmq-linux by default runs FioranoMQ Profile, to run Primary profile change the name of the profile on line 20 to FioranoMQ_HA_shared/HAPrimary. To run Secondary profile change the name of the profile on line 20 to FioranoMQ_HA_shared/HASecondary..
- Give Executable Permission, "chmod +x fmq-linux".
- To start as a service, type "./fmq-linux start".
- To stop the server, type "./fmq-linux stop".
- To run this as a service with system startup, type "chkconfig --add fmq-linux". This will launch the service whenever the system is started.
SOLARIS:
For enabling Shared HA profiles as service, there is a script "fmq-solaris" available in fmq/bin/service directory of FioranoMQ installation directory. Follow the procedures listed here:
- Set the FIORANO_HOME at line 9 of fmq-solaris file.
- fmq-solaris by default runs FioranoMQ Profile, to run Primary profile change the name of the profile on line 19 to FioranoMQ_HA_rpl/HAPrimary. To run Secondary profile, change the name of the profile on line 19 to FioranoMQ_HA_rpl/HASecondary.
- Copy the file fmq-solaris in "/etc/init.d".
- Give Executable Permission, "chmod +x fmq-solaris".
- To start as a service, type "./fmq-solaris start".
- To stop the server, type "./fmq-solaris stop".
- To run this as a service with system startup create the links from "/etc/init.d" using the following commands
To start the service at startup:
ln -s fmq-solaris /etc/rc3.d/S86fmq-solaris
Note: If the priority level '86' which is specified in the link already exists in the run level (rc3.d), then select a number which doesn't exist there.
Example: If you want to set the priority 71 then create the link using the following command in "/etc/init.d"
ln -s fmq-solaris /etc/rc3.d/S71fmq-solaris
To stop the service at shutdown/reboot:
ln -s fmq-solaris /etc/rc3.d/K45fmq-solaris
Note: It is recommended to choose low priority level for shutdown
- Set JAVA_HOME in <FIORANO_HOME>/fiorano_vars.sh
Note: Even if you set JAVA_HOME in your .bashrc or .bash_profile, it won't be set at startup.
So JAVA_HOME must be set in "fiorano_vars.sh" script file.
5.2.2 Stopping the servers
5.1.2.2.1 Console
Windows:
When stopping the Primary HA Server in shared Mode with RMIPort 1858, the command line would be:
shutdown-fmq.bat -rmiPort 1858
For Secondary HA server in shared Mode with RMIPort 1859, the command line would be:
shutdown-fmq.bat -rmiPort 1859
Unix:
When stopping the Primary HA Server in shared Mode with RMIPort 1858, the command line would be:
./shutdown-fmq.sh -rmiPort 1858
For Secondary HA server in shared Mode with RMIPort 1859, the command line would be:
./shutdown-fmq.sh -rmiPort 1859
5.1.2.2.2 Background
Unix:
When stopping the Primary HA Server in shared Mode with RMIPort 1858, the command line would be:
./shutdown-fmq.sh -rmiPort 1858
For Secondary HA server in shared Mode with RMIPort 1859, the command line would be:
./shutdown-fmq.sh -rmiPort 1859
5.1.2.2.3 Service
Windows:
- To remove FioranoMQ Kernel NT service, run the command
uninstall-fmq-service.bat -profile %PROFILE_NAME%
- Un-Install should stop and remove NT service for given profile from the services list.
Linux:
To remove initially created service type "chkconfig --del fmq-linux". This will remove the previously added service
SOLARIS:
To stop the service at shutdown/reboot type:
ln -s fmq-solaris /etc/rc3.d/K45fmq-solaris
Note: It is recommended to choose low priority level for shutdown.
5.2.3. Determining status of servers
It is easy to determine the status of server while running through console, as status of servers are printed on console. It can also be determined by running ServerStatus.java file available in fmq/samples/JMX directory of FioranoMQ installation directory. Details about running this file are available in readme file in the same directory.
5.2.4. Log details
Just like the base FioranoMQ server, the HA server can log into files, consoles, or use any other custom-made logger. The type of logging is controlled through the Loggers module in Fiorano Studio. Options to log all information on the console or save all logs into a log or error file, is provided through Console-based and File-based logging respectively.
5.2.5 Verify HA Setup
On starting the Fiorano MQ Server that is part of an HA pair, the server prints debug information about its own state (ACTIVE, PASSIVE, and ACTIVATING). It also prints information about its backup server's state whenever it detects a change.
Example Statements on console:
[Sat Feb 07 14:03:50 IST 2009] Old status of remote server = DEAD
[Sat Feb 07 14:03:50 IST 2009] New status of remote server = WAITING
[Sat Feb 07 14:03:50 IST 2009] Old status of remote server = WAITING
[Sat Feb 07 14:03:50 IST 2009] New status of remote server = PASSIVE
The Console includes statements as shown below:
'Primary Server switched to ACTIVE' or 'Secondary Server switched to PASSIVE', which indicate that the pair has successfully connected. Also, a statement gets printed when the lock is successfully acquired over the lockfile on the active servers console.
Example: Successfully acquired lock on: C:\lockFile.dat.
The figure below illustrates a successfully started Fiorano HA MQ Server in shared mode: