-
Notifications
You must be signed in to change notification settings - Fork 225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SqlAG/SqlAGReplica: Are both needed? #1059
Comments
@johlju i feel as if a refactor is needed for these DSC resources. There are a couple of questions i had to ask myself when utilizing these. As is, these dsc resources have the following issues.
Proposed Solution: Benefits:
Proposed Solution: Benefits:
|
@TraGicCode I agree with both your proposals, both proposals aligns with what I wrote in the issue description. The second proposal aligns with the proposed parameter name Right now it seems better to concatenate the resources SqlAG and SqlAGReplic, but is there a scenario where the resource SqlAGReplica is needed. 🤔 |
I tried to wrap my head around this. I concatenated the parameters for both SqlAG and SqlAGReplica into a new Assumptions
Questions
Suggested schema.mof
Update 1: Updated the suggested answer for Q5 |
This issue has been automatically marked as needs more information 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 label with any of the work labels (e.g bug, enhancement, documentation, or tests) the issue will not auto-close. |
Reviving this thread a bit as I recently went through some pain implementing AGs with DSC. I agree completely that these two resources should be merged. I think the MOF that @johlju proposed above covers all the necessary functionality. I am questioning whether a few of these parameters are necessary?
I also was thinking that we want to add some additional parameters:
Last thought, is there value in also merging the
Thoughts on these additions? |
Regarding Regarding Regarding Regarding merging SqlAGDatabase, there could be beneficial to have that outside the new (refactored) resource since then it is possible for (partial) configurations to add databases to an existing Availability Group. |
Since the resource's code will be running on a cluster member, we can utilize the cluster registry to access some mapping information stored with the cluster resource. Based on some research and testing, I think the following flow would work for replacing
$ag = Get-CimInstance -Namespace root/MSCluster -ClassName MSCluster_Resource -Filter "Type = 'SQL Server Availability Group' AND Name = '$Name'"
$registryPath = "HKLM:\Cluster\Resources\$($ag.Id)\SqlInstToNodeMap"
$instanceNodeMap = (Get-Item -Path $registryPath).Property | ForEach-Object -Process {
New-Object -Property @{
SqlServerInstance = $_
NodeName = (Get-ItemPropertyValue -Path $registryPath -Name $_)
}
}
$ReplicaServerName, $ReplicaInstanceName = ($instanceNodeMap | Where-Object -Property NodeName -EQ $ag.OwnerNode).SqlServerInstance -split '\\'
if ([String]::IsNullOrEmpty($ReplicaInstanceName))
{
$ReplicaInstanceName = 'MSSQLSERVER'
} |
@nabrond That looks doable! |
@johlju I was wondering if this would be implemented. Cheers all ! |
@mdniou I started implementing these changes awhile back, but was sidetracked by other work. I think all that is left is some unit testing. |
@nabrond Would be great to get this issue resolved. If you have something working already then maybe we can help out getting it tested? |
@nabrond I'd be happy to help finish your work so that we can benefit of it. |
I'm doing SQL AG Cluster automation and found this issue. We are using SQL 2019 and I'm trying to use automatic seeding. However, it looks like it is not implemented in the current module version. Any chance to work again on this? |
@bvaradinov-c If you want to work on this then please do, I don't think there have been any work on this. Happy to review a PR for this. |
Details of the scenario you tried and the problem that is occurring:
Wouldn't it be better to concatenate SqlAG and SqlAGReplica into SqlAG? I want to discuss to see if this is possible, there might be a scenario that make having two resources necessary.
When looking at issue #518 and issue #1057 I'm started to wonder if SqlAGReplica is really needed. They need the same properties, which means the same code (which could be resolved by helper functions if the resources are kept as-is). We have properties that can only be set on the primary replica, so there is a logic in SqlAGReplica to search for and connect to the primary to make those changes.
The "new SqlAG" could instead use
$availabilityGroup.LocalReplicaRole
to determine which role the replica is running under, and set the properties accordingly.In the "new SqlAG" there could be a property to specify an existing replica (for example
ExistingReplicaName
). This new property is assigned a server instance'ServerName\InstanceName'
, which is the same format that is needed for theName
parameter. ThisExistingReplicaName
is the same as the propertiesPrimaryReplicaServerName
andPrimaryReplicaInstanceName
in SqlAGReplica. This will be used to find the primary replica, for example to be able to add a secondary to the Availability Group./cc @randomnote1, @TraGicCode
The DSC configuration that is using the resource (as detailed as possible):
n/a
Version of the Operating System, SQL Server and PowerShell the DSC Target Node is running:
n/a
What module (SqlServer or SQLPS) and which version of the module the DSC Target Node is running:
n/a
Version of the DSC module you're using, or 'dev' if you're using current dev branch:
n/a
The text was updated successfully, but these errors were encountered: