How to gracefully shut down a Streaming node that was started via a Windows Service

How to gracefully shut down a Streaming node that was started via a Windows Service

book

Article ID: KB0071350

calendar_today

Updated On:

Products Versions
TIBCO Streaming 11.0 and later

Description

When you configure and start Streaming nodes via a Windows Service, this makes use of the epservice executable, which may be found in the Streaming installation under %TIBCO_HOME%\str\11.x\distrib\kabira\bin\epservice.exe.

In the case where the epservice.exe shuts down unexpectedly, follow the below guidance to determine if the related Streaming nodes are still running and how to gracefully shut them down.

Issue/Introduction

Outlines the steps needed to gracefully shut down a Streaming node that was started via a Windows Service. The Windows registry may be checked to confirm the node installation path as described below.

Resolution

First, you may check the service startup parameters for your Windows service. This will confirm the following parameter values:
  • application -  The absolute path to the application archive that was used to install the node(s).
  • nodedeploy - The absolute path to the node deploy HOCON configuration file.
  • nodedirectory - The absolute path to the node install directory.
  • nodename - The fully-qualified node service name (clustername.nodename).
  • substitutionfile - The absolute path to the substitution file (if applicable).
These parameter values are stored in the Windows registry using the following key when the service is installed. 
 
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\TIBCO Software Inc.\Settings\str\win-service-name\

..where 'node-name' is the fully qualified service name of the node running the application, and 'win-service-name' is the Windows service name specified when the application was installed as a service.

Once you determine the node name, you may attempt to shut it down by opening a StreamBase Command Prompt and running the 'epadmin stop node' command. For example..
 
epadmin --servicename clustername.nodename stop node

This should gracefully shut down the node.

If, when you run the above command, you see an error like..
 
[service.name] not able to get the node's name from the node: Authentication of user [YourWindowsUser] failed: authentication failed

..this likely means that you installed the service using the Local System user. In this case, you must run 'epadmin stop node' in a command-prompt launched by the Local System user. To do this, first download the PsExec Sysinternals tool from Microsoft:

https://learn.microsoft.com/en-us/sysinternals/downloads/psexec

Then, launch a StreamBase Command Prompt as Administrator. You can do this by locating the StreamBase Command Prompt shortcut in the Windows Start menu (under the TIBCO sub-menu), right-click on the shortcut, then select 'More > Run as administrator'. In the new StreamBase Command Prompt, execute the following command..
 
PsExec -i -s cmd.exe

This will launch a second command prompt as the Local System user. From this prompt, you may then stop the node gracefully using the 'epadmin stop node' command shown above.

As an alternative to using the --servicename parameter in your epadmin commands, you may obtain the node's administration port using the 'epadmin getadminport node' command, assuming you know the machine hostname and the nodedirectory value as discussed above. For example..
 
epadmin --hostname mymachinename getadminport node --installpath path\to\nodedirectory\

Once you obtain the administration port, you may use the --adminport parameter to stop the node:
 
epadmin --hostname mymachinename --adminport <value obtained from the 'getadminport node' command> stop node

 

Additional Information

For more details, refer to the documentation on the epadmin 'node' target:

https://docs.tibco.com/pub/str/11.0.1/doc/html/rtcmd/epadmin-node.html