一個磁碟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
  • 前言 本文介紹一款使用 C# 與 WPF 開發的音頻播放器,其界面簡潔大方,操作體驗流暢。該播放器支持多種音頻格式(如 MP4、WMA、OGG、FLAC 等),並具備標記、實時歌詞顯示等功能。 另外,還支持換膚及多語言(中英文)切換。核心音頻處理採用 FFmpeg 組件,獲得了廣泛認可,目前 Git ...
  • OAuth2.0授權驗證-gitee授權碼模式 本文主要介紹如何筆者自己是如何使用gitee提供的OAuth2.0協議完成授權驗證並登錄到自己的系統,完整模式如圖 1、創建應用 打開gitee個人中心->第三方應用->創建應用 創建應用後在我的應用界面,查看已創建應用的Client ID和Clien ...
  • 解決了這個問題:《winForm下,fastReport.net 從.net framework 升級到.net5遇到的錯誤“Operation is not supported on this platform.”》 本文內容轉載自:https://www.fcnsoft.com/Home/Sho ...
  • 國內文章 WPF 從裸 Win 32 的 WM_Pointer 消息獲取觸摸點繪製筆跡 https://www.cnblogs.com/lindexi/p/18390983 本文將告訴大家如何在 WPF 裡面,接收裸 Win 32 的 WM_Pointer 消息,從消息裡面獲取觸摸點信息,使用觸摸點 ...
  • 前言 給大家推薦一個專為新零售快消行業打造了一套高效的進銷存管理系統。 系統不僅具備強大的庫存管理功能,還集成了高性能的輕量級 POS 解決方案,確保頁面載入速度極快,提供良好的用戶體驗。 項目介紹 Dorisoy.POS 是一款基於 .NET 7 和 Angular 4 開發的新零售快消進銷存管理 ...
  • ABP CLI常用的代碼分享 一、確保環境配置正確 安裝.NET CLI: ABP CLI是基於.NET Core或.NET 5/6/7等更高版本構建的,因此首先需要在你的開發環境中安裝.NET CLI。這可以通過訪問Microsoft官網下載並安裝相應版本的.NET SDK來實現。 安裝ABP ...
  • 問題 問題是這樣的:第三方的webapi,需要先調用登陸介面獲取Cookie,訪問其它介面時攜帶Cookie信息。 但使用HttpClient類調用登陸介面,返回的Headers中沒有找到Cookie信息。 分析 首先,使用Postman測試該登陸介面,正常返回Cookie信息,說明是HttpCli ...
  • 國內文章 關於.NET在中國為什麼工資低的分析 https://www.cnblogs.com/thinkingmore/p/18406244 .NET在中國開發者的薪資偏低,主要因市場需求、技術棧選擇和企業文化等因素所致。歷史上,.NET曾因微軟的閉源策略發展受限,儘管後來推出了跨平臺的.NET ...
  • 在WPF開發應用中,動畫不僅可以引起用戶的註意與興趣,而且還使軟體更加便於使用。前面幾篇文章講解了畫筆(Brush),形狀(Shape),幾何圖形(Geometry),變換(Transform)等相關內容,今天繼續講解動畫相關內容和知識點,僅供學習分享使用,如有不足之處,還請指正。 ...
  • 什麼是委托? 委托可以說是把一個方法代入另一個方法執行,相當於指向函數的指針;事件就相當於保存委托的數組; 1.實例化委托的方式: 方式1:通過new創建實例: public delegate void ShowDelegate(); 或者 public delegate string ShowDe ...