TWI740885B - Service node switching method and device of distributed storage system - Google Patents

Service node switching method and device of distributed storage system Download PDF

Info

Publication number
TWI740885B
TWI740885B TW106102471A TW106102471A TWI740885B TW I740885 B TWI740885 B TW I740885B TW 106102471 A TW106102471 A TW 106102471A TW 106102471 A TW106102471 A TW 106102471A TW I740885 B TWI740885 B TW I740885B
Authority
TW
Taiwan
Prior art keywords
service node
response
service
abnormal
node
Prior art date
Application number
TW106102471A
Other languages
Chinese (zh)
Other versions
TW201828087A (en
Inventor
姚文輝
劉俊峰
黃碩
張海勇
朱家稷
Original Assignee
香港商阿里巴巴集團服務有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 香港商阿里巴巴集團服務有限公司 filed Critical 香港商阿里巴巴集團服務有限公司
Priority to TW106102471A priority Critical patent/TWI740885B/en
Publication of TW201828087A publication Critical patent/TW201828087A/en
Application granted granted Critical
Publication of TWI740885B publication Critical patent/TWI740885B/en

Links

Images

Abstract

本發明實施例提供了一種分布式儲存系統的服務節點切換方法,服務節點包括當前服務節點和備用服務節點,所述方法包括:監控所述服務節點對服務請求的響應狀態;若所述當前服務節點的響應狀態異常,則停止所述當前服務節點與備用服務節點之間的通訊,並觸發當前服務節點的切換處理。通過服務節點檢查邏輯,針對影響服務節點響應狀態的多方面因素進行邏輯判斷和資料統計,在遇到硬體故障或軟體缺陷帶來的服務超時、服務不可用、服務異常等的情況時,實現服務節點的自主切換和恢復,增強了服務可用性。 The embodiment of the present invention provides a service node switching method of a distributed storage system. The service node includes a current service node and a standby service node. The method includes: monitoring the response status of the service node to a service request; If the response state of the node is abnormal, the communication between the current service node and the standby service node is stopped, and the switching process of the current service node is triggered. Through the service node inspection logic, logical judgment and data statistics are made for various factors that affect the response status of the service node. In the event of service timeout, service unavailability, service abnormality, etc. caused by hardware failure or software defect, Realize autonomous switching and recovery of service nodes, enhancing service availability.

Description

分布式儲存系統的服務節點切換方法及裝置 Service node switching method and device of distributed storage system

本發明涉及互聯網技術領域,特別是涉及一種分布式儲存系統的服務節點切換方法和一種分布式儲存系統的服務節點切換裝置。 The present invention relates to the field of Internet technology, in particular to a service node switching method of a distributed storage system and a service node switching device of a distributed storage system.

在當前大規模分布式儲存系統中,為了實現集中權限認證和配額控制,主要採用集中式元資料管理的方法,即將整個系統中所有資料的元資料集中在若干個元資料服務節點進行儲存。 In the current large-scale distributed storage system, in order to achieve centralized authority authentication and quota control, a centralized metadata management method is mainly adopted, that is, the metadata of all data in the entire system is concentrated in several metadata service nodes for storage.

這樣的架構中元資料服務節點的可用性直接關係到整個系統的可用性,因此在分布式儲存系統中通常通過冗餘的方式提升元資料服務節點的可用性。目前提升元資料服務節點可用性的主要有兩種方法,例如由元資料服務(Name Node)通過HA的方式(High Avai1ablity,高可用性),利用備用服務節點(Slave節點)切換掉異常狀態的當前服務節點(Primary節點);或者在例如阿裡雲飛天分布式系統和盤古文件儲存系統使用Paxos協議實現服務節點的切換。 The availability of metadata service nodes in such an architecture is directly related to the availability of the entire system. Therefore, in a distributed storage system, the availability of metadata service nodes is usually improved through redundancy. At present, there are two main methods to improve the availability of metadata service nodes. For example, the metadata service (Name Node) uses HA (High Avai1ablity, high availability), and the standby service node (Slave node) is used to switch the current service in abnormal state. Node (Primary node); or, for example, the Alibaba Cloud Feitian distributed system and the Pangu file storage system use the Paxos protocol to switch the service node.

上述兩種服務節點切換方法中,僅僅在由於伺服器宕機、服務進程重啟、網路斷開等情況而導致的當前服務節點無法正常向備用服務節點發送心跳確認的情況下,才會觸發服務節點的切換處理,在其他的例如雙工網路單路斷開、部分網路協議異常、磁盤響應慢等的異常情況下,由於鎖維護機制和心跳機制,備用服務節點還是會認為當前服務節點處於正常的工作狀態,而不會觸發服務節點的切換處理。 In the above two service node switching methods, the service will only be triggered when the current service node cannot normally send a heartbeat confirmation to the standby service node due to server downtime, service process restart, network disconnection, etc. Node switching processing, in other abnormal situations such as duplex network single-way disconnection, some network protocol abnormalities, slow disk response, etc., due to the lock maintenance mechanism and heartbeat mechanism, the standby service node will still consider the current service node It is in a normal working state without triggering the switching process of the service node.

然而,實際上處於異常狀態的當前服務節點會導致響應用戶的服務請求超時,無法提供完整的元資料,無法將日誌儲存在共享儲存設備上等的問題,實際上已經影響到當前服務節點向用戶提供的服務質量,但目前的服務節點切換方法無法相應地恢復正常和穩定的元資料服務。因此,目前的服務節點切換方法存在元資料服務恢復效率較低,影響了用戶體驗的問題。 However, in fact, the current service node in an abnormal state will cause the response to the user’s service request to time out, fail to provide complete metadata, and fail to store the log on the shared storage device. This has actually affected the current service node’s The quality of service provided by users, but the current service node switching method cannot restore normal and stable metadata services accordingly. Therefore, the current service node switching method has a problem that the metadata service recovery efficiency is low, which affects the user experience.

鑒於上述問題,提出了本發明實施例以便提供一種克服上述問題或者至少部分地解決上述問題的一種分布式儲存系統的服務節點切換方法和相應的一種分布式儲存系統的服務節點切換裝置。 In view of the above problems, embodiments of the present invention are proposed to provide a method for switching service nodes of a distributed storage system and a corresponding service node switching device of a distributed storage system that overcome the above problems or at least partially solve the above problems.

為了解決上述問題,本發明公開了一種分布式儲存系統的服務節點切換方法,所述服務節點包括當前服務節點和備用服務節點,所述方法包括: 監控所述服務節點對服務請求的響應狀態;若所述當前服務節點的響應狀態異常,則停止所述當前服務節點與備用服務節點之間的通訊,並觸發當前服務節點的切換處理。 In order to solve the above problems, the present invention discloses a service node switching method of a distributed storage system. The service node includes a current service node and a standby service node. The method includes: monitoring the response status of the service node to a service request; If the response status of the current service node is abnormal, the communication between the current service node and the standby service node is stopped, and the switching process of the current service node is triggered.

可選地,所述方法還包括:若某個服務節點的響應狀態異常,則對所述服務節點添加用於標記不參與當前服務節點的切換處理的異常節點標識。 Optionally, the method further includes: if the response status of a certain service node is abnormal, adding an abnormal node identifier for marking that it does not participate in the handover processing of the current service node to the service node.

可選地,所述觸發當前服務節點的切換處理的步驟包括:觸發選取至少一個沒有攜帶所述異常節點標識的服務節點作為新的當前服務節點,替換響應狀態異常的當前服務節點。 Optionally, the step of triggering the handover process of the current service node includes: triggering to select at least one service node that does not carry the abnormal node identifier as the new current service node, and replace the current service node that responds to an abnormal state.

可選地,所述監控所述服務節點對服務請求的響應狀態的步驟包括:通過多線程監控所述服務節點對服務請求的響應狀態。 Optionally, the step of monitoring the response status of the service node to the service request includes: monitoring the response status of the service node to the service request through multiple threads.

可選地,所述通過多線程監控所述服務節點對服務請求的響應狀態的步驟包括:通過第一檢查線程獲取所述服務節點從服務請求隊列中最近取出服務請求的時間點T1,並將與當前時間點N1的時間間隔D1作為響應時間;判斷所述響應時間是否大於第一預設響應時間閾值,若是,則確定所述服務節點的響應狀態異常。 Optionally, the step of monitoring the response status of the service node to the service request through multiple threads includes: obtaining, through a first check thread, the time point T1 at which the service node recently took out the service request from the service request queue, and The time interval D1 from the current time point N1 is taken as the response time; it is determined whether the response time is greater than the first preset response time threshold, and if so, it is determined that the response state of the service node is abnormal.

可選地,所述通過多線程監控所述服務節點對服務請求的響應狀態的步驟包括:通過第二檢查線程判斷所述服務節點的儲存單元是否攜帶儲存響應超時標識;若是,則將所述儲存響應超時標識對應的標識添加時間點T2與當前時間點N2的時間間隔D2作為所述響應時間,若所述響應時間大於第二預設響應時間閾值,則確定所述服務節點的響應狀態異常。 Optionally, the step of monitoring the response status of the service node to the service request through multiple threads includes: judging through a second check thread whether the storage unit of the service node carries a storage response timeout identifier; The time interval D2 between the addition time point T2 and the current time point N2 of the identifier corresponding to the storage response timeout identifier is used as the response time, and if the response time is greater than the second preset response time threshold, the response of the service node is determined The status is abnormal.

可選地,在所述通過多線程監控所述服務節點對服務請求的響應狀態的步驟之前,所述方法還包括:通過日誌記錄線程獲取所述服務節點的儲存單元寫日誌的起止時間,並將所述起止時間的時間間隔作為儲存單元響應時間;判斷所述儲存單元響應時間是否大於第三預設響應時間閾值,若是,則針對所述儲存單元添加所述儲存響應超時標識,並相應記錄添加標識的時間點T2。 Optionally, before the step of monitoring the response status of the service node to the service request through multithreading, the method further includes: obtaining the start and end time of the log writing of the storage unit of the service node through a log recording thread, and Use the time interval between the start and end times as the response time of the storage unit; determine whether the response time of the storage unit is greater than a third preset response time threshold, and if so, add the storage response timeout flag for the storage unit, and respond accordingly Record the time point T2 when the logo is added.

可選地,所述方法還包括:若所述儲存單元響應時間小於所述第三預設響應時間閾值、且所述儲存單元已經攜帶有所述儲存響應超時標識,則刪除所述儲存響應超時標識。 Optionally, the method further includes: if the storage unit response time is less than the third preset response time threshold, and the storage unit already carries the storage response timeout flag, deleting the storage response Timeout indicator.

可選地,在所述監控所述服務節點對服務請求的響應狀態的步驟之前,所述方法還包括:將對至少一個所述服務節點的監控結果註冊到監控結果註冊列表; 所述監控所述服務節點對服務請求的響應狀態的步驟為:在所述監控結果註冊列表的起始位置輪詢註冊的監控結果。 Optionally, before the step of monitoring the response status of the service node to the service request, the method further includes: registering a monitoring result of at least one of the service nodes in a monitoring result registration list; The step of the service node's response status to the service request is: polling the registered monitoring result at the start position of the monitoring result registration list.

可選地,所述方法還包括:將所述多線程的個數除以所述預設響應時間閾值的結果作為監控所述服務節點響應狀態的頻率。 Optionally, the method further includes: dividing the number of the multi-threads by the preset response time threshold as the frequency of monitoring the response state of the service node.

為了解決上述問題,本發明還公開了一種分布式儲存系統的服務節點切換裝置,所述服務節點包括當前服務節點和備用服務節點,所述裝置包括:服務節點響應狀態監控模組,用於監控所述服務節點對服務請求的響應狀態;當前服務節點切換觸發模組,用於若所述當前服務節點的響應狀態異常,則停止所述當前服務節點與備用服務節點之間的通訊,並觸發當前服務節點的切換處理。 In order to solve the above problems, the present invention also discloses a service node switching device of a distributed storage system. The service node includes a current service node and a standby service node. The device includes: a service node response status monitoring module for monitoring The response status of the service node to the service request; the current service node switching trigger module is used to stop the communication between the current service node and the standby service node if the response status of the current service node is abnormal, and trigger Handover processing of the current service node.

可選地,所述裝置還包括:異常節點標識添加模組,用於若某個服務節點的響應狀態異常,則對所述服務節點添加用於標記不參與當前服務節點的切換處理的異常節點標識。 Optionally, the device further includes: an abnormal node identification adding module, which is used to add an abnormal node for marking the service node not to participate in the handover process of the current service node if the response status of a certain service node is abnormal Logo.

可選地,所述當前服務節點切換觸發模組包括:觸發選取子模組,用於觸發選取至少一個沒有攜帶所述異常節點標識的服務節點作為新的當前服務節點,替換響應狀態異常的當前服務節點。 Optionally, the current service node switching trigger module includes: a trigger selection sub-module for triggering the selection of at least one service node that does not carry the abnormal node identifier as the new current service node, replacing the current service node with an abnormal response state Service node.

可選地,所述服務節點響應狀態監控模組包括: 多線程監控子模組,用於通過多線程監控所述服務節點對服務請求的響應狀態。 Optionally, the service node response status monitoring module includes: a multi-thread monitoring sub-module configured to monitor the response status of the service node to the service request through multiple threads.

可選地,所述多線程監控子模組包括:第一檢查線程子單元,用於通過第一檢查線程獲取所述服務節點從服務請求隊列中最近取出服務請求的時間點T1,並將與當前時間點N1的時間間隔D1作為響應時間;第一預設響應時間閾值判斷子單元,用於判斷所述響應時間是否大於第一預設響應時間閾值,若是,則確定所述服務節點的響應狀態異常。 Optionally, the multi-thread monitoring submodule includes: a first check thread subunit, configured to obtain, through the first check thread, the time point T1 at which the service node recently took out the service request from the service request queue, and compare it with The time interval D1 of the current time point N1 is used as the response time; the first preset response time threshold judging subunit is used to judge whether the response time is greater than the first preset response time threshold, and if so, determine the response of the service node The status is abnormal.

可選地,所述多線程監控子模組包括:第二檢查線程子單元,用於通過第二檢查線程判斷所述服務節點的儲存單元是否攜帶儲存響應超時標識;若是,則調用第二預設響應時間閾值判斷子單元;第二預設響應時間閾值判斷子單元,用於將所述儲存響應超時標識對應的標識添加時間點T2與當前時間點N2的時間間隔D2作為所述響應時間,若所述響應時間大於第二預設響應時間閾值,則確定所述服務節點的響應狀態異常。 Optionally, the multi-thread monitoring sub-module includes: a second check thread subunit, which is used to determine whether the storage unit of the service node carries a storage response timeout flag through the second check thread; if so, call the second check thread A preset response time threshold judging subunit; a second preset response time threshold judging subunit for adding the identifier corresponding to the stored response timeout identifier to the time interval D2 between the time point T2 and the current time point N2 as the response Time, if the response time is greater than the second preset response time threshold, it is determined that the response state of the service node is abnormal.

可選地,所述裝置還包括:儲存單元響應時間確定模組,用於通過日誌記錄線程獲取所述服務節點的儲存單元寫日誌的起止時間,並將所述起止時間的時間間隔作為儲存單元響應時間;儲存響應超時標識添加模組,用於判斷所述儲存單元 響應時間是否大於第三預設響應時間閾值,若是,則針對所述儲存單元添加所述儲存響應超時標識,並相應記錄添加標識的時間點T2。 Optionally, the device further includes: a storage unit response time determination module, configured to obtain the start and end time of the log writing of the storage unit of the service node through the log recording thread, and use the time interval of the start and end time as the storage unit Response time; storage response timeout flag adding module, used to determine whether the storage unit response time is greater than the third preset response time threshold, if so, add the storage response timeout flag for the storage unit, and corresponding Record the time point T2 when the logo is added.

可選地,所述裝置還包括:儲存響應超時標識刪除模組,用於若所述儲存單元響應時間小於所述第三預設響應時間閾值、且所述儲存單元已經攜帶有所述儲存響應超時標識,則刪除所述儲存響應超時標識。 Optionally, the device further includes: a storage response timeout flag deletion module, configured to: if the storage unit response time is less than the third preset response time threshold, and the storage unit already carries the storage In response to the timeout flag, the storage response timeout flag is deleted.

可選地,所述裝置還包括:監控結果註冊模組,用於將對至少一個所述服務節點的監控結果註冊到監控結果註冊列表;所述服務節點響應狀態監控模組包括:監控結果輪詢子模組,用於在所述監控結果註冊列表的起始位置輪詢註冊的監控結果。 Optionally, the device further includes: a monitoring result registration module, configured to register a monitoring result of at least one of the service nodes in a monitoring result registration list; the service node response status monitoring module includes: a monitoring result wheel The inquiry sub-module is used for polling the registered monitoring result at the start position of the monitoring result registration list.

可選地,所述裝置還包括:監控頻率確定模組,用於將所述多線程的個數除以所述預設響應時間閾值的結果作為監控所述服務節點響應狀態的頻率。 Optionally, the device further includes: a monitoring frequency determination module, configured to divide the number of the multithreads by the preset response time threshold as the frequency of monitoring the response state of the service node.

本發明實施例包括以下優點:本發明實施例通過監控服務節點對服務請求的響應狀態,並針對響應狀態異常的當前服務節點執行停止其與備用服務節點之間的通訊,由此觸發當前服務節點的切換處理。通過服務節點檢查邏輯,針對影響服務節點響應狀態的多方面因素進行邏輯判斷和資料統計,在遇到硬體故障 或軟體缺陷帶來的服務超時、服務不可用、服務異常等的情況時,實現服務節點的自主切換和恢復,增強了服務可用性,提升了服務恢復效率,改善了用戶體驗。 The embodiment of the present invention includes the following advantages: The embodiment of the present invention monitors the response status of the service node to the service request, and stops the communication between the current service node and the standby service node for the current service node whose response status is abnormal, thereby triggering the current service node Handover processing. Through the service node inspection logic, logical judgment and data statistics are made for various factors that affect the response status of the service node. In the event of service timeout, service unavailability, service abnormality, etc. caused by hardware failure or software defect, The autonomous switching and recovery of service nodes are realized, service availability is enhanced, service recovery efficiency is improved, and user experience is improved.

其次,本發明實施例可以針對影響服務節點響應狀態的一個或多個方面的因素進行監控,多維度的監控手段提升了服務恢復的全面性和可擴展性。 Secondly, the embodiment of the present invention can monitor one or more factors that affect the response status of the service node, and the multi-dimensional monitoring method improves the comprehensiveness and scalability of service recovery.

進一步,本發明實施例對於異常的當前服務節點不將其直接初始化,而是採用相對保守的停止與備用服務節點通訊的方式來觸發服務節點切換,當出現誤診事故時,被誤診為響應狀態異常的當前服務節點也有機會重新作為新的當前服務節點,繼續提供服務,避免了誤診對整個系統帶來負面的影響。 Further, the embodiment of the present invention does not directly initialize the abnormal current service node, but uses a relatively conservative manner of stopping communication with the standby service node to trigger the service node switch. When a misdiagnosis accident occurs, it is misdiagnosed as an abnormal response state. The current service node also has the opportunity to re-function as the new current service node and continue to provide services, avoiding the negative impact of misdiagnosis on the entire system.

進一步,本發明實施例對響應狀態異常的服務節點添加異常節點標識,避免了將響應狀態異常的服務節點被選作當前服務節點、從而無法實現服務節點切換目的的問題。而且,將異常的服務節點排除,服務節點的切換處理可以保證新的當前服務節點的穩定性,避免了多次服務節點切換引起的系統波動,提升了服務恢復的穩定性。 Further, the embodiment of the present invention adds an abnormal node identifier to the service node with an abnormal response state, which avoids the problem that the service node with an abnormal response state is selected as the current service node, thereby failing to achieve the purpose of service node switching. Moreover, the abnormal service node is excluded, and the switching processing of the service node can ensure the stability of the new current service node, avoid system fluctuations caused by multiple service node switching, and improve the stability of service recovery.

501‧‧‧服務節點響應狀態監控模組 501‧‧‧Service node response status monitoring module

502‧‧‧當前服務節點切換觸發模組 502‧‧‧Current service node switching trigger module

601‧‧‧監控結果註冊模組 601‧‧‧Monitoring result registration module

602‧‧‧服務節點響應狀態監控模組 602‧‧‧Service node response status monitoring module

603‧‧‧當前服務節點切換觸發模組 603‧‧‧Current service node switching trigger module

604‧‧‧異常節點標識添加模組 604‧‧‧Abnormal node identification add module

605‧‧‧監控頻率確定模組 605‧‧‧Monitoring frequency determination module

圖1是本發明的一種分布式儲存系統的服務節點切換方法實施例一的步驟流程圖;圖2是本發明的一種分布式儲存系統的服務節點切換方法實施例二的步驟流程圖; 圖3是本發明的一種分布式儲存系統的服務節點切換方法實施例三的步驟流程圖;圖4是本發明的一種分布式儲存系統的服務節點切換方法實施例四的步驟流程圖;圖5是本發明的一種分布式儲存系統的服務節點切換裝置實施例一的結構框圖;圖6是本發明的一種分布式儲存系統的服務節點切換裝置實施例二的結構框圖。 Fig. 1 is a step flow chart of Embodiment 1 of a service node switching method of a distributed storage system of the present invention; Fig. 2 is a step flow chart of Embodiment 2 of a service node switching method of a distributed storage system of the present invention; Fig. 3 Is a step flow chart of the third embodiment of the service node switching method of a distributed storage system of the present invention; FIG. 4 is a step flow chart of the fourth embodiment of the service node switching method of a distributed storage system of the present invention; FIG. 5 is the present invention A structural block diagram of the first embodiment of a service node switching device of a distributed storage system of the invention; FIG. 6 is a structural block diagram of a second embodiment of the service node switching device of a distributed storage system of the present invention.

為使本發明的上述目的、特徵和優點能夠更加明顯易懂,下面結合附圖和具體實施方式對本發明作進一步詳細的說明。 In order to make the above-mentioned objects, features and advantages of the present invention more obvious and understandable, the present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments.

目前較常用的提升元資料服務節點可用性的方式中,可以在例如Hadoop分布式文件系統中,元資料服務利用備用服務節點切換掉異常狀態的當前服務節點。具體為:通過分布式鎖服務,由獲取到分布式鎖的服務節點作為當前服務節點,由當前服務節點對外提供,並將產生的日誌儲存在共享儲存設備上,其他的備用服務節點不對外提供元資料服務,僅從共享儲存設備上讀取日誌應用到隨機存取記憶體,保持隨機存取記憶體與當前服務節點同步一致。備用服務節點不定時檢測鎖的狀態,當鎖被釋放時,即表明當前服務節點處於伺服器宕機、服務進程重啟、網路斷開等異常狀態,備用服務節點則獲取分布式鎖升級為 新的當前服務節點並對外提供元資料服務。 Among the more commonly used methods to improve the availability of metadata service nodes, for example, in the Hadoop distributed file system, the metadata service utilizes a backup service node to switch the current service node in an abnormal state. Specifically: through the distributed lock service, the service node that has obtained the distributed lock is used as the current service node, and the current service node provides it to the outside world, and stores the generated log on the shared storage device, and other standby service nodes do not provide it to the outside world The metadata service only reads logs from the shared storage device and applies them to the random access memory, keeping the random access memory in sync with the current service node. The standby service node checks the lock status from time to time. When the lock is released, it indicates that the current service node is in abnormal conditions such as server downtime, service process restart, network disconnection, etc. The standby service node acquires the distributed lock and upgrades it to a new one. The current service node and provide metadata services to the outside world.

另外一種較常用的提升可用性方式中,多個備用服務節點通過Paxos協議進行當前服務節點選舉,從中產生一個對外提供元資料服務的當前服務節點,用戶向當前服務節點請求元資料服務,當前服務節點響應後產生日誌儲存到本地,併發送給所有備用服務節點。備用服務節點收到日誌後儲存到本地並應用到隨機存取記憶體,保持與當前服務節點同步一致。同時,在當前服務節點正常工作時,其可以向備用服務節點發送心跳確認資訊,備用服務節點通過心跳機制確認當前服務節點的存活。若當前服務節點出現如伺服器宕機、服務進程重啟、網路斷開等異常情況時,當前服務節點無法向備用服務節點發送心跳確認資訊,備用服務節點由此發起當前服務節點切換處理,從備用服務節點中選舉出新的當前服務節點對外提供元資料服務。 In another commonly used way to improve availability, multiple backup service nodes use Paxos protocol to elect the current service node, from which a current service node that provides metadata services to the outside world is generated, and the user requests metadata services from the current service node. The current service node The log generated after the response is stored locally and sent to all standby service nodes. After receiving the log, the standby service node stores it locally and applies it to the random access memory, keeping it in sync with the current service node. At the same time, when the current service node is working normally, it can send heartbeat confirmation information to the backup service node, and the backup service node confirms the survival of the current service node through the heartbeat mechanism. If the current service node encounters abnormal conditions such as server downtime, service process restart, network disconnection, etc., the current service node cannot send heartbeat confirmation information to the standby service node, and the standby service node initiates the current service node switching process. A new current service node is elected from the standby service nodes to provide metadata services to the outside world.

從上述可見,目前的提高元資料服務節點可用性的方法中,觸發服務節點的切換依賴於導致當前服務節點完全無法工作的嚴重故障,其他一些引起當前服務節點響應慢等異常狀態的故障則不會觸發服務節點的切換,然而處於異常狀態的當前服務節點已經影響到了向用戶提供服務的質量。 It can be seen from the above that in the current methods of improving the availability of metadata service nodes, triggering the switching of service nodes depends on serious failures that cause the current service node to completely fail to work. Other failures that cause abnormal conditions such as slow response of the current service node will not Trigger the switching of the service node, but the current service node in an abnormal state has affected the quality of the service provided to the user.

因此,目前的服務節點切換方法存在元資料服務恢復效率較低,影響了用戶體驗的問題。而且,根據目前的服務節點切換方法,即使觸發了服務節點切換處理,也有可 能再次切換到已經處於異常狀態的服務節點上,無法實現服務節點切換的目的,影響了元資料服務恢復的效率。為了解決上述問題,以下提出了若干個服務節點切換方法的實施例。 Therefore, the current service node switching method has a problem that the metadata service recovery efficiency is low, which affects the user experience. Moreover, according to the current service node switching method, even if the service node switching process is triggered, it may be switched to a service node that is already in an abnormal state again. The purpose of service node switching cannot be achieved, which affects the efficiency of metadata service recovery. In order to solve the above-mentioned problems, several embodiments of service node switching methods are proposed below.

參照圖1,示出了本發明的一種分布式儲存系統的服務節點切換方法實施例一的步驟流程圖,所述服務節點包括當前服務節點和備用服務節點,所述方法具體可以包括如下步驟: 1, there is shown a step flow chart of Embodiment 1 of a service node switching method for a distributed storage system of the present invention. The service node includes a current service node and a standby service node. The method may specifically include the following steps:

步驟101,監控服務節點對服務請求的響應狀態。 Step 101: Monitor the response status of the service node to the service request.

需要說明的是,服務節點可以為提供元資料服務的服務節點。元資料(Metadata)又稱中介資料、中繼資料,為描述資料的資料(data about data),主要是描述資料屬性(property)的資訊,用來支持如指示儲存位置、歷史資料、資源查找、文件記錄等功能。 It should be noted that the service node may be a service node that provides metadata services. Metadata, also known as intermediary data, metadata, is data about data, mainly information describing properties of data, and is used to support information such as indicating storage location, historical data, resource search, File recording and other functions.

在具體的實現中,可以針對不同方面的檢查點,在系統中相應地設置若干個檢查線程以監控服務節點的響應狀態是否異常。例如,設置一個關注於服務請求隊列響應時間異常的第一檢查線程和/或設置一個關注於儲存單元響應時間異常的第二檢查線程。 In a specific implementation, for different check points, a number of check threads can be set up in the system to monitor whether the response status of the service node is abnormal. For example, setting a first inspection thread focusing on abnormal response time of the service request queue and/or setting a second inspection thread focusing on abnormal response time of the storage unit.

需要說明的是,響應時間是否異常可以通過與預設的響應時間閾值進行比較而確定,例如,可以預設響應時間閾值為10秒,如果服務節點對服務請求隊列中的某各服務請求的響應時間超過10秒,或者服務節點的儲存單元進行日誌讀寫的響應時間超過10秒,可以理解為該服務 節點的響應狀態異常,其對服務請求的響應需要用戶長時間等待,甚至無法正常服務,已影響到了用戶體驗。 It should be noted that whether the response time is abnormal can be determined by comparing with the preset response time threshold. For example, the response time threshold can be preset to 10 seconds. If the service node responds to a certain service request in the service request queue If the time exceeds 10 seconds, or the response time of the storage unit of the service node for log reading and writing exceeds 10 seconds, it can be understood that the response status of the service node is abnormal, and its response to the service request requires the user to wait for a long time, or even fails to serve normally. Has affected the user experience.

作為本發明實施例的較佳示例,可以通過多線程監控所述服務節點對服務請求的響應狀態。因為在實際應用中,服務節點的響應狀態可能會被多方面的因素所影響,本領域技術人員可以根據實際情況組合設置多個檢查線程以監控服務節點對服務請求的響應狀態,例如,還可以設置關注於儲存單元是否接近滿載的檢查線程。 As a preferred example of the embodiment of the present invention, the response status of the service node to the service request can be monitored through multithreading. Because in actual applications, the response status of the service node may be affected by many factors, those skilled in the art can combine to set up multiple inspection threads according to the actual situation to monitor the response status of the service node to the service request. For example, Set up a check thread that focuses on whether the storage unit is close to full.

較佳地,用於監控服務節點的檢查線程可以不具備執行邏輯的能力,而僅僅用作檢查響應狀態的邏輯判斷和資料統計。檢查線程儘量保持輕量,避免進行運算量較大和耗時較長的處理工作,例如可以不進行RPC(Remote Procedure Call Protocol,遠程過程調用協議)操作或者長時間的等鎖操作,該操作有可能導致後續的服務節點切換處理被嚴重延遲、甚至無法有效執行,最終可能導致整個檢查機制失去應有的效果。 Preferably, the check thread used to monitor the service node may not have the ability to execute logic, but is only used for logical judgment and data statistics for checking the response state. Keep the check thread as lightweight as possible to avoid processing tasks that require a large amount of calculation and time-consuming. For example, it is possible not to perform RPC (Remote Procedure Call Protocol, remote procedure call protocol) operations or wait for a long time for lock operations. As a result, the subsequent service node switching processing is severely delayed or even cannot be executed effectively, which may eventually cause the entire inspection mechanism to lose its due effect.

步驟102,若所述當前服務節點的響應狀態異常,則停止所述當前服務節點與備用服務節點之間的通訊,並觸發當前服務節點的切換處理。 Step 102: If the response state of the current service node is abnormal, stop the communication between the current service node and the backup service node, and trigger the switching process of the current service node.

在具體的實現中,通過對服務節點的響應狀態的監控,可以確定當前服務節點和備用服務節點的響應狀態是否異常。針對於不同的服務節點的不同監控結果,可以執行相應的操作。針對於響應狀態異常的當前服務節點,可以停止其與多個備用服務節點之間的通訊。 In a specific implementation, by monitoring the response status of the service node, it can be determined whether the response status of the current service node and the standby service node is abnormal. For different monitoring results of different service nodes, corresponding operations can be performed. For the current service node that responds to an abnormal state, the communication between it and multiple standby service nodes can be stopped.

停止相互通訊的方式可以有多種,例如通過停止當前服務節點與備用服務節點之間的心跳確認的方式,當備用服務節點超過一定時間沒有接收到當前服務節點發送的心跳確認資訊,則可以認為當前服務節點處於異常狀態並失效,需要發起當前服務節點的切換處理。 There can be many ways to stop communicating with each other. For example, by stopping the heartbeat confirmation between the current service node and the standby service node, when the standby service node has not received the heartbeat confirmation information sent by the current service node for a certain period of time, it can be considered as the current The service node is in an abnormal state and is invalid, and the handover process of the current service node needs to be initiated.

備用服務節點無法與當前服務節點正常通訊,可以認為當前服務節點處於異常狀態,由此觸發新的當前服務節點選舉操作,並將新選舉出的當前服務節點替換異常的當前服務節點,以完成當前服務節點的切換處理。當前服務節點的選舉操作可以通過Paxos協議實現。 The standby service node cannot communicate with the current service node normally. It can be considered that the current service node is in an abnormal state, which triggers a new current service node election operation, and replaces the newly elected current service node with the abnormal current service node to complete the current service node. Handover processing of the service node. The election operation of the current service node can be implemented through the Paxos protocol.

實際應用中,還可以採用其他方式觸發當前服務節點的切換處理,例如利用分布式鎖服務,若備用服務節點認為該當前服務節點處於異常狀態並失效,則觸發該當前服務節點釋放鎖,多個備用服務節點進行搶鎖操作,由獲取到鎖的備用服務節點替換異常的當前服務節點,以完成當前服務節點的切換處理。 In practical applications, other methods can also be used to trigger the switching process of the current service node, such as using distributed lock service. If the standby service node thinks that the current service node is in an abnormal state and is invalid, it triggers the current service node to release the lock. The standby service node performs a lock grab operation, and the abnormal current service node is replaced by the standby service node that has acquired the lock to complete the switching process of the current service node.

針對於響應狀態異常的當前服務節點和備用服務節點,還可以添加一個異常節點標識,攜帶有該標識的服務節點,則在服務節點的切換處理中不會被切換為新的當前服務節點,以免將異常的服務節點作為新的當前服務節點,達不到服務恢復的效果。 For the current service node and standby service node that respond to abnormal status, an abnormal node identifier can also be added, and the service node carrying the identifier will not be switched to the new current service node during the switching process of the service node, so as not to Taking the abnormal service node as the new current service node cannot achieve the effect of service restoration.

作為本發明實施例的較佳示例,可以將對至少一個所述服務節點的監控結果註冊到監控結果註冊列表;在所述監控結果註冊列表的起始位置輪詢註冊的監控結果。 As a preferred example of the embodiment of the present invention, the monitoring result of at least one of the service nodes may be registered to the monitoring result registration list; the registered monitoring result can be polled at the beginning of the monitoring result registration list.

實際應用中,可以設置檢查點執行模組,以針對不同的監控結果執行相應的操作。各檢查線程可以在系統啟動過程中產生監控結果,並將監控結果註冊到檢查點執行模組的監控結果註冊列表中。該檢查點執行模組可以是系統後臺線程,其可以在註冊列表的起始位置開始按序逐一輪詢監控結果,並根據監控結果執行相應的處理。例如,在某個監控結果中,第一檢查線程根據服務請求處理響應時間判斷出當前服務節點的響應狀態異常,檢查點執行模組由此可以停止其向備用服務節點發送心跳確認資訊,並添加一個異常節點標識;又例如,在另外一個監控結果中,第二檢查線程根據儲存單元讀寫日誌超時判斷出備用服務節點的響應狀態異常,檢查點執行模組由此針對該備用服務節點添加異常節點標識。 In practical applications, checkpoint execution modules can be set to perform corresponding operations for different monitoring results. Each inspection thread can generate monitoring results during system startup, and register the monitoring results in the monitoring result registration list of the checkpoint execution module. The checkpoint execution module can be a system background thread, which can start to poll the monitoring results one by one at the beginning of the registration list, and perform corresponding processing according to the monitoring results. For example, in a certain monitoring result, the first check thread judges that the response status of the current service node is abnormal according to the service request processing response time, and the checkpoint execution module can stop it from sending heartbeat confirmation information to the standby service node and add An abnormal node identification; for another example, in another monitoring result, the second check thread judges that the response status of the standby service node is abnormal according to the timeout of the storage unit's read and write log, and the checkpoint execution module is added for the standby service node The identifier of the abnormal node.

需要說明的是,檢查點執行模組可以不需要關注各個檢查線程的邏輯判斷如何實現,即不需要關注該檢查線程具體如何監控該服務節點是否異常,僅僅關注監控結果所反映出的服務節點響應狀態是否異常即可。具體地,服務節點的響應狀態是否異常,可以由True和False表示,檢查線程可以僅將True或False的值作為監控結果註冊到檢查點執行模組的註冊列表中。 It should be noted that the checkpoint execution module does not need to pay attention to the logic of each check thread to determine how to implement it, that is, it does not need to pay attention to how the check thread specifically monitors whether the service node is abnormal, and only pays attention to the service node response reflected by the monitoring result Whether the status is abnormal. Specifically, whether the response status of the service node is abnormal can be represented by True and False, and the check thread may only register the value of True or False as the monitoring result in the registration list of the checkpoint execution module.

此外,還可以將所述多線程的個數除以所述預設響應時間閾值的結果作為監控所述服務節點響應狀態的頻率。 In addition, the result of dividing the number of the multi-threads by the preset response time threshold may be used as the frequency of monitoring the response state of the service node.

因為在實際應用中,如果監控的頻率過低,則可能會遺漏了反映異常服務節點的監控結果,無法保證在當前服 務節點出現異常時及時進行切換。因此,為了提高檢查精度,監控的執行間隔不能大於任何一個檢查線程用於判斷響應狀態是否異常而設置的預設響應時間閾值。例如,若預設的響應時間閾值為10秒,則監控的執行間隔可以設為1秒。為了便於確定監控頻率,可以根據進行監控的檢查線程個數除以預設響應時間閾值,將結果作為監控頻率。例如檢查線程為10個,而預設響應時間閾值為10秒,則監控頻率為1個每秒,即檢查點執行模組可以每隔1秒就從監控結果註冊列表調取一個監控結果,以執行相應處理。 Because in actual applications, if the monitoring frequency is too low, the monitoring results reflecting abnormal service nodes may be omitted, and it is impossible to guarantee timely switching when the current service node is abnormal. Therefore, in order to improve the inspection accuracy, the monitoring execution interval cannot be greater than the preset response time threshold set by any inspection thread to determine whether the response status is abnormal. For example, if the preset response time threshold is 10 seconds, the monitoring execution interval can be set to 1 second. In order to facilitate the determination of the monitoring frequency, the number of inspection threads to be monitored can be divided by the preset response time threshold, and the result can be used as the monitoring frequency. For example, there are 10 inspection threads, and the preset response time threshold is 10 seconds, the monitoring frequency is 1 per second, that is, the checkpoint execution module can retrieve a monitoring result from the monitoring result registration list every 1 second to Perform the corresponding processing.

本領域技術人員可以根據實際情況將本發明實施例所提供的方法應用於各種分布式文件系統和計算、儲存平臺,例如,HDFS系統(Hadoop Distributed File System),ODPS計算平臺(Open Data Processing Service,開放資料處理服務),OSS儲存平臺(Object Storage Service,開放對象儲存服務),OTS儲存平臺(Open Table Service,開放表服務結構化資料服務),ECS計算平臺(Elastic Compute Service,彈性計算服務)等等。 Those skilled in the art can apply the methods provided in the embodiments of the present invention to various distributed file systems and computing and storage platforms, such as HDFS (Hadoop Distributed File System) and ODPS computing platforms (Open Data Processing Service, Open data processing service), OSS storage platform (Object Storage Service, open object storage service), OTS storage platform (Open Table Service, open table service structured data service), ECS computing platform (Elastic Compute Service, elastic computing service), etc. Wait.

相比起目前的服務節點切換方法,本發明實施例通過監控服務節點對服務請求的響應狀態,並針對響應狀態異常的當前服務節點執行停止其與備用服務節點之間的通訊,由此觸發當前服務節點的切換處理。通過服務節點檢查邏輯,針對影響服務節點響應狀態的多方面因素進行邏輯判斷和資料統計,在遇到硬體故障或軟體缺陷帶來的服 務超時、服務不可用、服務異常等的情況時,實現服務節點的自主切換和恢復,增強了服務可用性,提升了服務恢復效率,改善了用戶體驗。 Compared with the current service node switching method, the embodiment of the present invention monitors the response status of the service node to the service request, and stops the communication between the current service node and the standby service node for the current service node whose response status is abnormal, thereby triggering the current Handover processing of the service node. Through the service node inspection logic, logical judgment and data statistics are made for various factors that affect the response status of the service node. In the event of service timeout, service unavailability, service abnormality, etc. caused by hardware failure or software defect, The autonomous switching and recovery of service nodes are realized, service availability is enhanced, service recovery efficiency is improved, and user experience is improved.

其次,本發明實施例可以針對影響服務節點響應狀態的一個或多個方面的因素進行監控,多維度的監控手段提升了服務恢復的全面性和可擴展性。 Secondly, the embodiment of the present invention can monitor one or more factors that affect the response status of the service node, and the multi-dimensional monitoring method improves the comprehensiveness and scalability of service recovery.

進一步,本發明實施例對於異常的當前服務節點不將其直接初始化,而是採用相對保守的停止與備用服務節點通訊的方式來觸發服務節點切換,當出現誤診事故時,被誤診為響應狀態異常的當前服務節點也有機會重新作為新的當前服務節點,繼續提供服務,避免了誤診對整個系統帶來負面的影響。 Further, the embodiment of the present invention does not directly initialize the abnormal current service node, but uses a relatively conservative manner of stopping communication with the standby service node to trigger the service node switch. When a misdiagnosis accident occurs, it is misdiagnosed as an abnormal response state. The current service node also has the opportunity to re-function as the new current service node and continue to provide services, avoiding the negative impact of misdiagnosis on the entire system.

參照圖2,示出了本發明的一種分布式儲存系統的服務節點切換方法實施例二的步驟流程圖,所述服務節點包括當前服務節點和備用服務節點,所述方法具體可以包括如下步驟: 2, there is shown a flow chart of the second embodiment of a service node switching method for a distributed storage system of the present invention. The service node includes a current service node and a standby service node. The method may specifically include the following steps:

步驟201,通過第一檢查線程獲取所述服務節點從服務請求隊列中最近取出服務請求的時間點T1,並將與當前時間點N1的時間間隔D1作為響應時間。 Step 201: Obtain the time point T1 at which the service node recently took out the service request from the service request queue through the first check thread, and use the time interval D1 from the current time point N1 as the response time.

需要說明的是,上述的第一檢查線程可以是關注於服務請求隊列響應時間是否異常的檢查線程。當用戶向當前服務節點提交服務請求,會先將服務請求放入服務請求隊列中排隊,等待被當前服務節點逐一處理。當前服務節點從隊列中取出服務請求時,可以記錄此時的時間點T1。 It should be noted that the above-mentioned first check thread may be a check thread that focuses on whether the response time of the service request queue is abnormal. When a user submits a service request to the current service node, the service request will be queued in the service request queue first, waiting to be processed by the current service node one by one. When the current service node takes out the service request from the queue, it can record the time point T1 at this time.

第一檢查線程可以定期對服務請求隊列進行檢查,當服務請求隊列存在等待處理的服務請求時,第一檢查線程獲取之前記錄的最近取出服務請求的時間點T1,將當前時間點N1與T1的時間間隔D1作為該當前服務節點的響應時間。 The first check thread can periodically check the service request queue. When there are service requests waiting to be processed in the service request queue, the first check thread obtains the previously recorded time point T1 at which the service request was recently taken out, and compares the current time point N1 with T1. The time interval D1 is used as the response time of the current service node.

步驟202,判斷所述響應時間是否大於第一預設響應時間閾值,若是,則確定所述服務節點的響應狀態異常。 Step 202: Determine whether the response time is greater than a first preset response time threshold, and if so, determine that the response state of the service node is abnormal.

可以將響應時間與第一預設響應時間閾值進行比較,若響應時間大於第一預設響應時間閾值,則表明該當前服務節點在處理用戶的服務請求時被阻塞,造成用戶長時間等待服務的情況。因此,無論該當前服務節點的其他方面是否正常,也可以認為該當前服務節點的響應狀態異常。 The response time can be compared with the first preset response time threshold. If the response time is greater than the first preset response time threshold, it indicates that the current service node is blocked while processing the user's service request, causing the user to wait for a long time for service. Condition. Therefore, regardless of whether other aspects of the current service node are normal, it can also be considered that the response state of the current service node is abnormal.

實際應用中可以將第一預設響應時間閾值設置為10秒,也即是說,如果10秒之內也沒有成功響應用戶提交的服務請求,可以理解為當前服務節點的響應狀態異常,當然,本領域技術人員可以根據實際情況設置第一預設響應時間閾值,本發明實施例對此不作限制。 In practical applications, the first preset response time threshold can be set to 10 seconds, that is, if the service request submitted by the user is not successfully responded within 10 seconds, it can be understood that the response status of the current service node is abnormal. Of course, Those skilled in the art can set the first preset response time threshold according to actual conditions, which is not limited in the embodiment of the present invention.

第一檢查線程可以將響應狀態異常或正常的監控結果註冊到檢查點執行模組的監控結果註冊列表中,由檢查點執行模組根據監控結果採取相應的處理。 The first check thread may register the abnormal response state or the normal monitoring result in the monitoring result registration list of the checkpoint execution module, and the checkpoint execution module will take corresponding processing according to the monitoring result.

步驟203,若所述當前服務節點的響應狀態異常,則停止所述當前服務節點與備用服務節點之間的通訊,並觸發當前服務節點的切換處理。 Step 203: If the response state of the current service node is abnormal, stop the communication between the current service node and the backup service node, and trigger the switching process of the current service node.

步驟204,若某個服務節點的響應狀態異常,則對所 述服務節點添加用於標記不參與當前服務節點的切換處理的異常節點標識。 Step 204: If the response status of a certain service node is abnormal, add an abnormal node identifier for marking that it does not participate in the handover process of the current service node to the service node.

檢查點執行模組針對於響應狀態異常的當前服務節點,可以停止其與多個備用服務節點之間的通訊。針對於響應狀態異常的當前服務節點和備用服務節點,還可以添加一個異常節點標識,攜帶有該標識的服務節點,則在服務節點的切換處理中不會被切換為新的當前服務節點。 The checkpoint execution module can stop the communication with multiple standby service nodes for the current service node that responds to the abnormal state. For the current service node and the standby service node that respond to the abnormal state, an abnormal node identifier can also be added, and the service node carrying the identifier will not be switched to the new current service node during the switching process of the service node.

作為本發明實施例的較佳示例,所述觸發當前服務節點的切換處理的步驟可以包括:觸發選取至少一個沒有攜帶所述異常節點標識的服務節點作為新的當前服務節點,替換響應狀態異常的當前服務節點。 As a preferred example of the embodiment of the present invention, the step of triggering the handover processing of the current service node may include: triggering the selection of at least one service node that does not carry the abnormal node identifier as the new current service node, and replacing the one that responds to the abnormal state. The current service node.

實際應用中,如果是通過Paxos協議選舉當前服務節點,攜帶異常節點標識的服務節點不會參與到選舉中。當備用服務節點觸發當前服務節點的切換處理時,攜帶異常節點標識的服務節點不參與選舉,則不會被選作新的當前服務節點。如果是通過分布式鎖服務切換服務節點,攜帶異常節點標識的服務節點不會進行搶鎖操作,僅僅由正常的服務節點參與搶鎖。 In practical applications, if the current service node is elected through the Paxos protocol, the service node carrying the identifier of the abnormal node will not participate in the election. When the standby service node triggers the switching process of the current service node, the service node carrying the abnormal node identifier does not participate in the election, and will not be selected as the new current service node. If the service node is switched through the distributed lock service, the service node carrying the identifier of the abnormal node will not perform the lock grab operation, and only the normal service node participates in the lock grab.

本發明實施例對響應狀態異常的服務節點添加異常節點標識,避免了將響應狀態異常的服務節點被選作當前服務節點、從而無法實現服務節點切換目的的問題。而且,將異常的服務節點排除,服務節點的切換處理可以保證新的當前服務節點的穩定性,避免了多次服務節點切換引起的系統波動,提升了服務恢復的穩定性。 The embodiment of the present invention adds an abnormal node identifier to the service node with an abnormal response state, which avoids the problem that the service node with an abnormal response state is selected as the current service node, thereby failing to achieve the purpose of switching the service node. Moreover, the abnormal service node is excluded, and the switching processing of the service node can ensure the stability of the new current service node, avoid system fluctuations caused by multiple service node switching, and improve the stability of service recovery.

參照圖3,示出了本發明的一種分布式儲存系統的服務節點切換方法實施例三的步驟流程圖,所述服務節點包括當前服務節點和備用服務節點,所述方法具體可以包括如下步驟: 3, there is shown a step flow chart of Embodiment 3 of a service node switching method for a distributed storage system of the present invention. The service node includes a current service node and a standby service node. The method may specifically include the following steps:

步驟301,通過日誌記錄線程獲取所述服務節點的儲存單元寫日誌的起止時間,並將所述起止時間的時間間隔作為儲存單元響應時間。 Step 301: Obtain the start and end time of log writing by the storage unit of the service node through the log recording thread, and use the time interval of the start and end time as the storage unit response time.

需要說明的是,用戶提交服務請求時會產生日誌,當前服務節點和備用服務節點均需要通過日誌記錄線程將日誌記錄到儲存單元中,然後返回用戶的服務請求處理成功的通知,因此儲存單元的響應時間直接影響到對服務請求的響應時間。 It should be noted that when a user submits a service request, a log will be generated. Both the current service node and the standby service node need to record the log in the storage unit through the logging thread, and then return a notification that the user's service request has been successfully processed. Response time directly affects the response time to service requests.

在具體的實現中,日誌記錄線程記錄有服務節點開始寫日誌的起止時間點和寫日誌完畢後的結束時間點,將起始時間點的時間間隔作為儲存單元響應時間。 In a specific implementation, the log recording thread records the start and end time points when the service node starts to write the log and the end time point after the log writing is completed, and the time interval of the start time point is used as the storage unit response time.

步驟302,判斷所述儲存單元響應時間是否大於第三預設響應時間閾值,若是,則針對所述儲存單元添加所述儲存響應超時標識,並相應記錄添加標識的時間點T2。 Step 302: Determine whether the response time of the storage unit is greater than a third preset response time threshold, and if so, add the storage response timeout flag for the storage unit, and record the time point T2 when the flag is added accordingly.

判斷儲存單元響應時間是否大於第三預設響應時間閾值,若是,表明服務節點的儲存單元存在異常,則可以針對儲存單元添加儲存響應超時標識,並記錄添加該標識時的時間點T2。如果該服務節點的儲存單元已經攜帶有儲存響應超時標識,則可以不需要作標識添加處理。 It is determined whether the storage unit response time is greater than the third preset response time threshold. If it is, it indicates that the storage unit of the service node is abnormal, a storage response timeout flag can be added to the storage unit, and the time point T2 when the flag is added is recorded. If the storage unit of the service node already carries the storage response timeout identifier, there is no need to add the identifier.

步驟303,若所述儲存單元響應時間小於所述第三預 設響應時間閾值、且所述儲存單元已經攜帶有所述儲存響應超時標識,則刪除所述儲存響應超時標識。 Step 303: If the storage unit response time is less than the third preset response time threshold and the storage unit already carries the storage response timeout flag, delete the storage response timeout flag.

在實際應用中,檢查線程需要關注的是儲存單元響應連續響應慢的異常情況,對於單獨一次的儲存單元響應慢,可能是偶然因素造成,可以暫時忽略,以免造成誤測。因此,若儲存單元響應時間小於第三預設響應時間閾值,且已經攜帶有儲存響應超時標識,可以刪除該標識。 In practical applications, the inspection thread needs to pay attention to the abnormal situation of continuous slow response of the storage unit. The slow response of a single storage unit may be caused by accidental factors and can be temporarily ignored to avoid misdetection. Therefore, if the response time of the storage unit is less than the third preset response time threshold, and the storage response timeout flag is already carried, the flag can be deleted.

步驟304,通過第二檢查線程判斷所述服務節點的儲存單元是否攜帶儲存響應超時標識。 Step 304: Determine whether the storage unit of the service node carries a storage response timeout flag through a second check thread.

步驟305,若是,則將所述儲存響應超時標識對應的標識添加時間點T2與當前時間點N2的時間間隔D2作為所述響應時間,若所述響應時間大於第二預設響應時間閾值,則確定所述服務節點的響應狀態異常。 Step 305: If yes, use the time interval D2 between the time point T2 and the current time point N2 corresponding to the storage response timeout identifier as the response time, and if the response time is greater than the second preset response time threshold, It is determined that the response status of the service node is abnormal.

第二檢查線程可以判斷儲存單元是否攜帶儲存響應超時標識,並根據判斷結果進行相應處理。 The second checking thread can judge whether the storage unit carries a storage response timeout flag, and perform corresponding processing according to the judgment result.

若攜帶儲存響應超時標識,則從日誌記錄線程中獲取該標識的添加時間點T2,與當前的時間點N2相減得到兩者的時間間隔D2作為服務節點的響應時間。若該響應時間大於第二預設響應時間閾值,則表明該服務節點將日誌記錄到儲存單元的耗時過長,影響到對服務請求的響應時間。因此,無論該當前服務節點的其他方面是否正常,也可以認為該當前服務節點的響應狀態異常。 If the storage response timeout flag is carried, the time point T2 of adding the flag is obtained from the log recording thread, and the current time point N2 is subtracted to obtain the time interval D2 between the two as the response time of the service node. If the response time is greater than the second preset response time threshold, it indicates that it takes too long for the service node to record the log to the storage unit, which affects the response time to the service request. Therefore, regardless of whether other aspects of the current service node are normal, it can also be considered that the response state of the current service node is abnormal.

第二檢查線程將響應狀態異常或正常的監控結果註冊到檢查點執行模組的監控結果註冊列表中,由檢查點執行 模組根據監控結果採取相應的處理。例如,第二檢查線程檢查出在30秒隨機存取記憶體儲存單元的響應時間沒有降低到30毫秒以下,則可以判斷該服務節點的儲存單元出現異常,導致服務節點的響應狀態異常。 The second check thread registers the abnormal response state or normal monitoring results in the monitoring result registration list of the checkpoint execution module, and the checkpoint execution module takes corresponding processing according to the monitoring results. For example, if the second checking thread detects that the response time of the random access memory storage unit within 30 seconds has not decreased to less than 30 milliseconds, it can be determined that the storage unit of the service node is abnormal, resulting in an abnormal response state of the service node.

步驟306,若所述當前服務節點的響應狀態異常,則停止所述當前服務節點與備用服務節點之間的通訊,並觸發當前服務節點的切換處理。 Step 306: If the response state of the current service node is abnormal, stop the communication between the current service node and the backup service node, and trigger the switching process of the current service node.

步驟307,若某個服務節點的響應狀態異常,則對所述服務節點添加用於標記不參與當前服務節點的切換處理的異常節點標識。 Step 307: If the response status of a certain service node is abnormal, add an abnormal node identifier for marking that it does not participate in the handover process of the current service node to the service node.

檢查點執行模組針對於響應狀態異常的當前服務節點,可以停止其與多個備用服務節點之間的通訊。針對於響應狀態異常的當前服務節點和備用服務節點,還可以添加一個異常節點標識,攜帶有該標識的服務節點,則在服務節點的切換處理中不會被切換為新的當前服務節點。 The checkpoint execution module can stop the communication with multiple standby service nodes for the current service node that responds to the abnormal state. For the current service node and the standby service node that respond to the abnormal state, an abnormal node identifier can also be added, and the service node carrying the identifier will not be switched to the new current service node during the switching process of the service node.

需要說明的是,步驟301至步驟303可以循環進行,反復統計和比較儲存單元寫日誌的響應時間,針對性地判斷出是否存在儲存單元連續響應慢的異常情況,並相應地更新儲存單元的儲存響應超時標識,以便於第二檢查線程根據標識進行相應處理。 It should be noted that steps 301 to 303 can be performed in a loop, repeating statistics and comparisons of the response time of the storage unit to write logs, and specifically determine whether there is an abnormal situation in which the storage unit continuously responds slowly, and update the storage of the storage unit accordingly. Responding to the timeout identifier, so that the second check thread performs corresponding processing according to the identifier.

需要說明的是,對於方法實施例,為了簡單描述,故將其都表述為一系列的動作組合,但是本領域技術人員應該知悉,本發明實施例並不受所描述的動作順序的限制,因為依據本發明實施例,某些步驟可以採用其他順序或者 同時進行。其次,本領域技術人員也應該知悉,說明書中所描述的實施例均屬於較佳實施例,所涉及的動作並不一定是本發明實施例所必須的。 It should be noted that for the method embodiments, for the sake of simple description, they are all expressed as a series of action combinations, but those skilled in the art should know that the embodiments of the present invention are not limited by the described sequence of actions, because According to the embodiments of the present invention, certain steps may be performed in other order or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.

參照圖4,示出了本發明的一種分布式儲存系統的服務節點切換方法實施例四的步驟流程圖,所述服務節點包括當前服務節點和備用服務節點,所述方法具體可以包括如下步驟: 4, there is shown a step flow chart of Embodiment 4 of a service node switching method for a distributed storage system of the present invention. The service node includes a current service node and a standby service node. The method may specifically include the following steps:

步驟401,通過多線程監控所述服務節點對服務請求的響應狀態。 Step 401: Monitor the response status of the service node to the service request through multithreading.

可以通過多個關注於服務節點不同方面問題的檢查線程,監控所述服務節點對服務請求的響應狀態是否異常。因為在實際應用中,服務節點的響應狀態可能會被多方面的因素所影響,無論是單方面的因素還是多個因素綜合作用,當影響到服務節點的響應狀態,均可以針對性地監控,因此,為了更全面和靈活地監控服務節點,可以通過多個線程的組合來監控服務節點。當然,線程的數量和線程具體的組合方式可以由本領域技術人員根據實際情況而定。 It is possible to monitor whether the response status of the service node to the service request is abnormal through multiple inspection threads focusing on different aspects of the service node. Because in practical applications, the response status of the service node may be affected by many factors, whether it is a unilateral factor or the combined effect of multiple factors, when it affects the response status of the service node, it can be monitored in a targeted manner. Therefore, in order to monitor the service node more comprehensively and flexibly, the service node can be monitored through a combination of multiple threads. Of course, the number of threads and the specific combination of threads can be determined by those skilled in the art according to actual conditions.

作為本發明實施例的較佳示例,所述步驟401可以具體包括以下子步驟: As a preferred example of the embodiment of the present invention, the step 401 may specifically include the following sub-steps:

子步驟S11,通過第一檢查線程獲取所述服務節點從服務請求隊列中最近取出服務請求的時間點T1,並將與當前時間點N1的時間間隔D1作為響應時間。 In sub-step S11, the time point T1 at which the service node recently took out the service request from the service request queue is obtained through the first check thread, and the time interval D1 from the current time point N1 is used as the response time.

子步驟S12,判斷所述響應時間是否大於第一預設響 應時間閾值,若是,則確定所述服務節點的響應狀態異常。 In sub-step S12, it is determined whether the response time is greater than a first preset response time threshold, and if so, it is determined that the response state of the service node is abnormal.

子步驟S13,通過第二檢查線程判斷所述服務節點的儲存單元是否攜帶儲存響應超時標識。 In sub-step S13, a second check thread is used to determine whether the storage unit of the service node carries a storage response timeout flag.

子步驟S14,若是,則將所述儲存響應超時標識對應的標識添加時間點T2與當前時間點N2的時間間隔D2作為所述響應時間,若所述響應時間大於第二預設響應時間閾值,則確定所述服務節點的響應狀態異常。 Sub-step S14, if yes, add the time interval D2 between the time point T2 and the current time point N2 of the identifier corresponding to the stored response timeout identifier as the response time, if the response time is greater than the second preset response time threshold , It is determined that the response status of the service node is abnormal.

上述的第一檢查線程可以是關注於服務請求隊列響應時間是否異常的線程。通過第一檢查線程監控服務節點,可以針對由於處理服務請求隊列響應時間過慢所引起服務節點異常的情況進行監控。上述的第二檢查線程可以是關注於儲存單元響應時間是否異常的線程。通過第二檢查線程監控服務節點,可以針對由於儲存單元寫日誌過慢所引起服務節點異常的情況進行監控。需要說明的是,上述子步驟並沒有先後之分,即可以同時通過第一檢查線程和第二檢查線程進行監控。 The aforementioned first check thread may be a thread that focuses on whether the response time of the service request queue is abnormal. By monitoring the service node by the first check thread, the abnormality of the service node caused by the too slow response time of the processing service request queue can be monitored. The above-mentioned second check thread may be a thread that focuses on whether the response time of the storage unit is abnormal. By monitoring the service node by the second check thread, the abnormal situation of the service node caused by the slow log writing of the storage unit can be monitored. It should be noted that the above sub-steps are not prioritized, that is, the first inspection thread and the second inspection thread can be used for monitoring at the same time.

步驟402,若所述當前服務節點的響應狀態異常,則停止所述當前服務節點與備用服務節點之間的通訊,並觸發當前服務節點的切換處理。 Step 402: If the response status of the current service node is abnormal, stop the communication between the current service node and the standby service node, and trigger the switching process of the current service node.

步驟403,若某個服務節點的響應狀態異常,則對所述服務節點添加用於標記不參與當前服務節點的切換處理的異常節點標識。 Step 403: If the response status of a certain service node is abnormal, add an abnormal node identifier for marking that it does not participate in the handover process of the current service node to the service node.

通過上述的第一檢查線程和第二檢查線程同時監控服 務節點對服務請求的響應狀態,可以同時針對處理服務請求隊列響應時間和儲存單元寫日誌響應時間進行監控,當任何一方面出現問題,均可以觸發服務節點的切換處理,並針對性地添加異常節點標識。從而通過多維度的監控手段提升了服務恢復的全面性和可擴展性。 Through the above-mentioned first inspection thread and second inspection thread at the same time to monitor the response status of the service node to the service request, the response time of the processing service request queue and the response time of the storage unit writing log can be monitored at the same time. It can trigger the handover processing of the service node, and add the abnormal node identifier in a targeted manner. Thus, the comprehensiveness and scalability of service recovery are improved through multi-dimensional monitoring methods.

參照圖5,示出了本發明的一種分布式儲存系統的服務節點切換裝置實施例一的結構框圖,所述服務節點包括當前服務節點和備用服務節點,所述裝置具體可以包括如下模組: 5, there is shown a structural block diagram of Embodiment 1 of a service node switching device for a distributed storage system of the present invention. The service node includes a current service node and a backup service node. The device may specifically include the following modules :

服務節點響應狀態監控模組501,用於監控所述服務節點對服務請求的響應狀態。 The service node response status monitoring module 501 is used to monitor the response status of the service node to the service request.

當前服務節點切換觸發模組502,用於若所述當前服務節點的響應狀態異常,則停止所述當前服務節點與備用服務節點之間的通訊,並觸發當前服務節點的切換處理。 The current service node switching trigger module 502 is configured to stop the communication between the current service node and the standby service node if the response state of the current service node is abnormal, and trigger the switching process of the current service node.

本發明實施例通過監控服務節點對服務請求的響應狀態,並針對響應狀態異常的當前服務節點執行停止其與備用服務節點之間的通訊,由此觸發當前服務節點的切換處理。通過服務節點檢查邏輯,針對影響服務節點響應狀態的多方面因素進行邏輯判斷和資料統計,在遇到硬體故障或軟體缺陷帶來的服務超時、服務不可用、服務異常等的情況時,實現服務節點的自主切換和恢復,增強了服務可用性,提升了服務恢復效率,改善了用戶體驗。 The embodiment of the present invention monitors the response status of the service node to the service request, and stops the communication between the current service node and the standby service node for the current service node whose response status is abnormal, thereby triggering the switching process of the current service node. Through the service node inspection logic, logical judgment and data statistics are made for various factors that affect the response status of the service node. In the event of service timeout, service unavailability, service abnormality, etc. caused by hardware failure or software defect, The autonomous switching and recovery of service nodes are realized, service availability is enhanced, service recovery efficiency is improved, and user experience is improved.

其次,本發明實施例可以針對影響服務節點響應狀態的一個或多個方面的因素進行監控,多維度的監控手段提 升了服務恢復的全面性和可擴展性。 Secondly, the embodiment of the present invention can monitor one or more factors that affect the response status of the service node, and the multi-dimensional monitoring method improves the comprehensiveness and scalability of service recovery.

進一步,本發明實施例對於異常的當前服務節點不將其直接初始化,而是採用相對保守的停止與備用服務節點通訊的方式來觸發服務節點切換,當出現誤診事故時,被誤診為響應狀態異常的當前服務節點也有機會重新作為新的當前服務節點,繼續提供服務,避免了誤診對整個系統帶來負面的影響。 Further, the embodiment of the present invention does not directly initialize the abnormal current service node, but uses a relatively conservative manner of stopping communication with the backup service node to trigger the service node switching. When a misdiagnosis accident occurs, it is misdiagnosed as an abnormal response state. The current service node also has the opportunity to re-function as the new current service node and continue to provide services, avoiding the negative impact of misdiagnosis on the entire system.

參照圖6,示出了本發明的一種分布式儲存系統的服務節點切換裝置實施例二的結構框圖,所述服務節點包括當前服務節點和備用服務節點,所述裝置具體可以包括如下模組: 6, there is shown a structural block diagram of the second embodiment of a service node switching device for a distributed storage system of the present invention. The service node includes the current service node and the standby service node. The device may specifically include the following modules :

監控結果註冊模組601,用於將對至少一個所述服務節點的監控結果註冊到監控結果註冊列表。 The monitoring result registration module 601 is configured to register the monitoring result of at least one of the service nodes to the monitoring result registration list.

服務節點響應狀態監控模組602,用於監控所述服務節點對服務請求的響應狀態。 The service node response status monitoring module 602 is used to monitor the response status of the service node to the service request.

當前服務節點切換觸發模組603,用於若所述當前服務節點的響應狀態異常,則停止所述當前服務節點與備用服務節點之間的通訊,並觸發當前服務節點的切換處理。 The current service node switching trigger module 603 is configured to stop the communication between the current service node and the standby service node if the response state of the current service node is abnormal, and trigger the switching process of the current service node.

異常節點標識添加模組604,用於若某個服務節點的響應狀態異常,則對所述服務節點添加用於標記不參與當前服務節點的切換處理的異常節點標識。 The abnormal node identifier adding module 604 is configured to add an abnormal node identifier for marking the service node not to participate in the switching process of the current service node if the response state of a certain service node is abnormal.

監控頻率確定模組605,用於將所述多線程的個數除以所述預設響應時間閾值的結果作為監控所述服務節點響應狀態的頻率。 The monitoring frequency determination module 605 is configured to divide the number of the multi-threads by the preset response time threshold as the frequency of monitoring the response state of the service node.

作為本發明實施例的較佳示例,所述裝置可以還包括:儲存單元響應時間確定模組,用於通過日誌記錄線程獲取所述服務節點的儲存單元寫日誌的起止時間,並將所述起止時間的時間間隔作為儲存單元響應時間。 As a preferred example of the embodiment of the present invention, the device may further include: a storage unit response time determination module, which is used to obtain the start and end time of the storage unit writing log of the service node through a log recording thread, and to set the start and end The time interval is used as the response time of the storage unit.

儲存響應超時標識添加模組,用於判斷所述儲存單元響應時間是否大於第三預設響應時間閾值,若是,則針對所述儲存單元添加所述儲存響應超時標識,並相應記錄添加標識的時間點T2。 The storage response timeout flag adding module is used to determine whether the storage unit response time is greater than the third preset response time threshold; if so, the storage response timeout flag is added to the storage unit, and the corresponding record adds the flag The time point T2.

儲存響應超時標識刪除模組,用於若所述儲存單元響應時間小於所述第三預設響應時間閾值、且所述儲存單元已經攜帶有所述儲存響應超時標識,則刪除所述儲存響應超時標識。 The storage response timeout flag deletion module is configured to delete the storage if the storage unit response time is less than the third preset response time threshold and the storage unit already carries the storage response timeout flag Response timeout indicator.

作為本發明實施例的較佳示例,所述當前服務節點切換觸發模組603可以包括以下子模組:觸發選取子模組,用於觸發選取至少一個沒有攜帶所述異常節點標識的服務節點作為新的當前服務節點,替換響應狀態異常的當前服務節點。 As a preferred example of the embodiment of the present invention, the current service node switching trigger module 603 may include the following sub-modules: a trigger selection sub-module for triggering the selection of at least one service node that does not carry the abnormal node identifier as The new current service node replaces the current service node that responds to an abnormal state.

作為本發明實施例的較佳示例,所述服務節點響應狀態監控模組602可以包括以下子模組:多線程監控子模組,用於通過多線程監控所述服務節點對服務請求的響應狀態。 As a preferred example of the embodiment of the present invention, the service node response status monitoring module 602 may include the following sub-modules: a multi-thread monitoring sub-module for monitoring the response status of the service node to service requests through multiple threads .

作為本發明實施例的較佳示例一,所述多線程監控子模組可以包括以下子單元: 第一檢查線程子單元,用於通過第一檢查線程獲取所述服務節點從服務請求隊列中最近取出服務請求的時間點T1,並將與當前時間點N1的時間間隔D1作為響應時間。 As a preferred example one of the embodiment of the present invention, the multi-threaded monitoring sub-module may include the following sub-units: The first check thread sub-unit is used to obtain the service node from the service request queue by the first check thread Take out the time point T1 of the service request, and use the time interval D1 from the current time point N1 as the response time.

第一預設響應時間閾值判斷子單元,用於判斷所述響應時間是否大於第一預設響應時間閾值,若是,則確定所述服務節點的響應狀態異常。 The first preset response time threshold judging subunit is configured to judge whether the response time is greater than the first preset response time threshold, and if so, determine that the response state of the service node is abnormal.

作為本發明實施例的較佳示例二,所述多線程監控子模組可以包括以下子單元:第二檢查線程子單元,用於通過第二檢查線程判斷所述服務節點的儲存單元是否攜帶儲存響應超時標識;若是,則調用第二預設響應時間閾值判斷子單元。 As a second preferred example of the embodiment of the present invention, the multi-threaded monitoring sub-module may include the following sub-units: a second check thread sub-unit for determining whether the storage unit of the service node carries storage through the second check thread Response timeout flag; if yes, call the second preset response time threshold judging subunit.

第二預設響應時間閾值判斷子單元,用於將所述儲存響應超時標識對應的標識添加時間點T2與當前時間點N2的時間間隔D2作為所述響應時間,若所述響應時間大於第二預設響應時間閾值,則確定所述服務節點的響應狀態異常。 The second preset response time threshold judgment subunit is configured to add the time interval D2 between the time point T2 and the current time point N2 of the identifier corresponding to the storage response timeout identifier as the response time, if the response time is greater than the first 2. When the response time threshold is preset, it is determined that the response state of the service node is abnormal.

作為本發明實施例的較佳示例,所述服務節點響應狀態監控模組602可以包括以下子模組:監控結果輪詢子模組,用於在所述監控結果註冊列表的起始位置輪詢註冊的監控結果。 As a preferred example of the embodiment of the present invention, the service node response status monitoring module 602 may include the following sub-modules: a monitoring result polling sub-module for polling registration at the beginning of the monitoring result registration list Monitoring results.

本發明實施例對響應狀態異常的服務節點添加異常節點標識,避免了將響應狀態異常的服務節點被選作當前服務節點、從而無法實現服務節點切換目的的問題。而且, 將異常的服務節點排除,服務節點的切換處理可以保證新的當前服務節點的穩定性,避免了多次服務節點切換引起的系統波動,提升了服務恢復的穩定性。 The embodiment of the present invention adds an abnormal node identifier to the service node with an abnormal response state, which avoids the problem that the service node with an abnormal response state is selected as the current service node, thereby failing to achieve the purpose of switching the service node. Moreover, the abnormal service node is excluded, and the switching processing of the service node can ensure the stability of the new current service node, avoid system fluctuations caused by multiple service node switching, and improve the stability of service recovery.

對於裝置實施例而言,由於其與方法實施例基本相似,所以描述的比較簡單,相關之處參見方法實施例的部分說明即可。 As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and for related parts, please refer to the part of the description of the method embodiment.

本說明書中的各個實施例均採用遞進的方式描述,每個實施例重點說明的都是與其他實施例的不同之處,各個實施例之間相同相似的部分互相參見即可。 The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the various embodiments can be referred to each other.

本領域內的技術人員應明白,本發明實施例的實施例可提供為方法、裝置、或計算機程序產品。因此,本發明實施例可採用完全硬體實施例、完全軟體實施例、或結合軟體和硬體方面的實施例的形式。而且,本發明實施例可採用在一個或多個其中包含有計算機可用程序代碼的計算機可用儲存媒體(包括但不限於磁盤記憶體、CD-ROM、光學記憶體等)上實施的計算機程序產品的形式。 Those skilled in the art should understand that the embodiments of the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may adopt computer program products implemented on one or more computer-usable storage media (including but not limited to disk memory, CD-ROM, optical memory, etc.) containing computer-usable program codes. form.

在一個典型的配置中,所述計算機設備包括一個或多個處理器(CPU)、輸入/輸出介面、網路介面和隨機存取記憶體。隨機存取記憶體可能包括計算機可讀媒體中的非永久性記憶體,隨機存取記憶體(RAM)和/或非易失性隨機存取記憶體等形式,如唯讀記憶體(ROM)或閃存(flash RAM)。隨機存取記憶體是計算機可讀媒體的示例。計算機可讀媒體包括永久性和非永久性、可移動和非可移動媒體可以由任何方法或技術來實現資訊儲存。資訊可以是計 算機可讀指令、資料結構、程序的模組或其他資料。計算機的儲存媒體的例子包括,但不限於相變隨機存取記憶體(PRAM)、靜態隨機存取記憶體(SRAM)、動態隨機存取記憶體(DRAM)、其他類型的隨機存取記憶體(RAM)、唯讀記憶體(ROM)、電可擦除可編程唯讀記憶體(EEPROM)、快閃記憶體或其他隨機存取記憶體技術、唯讀光碟唯讀記憶體(CD-ROM)、數位多功能光碟(DVD)或其他光學儲存、磁盒式磁帶,磁帶磁盤儲存或其他磁性儲存設備或任何其他非傳輸媒體,可用於儲存可以被計算設備訪問的資訊。按照本文中的界定,計算機可讀媒體不包括非持續性的電腦可讀媒體(transitory media),如調製的資料信號和載波。 In a typical configuration, the computer device includes one or more processors (CPUs), input/output interfaces, network interfaces, and random access memory. Random access memory may include non-permanent memory in computer-readable media, random access memory (RAM) and/or non-volatile random access memory, such as read-only memory (ROM) Or flash memory (flash RAM). Random access memory is an example of computer-readable media. Computer-readable media includes permanent and non-permanent, removable and non-removable media, and information storage can be realized by any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change random access memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), and other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other random access memory technology, CD-ROM ), digital versatile discs (DVD) or other optical storage, magnetic cassettes, magnetic tape storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by computing devices. According to the definition in this article, computer-readable media does not include non-persistent computer-readable media (transitory media), such as modulated data signals and carrier waves.

