一個磁碟I/O故障導致的AlwaysOn FailOver 過程梳理和分析

来源:https://www.cnblogs.com/xuliuzai/archive/2018/10/31/9886686.html
-Advertisement-
Play Games

下麵是我們在使用AlwaysOn過程中遇到的一個切換案例。這個案例發生在2014年8月,雖然時間相對久遠了,但是對我們學習理解AlwaysOn的FailOver原理和過程還是很有幫助的。本次FailOver的觸發原因是系統I/O問題。大家需要理解,操作系統I/O出現了問題不一定立即觸發SQL Ser ...


下麵是我們在使用AlwaysOn過程中遇到的一個切換案例。這個案例發生在2014年8月,雖然時間相對久遠了,但是對我們學習理解AlwaysOn的FailOver原理和過程還是很有幫助的。本次FailOver的觸發原因是系統I/O問題。大家需要理解,操作系統I/O出現了問題不一定立即觸發SQL Server發生漂移,因為壞的槽點可能不在SQL Server實例所用到的位置,但是隨著時間持續 和數據堆積,問題槽點可能擴大升級。我們可以看到在本例中,第一次出現I/O問題到SQL Server 漂移間隔了16分鐘,所以大家不要奇怪。我們重點可以FailOver的過程和觸發條件設置上,即文章的第二和第三部分。

一 . 系統 I/O 異常 Log追蹤 

1.1  10:36:12 發現I/O異常

 

1.2   10:45:43    顯示個別讀寫花費時間較長

1.3  10:45:28 看似I/O嚴重

1.4   10:52:20 出現個別連接Fail現象

(查看表中的最後一筆數據顯示為10:53:17

 

 . AlwaysOn FailOver 過程

2.1 系統提示需要FailOver

 

2.2 高可用性組的本地副本需要離線。

相關知識:Lease expired event from the cluster. Possible causes include loss of lease, possible network issues and sp_server_diagnostic query timeout. )

2.3 錯誤提示信息顯示,SQL Instance和WSFC連接異常。

2.4 可用性副本的角色發生變換。

 

2.5 角色為RESOLVING無法訪問DB

相關知識:When the role of an availability replica is indeterminate, such as during a failover, its databases are temporarily in a NOT SYNCHRONIZING state. Their role is set to RESOLVING until the role of the availability replica has resolved.)

此時: 通過SSMS管理器,連接數據也是不可以訪問的,顯示狀態為不同步了。

三 . 相關知識點

3.1  什麼是resourceDell?resourceDell的用途?

由於AlwaysOn可用性組是建立在Windows故障轉移群集之上的,Alwayson可用性組需要一個群集resourceDell來連接Windows群集和SQLServer實例。由於可用性組是一個群集資源,Windows群集需要透過AlwaysOn的resourceDell來控制資源的上線/離線,檢查資源是否失敗,更改資源的狀態和屬性,以及發生各種命令給可用性副本實例。(AlwaysOn可用性組的資源類型是“SQLServer Availability Group”)

AlwaysOn通過sp_server_diagnostics來檢查可用性組的健康狀況,不斷地獲得診斷信息。sp_server_diagnostics的評估結果會被用來和AlwaysOn可用性組的FailureConditionLevel設置相比較,來約定是否符合發生故障轉移的條件。一旦條件滿足,則可用性組就被切換到新的可用性副本上。

 

3.2  HealthCheckTimeout

The HealthCheckTimeout setting is used to specify the length of time, in milliseconds, that the SQL Server resource DLL should wait for information returned by the sp_server_diagnostics stored procedure before reporting the AlwaysOn Failover Cluster Instance (FCI) as unresponsive. Changes that are made to the timeout settings are effective immediately and do not require a restart of the SQL Server resource.

The resource DLL determines the responsiveness of the SQL instance using a health check timeout. The HealthCheckTimeout property defines how long the resource DLL should wait for the sp_server_diagnostics stored procedure before it reports the SQL instance as unresponsive to the WSFC service.

The following items describe how this property affects timeout and repeat interval settings:

  • The resource DLL calls the sp_server_diagnostics stored procedure and sets the repeat interval to one-third of the HealthCheckTimeout setting.
  • If the sp_server_diagnostics stored procedure is slow or is not returning information, the resource DLL will wait for the interval specified by HealthCheckTimeout before it reports to the WSFC service that the SQL instance is unresponsive.
  • If the dedicated connection is lost, the resource DLL will retry the connection to the SQL instance for the interval specified by HealthCheckTimeout before it reports to the WSFC service that the SQL instance is unresponsive.

 

3.3  FailureConditionLevel

