Skip to content

microsoft/mssql-server-ha

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This repository contains the source code of the Pacemaker resource agents that ship in the mssql-server-ha package.

This is a snapshot of our SQL Server-internal repository where the actual development takes place. As the commit histories are completely different, we cannot currently accept pull requests to this repository. This snapshot is provided so that users can see the source of the agents, make changes to suit any specific scenarios they have, write agents for other clustering systems following the same protocol, and so on. We intend to migrate development to this repository at a future date.

We're happy to receive bug reports, suggestions and feedback for the code in this repository as Github issues.

Kubernetes agents for monitoring SQL Server instances and Availability Groups are also coming, and will be added to this repository at a future date.

Availability Group resource agent ocf:mssql:ag

This is made up of a golang binary go/src/ag-helper and a shell script ag/ag. ag-helper can be built by running GOPATH=$PWD/go go install ag-helper

The agent can be installed by moving the files to these locations:

  • ag/ag to /usr/lib/ocf/resource.d/mssql/ag
  • ag/docs/* to /usr/lib/ocf/lib/mssql/*
  • go/bin/ag-helper to /usr/lib/ocf/lib/mssql/ag-helper

The shell script is the entry point for the resource agent and delegates to the helper binary for most tasks. The helper binary monitors the instance health by running sp_server_diagnostics and the AG health by querying sys.databases. It also implements the promote and demote actions by running the ALTER AVAILABILITY GROUP FAILOVER and ALTER AVAILABILITY GROUP SET (ROLE = SECONDARY) DDLs.

Major changes since SQL2017:

  • Provide hostname support for ag and fci
  • Install External Lease in Pacemaker
  • Introduce external write lease handling to Pacemaker AG resource agent
  • Not to wait for databases to come online during failover
  • Bring secondaries offline in post promote
  • Various Pacemaker AG agent fixes for more reliable failovers

Failover Cluster Instance resource agent ocf:mssql:fci

This is made up of a golang binary go/src/fci-helper and a shell script fci/fci. fci-helper can be built by running GOPATH=$PWD/go go install fci-helper

The agent can be installed by moving the files to these locations:

  • fci/fci to /usr/lib/ocf/resource.d/mssql/fci
  • fci/docs/* to /usr/lib/ocf/lib/mssql/*
  • go/bin/fci-helper to /usr/lib/ocf/lib/mssql/fci-helper

The shell script is the entry point for the resource agent and handles starting and stopping the sqlservr process. The script invokes the fci-helper binary to fixup the server name after starting the resource (if necessary), and to monitor the instance health by running sp_server_diagnostics

Major changes since SQL2017:

  • Ensure ag-helper and fci-helper exit if the resource agent process is killed
  • ag helper will reattempt connection if connection times out for monitor action

License

MIT

Contributing

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

About

Contains source code for the mssql-server-ha package

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published