AG排查和监控指南
1. 排查场景
如下表包含了常用排查的场景。根据被分为几个场景类型,比如Configuration,client connectivity,failover和performance。
Scenario | 笔记 | Scenario Type | Description |
Troubleshoot AlwaysOn Availability Groups Configuration (SQL Server) | Configuration | 提供了一些典型的配置AG实例发生问题的信息。比如AG被禁用,账号配置不正确,镜像endpoint不存在(SQL Server Error 1418)。网络访问不存在,join数据库失败(SQL Server Error 35250)。 | |
Troubleshoot "Validating WSFC quorum vote configuration" warning |
| Configuration | 当使用对话框创建AG时,收到一个警告: “The current WSFC cluster quorum vote configuration is not recommended for this availability group.” |
Troubleshoot issues when creating availability group listeners |
| Configuration | 在创建AG Listener的时候发生错误。 |
Troubleshoot a Failed Add-File Operation (AlwaysOn Availability Groups) |
| Configuration | 添加文件导致secondary数据库挂起,状态变为NOT SYNCHORNIZING |
Fix: Error 41009 when you try to create multiple availability groups |
| Configuration | 创建多个AG时发生41009 错误 |
Cannot connect to availability group listener in a multi-subnet environment |
| Client Connectivity | 创建了AG Listener之后,无法ping通和连接 |
| Failover | 自动故障转移不能成功完成 | |
Performance | 自动故障转移或者计划内的手动转移之后,切换时间超过了RTO时间 | ||
Performance | 强制故障转移后,都是的数据超过了RPO。或者异步提交的replica能够承受的数据丢失超过了RPO。 | ||
Troubleshoot: Changes on the Primary Replica are not Reflected on the Secondary Replica | Performance | 客户端程序可以成功的完成primary的修改,但是查询replia却没有反应。 |
2. 排查工具
以下工具可以用来排查,配置时或者运行时发生的问题
Tool | 笔记 | Description |
| 在UI接口下,获取某个时间点的AG健康情况。 | |
| 被Alwayson Dashboard使用 | |
记录AG,副本,数据库,其他AG主键的状态变化,和AG的错误 | ||
记录集群时间,包括AG资源的状态变化,SQL Server resource DDL的事件和错误。 | ||
记录SQL Server健康诊断被报告到WSFC集群,由sp_server_diagnostics (Transact-SQL)产生 | ||
Dynamic Management Views and System Catalog Views (AlwaysOn Availability Groups) | 报告AG的信息,比如配置,健康状况,性能问题 | |
提供了详细AG信息用来诊断,分析起因 | ||
提供了AG特定的等待信息,用来调整性能 | ||
AlwaysOn Performance Counters |
| 监控AG的活动,反馈到系统监视器,用来调优,具体可以看 SQL Server, Availability Replica 和 SQL Server, Database Replica. |
记录SQL Server系统内部争端的警告,用来debug和AG有关的问题。 |
3. 监控AG
理想的排查时间是在故障转移之前。这个可以通过监控性能值,在超过SLA之前发送告警。比如同步secnodary副本有性能问题,因为预计failover时间增加。AG是高可用和灾难恢复解决访问,最重要的性能指标是切换时间,会影响RTO,灾难导致的数据丢失会影响RPO。
以下表文章用来监控AG的健康状况:
Topic | 笔记 | Description |
描述AG数据同步,阀值控制,和一些有用的值用来监控AG,还有如何收集RTO,RPO的值。 | ||
| 提供一些AG监控工具 | |
The AlwaysOn Health Model Part 1 -- Health Model Architecture | 提供一个Alwayson健康模型的概述 | |
The AlwaysOn Health Model Part 2 -- Extending the Health Model | 如何用户定制Alwayson监控模型和用户定义Alwayson Dashboard,来显示额外的信息。 | |
Monitoring AlwaysOn Health with PowerShell - Part 1: Basic Cmdlet Overview | 提供一些基本的Alwayson Powershell命令。用来监控AG的健康状况。 | |
Monitoring AlwaysOn Health with PowerShell - Part 2: Advanced Cmdlet Usage | 提供一些高级的Alwayson Powershell命令。用来监控AG的健康状况。 | |
Monitoring AlwaysOn Health with PowerShell - Part 3 : A Simple Monitoring Application | 显示如何使用城区监控AG。 | |
Monitoring AlwaysOn Health with PowerShell - Part 4 : Integration with SQL Server Agent | 如何使用SQL Server Agent集成监控AG,并且在出问题的时候通知。 |