For critical production workloads we recommend using multiple Agents and a Shared State Store hosted on either SQL Server
In this article we'll look at configurations for using either SQL Server as the Frends Agent Shared State Store and enabling High Availability.
Using a SQL Server Database
Prerequisites
For this configuration you'll need the following
SQL Admin Connection String (used to initialize the Agent Database)
Frends Agent database
Frends Agent database user with db_datareader, db_datawriter, execute permissions
Frends Agent database password
The Frends Database Initializer command line utility
Prepare Frends Agent Database
Prior to deployment the Frends Agent Database needs to be initialised using the Frends Database Initialiser command line utility
The Database Initializer is included in the "Kubernetes Configuration" bundle which can be downloaded from the Environment/AgentGroup section of your Frends Control Panel.
Just unzip DatabaseInitializer.zip and follow the instructions below.
The connection string [SqlServerConnectionString] shown in the example below needs alter rights to the Frends Agent Database.
Example Frends Version 5.5.4 and below
Frends.DatabaseInitializer.exe -c [SqlServerConnectionString] -n Frends.DatabaseInitializer.AgentStore -u [FRENDSAgentDatabaseUsername] -p [FRENDSAgentDatabasePassword] --doNotCreateBackupJobs
Example Frends Version 5.5.5 and above
Frends.DatabaseInitializer.exe -c [SqlServerConnectionString] -n Frends.Agent.Data.Initialization.Migrations.SqlServerAgentStore -u [FRENDSAgentDatabaseUsername] -p [FRENDSAgentDatabasePassword] --doNotCreateBackupJobs
Update Agent App Settings
Next you need to add an AgentDatabaseConnectionString key to appsettings.secrets.json
Example
"AgentDatabaseConnectionString": "Server=tcp:[SqlServerHostName],1433;Database=[FRENDSAgentDatabase];User ID=[FRENDSAgentDatabaseUsername]@[SqlServerHostName];Password=[FRENDSAgentDatabasePassword];Trusted_Connection=False;Encrypt=True;Connection Timeout=30;"
βAgentDatabaseConnectionString uses the same [FRENDSAgentDatabaseUsername] and [FRENDSAgentDatabasePassword] used by the DatabaseInitializer earlier.
For more information on Application Settings please see Application Settings for cross platform frends agent
Enable High Availability
Once the Shared State Store is configured you need to edit FRENDS-Agent-Deploy.yaml and set the desired number of replicas.
Example
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: frends-agent-linux
spec:
replicas: 2
This setting tells Kubernetes to maintain 2 replicas for this deployment (2 Frends Agents in the Agent Group) which will both share the same Application Settings/Shared State Store.
For more information see Kubernetes Deployments