Skip to content
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

SqlAGListener: Should Be Cluster Aware #871

Closed
randomnote1 opened this issue Oct 13, 2017 · 2 comments · Fixed by #1783
Closed

SqlAGListener: Should Be Cluster Aware #871

randomnote1 opened this issue Oct 13, 2017 · 2 comments · Fixed by #1783
Labels
enhancement The issue is an enhancement request.

Comments

@randomnote1
Copy link
Contributor

Details of the scenario you tried and the problem that is occurring:
When the xSQLServerAvailabilityGroupListener resource is applied to all of the nodes in a Failover Cluster Instance (FCI), the nodes will "fight" with each other while trying to manage the Availability Group Listener on the specified AG.

The DSC configuration that is using the resource (as detailed as possible):
When the following configuration is applied to two or more nodes in a FCI.

xSQLServerAvailabilityGroupListener RemoveAvailabilityGroupListenerWithDifferentNameAsVCO
{
    Ensure               = 'Absent'
    NodeName             = 'SQLNODE01.company.local'
    InstanceName         = 'MSSQLSERVER'
    AvailabilityGroup    = 'AvailabilityGroup-01'
    Name                 = 'AG-01'

    PsDscRunAsCredential = $SysAdminAccount
}

Version of the Operating System, SQL Server and PowerShell the DSC Target Node is running:
Any

What module (SqlServer or SQLPS) and which version of the module the DSC Target Node is running:
Any

Version of the DSC module you're using, or 'dev' if you're using current dev branch:
Any

@randomnote1
Copy link
Contributor Author

The resource should evaluate if the current node is actively hosting the SQL instance. If it is not hosting the instance, it should write a verbose message stating that it does not own the instance, and then silently exit.

@johlju johlju added enhancement The issue is an enhancement request. help wanted The issue is up for grabs for anyone in the community. labels Oct 14, 2017
@randomnote1
Copy link
Contributor Author

To resolve this issue, a parameter called ProcessOnlyOnActiveNode should be created on the Set-TargetResource and Test-TargetResource functions.

The Get-TargetResource function will execute the helper function Test-ActiveNode to determine if the current node is actively hosting the SQL instance and return the result via the read-only property IsActiveNode.

The Test-TargetResource function will use the value of ProcessOnlyOnActiveNode and IsActiveNode to determine if it should continue. If ProcessOnlyOnActiveNode is $true and IsActiveNode is $false, Test-TargetResource will return $true.

I put together this gist as a guide to updating the resource.

Also, see the xSQLServerAlwaysOnAvailabilityGroup resource for a completed example.

@johlju johlju changed the title xSQLServerAvailabilityGroupListener: Should Be Cluster Aware SqlAGListener: Should Be Cluster Aware Dec 23, 2017
dlenkov added a commit to dlenkov/SqlServerDsc that referenced this issue Aug 29, 2022
dlenkov added a commit to dlenkov/SqlServerDsc that referenced this issue Sep 15, 2022
johlju added a commit to dlenkov/SqlServerDsc that referenced this issue Mar 26, 2023
johlju pushed a commit to dlenkov/SqlServerDsc that referenced this issue Sep 30, 2023
johlju pushed a commit that referenced this issue Sep 30, 2023
…ster aware (#1783)

- SqlAGListener
  - Made the resource cluster aware. When ProcessOnlyOnActiveNode is specified,
    the resource will only determine if a change is needed if the target node
    is the active host of the SQL Server instance (issue #871).
@johlju johlju removed the help wanted The issue is up for grabs for anyone in the community. label Sep 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement The issue is an enhancement request.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants