Automating Dependency Replication for Active/Passive Disaster Recovery in Azure

Jagadeeskumar Lenin 121 Reputation points
2024-02-27T11:22:20.18+00:00

Primary region setup : Traffic manger (Priority routing) --> APP Service (frond end) +Azure SQL Database (Backend). For the above scenario we setup the Active (Primary region)- Passive(secondary) DR. Question : Primary setup have some set of dependencies , if incase I initiate a DR for the secondary region , how can I achieve the same dependencies of primary region to the secondary DR region(i need a solution Automated way). Note : DependencyDR-scenario.png may be running in the same or different region.

------------------------Additional information -------------------------- Dependency Explanation based on the Ticketing Tool: In the context of a ticketing tool used for managing customer support requests, User A's actions on the frontend of the tool generate data. This data can include information about the type of issues raised, customer details, and the status of the support tickets. This generated data is then stored in the backend of the Azure SQL Database. Now, let's consider another application, such as a performance tracking tool, which also relies on the Azure SQL Database. This application might analyze the efficiency of the support team by monitoring the number of tickets resolved, the average time taken to resolve a ticket, and other relevant metrics. The dependency here lies in the fact that both the ticketing tool and the performance tracking tool rely on the same Azure SQL Database for storing and retrieving data. This shared database ensures that both applications can access the necessary information to perform their respective functions. In summary, the set of dependencies in this scenario includes the ticketing tool's frontend, the Azure SQL Database, and the performance tracking application. The frontend allows User A to generate data, which is then stored in the Azure SQL Database. The performance tracking application also uses the same database to gather data and analyze the efficiency of the support team.

DR-scenario

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
2,971 questions
Azure SQL Database
Azure Site Recovery
Azure Site Recovery
An Azure native disaster recovery service. Previously known as Microsoft Azure Hyper-V Recovery Manager.
672 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,285 questions
{count} votes