本發明實施例是參照根據本發明實施例的方法、終端設備(系統)、和計算機程序產品的流程圖和/或方框圖來描述的。應理解可由計算機程序指令實現流程圖和/或方框圖中的每一流程和/或方框、以及流程圖和/或方框圖中的流程和/或方框的結合。可提供這些計算機程序指令到通用計算機、專用計算機、嵌入式處理機或其他可編程資料處理終端設備的處理器以產生一個機器,使得通過計算機或其他可編程資料處理終端設備的處理器執行的指令產生用於實現在流程圖一個流程或多個流程和/或方框圖一個方框或多個方框中指定的功能的裝置。 The embodiments of the present invention are described with reference to the flowcharts and/or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and/or block in the flowchart and/or block diagram, and the combination of processes and/or blocks in the flowchart and/or block diagram can be realized by computer program instructions. These computer program instructions can be provided to the processors of general-purpose computers, special-purpose computers, embedded processors, or other programmable data processing terminal equipment to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal equipment A device for realizing the functions specified in a flow or multiple flows in the flowchart and/or a block or multiple blocks in the block diagram is generated.

這些計算機程序指令也可儲存在能引導計算機或其他可編程資料處理終端設備以特定方式工作的計算機可讀記 憶體中,使得儲存在該計算機可讀記憶體中的指令產生包括指令裝置的製造品,該指令裝置實現在流程圖一個流程或多個流程和/或方框圖一個方框或多個方框中指定的功能。 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing terminal equipment to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including the instruction device , The instruction device realizes the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.