The SQL Server Database Engine resource DLL determines whether the detected health status is a condition for failure using the FailureConditionLevel property. The FailureConditionLevel property defines which detected health statuses cause restarts or failovers.

Review sp_server_diagnostics (Transact-SQL) as this system stored procedure plays in important role in the failure condition levels.

Level

Condition

Description

0

No automatic failover or restart

  • Indicates that no failover or restart will be triggered automatically on any failure conditions. This level is for system maintenance purposes only.

1

Failover or restart on server down

Indicates that a server restart or failover will be triggered if the following condition is raised:

SQL Server service is down.

2

Failover or restart on server unresponsive

Indicates that a server restart or failover will be triggered if any of the following conditions are raised:

SQL Server service is down.

SQL Server instance is not responsive (Resource DLL cannot receive data from sp_server_diagnostics within the HealthCheckTimeout settings).

3

Failover or restart on critical server errors

Indicates that a server restart or failover will be triggered if any of the following conditions are raised:

SQL Server service is down.

SQL Server instance is not responsive (Resource DLL cannot receive data from sp_server_diagnostics within the HealthCheckTimeout settings).

System stored procedure sp_server_diagnostics returns ‘system error’.

4

Failover or restart on moderate server errors

Indicates that a server restart or failover will be triggered if any of the following conditions are raised:

SQL Server service is down.

SQL Server instance is not responsive (Resource DLL cannot receive data from sp_server_diagnostics within the HealthCheckTimeout settings).

System stored procedure sp_server_diagnostics returns ‘system error’.

System stored procedure sp_server_diagnostics returns ‘resource error’.

5

Failover or restart on any qualified failure conditions

Indicates that a server restart or failover will be triggered if any of the following conditions are raised:

SQL Server service is down.

SQL Server instance is not responsive (Resource DLL cannot receive data from sp_server_diagnostics within the HealthCheckTimeout settings).

System stored procedure sp_server_diagnostics returns ‘system error’.

System stored procedure sp_server_diagnostics returns ‘resource error’.

System stored procedure sp_server_diagnostics returns ‘query_processing error’.

 

3.4  通過SQL更改相關配置。

  The following example sets the HealthCheckTimeout option to 15,000 milliseconds (15 seconds).

ALTER SERVER CONFIGURATION 
SET FAILOVER CLUSTER PROPERTY HealthCheckTimeout = 15000;

  The following example sets the FailureConditionLevel property to 0, indicating that failover or restart will not be triggered automatically on any failure conditions.

ALTER SERVER CONFIGURATION SET FAILOVER CLUSTER PROPERTY FailureConditionLevel = 0;

四 . 結語

  可用性副本的FailOver不僅僅取決於Availability Mode 和FailOver Mode,還要受限於FailureConditionLevel。

 

 本文版權歸作者所有,未經作者同意不得轉載,謝謝配合!!!


您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 文章的格式也許不是很好看,也沒有什麼合理的順序 完全是想到什麼寫一些什麼,但各個方面都涵蓋到了 能耐下心看的朋友歡迎一起學習,大牛和杠精們請繞道 基本的控制台命令介紹: banner 查看metasploit的基本信息 connect 這裡理解成kali的nc命令,基本一致 簡單使用下: show ...
  • 一、ftp安裝 1、安裝vsftpd 命令:yum -y install vsftpd 2、修改ftp配置文件 命令:vim /etc/vsftpd/vsftpd.conf 3、按i進入insert模式後,按以下要求修改 anonymous_enable=YES 改為anonymous_enable ...
  • 一、自述 最近剛剛接觸linux,因為我設置密碼比較隨性,把自己做系統的時候設置的root密碼給forget,每當系統崩潰,重新把虛擬機備份還原後,就面臨無法登陸的尷尬情況,只得重置root密碼,好了,開始記錄我的linux學習歷程—— 二、過程 首先,我們開機,出現如下引導界面,按e,進入內核編輯 ...
  • 雖然我對路由器沒什麼興趣,但是緊跟潮流還是有必要的,現在因為網路閉關鎖國政策,很多人都想自己搭配一臺私人的伺服器,不想被商業公司左右數據安全。我感覺這個是一個商機,建議大家可以朝這個方向發展。這裡最關鍵的一步,其實就是私人智能路由器,俗稱軟路由的搭建。這裡我記錄個人學習LEDE軟路由的經驗,和大家分... ...
  • 工具/原料 win7旗艦版系統 筆記本一臺 WIN7下怎麼安裝iis教程: 點擊開始→控制面板,然後再點擊程式和功能,勿點擊卸載程式,否則到不了目標系統界面。 然後在程式和功能下麵,點擊打開和關閉windows功能。 進入Windows功能視窗,然後看到internet信息服務選項,然後按照圖中設置 ...
  • 1. 首先去官方網站下載壓縮文件:https://dev.mysql.com/downloads/mysql/ 2. 解壓下載的文件。 3. 將解壓的所有文件放在一個文件夾里(最好是C:\Program Files\MySQL\里(Mysql文件夾是自己創建的),其他位置也可以,我安裝在D盤上,下為... ...
  • 實驗機器: Kali虛擬機一臺(192.168.163.133) Windows XP虛擬機一臺(192.168.163.130) 如何用Kali虛擬機一步一步“黑掉”這個windowsXP虛擬機呢? 用到的軟體: SLmail程式(存在緩衝區溢出漏洞) ImmunityDebugger(調試工具) ...
  • linux的資料比較零散,經常是好不容易查到了,然後幾秒鐘就忘了,然後就怎麼都找不到了。看來學這個不能偷懶,必須要隨時隨地把資料給記錄下來。這就是這篇博文的意義。Xfce 一個圖形桌面環境。debian 一個linux發行版。引導提示符,按tab編輯命令行:desktop=xfceX Window ... ...
