Siemens SIMATIC WinCC: redundancy & high availability with a very simple active active solution
With the synchronous replication and automatic failover of Evidian SafeKit
The solution for Siemens SIMATIC WinCC
Evidian SafeKit brings redundancy and high availability to Siemens SIMATIC WinCC between two active servers.
This article explains how to implement quickly a Siemens SIMATIC WinCC cluster without specific skills. No specific WinCC configuration is required for redundancy.
The principle of the solution is to put WinCC applications in virtual machines under Hyper-V. SafeKit implements real-time replication and automatic failover of the virtual machines.
No specific hardware, no specific hypervisor
Hyper-V is the native Windows hypervisor included for free in all versions of Windows, even Windows for PC. And SafeKit is working with Windows for servers and PC.
SafeKit is hardware agnostic . It's a pure software solution that does not require any additional hardware. There is no need for a shared disk, a replicated SAN, dedicated disks, dedicated networks.
About products under Siemens LMS licensing
- To avoid the broken Siemens license on failover, the dongle containing the Siemens key can be put in a USB over IP device (like DIGI AnywhereUSB).
- The dongle can also be put in an external PC with the LMS license server on the PC (for example the PC which manages the Siemens graphical interface).
Redundancy and high availability at the application level
In this type of solution, only application data are replicated. And only the application is restared in case of failure.
With this solution, restart scripts must be written to restart the application. This solution is platform agnostic and works with applications inside physical machines, virtual machines, in the Cloud. Any hypervisor is supported (VMware, Hyper-V...).
Redundancy and high availability at the virtual machine level
In this type of solution, the SCADA software is put inside a virtual machine. The full Virtual Machine (VM) is replicated and restarted (Application + OS).
The advantage of this solution is that there is no restart scripts to write per application. This solution is generic for any SCADA software. It works with Windows/Hyper-V and Linux/KVM but not with VMware. This is an active/active solution with several virtual machines replicated and restarted between two nodes.
- Solution for a new application (no restart script to write): Windows/Hyper-V, Linux/KVM
Solution preferred by Siemens
SafeKit is available in the Siemens marketplace with its SCADA sofware: Desigo CC (building management), SIMATIC WinCC, SIMATIC PCS 7 and also with the Siveillance suite (video and access control).
SafeKit is deployed by Siemens in Australia, France, the Netherlands, Qatar, Switzerland, the UAE, the UK, the US.
SafeKit chosen by Alstef Group
Alstef Group, a key player in baggage handling systems, deploys SafeKit for redundancy and high availability of its SCADA software suite, BAGware.
SafeKit has been deployed by Alstef Group in many airports with BAGware.
Fives Syleps has chosen SafeKit
Fives Syleps, a key player in automated logistics, deploys SafeKit for redundancy and high availability of its software suite.
SafeKit has been deployed by Fives Syleps in many factories.
Built-in Hyper-V replication
- Asynchronous replication => data loss
- Manual failover (no automatic failover)
- Not a high availability solution
Microsoft clustering (same as VMware HA)
- Requires a shared disk
- Price of the shared disk and its installation (SAN, iSCSI)
- Configuration complexity of Windows failover cluster (AD…)
- Remote sites = replicated storage
Evidian SafeKit
- Simple and economical
- Synchronous replication => no data loss
- Automatic failover and failback
- No shared disk
- Free trial and quick installation guide
Prerequisites
- You need the Hyper-V role installed on 2 Windows nodes (embedded for free in all Windows versions including Windows for PC).
- You need your critical applications installed inside one or more virtual machines.
- As the failover script imports a virtual machine on the secondary Hyper-V, be careful on Hyper-V settings and processor compatibility between both nodes.
Package installation on Windows
-
Download the free version of SafeKit on 2 Windows nodes.
Note: the free version includes all SafeKit features. At the end of the trial, you can activate permanent license keys without uninstalling the package.
-
To open the Windows firewall, on both nodes start a powershell as administrator, and type
c:/safekit/private/bin/firewallcfg add
-
To initialize the password for the default admin user of the web console, on both nodes start a powershell as administrator, and type
c:/safekit/private/bin/webservercfg.ps1 -passwd pwd
- Use aphanumeric characters for the password (no special characters).
- pwd must be the same on both nodes.
-
Exclude from antivirus scans C:\safekit\ (the default installation directory) and all replicated folders that you are going to define.
Antiviruses may face detection challenges with SafeKit due to its close integration with the OS, virtual IP mechanisms, real-time replication and restart of critical services.
Module installation on Windows
-
Download the hyperv.safe module.
The module is free. It contains the files userconfig.xml and the restart scripts.
- Put hyperv.safe under C:\safekit\Application_Modules\demo (create the demo directory if it does not exist).
The Hyper-V configuration is presented with a virtual machine named VM1 and containing the application to restart in case of failure.
You will have to repeat this configuration for all VMs that you want to replicate and to restart. SafeKit supports up to 25 virtual machines.
1. Prerequisites
The VM1 virtual machine files (VM1 configuration file, virtual hard disk...) must be put in a same folder: this folder will be replicated by SafeKit.
Make sure the virtual switch name(s) referenced by the virtual machine exist on both Hyper-V servers and corresponds to the same physical network.
If all the files of VM1 are not in the same folder, use Hyper-V manager:
- Export VM1 in a folder, for example in D:\Repli-Hyper-V
- This export will create a folder D:\Repli-Hyper-V\VM1\ containing all VM1 files
- Remove VM1 from the inventory of Hyper-V manager
- Import VM1, previously exported, into Hyper-V manager
It is important that all the files representing a VM (Virtual Machines/, Virtual Hard Disks/, .vmcx, .vmgs, .vmrs, .vhdx, ...) are in the same directory replicated by SafeKit. Else your VM will not reboot after replication. If you are not sure, take a snapshot or your VM before starting the procedure.
2. Launch the SafeKit console
- Launch the web console in a browser on one node by connecting to
http://localhost:9010
. - Enter
admin
as user name and the password defined during installation.
You can also run the console in a browser on a workstation external to the cluster.
The configuration of SafeKit is done on both nodes from a single browser.
To secure the web console, see 11. Securing the SafeKit web console in the User's Guide.
3. Configure node addresses
- Enter the node IP addresses.
- Then, click on
Apply
to save the configuration.
If node1 or node2 background color is red, check connectivity of the browser to both nodes and check firewall on both nodes for troubleshooting.
This operation will place the IP addresses in the cluster.xml
file on both nodes (more information in the training with the command line).
5. Configure the module
- Choose an automatic start of the module at boot without delay.
- Normally, you have a single heartbeat network on which the replication is made. But, you can define a private network if necessary.
- Put in VM_PATH, the root path of the replicated directory (D:\Repli-Hyper-V).
- Enter in VM_NAME, the name of the virtual machine (VM1).
We assume that all VM1 files are in D:\Repli-Hyper-V\VM1\ (see prerequisites). This directory will be replicated in real-time by SafeKit.
The NORMAL_STOP and FORCE_STOP values can be "stop", "save" or "off":
- "stop" shutdowns the VM when the module is stopped.
- "save" saves the current state of the VM (suspend) when the module is stopped.
- "off" turns off the VM (power off) when the module is stopped.
"stop" is recommended because it causes the shutdown then the reboot of the VM when the module is stopped and restarted. Thus the application inside the VM is restarted.
This will be the case, for example, when switching between primary and secondary roles.
This operation will report the configuration in the userconfig.xml
file on both nodes (more information in the training with the command line).
7. Start the node with up-to-date data
- If node 1 has the up-to-date
VM1\
replicated directory, select it and start it.
When node 2 will be started, all data in VM1\
will be copied from node 1 to node 2.
If you make the wrong choice, you run the risk of synchronizing outdated data on both nodes.
It is also assumed that the VM1 virtual machine is stopped on node 1 so that SafeKit installs the replication mechanisms and then starts VM1 in the start_prim
script.
8. Wait for the transition to ALONE (green)
- Node 1 should reach the ALONE (green) state, which means that the
start_prim
script has been executed on node 1.
If the status is ALONE (green) and VM1 is not started, check output messages of start_prim
in the Application Log of node 1.
If node 1 does not reach ALONE (green) state, analyze why with the Module Log of node 1.
If the cluster is in WAIT (red) not uptodate - STOP (red) not uptodate
state, stop the WAIT node and force its start as primary.
9. Start node 2
- Start node 2 with its contextual menu.
- Wait for the SECOND (green) state.
Node 2 stays in the SECOND (magenta) state while resynchronizing the VM1\
replicated directory (copy from node 1 to node 2).
This may take a while depending on the size of files to resynchronize in VM1\
and the network bandwidth.
To see the progress of the copy, see the Module Log of node 2 with the verbose option without forgetting to refresh the window.
11. Testing
- Stop the PRIM node by scrolling down its contextual menu and clicking Stop.
- Verify that there is a failover on the SECOND node which should become ALONE (green).
- Check the restart of VM1 with Hyper-V manager.
If VM1 is not started on node 2 while the state is ALONE (green), check the output messages of the start_prim
script in the Application Log of node 2.
As the start_prim
script imports the virtual machine on node 2, the failover can fail because of Hyper-V settings (see this article).
If ALONE (green) is not reached, analyze why with the Module Log of node 2.
12. Custom checker to detect VM malfunction
A custom checker is included in the hyperv.safe module to run in the host and to detect VM malfunction using Hyper-V heartbeat feature: VM locked up, crashed or ceased to function.
The custom checker sends heartbeat messages from the host to the VM at regular intervals. It is then the job of the Hyper-V Heartbeat Service installed on the VM to send a response to each of these heartbeat messages. If the Hyper-V Heartbeat Service does not respond to the message, then the custom checker restarts the VM on the same Hyper-V. If after 3 unsuccessful restarts (maxloop) in 24 hours (loop_interval), then the SafeKit hyperv module stops on the primary server and there is a failover of the VM on the secondary server. There is also a configuration with a direct failover on the other Hyper-V server as soon as the VM does not respond to heartbeats.
How to change conf/userconfig.xml to configure the custom checker
In Advanced Configuration tab, you can edit conf/userconfig.xml .
1) Declare the custom checker and its associated resource custom.VM
<service mode="mirror" maxloop="3" loop_interval="24" ...>
...
<check>
<custom ident="VM" exec="vmcheck.ps1" arg="%VM_NAME%" when="prim"></custom>
</check>
...
2) Add a failover rule to react on the resource change in conf/userconfig.xml
<failover>
<![CDATA[
vm_failure:
if( custom.VM == down ) then restart();
]]>
</failover>
With stopstart() instead of restart(), there is an immediate failover on the secondary server.
You must apply the new configuration by a right click on the icon/xxx on the left side (see image): the interface will allow you to redeploy the modified userconfig.xml file on both servers.
13. Automatic restart if a critical service fails inside the VM
If you want an automatic restart or failover when a critical service inside the VM fails, you can configure the Recovery properties of the service (see image).
First you must configure the custom checker previously described.
And then in Microsoft Service Manager inside the VM, select your critical service and in the recovery property of the service, you just have to configure shutdown of the VM when the critical service fails.
For that, in the Recovery options of your critical service, choose "Run a Program" on failures and in Run program options, set"C:\Windows\System32\shutdown.exe" and in "Command line parameters", set /s /c "service fails".
Of course, you can implement more subtle recovery with your own scripts. But just be aware that shutting down the VM will enable the custom checker in the host. The custom checker will detect that the Hyper-V heartbeat is no more responding and will restart the VM on the same Hyper-V server or will make a failover on the other Hyper-V server (depending on its configuration).
To test the feature, use Task Manager and kill the process (End task) associated to the critical service. A clean stop of the service through Service Manager or the "net stop" command does not trigger the recovery action inside Windows Service Manager.
Module log
- Read the module log to understand the reasons of a failover, of a waiting state etc...
To see the module log of node 1 (image):
- click on the Control tab
- click on node 1/PRIM on the left side to select the server (it becomes blue)
- click on Module Log
- click on the Refresh icon (green arrows) to update the console
- click on the floppy disk to save the module log in a .txt file and to analyze in a text editor
Click on node2 to see the module log of the secondary server.
Application log
- Read the application log to see the output messages of the start_prim and stop_prim restart scripts.
To see the application log of node1 (image):
- click on the Control tab
- click on node 1/PRIM on the left side to select the server (it becomes blue)
- click on Application Log to see messages when starting and stopping services
- click on the Refresh icon (green arrows) to update the console
- click on the floppy disk to save the application log in a .txt file and to analyze in a text editor
Click on node 2 to see the application log of the secondary server.
Advanced configuration
- In Advanced Configuration tab, you can edit internal files of the module: bin/start_prim and bin/stop_prim and conf/userconfig.xml .
If you make change in the internal files here, you must apply the new configuration by a right click on the icon/xxx on the left side (see image): the interface will allow you to redeploy the modified files on both servers.
Support
- For getting support, take 2 SafeKit Snapshots (2 .zip files), one for each server.
If you have an account on https://support.evidian.com, upload them in the call desk tool.
How the SafeKit Hyper-V cluster works with replication and failover of Siemens SIMATIC WinCC?
The following steps are described for one virtual machine containing Siemens SIMATIC WinCC inside one mirror module. Each replicated virtual machine runs in an independent mirror module (with a maximum of 25 virtual machines) with a primary server that can be either the Hyper-V server 1 or the Hyper-V server 2.
Step 1. Real-time replication
Server 1 (PRIM) runs the VM (virtual machine) containing Siemens SIMATIC WinCC. SafeKit replicates in real time the VM files (virtual hard disk, VM configuration). Only changes made in the files are replicated across the network.
The replication is synchronous with no data loss on failure contrary to asynchronous replication.
You just have to configure the VM directory name in SafeKit. There are no pre-requisites on disk organization. The directory may be located in the system disk.
Step 2. Automatic failover
When Server 1 fails, Server 2 takes over. SafeKit restarts the VM containing Siemens SIMATIC WinCC on Server 2. Hyper-V finds the files replicated by SafeKit uptodate on Server 2.
The VM continues to run on Server 2 by locally modifying its files that are no longer replicated to Server 1.
The failover time is equal to the fault-detection time (set to 30 seconds by default) plus the VM reboot time.
Step 4. Back to normal
After reintegration, the VM files are once again in mirror mode, as in step 1. The system is back in high-availability mode, with the VM containing Siemens SIMATIC WinCC running on Server 2 and SafeKit replicating file updates to Server 1.
If the administrator wishes the VM to run on Server 1, he/she can execute a "swap" command either manually at an appropriate time, or automatically through configuration.
More information on power outage and network isolation in a cluster.
Why a replication of a few Tera-bytes?
Resynchronization time after a failure (step 3)
- 1 Gb/s network ≈ 3 Hours for 1 Tera-bytes.
- 10 Gb/s network ≈ 1 Hour for 1 Tera-bytes or less depending on disk write performances.
Alternative
- For a large volume of data, use external shared storage.
- More expensive, more complex.
Why a replication < 1,000,000 files?
- Resynchronization time performance after a failure (step 3).
- Time to check each file between both nodes.
Alternative
- Put the many files to replicate in a virtual hard disk / virtual machine.
- Only the files representing the virtual hard disk / virtual machine will be replicated and resynchronized in this case.
Why a failover < 25 replicated VMs?
- Each VM runs in an independent mirror module.
- Maximum of 25 mirror modules running on the same cluster.
Alternative
- Use an external shared storage and another VM clustering solution.
- More expensive, more complex.
Why a LAN/VLAN network between remote sites?
- Automatic failover of the virtual IP address with 2 nodes in the same subnet.
- Good bandwidth for resynchronization (step 3) and good latency for synchronous replication (typically a round-trip of less than 2ms).
Alternative
- Use a load balancer for the virtual IP address if the 2 nodes are in 2 subnets (supported by SafeKit, especially in the cloud).
- Use backup solutions with asynchronous replication for high latency network.
Partners, the success with SafeKit
This platform agnostic solution is ideal for a partner reselling a critical application and who wants to provide a redundancy and high availability option easy to deploy to many customers.
With many references in many countries won by partners, SafeKit has proven to be the easiest solution to implement for redundancy and high availability of building management, video management, access control, SCADA software...
Building Management Software (BMS)
Video Management Software (VMS)
Electronic Access Control Software (EACS)
SCADA Software (Industry)
SafeKit with the Hyper-V module or the KVM module | Microsoft Hyper-V Cluster & VMware HA |
|
|
Note that the Hyper-V/SafeKit and KVM/SafeKit solutions are limited to replication and failover of 25 VMs.
VM HA with the SafeKit Hyper-V or KVM module | Application HA with SafeKit application modules |
SafeKit inside 2 hypervisors |
SafeKit inside 2 virtual or physical machines |
Replicates more data (App+OS) | Replicates only application data |
Reboot of VM on hypervisor 2 if hypervisor 1 crashes Recovery time depending on the OS reboot |
Quick recovery time with restart of App on OS2 if crash of server 1 Around 1 mn or less (see RTO/RPO here) Application checker and software failover |
Generic solution for any application / OS | Restart scripts to be written in application modules |
Software clustering vs hardware clustering More info > |
|
|
|
Shared nothing vs a shared disk cluster More info > |
|
|
|
Application High Availability vs Full Virtual Machine High Availability More info > |
|
|
|
High availability vs fault tolerance More info > |
|
|
|
Synchronous replication vs asynchronous replication More info > |
|
|
|
Byte-level file replication vs block-level disk replication More info > |
|
|
|
Heartbeat, failover and quorum to avoid 2 master nodes More info > |
|
|
|
Virtual IP address primary/secondary, network load balancing, failover More info > |
|
|
|
Network load balancing and failover |
|
Windows farm | Linux farm |
Generic Windows farm > | Generic Linux farm > |
Microsoft IIS > | - |
NGINX > | |
Apache > | |
Amazon AWS farm > | |
Microsoft Azure farm > | |
Google GCP farm > | |
Other cloud > |
Advanced clustering architectures
Several modules can be deployed on the same cluster. Thus, advanced clustering architectures can be implemented:
- the farm+mirror cluster built by deploying a farm module and a mirror module on the same cluster,
- the active/active cluster with replication built by deploying several mirror modules on 2 servers,
- the Hyper-V cluster or KVM cluster with real-time replication and failover of full virtual machines between 2 active hypervisors,
- the N-1 cluster built by deploying N mirror modules on N+1 servers.
User's Guide
Application Modules
Release Notes
Presales documentation
Introduction
-
- Demonstration
- Examples of redundancy and high availability solution
- Evidian SafeKit sold in many different countries with Milestone
- 2 solutions: virtual machine or application cluster
- Distinctive advantages
- More information on the web site
- SafeKit training
-
- Cluster of virtual machines
- Mirror cluster
- Farm cluster
Installation, Console, CLI
- Install and setup / pptx
- Package installation
- Nodes setup
- Upgrade
- Web console / pptx
- Cluster configuration
- Configuration tab
- Control tab
- Monitor tab
- Advanced Configuration tab
- Troubleshooting
- Command line / pptx
- Cluster administration
- Module administration
- Control commands
- Troubleshooting
Advanced configuration
- Mirror module / pptx
- Mirror's states in action
- start_prim / stop_prim scripts
- userconfig.xml
- Heartbeat (<hearbeat>)
- Virtual IP address (<vip>)
- Real-time file replication (<rfs>)
- How real-time file replication works?
- Troubleshooting
- Farm module / pptx
- Farm's states in action
- start_both / stop_both scripts
- userconfig.xml
- Farm heartbeats (<farm>)
- Virtual IP address (<vip>)
- Troubleshooting
Advanced configuration
- Checkers / pptx
- Checkers in action
- userconfig.xml
- errd checker
- intf and ip checkers
- custom checker
- splitbrain checker for a mirror module
- tcp, ping, module checkers
- Troubleshooting
Support
- Support tools / pptx
- How to analyze snapshots?
- Best practises
- Evidian support / pptx
- Get permanent license key
- Register on support.evidian.com
- Call desk