這些計算機程序指令也可裝載到計算機或其他可編程資料處理終端設備上,使得在計算機或其他可編程終端設備上執行一系列操作步驟以產生計算機實現的處理,從而在計算機或其他可編程終端設備上執行的指令提供用於實現在流程圖一個流程或多個流程和/或方框圖一個方框或多個方框中指定的功能的步驟。 These computer program instructions can also be loaded on a computer or other programmable data processing terminal equipment, so that a series of operation steps are executed on the computer or other programmable terminal equipment to generate computer-implemented processing, so that the computer or other programmable terminal equipment The instructions executed above provide steps for implementing functions specified in a flow or multiple flows in the flowchart and/or a block or multiple blocks in the block diagram.

儘管已描述了本發明實施例的較佳實施例,但本領域內的技術人員一旦得知了基本創造性概念,則可對這些實施例做出另外的變更和修改。所以,所附申請專利範圍意欲解釋為包括較佳實施例以及落入本發明實施例範圍的所有變更和修改。 Although the preferred embodiments of the embodiments of the present invention have been described, those skilled in the art can make additional changes and modifications to these embodiments once they learn the basic creative concept. Therefore, the scope of the attached patent application is intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the embodiments of the present invention.

最後,還需要說明的是,在本文中,諸如第一和第二等之類的關係術語僅僅用來將一個實體或者操作與另一個實體或操作區分開來,而不一定要求或者暗示這些實體或操作之間存在任何這種實際的關係或者順序。而且,術語“包括”、“包含”或者其任何其他變體意在涵蓋非排他性的包含,從而使得包括一系列要素的過程、方法、物品或者終端設備不僅包括那些要素,而且還包括沒有明確列出的其他要素,或者是還包括為這種過程、方法、物品或者終端設備所固有的要素。在沒有更多限制的情況下,由語句 “包括一個......”限定的要素,並不排除在包括所述要素的過程、方法、物品或者終端設備中還存在另外的相同要素。 Finally, it should be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply these entities. Or there is any such actual relationship or sequence between operations. Moreover, the terms "including", "including" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements not only includes those elements, but also includes those elements that are not explicitly listed. Other elements listed, or also include elements inherent to this process, method, article, or terminal device. Without more restrictions, the element defined by the sentence "including a..." does not exclude the existence of other identical elements in the process, method, article, or terminal device that includes the element.

