Cluster Basics
Some settings apply to the whole cluster. You set them in the cluster registration from Getting Started:
- PostgreSQL
- MySQL
- SQL Server
- RavenDB
builder.Services.AddJobMasterCluster(config =>
{
config.UseStandaloneCluster()
.ClusterId("Local-Cluster-01")
.UsePostgres("Host=localhost;Database=jobmaster_db;Username=postgres;Password=pwd")
.DefaultJobTimeout(TimeSpan.FromMinutes(5))
.DefaultMaxRetryCount(5)
.RetryDelays(TimeSpan.FromSeconds(30), TimeSpan.FromMinutes(5))
.IanaTimeZoneId("Europe/London")
.DataRetentionTtl(TimeSpan.FromDays(30))
.AddWorker();
});
builder.Services.AddJobMasterCluster(config =>
{
config.UseStandaloneCluster()
.ClusterId("Local-Cluster-01")
.UseMySql("Server=localhost;Database=jobmaster_db;User ID=root;Password=pwd")
.DefaultJobTimeout(TimeSpan.FromMinutes(5))
.DefaultMaxRetryCount(5)
.RetryDelays(TimeSpan.FromSeconds(30), TimeSpan.FromMinutes(5))
.IanaTimeZoneId("Europe/London")
.DataRetentionTtl(TimeSpan.FromDays(30))
.AddWorker();
});
builder.Services.AddJobMasterCluster(config =>
{
config.UseStandaloneCluster()
.ClusterId("Local-Cluster-01")
.UseSqlServer("Server=localhost;Database=jobmaster_db;User Id=sa;Password=pwd;TrustServerCertificate=True")
.DefaultJobTimeout(TimeSpan.FromMinutes(5))
.DefaultMaxRetryCount(5)
.RetryDelays(TimeSpan.FromSeconds(30), TimeSpan.FromMinutes(5))
.IanaTimeZoneId("Europe/London")
.DataRetentionTtl(TimeSpan.FromDays(30))
.AddWorker();
});
builder.Services.AddJobMasterCluster(config =>
{
config.UseStandaloneCluster()
.ClusterId("Local-Cluster-01")
.UseRavenDB("Urls=http://localhost:8080;Database=JobMaster")
.DefaultJobTimeout(TimeSpan.FromMinutes(5))
.DefaultMaxRetryCount(5)
.RetryDelays(TimeSpan.FromSeconds(30), TimeSpan.FromMinutes(5))
.IanaTimeZoneId("Europe/London")
.DataRetentionTtl(TimeSpan.FromDays(30))
.AddWorker();
});
All of them are optional; the sections below give each default.
Job Timeout and Retries
DefaultJobTimeout(default: 1 minute): how long a run may take.DefaultMaxRetryCount(default: 3): how many times a failed job is retried.
These apply to jobs whose handler has no [JobMasterTimeout] or [JobMasterMaxNumberOfRetries]. Each setting is resolved in this order: the scheduling call, then the handler's attribute, then the cluster default.
Retry Delays
RetryDelays sets the wait before each retry: the first delay before the first retry, the second before the second, and so on. The last one repeats for every later retry. Each delay must be at least 30 seconds.
Default: 30 seconds, 2 minutes, 10 minutes, 30 minutes, then 1 hour.
Time Zone
IanaTimeZoneId (default: the machine's local time zone): the time zone recurring schedules run in, unless an expression names its own (tz America/New_York).
Set it explicitly: servers often run in a different zone than your machine (cloud servers are usually UTC), and the schedules would shift with it.
Data Retention
DataRetentionTtl (default: keep forever): how long finished jobs, inactive recurring schedules and logs are kept before they're deleted automatically. The minimum is 10 minutes.
Set it before going to production; otherwise the job tables only grow.
More
Every cluster setting, including the ones for distributed setups, is in Cluster Configuration.
Next
Worker Basics: what runs your jobs, and apps that only schedule them.