Accepted answer
  1. Ben Gimblett 3,840 Reputation points Microsoft Employee
    2024-02-29T15:56:17.2566667+00:00

    Hi - Thanks for the question

    Your question centres around an additional application, "performance tracking tool", which is conceptually related to the workload which is deployed cross region as active-passive, but has a reporting/analysis function.

    The shared dependency here is the data

    Traffic manager in priority mode also works nicely from a front end perspective. It's not clear if you'd use your own DNS or where client traffic for "performance tracking tool" originates.

    Managing the the database/data is the challenge

    Az SQL DB will offer managed geo replication and eventual consistency. https://video2.skills-academy.com/en-us/azure/azure-sql/database/disaster-recovery-guidance?view=azuresql

    Points
    *you need to think carefully about whether you want a capability to fail over all components or just some and whether you can really use the TM probes to automatically change the profile priority (active primary to passive secondary). In reality a number of steps may be required
    *you need to think about the app RTO and RPO as a whole (and that includes the "performance tracking tool" application which may have business importance). As part of this you need to decide if all components have their own SLA or a shared SLA to the business
    *you need to consider the RPO in terms of waiting for eventual consistency or accepting data loss (if / when you failover the DB)
    *you need to think about whether both "front end" applications need to have read/write - or could the "performance tracking tool" be read only? If it can be read only perhaps the secondary region (passive) deployment of this tool could point to the local database replica read only - meaning you could fail it over independently. If not then you could configure it with the general endpoint connection string meaning it, and the front end, deployed in the secondary actually still point to the primary db location - until the db is failed over (whereby the dns is updated as part of the failover process so the applications would be pointed at the new primary in the secondary region).
    *Consider that if both "front end apps " need read write then you will have to failover BOTH apps AND the database to achieve DR in the event of any one component having a problem
    *The database backup strategy is a key part of this story - dont focus only on geo-replication
    *Consider deploying in a way that the key application components are zone resilient (at least in the primary/active region) which means there's less chance you'll need to activate a DR plan in the first place. All components (everything inc dependencies required for the workload to be usable by the business) need to be zone resilient for this to work.

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. nagaraju kendyala 0 Reputation points
    2024-03-04T17:42:53.56+00:00

    Switching to a passive database in an active-passive disaster recovery setup with automation while ongoing processes are running and interacting with other databases requires careful planning and considerations. Here's a general approach, but specific implementation details will depend on your chosen tools and technologies:

    1. Pre-Failover Preparation:

    Identify running processes: Establish a mechanism to automatically detect and track processes interacting with the active database. This could involve:

    Monitoring tools like AWS CloudWatch

    Code instrumentation to identify database connections

    Maintaining a process registry or configuration file

    Transaction management: Implement transaction management strategies within your processes to ensure data consistency during failover.

    Utilize appropriate commit points or transaction boundaries to minimize potential data loss.

    Prepare passive replica: Ensure the passive database replica is up-to-date and ready to accept connections. This involves:

    Regularly syncing data from the active database to the passive replica using mechanisms like replication tools or AWS Database Migration Service (DMS).

    Verifying the passive replica's health and consistency before initiating failover.

    2. Failover Automation:

    Trigger: Define a trigger to initiate the failover process. This could be:

    A manual action in response to a detected incident.

    An automated failover initiated by an external monitoring system upon detecting an issue with the active database.

    Process handling:

    Graceful shutdown: Upon receiving the failover trigger, initiate a controlled shutdown of all processes interacting with the active database.

    Consider implementing graceful exit strategies within your processes to handle open connections and ongoing transactions.

    You may need to utilize techniques like rolling updates or timeouts to ensure all processes are terminated gracefully.

    Completion confirmation: Verify that all processes have successfully disconnected from the active database before proceeding.

    Database switch: Once processes are terminated:

    Point applications to passive replica: Update connection strings or configuration settings in your applications or other components to point to the passive database replica. This could involve:

    Utilizing environment variables or configuration management tools to dynamically update connection details.

    Employing scripts or automation tools to modify configurations across different systems.

    Verify connectivity: Ensure successful connection and functionality with the passive database after failover.

    3. Post-Failover Actions:

    Validate functionality: Conduct thorough testing to ensure applications and processes continue to function correctly with the passive database.

    Monitor and troubleshoot: Monitor the passive database and applications for any issues or performance problems.

    Investigate the incident: Analyze the cause of the failover and take corrective actions to prevent future incidents.

    Plan for failback: Establish a plan and procedures for potentially switching back to the original active database once the issue is resolved.

    Additional Considerations:

    Testing: Regularly test your failover automation procedures in a non-production environment to ensure they function as expected.

    Data consistency: While replication helps, there's always a potential for data loss between the last update and the failover. Evaluate your acceptable data loss tolerance and consider techniques like synchronous replication or near real-time updates for improved consistency.

    Complexity: Implementing automated failover with ongoing processes can be complex. Assess your technical expertise and resources before attempting this approach. It's recommended to seek guidance from experienced professionals, consult your specific database solution's documentation, and thoroughly test any custom automation scripts before deploying them in a production environment.

    0 comments No comments

  2. nagaraju kendyala 0 Reputation points
    2024-03-04T18:02:25.6133333+00:00

    Active-Passive Disaster Recovery with Automated Failover in Azure SQL Database

    Achieving automated failover in an active-passive Azure SQL Database setup while ongoing processes interact with other databases necessitates meticulous planning and execution. Here's a breakdown of the approach:

    1. Pre-Failover Preparation:

    • Identify running processes: Similar to the AWS scenario, leverage Azure Monitor and Application Insights to track applications and processes interacting with the active database. This could involve: Monitoring active connections and queries.
       Instrumenting your code to identify database interactions.
      
          Maintaining a centralized registry of processes and their dependencies.
      
         - **Transaction management:** Implement robust transaction management within your processes to ensure data consistency during failover.
      
             Utilize appropriate commit points or transaction boundaries to minimize potential data loss.
      
            - **Prepare passive replica:** Ensure the passive SQL Database replica is up-to-date and ready for connections.
      
                Utilize Azure Data Sync or Azure Database Migration Service (DMS) for efficient and reliable data synchronization between the active and passive databases.
      
                   Regularly monitor the synchronization status and verify the passive replica's health and consistency before initiating failover.
      

    2. Failover Automation:

    • Trigger: Define a trigger to initiate the automated failover process. This could be: A manual action in response to a detected incident.
       An automated failover initiated by Azure Monitor alerts based on predefined conditions like high resource usage or connectivity issues with the active database.
      
      - **Process handling:**
      
          **Graceful shutdown:** Upon receiving the failover trigger:
      
                Utilize Azure Monitor Application Insights to identify active connections and processes.
      
                      Trigger graceful shutdown of processes interacting with the active database:
      
                               Implement code-level mechanisms to handle ongoing transactions and connections gracefully.
      
                                        Consider rolling restarts or timeouts to ensure all processes terminate cleanly.
      
                                           **Completion confirmation:** Verify that all active connections have been closed using Azure Monitor before proceeding.
      
                                          - **Database switch:** Once processes are terminated:
      
                                              **Point applications to passive replica:** Update connection strings or configuration settings in your applications or other components to point to the passive database replica. This could involve:
      
                                                    Using Azure App Service settings or environment variables to dynamically update connection details.
      
                                                          Employing Azure Automation scripts to modify configurations across different systems.
      
                                                             **Verify connectivity:** Ensure successful connection and functionality with the passive database after failover.
      

    3. Post-Failover Actions:

    • Validate functionality: Conduct thorough testing to ensure applications and processes continue to function correctly with the passive database.
    • Monitor and troubleshoot: Monitor the passive database and applications for any issues or performance problems using Azure Monitor and Application Insights.
    • Investigate the incident: Analyze the cause of the failover and take corrective actions to prevent future incidents.
    • Plan for failback: Establish a plan and procedures for potentially switching back to the original active database once the issue is resolved. This might involve additional configuration changes and testing.

    Additional Considerations:

    • Testing: Regularly test your failover automation procedures in a non-production environment using Azure Resource Groups and Deployment Templates to ensure they function as expected.
    • Data consistency: While Azure Data Sync offers efficient replication, consider potential delays between the last update and the failover. Evaluate your acceptable data loss tolerance and consider techniques like synchronous replication or near real-time updates for improved consistency.
    • Complexity: Implementing automated failover with ongoing processes can be complex. Assess your technical expertise and resources before attempting this approach. Consult Microsoft documentation for specific guidance, and thoroughly test any custom automation scripts before deploying them in a production environment.

    Remember, this is a general outline. Specific implementation details will vary based on your chosen tools, technologies, and database configuration.

    0 comments No comments