以上對本發明所提供的一種分布式儲存系統的服務節點切換方法和一種分布式儲存系統的服務節點切換裝置,進行了詳細介紹,本文中應用了具體個例對本發明的原理及實施方式進行了闡述,以上實施例的說明只是用於幫助理解本發明的方法及其核心思想;同時,對於本領域的一般技術人員,依據本發明的思想,在具體實施方式及應用範圍上均會有改變之處,綜上所述,本說明書內容不應理解為對本發明的限制。 The foregoing provides a detailed introduction to the service node switching method of the distributed storage system and the service node switching device of the distributed storage system provided by the present invention. Specific examples are used in this article to illustrate the principle and implementation of the present invention. The description of the above embodiments is only used to help understand the method and core idea of the present invention; at the same time, for those of ordinary skill in the art, according to the idea of the present invention, there will be changes in the specific implementation and the scope of application In summary, the content of this specification should not be construed as a limitation of the present invention.

Claims (16)

一種分布式儲存系統的服務節點切換方法,所述服務節點包括當前服務節點和備用服務節點,所述方法包括:監控所述服務節點對服務請求的響應狀態,包括:通過多線程監控所述服務節點對服務請求的響應狀態;以及若所述當前服務節點的響應狀態異常,則停止所述當前服務節點與備用服務節點之間的通訊,並觸發當前服務節點的切換處理;其中,所述方法還包括將所述多線程的個數除以所述預設響應時間閾值的結果作為監控所述服務節點響應狀態的頻率。 A method for switching a service node of a distributed storage system. The service node includes a current service node and a standby service node. The method includes: monitoring the response status of the service node to a service request, including: monitoring the service through multiple threads The response status of the node to the service request; and if the response status of the current service node is abnormal, stop the communication between the current service node and the standby service node, and trigger the switching process of the current service node; wherein, the method It also includes the frequency of monitoring the response state of the service node as a result of dividing the number of the multi-threads by the preset response time threshold. 根據申請專利範圍第1項所述的方法,其中,還包括:若某個服務節點的響應狀態異常,則對所述服務節點添加用於標記不參與當前服務節點的切換處理的異常節點標識。 The method according to item 1 of the scope of patent application, further comprising: if the response status of a certain service node is abnormal, adding an abnormal node identifier for marking that it does not participate in the handover processing of the current service node to the service node. 根據申請專利範圍第2項所述的方法,其中,所述觸發當前服務節點的切換處理的步驟包括:觸發選取至少一個沒有攜帶所述異常節點標識的服務節點作為新的當前服務節點,替換響應狀態異常的當前服務節點。 The method according to item 2 of the scope of patent application, wherein the step of triggering the handover processing of the current service node includes: triggering the selection of at least one service node that does not carry the abnormal node identifier as the new current service node, and replacing the response The current service node with abnormal status. 根據申請專利範圍第1項所述的方法,其中,所述通過多線程監控所述服務節點對服務請求的響應狀態的步 驟包括:通過第一檢查線程獲取所述服務節點從服務請求隊列中最近取出服務請求的時間點T1,並將與當前時間點N1的時間間隔D1作為響應時間;判斷所述響應時間是否大於第一預設響應時間閾值,若是,則確定所述服務節點的響應狀態異常。 The method according to item 1 of the scope of patent application, wherein the step of monitoring the response status of the service node to the service request through multi-threading The steps include: obtaining the time point T1 at which the service node recently took out the service request from the service request queue through the first checking thread, and taking the time interval D1 from the current time point N1 as the response time; judging whether the response time is greater than the first A preset response time threshold, if yes, it is determined that the response state of the service node is abnormal. 根據申請專利範圍第1項所述的方法,其中,所述通過多線程監控所述服務節點對服務請求的響應狀態的步驟包括:通過第二檢查線程判斷所述服務節點的儲存單元是否攜帶儲存響應超時標識;若是,則將所述儲存響應超時標識對應的標識添加時間點T2與當前時間點N2的時間間隔D2作為所述響應時間,若所述響應時間大於第二預設響應時間閾值,則確定所述服務節點的響應狀態異常。 The method according to item 1 of the scope of patent application, wherein the step of monitoring the response status of the service node to the service request through multiple threads includes: judging whether the storage unit of the service node carries storage through a second check thread Response timeout flag; if yes, add the time interval D2 between the time point T2 and the current time point N2 to the storage response timeout flag corresponding to the time interval D2 as the response time, if the response time is greater than the second preset response time Threshold, it is determined that the response status of the service node is abnormal. 根據申請專利範圍第5項所述的方法,其中,在所述通過多線程監控所述服務節點對服務請求的響應狀態的步驟之前,所述方法還包括:通過日誌記錄線程獲取所述服務節點的儲存單元寫日誌的起止時間,並將所述起止時間的時間間隔作為儲存單元響應時間;判斷所述儲存單元響應時間是否大於第三預設響應時間閾值,若是,則針對所述儲存單元添加所述儲存響應超時標識,並相應記錄添加標識的時間點T2。 The method according to item 5 of the scope of patent application, wherein, before the step of monitoring the response status of the service node to the service request through multiple threads, the method further includes: obtaining the service node through a logging thread The storage unit writes the start and end time of the log, and uses the time interval between the start and end times as the response time of the storage unit; determine whether the response time of the storage unit is greater than the third preset response time threshold, and if so, add it for the storage unit The storage response timeout flag is stored, and the time point T2 when the flag is added is recorded accordingly. 根據申請專利範圍第6項所述的方法,其中,還包括:若所述儲存單元響應時間小於所述第三預設響應時間閾值、且所述儲存單元已經攜帶有所述儲存響應超時標識,則刪除所述儲存響應超時標識。 The method according to item 6 of the scope of patent application, further comprising: if the storage unit response time is less than the third preset response time threshold, and the storage unit already carries the storage response timeout flag , Delete the storage response timeout flag. 根據申請專利範圍第1項所述的方法,其中,在所述監控所述服務節點對服務請求的響應狀態的步驟之前,所述方法還包括:將對至少一個所述服務節點的監控結果註冊到監控結果註冊列表;所述監控所述服務節點對服務請求的響應狀態的步驟為:在所述監控結果註冊列表的起始位置輪詢註冊的監控結果。 The method according to item 1 of the scope of patent application, wherein, before the step of monitoring the response status of the service node to the service request, the method further includes: registering the monitoring result of at least one of the service nodes To the monitoring result registration list; the step of monitoring the response status of the service node to the service request is: polling the registered monitoring result at the start position of the monitoring result registration list. 一種分布式儲存系統的服務節點切換裝置,所述服務節點包括當前服務節點和備用服務節點,所述裝置包括:服務節點響應狀態監控模組,用於監控所述服務節點對服務請求的響應狀態,其包括:多線程監控子模組,用於通過多線程監控所述服務節點對服務請求的響應狀態;以及當前服務節點切換觸發模組,用於若所述當前服務節點的響應狀態異常,則停止所述當前服務節點與備用服務節點之間的通訊,並觸發當前服務節點的切換處理; 其中,所述裝置還包括:監控頻率確定模組,用於將所述多線程的個數除以所述預設響應時間閾值的結果作為監控所述服務節點響應狀態的頻率。 A service node switching device of a distributed storage system. The service node includes a current service node and a standby service node. The device includes: a service node response status monitoring module for monitoring the response status of the service node to a service request , Which includes: a multi-threaded monitoring sub-module for monitoring the response status of the service node to a service request through multi-threading; and a current service node switching trigger module for if the response status of the current service node is abnormal, Then stop the communication between the current service node and the standby service node, and trigger the switching process of the current service node; Wherein, the device further includes: a monitoring frequency determination module, configured to divide the number of the multi-threads by the preset response time threshold as the frequency of monitoring the response state of the service node. 根據申請專利範圍第9項所述的裝置,其中,所述裝置還包括:異常節點標識添加模組,用於若某個服務節點的響應狀態異常,則對所述服務節點添加用於標記不參與當前服務節點的切換處理的異常節點標識。 The device according to item 9 of the scope of patent application, wherein the device further includes: an abnormal node identification adding module, which is used to add an abnormal node identifier to the service node if the response status of a certain service node is abnormal. The identifier of the abnormal node participating in the handover process of the current service node. 根據申請專利範圍第10項所述的裝置,其中,所述當前服務節點切換觸發模組包括:觸發選取子模組,用於觸發選取至少一個沒有攜帶所述異常節點標識的服務節點作為新的當前服務節點,替換響應狀態異常的當前服務節點。 The device according to item 10 of the scope of patent application, wherein the current service node switching trigger module includes: a trigger selection sub-module for triggering the selection of at least one service node that does not carry the abnormal node identifier as a new The current service node replaces the current service node with an abnormal response state. 根據申請專利範圍第9項所述的裝置,其中,所述多線程監控子模組包括:第一檢查線程子單元,用於通過第一檢查線程獲取所述服務節點從服務請求隊列中最近取出服務請求的時間點T1,並將與當前時間點N1的時間間隔D1作為響應時間;第一預設響應時間閾值判斷子單元,用於判斷所述響應時間是否大於第一預設響應時間閾值,若是,則確定所述服務節點的響應狀態異常。 The device according to item 9 of the scope of patent application, wherein the multi-thread monitoring sub-module includes: a first check thread subunit for obtaining the service node from the service request queue by the first check thread The time point T1 of the service request, and the time interval D1 from the current time point N1 as the response time; the first preset response time threshold judging subunit is used to judge whether the response time is greater than the first preset response time threshold, If yes, it is determined that the response status of the service node is abnormal. 根據申請專利範圍第9項所述的裝置,其中,所述多線程監控子模組包括: 第二檢查線程子單元,用於通過第二檢查線程判斷所述服務節點的儲存單元是否攜帶儲存響應超時標識;若是,則調用第二預設響應時間閾值判斷子單元;第二預設響應時間閾值判斷子單元,用於將所述儲存響應超時標識對應的標識添加時間點T2與當前時間點N2的時間間隔D2作為所述響應時間,若所述響應時間大於第二預設響應時間閾值,則確定所述服務節點的響應狀態異常。 The device according to item 9 of the scope of patent application, wherein the multi-thread monitoring sub-module includes: The second check thread subunit is used for judging whether the storage unit of the service node carries the storage response timeout flag through the second check thread; if so, call the second preset response time threshold judging subunit; the second preset response The time threshold judging subunit is configured to add the time interval D2 between the time point T2 and the current time point N2 to the identifier corresponding to the storage response timeout identifier as the response time, if the response time is greater than the second preset response time Threshold, it is determined that the response status of the service node is abnormal. 根據申請專利範圍第13項所述的裝置,其中,所述裝置還包括:儲存單元響應時間確定模組,用於通過日誌記錄線程獲取所述服務節點的儲存單元寫日誌的起止時間,並將所述起止時間的時間間隔作為儲存單元響應時間;儲存響應超時標識添加模組,用於判斷所述儲存單元響應時間是否大於第三預設響應時間閾值,若是,則針對所述儲存單元添加所述儲存響應超時標識,並相應記錄添加標識的時間點T2。 The device according to item 13 of the scope of patent application, wherein the device further includes: a storage unit response time determining module, configured to obtain the start and end time of the storage unit of the service node to write logs through a log recording thread, and The time interval between the start and end times is used as the storage unit response time; the storage response timeout flag adding module is used to determine whether the storage unit response time is greater than the third preset response time threshold, and if so, add it for the storage unit The storage response timeout flag is stored, and the time point T2 when the flag is added is recorded accordingly. 根據申請專利範圍第14項所述的裝置,其中,所述裝置還包括:儲存響應超時標識刪除模組,用於若所述儲存單元響應時間小於所述第三預設響應時間閾值、且所述儲存單元已經攜帶有所述儲存響應超時標識,則刪除所述儲存響應超時標識。 The device according to item 14 of the scope of patent application, wherein the device further includes: a storage response timeout flag deletion module, configured to: if the storage unit response time is less than the third preset response time threshold, and If the storage unit already carries the storage response timeout flag, the storage response timeout flag is deleted. 根據申請專利範圍第9項所述的裝置,其中,所 述裝置還包括:監控結果註冊模組,用於將對至少一個所述服務節點的監控結果註冊到監控結果註冊列表;所述服務節點響應狀態監控模組包括:監控結果輪詢子模組,用於在所述監控結果註冊列表的起始位置輪詢註冊的監控結果。 According to the device described in item 9 of the scope of patent application, the The device further includes: a monitoring result registration module for registering the monitoring result of at least one of the service nodes to a monitoring result registration list; the service node response status monitoring module includes: a monitoring result polling sub-module, Polling the registered monitoring result at the start position of the monitoring result registration list.
TW106102471A 2017-01-23 2017-01-23 Service node switching method and device of distributed storage system TWI740885B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW106102471A TWI740885B (en) 2017-01-23 2017-01-23 Service node switching method and device of distributed storage system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW106102471A TWI740885B (en) 2017-01-23 2017-01-23 Service node switching method and device of distributed storage system

