Edge HA & Alerting
Contents
Introduction
Fail-over HA for Datonis Edge is achieved by mounting a Network shared drive and using it for the Data folder of Edge.
Data folder of Edge contains all the contextual information of the Edge.
Configuring Edge failover to support high availability use case
Datonis Edge now natively provides failover mechanism. It uses master/slave topology where one instance is active and others are in standby (All Edge instance services in running state). More than one slaves can be configured for failover.
Edge provides failover capability using a lock file from the shared data directory. The shared data directory holds a persistent state. As failover relies on the file system lock, the file system storing the data directory has to be accessible across instances(using SAN, NFS, …). Refer: https://en.wikipedia.org/wiki/Clustered_file_system.
When a first instance starts, if the lock is available, it takes the lock and becomes the master. Whenever a second instance starts, it tries to acquire the lock. As the lock is already held by the master, the instance becomes a slave, in standby mode (not active).
Following scenarios can be tackled using Edge Failover HA
- Datonis Edge Service in one of the instances crashes.
- Datonis Edge Service is stopped.
- One of the Edge host machines shuts down due to some reason.
The lock present in the shared data folder is acquired by the master Edge (The running Edge instance). This lock is released when the Edge process stops running and is subsequently taken up by the other instance.
Time required for the switch: Around 1 minute.
Typical life cycle of 2 HA Edge Instances
Configuration
Configuring failover in traditional installation
In the install/upgrade scripts (e.g. install_edge_service.sh/upgrade_edge_service.sh), add a new option --datadirpath (at the end of the command, in the script) that will point to the shared data directory across instances e.g. --datadirpath "/shared-vol/datonis-edge-data". After this step, install or upgrade edge service on all instances and edge services will start in failover mode, the first service to start will become master node.
Make sure that the path of all the Edge installations is identical. For example, the Path of Edge installation in all the instances can be "C:\Altizon\win-edge-6.0.0\datonis-edge-6.0.0".
Configuring failover in docker installation
In the Docker command line, edit option --mount to point the source volume to the shared data directory e.g. --mount type=bind,source=/shared-vol/datonis-edge-data,target=/opt/datonis-edge-data. The Docker containers started with shared mounts will configure edge program to run in failover mode. The first started docker container will become master node.
Alerting
- Create a thing on Datonis which can be used for the alerts related to Edge HA Mode.
- In Cloud Services -> EdgeCloudService, configure Enter Thing Key for getting Edge Alerts with that thing-key.
SHARING THE DATA FOLDER ON WINDOWS:
- Control panel -> Programs -> Programs and Features -> Turn windows features on or off
- Turn on features related to cifs (server and client) and nfs
- Create folder which has to be shared.
- Right click and turn network sharing on and give permissions and add users.
- You will see the network address.
MOUNTING THE NETWORK SHARED DIRECTORY ON WINDOWS:
- Win + r -> \\servername\sharedFolder
- Map the shared folder to a drive using UI (This PC -> Computer -> Map network drive)
- In command Prompt, create a symlink for the shared Folder.
mklink /D C:\myLink \\127.0.0.1\share
This will allow the Edge Service to access the shared folder at C:\myLink
SHARING THE DATA FOLDER ON UBUNTU:
- Install samba
- Create a directory for Edge data
- Right click -> properties -> Local share network : enable sharing and also change permissions to create and delete for users.
MOUNTING THE NETWORK SHARED DIRECTORY ON UBUNTU:
- Example:
- sudo mount -t cifs //192.168.0.145/share /home/yash/Altizon/sharedData -o username='yash',domain='WORKGROUP'