Skip to content

Multi Instance Installation Steps for openHistorian

J. Ritchie Carroll edited this page Mar 5, 2021 · 7 revisions

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

  1. (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.

  2. For each openHistorian instance, define names for each of these placeholders:

    Item Placeholder Examples
    Managed service account (optional) {MSA} OH\MSA_INST1, OH\MSA_INST2
    Name of the openHistorian instance {NAME} OpenHistorian-Instance1, OpenHistorian-Instance2
    Description for the openHistorian instance {DESCRIPTION} openHistorian instance 1 that archives time-series data
    SQL Server name and instance {SQLSERVER} localhost\SQLEXPRESS
    SQL database name {DBNAME} OpenHistorian-Inst1, OpenHistorian-Inst2
    Port number for the low-level data channel (e.g., 38400-38499) {DATAPORT} 38402, 38403
    Port number for the web host (e.g., 8180-8199) {WEBPORT} 8180, 8190
    Port number for the remoting host (e.g., 8510-8529) {REMOTEPORT} 8510, 8511
    Port number for STTP (e.g., 7175-7299) {STTPPORT} 7175, 7275
    Port number for STTPS (e.g., 7177-7299) {STTPSPORT} 7177, 7277
    Port number for GEP (e.g., 6175-6299) {GEPPORT} 6175, 6275
    Port 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:

  1. Go to https://www.gridprotectionalliance.org/NightlyBuilds/openHistorian/Beta/

  2. Download openHistorian.Binaries.zip

  3. 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.

  4. Extract the contents of the unblocked zip file into a temporary folder.

  5. 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.

  6. Return to the temporary folder that contains the extracted binaries and open the \Applications\openHistorian subfolder.

  7. Copy the contents of the openHistorian subfolder into the C:\Program Files\{NAME} folder.

2. Create and Configure the Windows Service

  1. Open Windows Command Prompt in administrator mode (Start > type "Command Prompt" > right-click on the Command Prompt icon > choose "Run as Administrator").

  2. 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"

  3. Enter this statement and replace the placeholders:

    sc description "{NAME}" "{DESCRIPTION}"

    Example:
    sc description "OpenHistorian-Instance2" "openHistorian instance 2 that archives time-series data"

  4. Verify that both statements return a success message.

  5. Open Windows Services (Start > type "Services") and locate the newly-created openHistorian service in the list.

  6. Right-click on the openHistorian service and choose Properties.

  7. On the General tab, set the startup type to Automatic.

  8. 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 account is selected

3. Assign Folder Permissions (MSA step only)

  1. In File Explorer, go to C:\Program Files, right-click on the custom-named openHistorian folder ({NAME}), and choose Properties > Security > Edit > Add...

  2. Choose "Service Accounts" on the Object Types, and enter the MSA name ({MSA}) without the $.

  3. 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

  1. Go to "configuration" > "categorizedSettings" > "systemSettings" > "WebHostURL"

  2. Change the WebHostURL port number:
    <add name="WebHostURL" value="http://+:{WEBPORT}" .../>

    Example:
    <add name="WebHostURL" value="http://+:8190" .../>

Remoting Server Port

  1. Go to "configuration" > "categorizedSettings" > "remotingServer" > "ConfigurationString"

  2. Change the ConfigurationString port number:
    <add name="ConfigurationString" value="Port={REMOTEPORT}" .../>

    Example:
    <add name="ConfigurationString" value="Port=8511" .../>

STTP Data Publisher Port

  1. Go to "configuration" > "categorizedSettings" > "sttpdatapublisher" > "ConfigurationString"

  2. Change the ConfigurationString port number:
    <add name="ConfigurationString" value="Port={STTPPORT}" .../>

    Example:
    <add name="ConfigurationString" value="Port=7275" .../>

STTP Secure Data Publisher Port

  1. Go to "configuration" > "categorizedSettings" > "sttpsdatapublisher" > "ConfigurationString"

  2. Change the ConfigurationString port number:
    <add name="ConfigurationString" value="Port={STTPSPORT}" .../>

    Example:
    <add name="ConfigurationString" value="Port=7277" .../>

GEP Data Publisher Port

  1. Go to "configuration" > "categorizedSettings" > "internaldatapublisher" > "ConfigurationString"

  2. Change the ConfigurationString port number:
    <add name="ConfigurationString" value="Port={GEPPORT}" .../>

    Example:
    <add name="ConfigurationString" value="Port=6275" .../>

Hosted Grafana Web Port

  1. Go to "configuration" > "categorizedSettings" > "grafanaHosting" > "HostedURL"

  2. 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

  1. Go to "[server]" > "http_port"

  2. Change the http_port number:
    http_port = {GRAFANAPORT}

    Example:
    http_port = 8195

openHistorian Proxy Web Host Port

  1. Go to "[server]" > "root_url"

  2. 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

  1. Go to "configuration" > "categorizedSettings" > "remotingClient" > "ConfigurationString"

  2. 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

  1. 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
  2. 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

  1. Open "Windows Services" > select the newly-installed openHistorian service instance ({NAME}) and choose Start.

  2. Run openHistorianConsole.exe, which is found in C:\Program Files\{NAME}, and verify that it connects successfully.

  3. Open a web browser and navigate to http://localhost:{WEBPORT} to verify proper operation.

10. Update openHistorian Manager Service Ports

  1. Run the instance specific openHistorian Manager application found in the found in C:\Program Files\{NAME}

  2. Navigate to System > Manage Nodes from the manager menu

  3. Update the Settings string as follows:
    RemoteStatusServerConnectionString={server=localhost:{REMOTEPORT}; integratedSecurity=true}; dataPublisherPort={GEPPORT}

    Example:
    RemoteStatusServerConnectionString={server=localhost:8511; integratedSecurity=true}; dataPublisherPort=6275

Clone this wiki locally