Elastic Job disaster recovery options

Ron Michael Zettlemoyer 1 Reputation point
2023-04-27T22:04:17.1233333+00:00

I have Elastic Jobs working in one region but I'm trying to figure out how to set up some kind of automated disaster recover to keep jobs running if resources or a region fails. I already have a replica set up for the Azure SQL Database for my application, and a failover group to handle switching to the backup database when needed. How do I achieve something like that for Elastic Jobs in case the agent in my primary region fails? Or does Azure already have the covered somehow?

PS - I did find an interesting way to achieve what I wanted: Create a replica of a jobs database in a different region; failover to the replica; create a new Elastic Job agent in the new region; can then switch back to the primary database. It seems like the agent won't/can't run on a read only replica.

Azure SQL Database
Azure
Azure
A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.
1,089 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Oury Ba-MSFT 18,021 Reputation points Microsoft Employee
    2023-04-28T00:34:57.9166667+00:00

    Ron Michael Zettlemoyer Thank you for reaching out.

    My understanding is that you are trying to keep jobs running if resources or a region fails.

    Any failover or move of Azure resources to a new Azure region will also move the job database and jobs metadata to the new Azure region. However, the Elastic Job agent is a compute only resource and needs to be explicitly re-created and started in the new region before jobs will start executing again in the new region. Once started, the Elastic Job agent will resume executing jobs in the new region as per the previously defined job schedule.

    This is also documented in the below documentation under the limitations of current Elastic Jobs.

     https://learn.microsoft.com/en-us/azure/azure-sql/database/elastic-jobs-overview?view=azuresql#known-limitations

    Job Agent will need write access to the Jobs Database to update Job status metadata.

    Regards,

    Oury

    0 comments No comments

  2. Oury Ba-MSFT 18,021 Reputation points Microsoft Employee
    2023-04-28T00:36:04.69+00:00

    Ron Michael Zettlemoyer Thank you for reaching out.

    My understanding is that you are trying to keep jobs running if resources or a region fails.

    Any failover or move of Azure resources to a new Azure region will also move the job database and jobs metadata to the new Azure region. However, the Elastic Job agent is a compute only resource and needs to be explicitly re-created and started in the new region before jobs will start executing again in the new region. Once started, the Elastic Job agent will resume executing jobs in the new region as per the previously defined job schedule.

    This is also documented in the below documentation under the limitations of current Elastic Jobs.

     https://learn.microsoft.com/en-us/azure/azure-sql/database/elastic-jobs-overview?view=azuresql#known-limitations

    Job Agent will need write access to the Jobs Database to update Job status metadata.

    Regards,

    Oury