一周排行
    -Advertisement-
    Play Games
  • 移動開發(一):使用.NET MAUI開發第一個安卓APP 對於工作多年的C#程式員來說,近來想嘗試開發一款安卓APP,考慮了很久最終選擇使用.NET MAUI這個微軟官方的框架來嘗試體驗開發安卓APP,畢竟是使用Visual Studio開發工具,使用起來也比較的順手,結合微軟官方的教程進行了安卓 ...
  • 前言 QuestPDF 是一個開源 .NET 庫,用於生成 PDF 文檔。使用了C# Fluent API方式可簡化開發、減少錯誤並提高工作效率。利用它可以輕鬆生成 PDF 報告、發票、導出文件等。 項目介紹 QuestPDF 是一個革命性的開源 .NET 庫,它徹底改變了我們生成 PDF 文檔的方 ...
  • 項目地址 項目後端地址: https://github.com/ZyPLJ/ZYTteeHole 項目前端頁面地址: ZyPLJ/TreeHoleVue (github.com) https://github.com/ZyPLJ/TreeHoleVue 目前項目測試訪問地址: http://tree ...
  • 話不多說,直接開乾 一.下載 1.官方鏈接下載: https://www.microsoft.com/zh-cn/sql-server/sql-server-downloads 2.在下載目錄中找到下麵這個小的安裝包 SQL2022-SSEI-Dev.exe,運行開始下載SQL server; 二. ...
  • 前言 隨著物聯網(IoT)技術的迅猛發展,MQTT(消息隊列遙測傳輸)協議憑藉其輕量級和高效性,已成為眾多物聯網應用的首選通信標準。 MQTTnet 作為一個高性能的 .NET 開源庫,為 .NET 平臺上的 MQTT 客戶端與伺服器開發提供了強大的支持。 本文將全面介紹 MQTTnet 的核心功能 ...
  • Serilog支持多種接收器用於日誌存儲,增強器用於添加屬性,LogContext管理動態屬性,支持多種輸出格式包括純文本、JSON及ExpressionTemplate。還提供了自定義格式化選項,適用於不同需求。 ...
  • 目錄簡介獲取 HTML 文檔解析 HTML 文檔測試參考文章 簡介 動態內容網站使用 JavaScript 腳本動態檢索和渲染數據,爬取信息時需要模擬瀏覽器行為,否則獲取到的源碼基本是空的。 本文使用的爬取步驟如下: 使用 Selenium 獲取渲染後的 HTML 文檔 使用 HtmlAgility ...
  • 1.前言 什麼是熱更新 游戲或者軟體更新時,無需重新下載客戶端進行安裝,而是在應用程式啟動的情況下,在內部進行資源或者代碼更新 Unity目前常用熱更新解決方案 HybridCLR,Xlua,ILRuntime等 Unity目前常用資源管理解決方案 AssetBundles,Addressable, ...
  • 本文章主要是在C# ASP.NET Core Web API框架實現向手機發送驗證碼簡訊功能。這裡我選擇是一個互億無線簡訊驗證碼平臺,其實像阿裡雲,騰訊雲上面也可以。 首先我們先去 互億無線 https://www.ihuyi.com/api/sms.html 去註冊一個賬號 註冊完成賬號後,它會送 ...
  • 通過以下方式可以高效,並保證數據同步的可靠性 1.API設計 使用RESTful設計,確保API端點明確,並使用適當的HTTP方法(如POST用於創建,PUT用於更新)。 設計清晰的請求和響應模型,以確保客戶端能夠理解預期格式。 2.數據驗證 在伺服器端進行嚴格的數據驗證,確保接收到的數據符合預期格 ...