dsccommunity / SqlServerDsc

This module contains DSC resources for deployment and configuration of Microsoft SQL Server.
MIT License
358 stars 224 forks source link

SqlAGReplica: Wait for new replica #1446

Open emyatsuna opened 4 years ago

emyatsuna commented 4 years ago

Hi, just wondering if this repository has a script to wait or checking for additional AG replica like that of SqlWaitForAG? I would like to have a checking if 2 nodes or more (Primary and Seconday) are already added as replicas in the same AG group. Tried with SqlAGReplica but the script will only add replica as new node in the AG group. Thanks.

johlju commented 4 years ago

Maybe you can use the Wait-resources to accomplish this? See https://docs.microsoft.com/en-us/powershell/scripting/dsc/configurations/crossnodedependencies?view=powershell-6

johlju commented 4 years ago

Although those resources assume that if the resource on the other nodes has run it was added as a replica. Do you think there is a need to have resource to check if one or more specific nodes have been added as replicas, a WaitForReplica resource?

emyatsuna commented 4 years ago

Hi @johlju , thanks for the suggestion. I will look into it. Did a re-run of my scripts and got move forward with the Synchronization on the Primary AGReplica. However, I get an error when the Secondary AGReplica tries to connect to a Synchronized Primary AGReplica. Providing a screenshot after a manual retry to Synchronize AGDatabase in the Secondary AGReplica.

That's why the only thing that I could think for now is to create a wait resource inside the Primary to re-check if 2 or more AGR replicas exist already in AG group before continuing with the SqlAGDatabase (synchronized) in the Primary. It's a challenge for me to fully synchronize Primary and Secondary replicas. Appreciate if you can provide me a process and tips too for AG synchronization of Primary and Secondary. Thanks.

AGDatabase_failed

emyatsuna commented 4 years ago

Hi @johlju , Still having the same problem. Hopefully you can help with this one. Thanks.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had activity from the community in the last 30 days. It will be closed if no further activity occurs within 10 days. If the issue is labelled with any of the work labels (e.g bug, enhancement, documentation, or tests) then the issue will not auto-close.

johlju commented 4 years ago

Sorry for not responding for so long. Been busy with DSC Community. There might be bugs you are encountering with the resource. Not sure right now. I need to test this but I currently does not have the bandwidth. But if you feel the resources can be improved then you are more than welcome to send a PR.

johlju commented 4 years ago

Labeling this a a bug in the mean time until someone can reproduce this issue.