Publications (2)

Publication Number Publication Date
TW201828087A TW201828087A (en) 2018-08-01
TWI740885B true TWI740885B (en) 2021-10-01

Family

ID=63960268

Family Applications (1)

Application Number Title Priority Date Filing Date
TW106102471A TWI740885B (en) 2017-01-23 2017-01-23 Service node switching method and device of distributed storage system

Country Status (1)

Country Link
TW (1) TWI740885B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112463754B (en) * 2020-11-25 2022-08-02 上海哔哩哔哩科技有限公司 Data node switching method and device in HDFS (Hadoop distributed File System) and computer equipment

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060173866A1 (en) * 2005-02-03 2006-08-03 International Business Machines Corporation Apparatus and method for handling backend failover in an application server
CN101690136A (en) * 2007-06-26 2010-03-31 汤姆逊许可证公司 Real time protocol stream migration
US20110191462A1 (en) * 2000-07-17 2011-08-04 Smith Philip S Method and system for operating an E-Commerce service provider
CN102521339A (en) * 2011-12-08 2012-06-27 北京京东世纪贸易有限公司 System and method for dynamic access of data sources
TW201514684A (en) * 2013-07-11 2015-04-16 Ibm Speculative recovery using storage snapshot in a clustered database
TW201619855A (en) * 2014-11-18 2016-06-01 Alibaba Group Services Ltd Service addressing in distributed environment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110191462A1 (en) * 2000-07-17 2011-08-04 Smith Philip S Method and system for operating an E-Commerce service provider
US20060173866A1 (en) * 2005-02-03 2006-08-03 International Business Machines Corporation Apparatus and method for handling backend failover in an application server
CN101690136A (en) * 2007-06-26 2010-03-31 汤姆逊许可证公司 Real time protocol stream migration
CN102521339A (en) * 2011-12-08 2012-06-27 北京京东世纪贸易有限公司 System and method for dynamic access of data sources
TW201514684A (en) * 2013-07-11 2015-04-16 Ibm Speculative recovery using storage snapshot in a clustered database
TW201619855A (en) * 2014-11-18 2016-06-01 Alibaba Group Services Ltd Service addressing in distributed environment

