Multi Instance Installation Steps for openHistorian - GridProtectionAlliance/openHistorian GitHub Wiki
These steps enable multiple openHistorian Windows service instances to run on the same machine. Note that the first openHistorian instance can optionally be installed normally using the installer, i.e., openHistorianSetup.msi, then these instructions can be followed for each other instance ensuring that the new instances use unique ports, service names and install locations. For full control of the deployment details, use these instructions for each instance.
Prerequisites
-
(Optional) Create a Windows Group Managed Service Account (MSA) for each openHistorian instance. An MSA account may be required when openHistorian should access external resources, e.g., a remote database or using remote archive locations.
-
For each openHistorian instance, define names for each of these placeholders:
Item Placeholder Examples Managed service account (optional) {MSA}OH\MSA_INST1,OH\MSA_INST2Name of the openHistorian instance {NAME}OpenHistorian-Instance1,OpenHistorian-Instance2Description for the openHistorian instance {DESCRIPTION}openHistorian instance 1 that archives time-series dataSQL Server name and instance {SQLSERVER}localhost\SQLEXPRESSSQL database name {DBNAME}OpenHistorian-Inst1,OpenHistorian-Inst2Port number for the low-level data channel (e.g., 38400-38499) {DATAPORT}38402,38403Port number for the web host (e.g., 8180-8199) {WEBPORT}8180,8190Port number for the remoting host (e.g., 8510-8529) {REMOTEPORT}8510,8511Port number for STTP (e.g., 7175-7299) {STTPPORT}7175,7275Port number for STTPS (e.g., 7177-7299) {STTPSPORT}7177,7277Port number for GEP (e.g., 6175-6299) {GEPPORT}6175,6275Port number for hosted Grafana (e.g., 8185-8199) {GRAFANAPORT}8185,8195
The ports listed above are considered "primary" services, however, there are other ports for lesser used services as well. When one or more instances of the openHistorian are configured to use the same service ports, the service for that port will only be available on the openHistorian that starts first. To change "all" relevant ports, see the full port listing and follow similar instructions for updating ports numbers as found below.
1. Download and Stage the Binaries
We cannot use the packaged openHistorian installer because we need to customize the Windows service details. Download the openHistorian binaries from Grid Protection Alliance's GitHub page:
-
Go to https://www.gridprotectionalliance.org/NightlyBuilds/openHistorian/Beta/
-
Download
openHistorian.Binaries.zip -
Right-click on the downloaded zip file, choose Properties, and select
Unblock. This will unblock the DLLs in Windows and enables the .NET runtime to load assemblies. -
Extract the contents of the unblocked zip file into a temporary folder.
-
Create a new (empty) folder within
C:\Program Files\for the openHistorian instance. Assign{NAME}as the folder name (see prerequisites). Example:C:\Program Files\OpenHistorian-Inst2. -
Return to the temporary folder that contains the extracted binaries and open the
\Applications\openHistoriansubfolder. -
Copy the contents of the
openHistoriansubfolder into theC:\Program Files\{NAME}folder.
2. Create and Configure the Windows Service
-
Open Windows Command Prompt in administrator mode (Start > type "Command Prompt" > right-click on the Command Prompt icon > choose "Run as Administrator").
-
Enter this statement and replace the placeholders:
sc create "{NAME}" binPath="\"C:\Program Files\{NAME}\openHistorian.exe\" -nomutex -runasservice"Example:
sc create "OpenHistorian-Instance2" binPath= "\"C:\Program Files\OpenHistorian-Inst2\openHistorian.exe\" -nomutex -runasservice" -
Enter this statement and replace the placeholders:
sc description "{NAME}" "{DESCRIPTION}"Example:
sc description "OpenHistorian-Instance2" "openHistorian instance 2 that archives time-series data" -
Verify that both statements return a success message.
-
Open Windows Services (Start > type "Services") and locate the newly-created openHistorian service in the list.
-
Right-click on the openHistorian service and choose Properties.
-
On the General tab, set the startup type to
Automatic. -
On the Log On tab, apply the credentials:
For MSA accounts:
- Use the following account name:
{MSA}$(the$is required!) - Password: clear the box (MSAs do not have passwords)
For all else:
- Verify
Local System accountis selected
- Use the following account name:
3. Assign Folder Permissions (MSA step only)
-
In File Explorer, go to
C:\Program Files, right-click on the custom-named openHistorian folder ({NAME}), and choose Properties > Security > Edit > Add... -
Choose "Service Accounts" on the Object Types, and enter the MSA name (
{MSA}) without the$. -
Set the MSA permissions to allow "Full control".
4. Run openHistorian Configuration Setup Utility
The following instructions assume openHistorian configuration database is for SQL Server, see the "Using the Configuration Setup Utility" wiki-page for other databases. Note that if the target database system is under configuration control, this utility may need to be run by a DBA.
Right-click on ConfigurationSetupUtility.exe (found in C:\Program Files\{NAME}) and choose "Run as administrator".
Set up new configuration > Database
Set up a database
- Choose "SQL Server"
- Uncheck "Run sample data script"
- Uncheck "Run audit log trigger scripts"
Set up a SQL Server database
- Host name:
{SQLSERVER}(see prerequisites) - Database name:
{DBNAME}(see prerequisites) - Check "Use integrated security"
Apply configuration changes
- Check "openHistorian Windows service"
- Check "openHistorian Manager (local application)"
- Check "Setup / change primary historian"
Set up primary historian
- Select "openHistorian 2.0 (Local)" as the adapter
Set up historian connection string
- DataChannel: change the port number to
{DATAPORT}(see prerequisites).This is the port that openHistorian will listen on (low-level non-secure socket). Default port is
38402- each openHistorian service instance will need to operate with a unique port.
Continue clicking Next until you get to the final screen. On the last screen, uncheck both "Start the openHistorian" and "Start openHistorian Manager" and then click Finish.
5. Update openHistorian Service Configuration Settings
Open openHistorian.exe.config found in C:\Program Files\{NAME}.
Web Host Port
-
Go to "configuration" > "categorizedSettings" > "systemSettings" > "WebHostURL"
-
Change the WebHostURL port number:
<add name="WebHostURL" value="http://+:{WEBPORT}" .../>Example:
<add name="WebHostURL" value="http://+:8190" .../>
Remoting Server Port
-
Go to "configuration" > "categorizedSettings" > "remotingServer" > "ConfigurationString"
-
Change the ConfigurationString port number:
<add name="ConfigurationString" value="Port={REMOTEPORT}" .../>Example:
<add name="ConfigurationString" value="Port=8511" .../>
STTP Data Publisher Port
-
Go to "configuration" > "categorizedSettings" > "sttpdatapublisher" > "ConfigurationString"
-
Change the ConfigurationString port number:
<add name="ConfigurationString" value="Port={STTPPORT}" .../>Example:
<add name="ConfigurationString" value="Port=7275" .../>
STTP Secure Data Publisher Port
-
Go to "configuration" > "categorizedSettings" > "sttpsdatapublisher" > "ConfigurationString"
-
Change the ConfigurationString port number:
<add name="ConfigurationString" value="Port={STTPSPORT}" .../>Example:
<add name="ConfigurationString" value="Port=7277" .../>
GEP Data Publisher Port
-
Go to "configuration" > "categorizedSettings" > "internaldatapublisher" > "ConfigurationString"
-
Change the ConfigurationString port number:
<add name="ConfigurationString" value="Port={GEPPORT}" .../>Example:
<add name="ConfigurationString" value="Port=6275" .../>
Hosted Grafana Web Port
-
Go to "configuration" > "categorizedSettings" > "grafanaHosting" > "HostedURL"
-
Change the HostedURL port number:
<add name="HostedURL" value="http://localhost:{GRAFANAPORT}" .../>Example:
<add name="HostedURL" value="http://localhost:8195" .../>
Save Configuration File Updates
Save openHistorian.exe.config in C:\Program Files\{NAME}, replacing the original file.
Note that saving file may require administrator privileges.
6. Update Hosted Grafana INI Configuration Settings
Open custom.ini found in C:\Program Files\{NAME}\Grafana\conf.
Grafana Web Host Port
-
Go to "[server]" > "http_port"
-
Change the http_port number:
http_port = {GRAFANAPORT}Example:
http_port = 8195
openHistorian Proxy Web Host Port
-
Go to "[server]" > "root_url"
-
Change the root_url web port number (leave
${HOSTNAME}as-is):root_url = http://${HOSTNAME}:{WEBPORT}/grafana/Example:
root_url = http://${HOSTNAME}:8190/grafana/
Save INI File Updates
Save custom.ini in C:\Program Files\{NAME}\Grafana\conf, replacing the original file.
Note that saving file may require administrator privileges.
7. Configure Console Settings
Open openHistorianConsole.exe.config found in C:\Program Files\{NAME}.
Remoting Port
-
Go to "configuration" > "categorizedSettings" > "remotingClient" > "ConfigurationString"
-
Change the ConfigurationString port number:
<add name="ConnectionString" value="Server=localhost:{REMOTEPORT}" .../>Example:
<add name="ConnectionString" value="Server=localhost:8511" .../>
Save openHistorianConsole.exe.config and place it in C:\Program Files\{NAME}, replacing the original file.
8. Configure Windows Firewall
-
Open Windows Firewall > Allow app or feature > Change settings > Allow another app...
- Choose
C:\Program Files\{NAME}\openHistorian.exe - Check the "Domain" box for the newly-added openHistorian entry
- Choose
-
When using an MSA account, open Windows Command Prompt in administrator mode and run this command, substituting
{WEBPORT}and{MSA}with the correct values:netsh http add urlacl http://+:{WEBPORT}/ user="{MSA}$"Example:
netsh http add urlacl http://+:8183/ user="OH\MSA_INST2$"This grants permission for the MSA to run an HTTP service on the specified port.
9. Initialize the Service
-
Open "Windows Services" > select the newly-installed openHistorian service instance (
{NAME}) and choose Start. -
Run
openHistorianConsole.exe, which is found inC:\Program Files\{NAME}, and verify that it connects successfully. -
Open a web browser and navigate to
http://localhost:{WEBPORT}to verify proper operation.
10. Update openHistorian Manager Service Ports
-
Run the instance specific openHistorian Manager application found in the found in
C:\Program Files\{NAME} -
Navigate to
System > Manage Nodesfrom the manager menu -
Update the
Settingsstring as follows:RemoteStatusServerConnectionString={server=localhost:{REMOTEPORT}; integratedSecurity=true}; dataPublisherPort={GEPPORT}Example:
RemoteStatusServerConnectionString={server=localhost:8511; integratedSecurity=true}; dataPublisherPort=6275