Also Published As

Publication number Publication date
TW201828087A (en) 2018-08-01

Similar Documents

Publication Publication Date Title
WO2017097130A1 (en) Method and apparatus for switching service nodes of distributed storage system
US10949245B2 (en) Maintaining high availability during network partitions for virtual machines stored on distributed object-based storage
US20220239602A1 (en) Scalable leadership election in a multi-processing computing environment
US9547521B2 (en) System and method for supporting dynamic thread pool sizing in a distributed data grid
JP5714571B2 (en) Cache data processing using cache clusters in configurable mode
JP4637842B2 (en) Fast application notification in clustered computing systems
US9495259B2 (en) Orchestrating high availability failover for virtual machines stored on distributed object-based storage
US20100106914A1 (en) Consistency models in a distributed store
US20100106915A1 (en) Poll based cache event notifications in a distributed cache
US11330071B2 (en) Inter-process communication fault detection and recovery system
US20200264777A1 (en) Method and apparatus for upgrading a distributed storage system
US10367676B1 (en) Stable leader selection for distributed services
US20160371122A1 (en) File processing workflow management
JP2002091938A (en) System and method for processing fail-over
US10423643B2 (en) System and method for supporting resettable acknowledgements for synchronizing data in a distributed data grid
US9367414B2 (en) Persisting high availability protection state for virtual machines stored on distributed object-based storage
US10075326B2 (en) Monitoring file system operations between a client computer and a file server
US11397632B2 (en) Safely recovering workloads within a finite timeframe from unhealthy cluster nodes
US9652307B1 (en) Event system for a distributed fabric
TWI740885B (en) Service node switching method and device of distributed storage system
US20220086037A1 (en) Technique for Connection Handling in a Distributed System
US20180309702A1 (en) Method and device for processing data after restart of node
CN109976663A (en) Distributed storage response method and system
US11487738B1 (en) Replica performance for transactions submitted to log-first distributed databases
TWI735521B (en) Method and device for upgrading distributed storage system