Server fault recovery method, NFS server side and system

By loading client information when the NFS server restarts, creating client IDs and reaffirming tags, restoring resource and locking states, the problem of insufficient recovery capabilities of traditional NFS server services is solved, and fast and secure state recovery and system continuity are achieved. .

CN119248552APending Publication Date: 2025-01-03SHANDONG LANGCHAO YUNTOU INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411274980.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-12
Publication Date
2025-01-03

AI Technical Summary

Technical Problem

When traditional NFS servers face hardware failures, software crashes or planned maintenance, their service recovery capabilities are insufficient, resulting in data conflicts, access competition, resource locking and inconsistent status problems, affecting system performance and data reliability, and the recovery process cannot be actively accelerated. , resulting in long business interruption.

Method used

When restarting the NFS server, load client information, create a unique client ID, set reaffirmation marks, restore the client's resource and locked state before restart, update client information and tags, and ensure the consistency of resource and locked states and reliability.

Benefits of technology

It realizes rapid, efficient and secure recovery of client operation status, ensures the continuity and user experience of the NFS server, avoids data inconsistency and business interruption, and improves the system's concurrency management capabilities and response speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119248552A_ABST
    Figure CN119248552A_ABST
Patent Text Reader

Abstract

The invention provides a server fault recovery method, an NFS server side and a system, and the method comprises the steps: loading client information of at least one client side when the NFS server side is restarted, and for each client side, executing the following steps: creating a client side ID for the client side when an access request of the client side is received; setting a duplicate mark for the client according to the client information and the client ID; sending the client ID to the client, and triggering the client to establish session connection; according to the restarting mark, recovering the opening state of the opened resource of the client before the NFS server is restarted; recovering the locking state of the client to the resources before the NFS server is restarted; and updating the client information of the at least one client and the corresponding duplicate mark based on the open state and the locked state. According to the method and the device, the operation state of the client can be quickly, efficiently and safely recovered, and the service continuity of the NFS server and the good experience of a user are guaranteed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of server failure, and in particular to a server failure recovery method, an NFS server and a system. Background Art

[0002] With the rapid development of information technology, the amount of enterprise data is showing an explosive growth trend, especially in large-scale distributed systems and cloud computing environments. In this context, NFS (Network File System), as a widely used file sharing protocol, has become a core tool for data exchange within and across enterprises because of its support for cross-platform file access and efficient data sharing capabilities. However, as enterprises have higher requirements for system stability and data consistency, traditional NFS servers face severe challenges in service recovery capabilities in the face of hardware failures, software crashes, and planned maintenance.

[0003] At present, traditional NFS service recovery strategies usually rely on a simple method based on a time waiting mechanism, that is, after a server fails and restarts, a certain time window is set in the expectation that the client can reestablish the connection and restore its previous operating state during this period. However, this recovery strategy has exposed many defects in practical applications. First, this method fails to effectively manage concurrent access. When multiple clients try to reconnect at the same time, data conflicts and access competition problems may occur. Secondly, the traditional recovery mechanism lacks refined management of client status, which easily leads to problems such as resource locking or inconsistent status, thereby affecting the overall performance and data reliability of the system. Finally, this recovery method that passively relies on client behavior cannot actively accelerate the recovery process, often resulting in long business interruptions and affecting the normal operation of the enterprise. Therefore, a more intelligent and efficient NFS service recovery method is urgently needed. Summary of the invention

[0004] The present application provides a server failure recovery method, an NFS server and a system to at least partially solve the above-mentioned problems.

[0005] In a first aspect, the present application provides a server failure recovery method applied to an NFS server, comprising:

[0006] When the NFS server is restarted, the client information of at least one client is loaded, and for each of the clients, the following operations are executed:

[0007] When receiving an access request from the client, creating a client ID for the client;

[0008] According to the loaded client information and the client ID, a reaffirmation mark is set for the client, wherein the reaffirmation mark is used to indicate that the client is allowed to perform a reaffirmation operation;

[0009] Sending the client ID to the client to trigger the client to establish a session connection with the NFS server;

[0010] After the client establishes a session connection with the NFS server, according to the reaffirmation mark, the open state of the resource opened by the client before the NFS server is restarted is restored;

[0011] Based on the open state, restore the locking state of the resource by the client before the NFS server is restarted;

[0012] Based on the open state and the locked state, the client information of the at least one client and the corresponding reaffirmation mark are updated.

[0013] In one embodiment, when receiving an access request from the client, before creating a client ID for the client, the method further includes:

[0014] Determining whether the access request is a heartbeat signal;

[0015] If so, executing the step of creating a client ID for the client;

[0016] If not, feedback information is sent to the client, wherein the feedback information is used to indicate that the NFS client is in a restart phase and rejects the non-re-assertion request.

[0017] In one embodiment, when the access request is a heartbeat signal, before creating a client ID for the client, the method further includes:

[0018] confirming whether the updating of the client information of the at least one client and the corresponding reaffirmation mark is completed;

[0019] If yes, sending a confirmation signal to the client to indicate that the connection between the NFS server and the client is normal;

[0020] If not, execute the step of creating a client ID for the client.

[0021] In one embodiment, when the access request is a heartbeat signal, creating a client ID for the client includes:

[0022] Sending a status code indicating that the current session is invalid to the client;

[0023] When receiving a session re-establishment request sent by the client according to the status code, sending to the client an error code indicating that the client ID in the session re-establishment request is invalid;

[0024] When receiving a client ID change request sent by the client according to the error code, a corresponding client ID is created for the client based on information in the client ID change request.

[0025] In one embodiment, updating the client information of the at least one client and the corresponding reaffirmation mark based on the open state and the locked state includes:

[0026] Sending a confirmation message to the client indicating that the locking state has been restored;

[0027] When receiving a reaffirmation completion request sent by the client according to the confirmation information and used to indicate that the reaffirmation status has been completed, sending a status recovery notification to the client, wherein the status recovery notification is used to indicate that the open state and the locked state of the resource have been restored;

[0028] Setting the current state of the reaffirmation mark of the client to state reaffirmation completed;

[0029] The client information of the at least one client is updated according to the client whose status has been reaffirmed and the current time point.

[0030] In one embodiment, updating the client information of the at least one client according to the client whose status has been reaffirmed and the current time point includes:

[0031] According to a preset detection cycle, determining whether the current status of the reaffirmation marks of each of the loaded clients is that the status reaffirmation is completed;

[0032] If yes, execute the preset background task;

[0033] If not, determine whether the time difference between the current time point and the time point when the NFS server is restarted is greater than or equal to the preset fault recovery duration. If so, delete the client information of the at least one client whose status has not been marked as reaffirmed, and execute the preset background task.

[0034] In one embodiment, the restoring the open state of the resource opened by the client before the NFS server is restarted according to the reaffirmation mark includes:

[0035] Sending a status reaffirmation signal to the client, wherein the status reaffirmation signal is used to instruct the client to reaffirm the open status of the resource accessed by the client before the NFS server is restarted;

[0036] When receiving the restore open state request sent by the client according to the state reaffirmation signal, determining whether the client ID in the restore open state request exists in the loaded client information;

[0037] When the loaded client information contains the client ID in the restore open status request and the client has been set with a reaffirmation mark, the open status of the resource by the client before the NFS server is restarted is restored.

[0038] In one embodiment, after the opening state of the resource opened by the client before the NFS server is restarted according to the reaffirmation mark, and before the locking state of the resource by the client before the NFS server is restarted based on the opening state, the method further comprises:

[0039] Setting the current state of the reaffirmation flag of the client that has resumed the open state to the resumed open state;

[0040] Creating a state ID corresponding to the resource in the restored open state, and sending the state ID to the client, so that the client can restore the locked state of the resource according to the state ID;

[0041] The restoring, based on the open state, the locking state of the resource by the client before the NFS server is restarted, includes:

[0042] When receiving the lock state request sent by the client according to the state ID, confirming whether the client ID in the restore open state request is the same as the client ID of the client for which the reaffirmation mark is set;

[0043] If they are the same, confirm whether the current state of the reaffirmation mark corresponding to the client ID is the restored open state;

[0044] If so, restore the locked state of the resource before the NFS server is restarted.

[0045] In one embodiment, the step of setting a reaffirmation mark for the client according to the loaded client information and the client ID includes:

[0046] Determine whether the client ID exists in the loaded client information;

[0047] If yes, set a reiteration flag for the client;

[0048] If not, the created client ID is used as the client information of the client and stored, and a reaffirmation mark is set for the client.

[0049] In one embodiment, the loading of client information of at least one client includes:

[0050] Clear the information in the memory;

[0051] Set the initialization state of the data structure;

[0052] storing client information of at least one client in the persistent storage into the set data structure;

[0053] The data structure after loading the client information is stored in the memory.

[0054] In a second aspect, the present application provides an NFS server, including:

[0055] An information loading module, used to load client information of at least one client when the NFS server is restarted;

[0056] a tag processing module, configured to, for each of the clients, create a client ID for the client when receiving an access request from the client; and set a reaffirmation tag for the client according to the client information and the client ID loaded by the information loading module, wherein the reaffirmation tag is used to indicate that the client is allowed to perform a reaffirmation operation;

[0057] A session connection module, used to send the client ID created by the tag processing module to the client, triggering the client to establish a session connection with the NFS server;

[0058] a reaffirmation processing module, configured to restore the open state of the resource opened by the client before the NFS server is restarted according to the reaffirmation mark set by the mark processing module after the client establishes the session connection triggered by the session connection module with the NFS server; and restore the locking state of the resource by the client before the NFS server is restarted based on the open state;

[0059] The information updating module is used to update the client information of the at least one client loaded by the information loading module and the corresponding reaffirmation mark set by the mark processing module based on the open state and the locked state restored by the reaffirmation processing module.

[0060] In a third aspect, the present application provides a fault recovery system, including: an NFS server and at least one client;

[0061] The NFS server is used to load the client information of at least one client when restarting;

[0062] The client is used to send an access request to the NFS server;

[0063] The NFS server is used to create a client ID for the client when receiving an access request from the client; set a reaffirmation mark for the client according to the loaded client information and the client ID, wherein the reaffirmation mark is used to indicate that the client is allowed to perform a reaffirmation operation; send the client ID to the client to trigger the client to establish a session connection with the NFS server; after the client establishes a session connection with the NFS server, according to the reaffirmation mark, restore the open state of the resources opened by the client before the NFS server is restarted; based on the open state, restore the lock state of the resources by the client before the NFS server is restarted; based on the open state, update the client information of at least one client and the corresponding reaffirmation mark.

[0064] In a fourth aspect, the present application provides a computer program product, comprising a computer program / instruction, wherein the computer program / instruction, when executed by a processor, implements the method steps described in any one of the first aspects.

[0065] In a fifth aspect, the present application provides a computer storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the methods described in the first aspect.

[0066] The embodiment of the present application provides a server fault recovery method, an NFS server and a system. When a client access request is received after the NFS server is restarted, a client ID is created for the client. Since each client ID is a unique identification code, it can effectively prevent illegal client access and also help manage the client. By setting a reaffirmation mark, it can be clearly indicated which clients are allowed to perform reaffirmation operations, thereby ensuring that only legal and reliable clients can reestablish sessions and avoid unauthorized access. The reaffirmation mark also helps to track the status of the client, making it convenient to restore its corresponding access status after the NFS server is restarted. Sending the client ID to the client can establish a clear identification basis for subsequent communications and ensure the reliability and consistency of communication. By restoring the open state of the resource, the consistency of the client's operating state before and after the NFS server is restarted is ensured, preventing operation interruptions and errors caused by state differences. By restoring the locked state of the resource, the uniqueness of the client's resource operations before and after the NFS server is restarted is ensured, preventing concurrent operation conflicts. Based on the open and locked status of the resource, the client information and reaffirmation mark are updated to ensure that the client status and operation permissions recorded in the NFS server are the latest, effectively maintaining the real-time and accuracy of the status. The dynamic update mechanism simplifies the system's maintenance and management of the client status. In summary, this application can quickly, efficiently, and safely restore the client's operating status, ensuring the continuity of NFS server services and a good user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0067] Figure 1 is a flow chart of a server failure recovery method provided by an embodiment of the present application;

[0068] Figure 2 is a flow chart of another server failure recovery method provided by an embodiment of the present application;

[0069] Figure 3 is a schematic diagram of an NFS server provided by an embodiment of the present application;

[0070] Figure 4 It is a schematic diagram of a server failure recovery system provided in one embodiment of the present application. DETAILED DESCRIPTION

[0071] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0072] Figure 1 A flowchart of a server failure recovery method provided in an embodiment of the present application, the method is applied to an NFS server, and specifically includes the following steps:

[0073] Step 101: When the NFS server is restarted, client information of at least one client is loaded.

[0074] In the embodiment of the present application, by loading the client information when the server restarts, the NFS server can restore the status of each client later, thereby reducing data inconsistency and service interruption time. This preloading process can quickly restore the integrity of the system and provide basic data support for subsequent recovery operations.

[0075] Step 102: For each client, execute: when receiving an access request from the client, create a client ID for the client.

[0076] In the embodiment of the present application, a unique client ID is created for the client, which can accurately identify and distinguish different clients, and help to more accurately manage and restore the state of each client. This helps to avoid data errors or resource conflicts caused by confusion, and lays the foundation for subsequent session establishment and state recovery.

[0077] Step 103: according to the loaded client information and the client ID, a reaffirmation mark is set for the client, wherein the reaffirmation mark is used to indicate that the client is allowed to perform a reaffirmation operation.

[0078] In the embodiment of the present application, a reaffirmation mark is set to make it easier to clarify the status of the client being allowed to perform the recovery operation, thereby enhancing the controllability of the NFS server recovery, effectively avoiding unnecessary resource locking and state inconsistency, and ensuring the consistency and integrity of the data.

[0079] Step 104: Send the client ID to the client, triggering the client to establish a session connection with the NFS server.

[0080] In the embodiment of the present application, sending the client ID and triggering the session connection can ensure that the client can quickly establish a new connection with the NFS server. This reduces the communication delay between the client and the NFS server, helps to speed up the recovery process, and improves the stability and response speed of the system operation.

[0081] Step 105: After the client establishes a session connection with the NFS server, the open state of the resources opened by the client before the NFS server is restarted is restored according to the re-affirmation mark.

[0082] In the embodiment of the present application, by restoring the opened resource status based on the re-mark, the working environment of the client before the NFS server restart can be quickly rebuilt, reducing the service interruption caused by the NFS server restart. This ensures the availability of resources and the consistency of data, and improves the reliability of the NFS server.

[0083] Step 106: Based on the open state, restore the resource locking state of the client before the NFS server is restarted.

[0084] In the embodiment of the present application, based on the open state of the resource, the locked state of the resource is restored, which can avoid concurrent access to the same resource by multiple clients and data conflicts. This helps maintain the consistency and integrity of the NFS server, ensures that the operations between clients do not interfere with each other, and helps improve the concurrent management capability of the system.

[0085] Step 107: Based on the open state and the locked state, update the client information and the corresponding reaffirmation mark of at least one client.

[0086] In the embodiment of the present application, by updating the client information and reiterating the mark in real time, it is ensured that the NFS server can accurately grasp the latest status of each client. This not only improves the dynamic management capability of the NFS server, but also lays the foundation for future server restart or fault recovery, which helps to continuously ensure the stability and operation efficiency of the system.

[0087] In an embodiment of the present application, when an access request from a client is received, before a client ID is created for the client, the following steps are further included:

[0088] Determine whether the access request is a heartbeat signal;

[0089] If yes, create a client ID for the client;

[0090] If not, feedback information is sent to the client, wherein the feedback information is used to indicate that the NFS client is in a restart phase and rejects the non-re-assertion request.

[0091] In one embodiment of the present application, by distinguishing heartbeat signals from other access requests, the NFS server can effectively avoid responding to inconsistent status requests during the restart process. By clearly informing the client that the server is restarting and rejecting non-reiteration requests through feedback information, the client's repeated requests and the possible pressure on the server can be effectively reduced. The NFS server will only create a client ID for the client after confirming that the request is a heartbeat signal, otherwise it will reject the non-reiteration request. This mechanism can concentrate resources to handle the most important recovery operations during the restart phase when system resources are tight, thereby improving system efficiency.

[0092] In an embodiment of the present application, when the access request is a heartbeat signal, before creating a client ID for the client, the method further includes:

[0093] confirming whether the updating of the client information and the corresponding reaffirmation mark of at least one client is completed;

[0094] If yes, a confirmation signal is sent to the client to indicate that the connection between the NFS server and the client is normal;

[0095] If not, execute Create a client ID for the client.

[0096] In one embodiment of the present application, after confirming the heartbeat signal and confirming that the update of each client information and the corresponding reaffirmation mark have been completed, it indicates that the NFS server has been restored. At this time, a confirmation signal is sent to the client to quickly confirm the connection status with the client. If the update of the client information and the reaffirmation mark are not completed, it indicates that the NFS server is still in the fault recovery stage. Therefore, the purpose of reaffirming the recovery status of the client is achieved through the created client ID.

[0097] In an embodiment of the present application, when the access request is a heartbeat signal, a client ID is created for the client, including:

[0098] Send a status code to the client indicating that the current session is invalid;

[0099] When receiving a session re-establishment request sent by the client according to the status code, sending an error code to the client indicating that the client ID in the session re-establishment request is invalid;

[0100] When a client ID change request sent by the client according to the error code is received, a corresponding client ID is created for the client based on the information in the client ID change request.

[0101] In one embodiment of the present application, since the client ID information is lost after the NFS server is restarted, it is necessary to re-assign the client ID to the client. The specific process is: when the access request sent by the client is a heartbeat signal, by sending the status code of the invalid session to the client, the client can clearly know that the current session has expired, avoiding data inconsistency or errors caused by continued operation. In this way, when the client sends the previously created client ID again, the NFS server can clearly inform the client that the client ID currently used is unavailable or expired by sending the error code of the invalid ID to the client, preventing the continued use of the invalid client ID. For the processing of the invalid client ID, it can effectively avoid the re-establishment of illegal or unsafe sessions and improve the security of the NFS client. After receiving the client ID change request from the client, a new client ID is created for the client, so that the client can continue to operate normally and restore the connection. Providing a new client ID to the client can also strengthen the identity authentication process of the client, prevent the unauthorized reuse of the previous client ID, and improve the overall security of the NFS server.

[0102] In an embodiment of the present application, based on the open state and the locked state, updating the client information and the corresponding reaffirmation mark of at least one client includes:

[0103] Sending a confirmation message to the client indicating that the lock state has been restored;

[0104] When receiving a reaffirmation completion request sent by the client according to the confirmation information to indicate that the reaffirmation status has been completed, sending a status recovery notification to the client, wherein the status recovery notification is used to indicate that the open state and the lock state of the resource have been restored;

[0105] Set the current state of the client's reaffirmation flag to state reaffirmation completed;

[0106] According to the client whose status has been reaffirmed and the current time point, client information of at least one client is updated.

[0107] In one embodiment of the present application, after restoring the lock state of the resource for the client, sending a confirmation message to the client can clearly inform the client that the lock state has been restored, thereby improving the client's visibility and understanding of the operation state, ensuring that the operation process of the client and the server is synchronized, and helping to reduce misunderstandings and potential problems. The state recovery notification sent to the client based on the reaffirmation completion request sent by the client has a detailed resource state feedback function, which can clearly convey the current state of the resource to the client and improve information transparency. At the same time, the restoration of the lock and resource state is confirmed by an explicit message, further ensuring the data consistency between the client and the server. Then, by marking the reaffirmation state as completed, the client's operation progress can be clearly recorded, avoiding repeated operations, helping to track the client's operation path and state changes, and providing a clear reference for subsequent operations or problem analysis. Finally, the client information update based on the current time point and client state helps to maintain the real-time and accuracy of the client information.

[0108] In an embodiment of the present application, updating the client information of at least one client according to the client whose status has been reaffirmed and the current time point includes:

[0109] According to a preset detection cycle, determine whether the current status of the reaffirmation mark of each loaded client is that the status reaffirmation is completed;

[0110] If yes, execute the preset background task;

[0111] If not, determine whether the time difference between the current time point and the time point when the NFS server is restarted is greater than or equal to the preset fault recovery duration. If so, delete the client information of at least one client whose status has not been marked as reaffirmed, and execute the preset background task.

[0112] In one embodiment of the present application, through a preset detection cycle, the NFS server can regularly check the reaffirmation status of each client to ensure continuous supervision of the client's status changes. When the reaffirmation status of all clients is completed, the NFS server can automatically execute the preset background tasks, reduce manual intervention, improve work efficiency, and optimize the use of system resources to ensure that system resources are fully utilized at the right time. The NFS server provides a fault recovery time window, and waits for all clients to complete the status reaffirmation during the fault recovery time. When the NFS server fault recovery time is reached, the client that failed to complete the status reaffirmation is cleared, which helps the NFS server to clean up useless or abnormal client information and keep the system clean and efficient. At the same time, through this fault-tolerant mechanism, it can be ensured that the operation of other normal clients proceeds smoothly and is not dragged down by abnormal clients. Even if some clients fail to complete the status reaffirmation, NFSfuwuduan can continue to execute the preset background tasks to ensure that key tasks are not interrupted and enhance the continuity and reliability of the NFS server.

[0113] In an embodiment of the present application, according to the re-mark, restoring the open state of the resource opened by the client before the NFS server is restarted includes:

[0114] Sending a status reaffirmation signal to the client, wherein the status reaffirmation signal is used to instruct the client to reaffirm the open status of the resource accessed by the client before the NFS server is restarted;

[0115] When receiving a restore open state request sent by the client according to the state reaffirmation signal, determining whether the client ID in the restore open state request exists in the loaded client information;

[0116] When the loaded client information contains the client ID in the restore open status request and the client has been set with a reaffirmation mark, the client's open status of the resource before the NFS server was restarted is restored.

[0117] In one embodiment of the present application, sending a status reaffirmation signal to the client can ensure that the client reconfirms its resource access status after the server restarts to maintain the consistency of the system. After receiving the client's request to restore the open status, the legality and validity of the request can be verified by confirming the client ID to prevent illegal or erroneous requests from entering the system; ensuring that only clients that exist in the system can restore the resource status helps to optimize resource management and prevent system resources from being occupied by invalid requests. If it is confirmed that the client ID exists and the reaffirmation mark is set, the open status of the resource accessed by the client is immediately restored to ensure the continuity of the client's operation and the consistency of the data.

[0118] In an embodiment of the present application, after restoring the open state of the resource opened by the client before the NFS server is restarted according to the reaffirmation mark, and before restoring the lock state of the resource by the client before the NFS server is restarted based on the open state, the method further includes:

[0119] Set the current state of the reaffirmation flag of the client that has resumed the open state to the resumed open state;

[0120] Creating a state ID corresponding to the resource in the restored open state, and sending the state ID to the client so that the client can restore the locked state of the resource according to the state ID;

[0121] Based on the open state, restore the resource lock state that the client had before the NFS server was restarted, including:

[0122] When receiving a lock state request sent by the client according to the state ID, confirm whether the client ID in the restore open state request is the same as the client ID of the client for which the reaffirmation mark is set;

[0123] If they are the same, confirm whether the current state of the reaffirmation mark corresponding to the client ID is the restored open state;

[0124] If so, restore the resource to the locked state before the NFS server was restarted.

[0125] In one embodiment of the present application, after restoring the open state of the resource for the client, the current state of the reaffirmation mark is modified to restore the open state, which can effectively track the status recovery progress of the client, so as to more accurately manage the recovery process in the subsequent steps. It can also prevent repeated recovery operations, thereby avoiding unnecessary occupation of resources and system redundant operations. Creating a unique state ID for each resource that has been restored to the open state helps to accurately manage and identify the state of each resource and avoid confusion. Sending the state ID to the client can enable both parties to clarify and unify the operation of the lock state, thereby improving the clarity and efficiency of communication. When the client receives the lock state request for the resource that has been restored to the open state, by confirming whether the client ID is consistent with the client ID of the reaffirmation mark, it can prevent illegal or non-existent requests from performing lock state recovery, ensuring the safety and effectiveness of the recovery process. Further verifying the current state of the reaffirmation mark, ensuring that the recovery of the lock state of the resource is performed only when the reaffirmation mark is in the restored open state, can prevent erroneous operations caused by lost or invalid states.

[0126] In an embodiment of the present application, a reaffirmation mark is set for the client according to the loaded client information and the client ID, including:

[0127] Determine whether the client ID exists in the loaded client information;

[0128] If so, set the reaffirmation flag for the client;

[0129] If not, the created client ID is used as the client information of the client and stored, and a reaffirmation flag is set for the client.

[0130] In one embodiment of the present application, by checking whether a client ID exists, the step of creating a client ID can be skipped when a client ID already exists in the loaded client information, thereby reducing unnecessary operations and improving resource utilization efficiency. A reaffirmation mark is set for the existing client ID to ensure that the client can continue the unfinished operation after the NFS server is restarted. This helps to maintain the continuity of the operation when the connection is restored. Through the reaffirmation mark, the state of the client session can be effectively managed to ensure that the system can correctly handle the recovery requirements of the session. If the client ID of the client is not in the loaded client information, a unique client ID is created and assigned for the new client without the client ID to ensure that the NFS server can correctly identify and manage the newly added client. A reaffirmation mark is set for the newly created client ID to ensure that the new client can also continue its unfinished operation after events such as the NFS server restart, thereby providing a consistent recovery mechanism.

[0131] In an embodiment of the present application, loading client information of at least one client includes:

[0132] Clear the information in the memory;

[0133] Set the initialization state of the data structure;

[0134] Storing client information of at least one client in the persistent storage into the set data structure;

[0135] Store the data structure after loading the client information into the memory.

[0136] In one embodiment of the present application, when the NFS server is restarted, clearing the information in the existing memory can release system resources, which is particularly important for services that run for a long time, because some data in the memory may no longer be needed or become garbage data. By setting the initialization state of the data structure, the consistency and stability of the data structure can be ensured each time the NFS server is started, even in different environments or conditions. The client information is extracted from the persistent storage and loaded into the data structure in the memory to ensure the consistency and integrity of the data and prevent data loss. After the NFS server is restarted, loading the client information helps to quickly restore the client state to the state before the NFS server was restarted, shortening the downtime and improving the user experience.

[0137] like Figure 2In order to more clearly illustrate the technical solution and advantages of the present application, a server failure recovery method provided by an embodiment of the present application is described in detail below, which may specifically include the following steps:

[0138] Step 201: When the NFS server is restarted, it clears the information in the memory, sets the initialization state of the data structure, stores the client information of at least one client in the persistent storage into the set data structure, and stores the data structure after loading the client information into the memory.

[0139] Specifically, clearing memory during restart can release resources that have not been reallocated, which helps to free up memory and clean up garbage data. Uninitialized data structures may lead to undefined behavior, and initialization can greatly reduce such runtime errors. Loading client information from persistent storage can help quickly restore the client state to the session state before restart. Storing data in memory significantly speeds up data access. Memory access is much faster than disk access, which can significantly shorten response time.

[0140] For example, the client IP, client ID, node name of client a and the client IP, client ID, node name of client b are loaded into the initialized data structure as corresponding client information.

[0141] Step 202: The NFS server determines whether the access request from the client is a heartbeat signal. If so, execute step 203; otherwise, execute step 208.

[0142] Specifically, confirming whether the access request sent by client a is a heartbeat signal is conducive to the subsequent confirmation of whether the connection status between the NFS server and client a is normal. By checking the heartbeat signal, the server can timely understand and record the connection status of each client.

[0143] Step 203: The NFS server confirms whether the update of each client information and the re-mark is completed. If so, execute step 204; otherwise, execute step 205.

[0144] Specifically, the NFS server confirms whether the update of the client information of the client a and the client b and the reiteration mark are completed, so as to confirm the completion of the fault recovery of the NFS server.

[0145] Step 204: The NFS server sends a confirmation signal to the client to indicate that the connection between the NFS server and the client is normal, and the current process ends.

[0146] Specifically, sending a confirmation signal to client a to feedback that the connection is in a normal state can ensure the integrity of the communication, and client a can perform the next operation according to the received feedback.

[0147] Step 205: The NFS server sends a status code indicating that the current session is invalid to the client, and step 206 is executed.

[0148] Specifically, when the NFS server has not completed updating the client information and reaffirming the mark, it indicates that the NFS server is still in the fault recovery period. Therefore, by sending a status code indicating that the current session is invalid to client a, it is helpful for client a to re-establish a session connection with the NFS server, and the recovery period is the state before the NFS server is restarted.

[0149] Step 206: When the NFS server receives the session re-establishment request sent by the client according to the status code, it sends an error code to the client indicating that the client ID in the session re-establishment request is invalid.

[0150] Specifically, after the NFS server is restarted, the client information stored before the restart has been cleared, so it is necessary to recreate an ID for client a to ensure the legitimacy of client a. The NFS server explicitly tells client a that its ID is invalid, so that client a knows that it needs to change its ID and prevents incorrect session recovery requests.

[0151] Step 207 : When the NFS server receives the client ID change request sent by the client according to the error code, it creates a corresponding client ID for the client based on the information in the client ID change request and executes step 209 .

[0152] Specifically, when the NFS server creates a client ID for the client a, it may create a client ID for the client a according to the client IP and the node name in the client ID change request sent by the client a.

[0153] Step 208: The NFS server sends feedback information to the client, and the current process ends.

[0154] Specifically, during the restart phase, the NFS server rejects all non-reaffirmation lock requests and read / write requests, and sends feedback to the client to inform the client that the server is currently in the restart phase and only accepts reaffirmation requests to prevent other operations from interfering with the recovery process. By limiting non-reaffirmation requests, the system stability and consistency during the restart phase are maintained.

[0155] Step 209: The NFS server determines whether the client ID exists in the loaded client information. If so, execute step 211; otherwise, execute step 210.

[0156] Specifically, by confirming whether the client ID of client a exists in the loaded client information, the existence of the client ID is checked to determine the next operation.

[0157] Step 210: The NFS server uses the created client ID as the client information of the client and stores it, and then executes step 211.

[0158] Specifically, if the loaded client information does not include the client ID of client a, a client ID needs to be created for client a to ensure subsequent operations of client a.

[0159] Step 211: The NFS server sets a reaffirmation mark for the client, and executes step 212.

[0160] Specifically, for an existing client ID, a reaffirmation mark is set for client a to allow reaffirmation operation, so as to facilitate monitoring of the reaffirmation status of client a and facilitate system management and control.

[0161] Step 212: The NFS server sends the client ID to the client, triggering the client to establish a session connection with the NFS server, and sends a status reaffirmation signal to the client.

[0162] Specifically, the client ID is sent to the client a to ensure that the client a receives the new client ID and the reaffirmation signal, thereby maintaining the consistency of the information of the client a and the NFS server.

[0163] Step 213: When the NFS server receives the restore open status request sent by the client according to the status reaffirmation signal, and the loaded client information contains the client ID in the restore open status request, and the client has been set with a reaffirmation mark, the client restores the open status of the resource before the NFS server is restarted.

[0164] Specifically, when it is determined that the client ID in the restore open status request is the client ID in the loaded client information, it indicates that the identity of client a is legal, and the reaffirmation mark has been set for client a, indicating that client a is allowed to reaffirm the status. Therefore, the open status of the resource can be restored for client a based on the file handle or status information of the resource maintained before the NFS server is restarted in the restore open status request.

[0165] It is understandable that the restore open state request may be an OPEN request with a RECLAIM_PREVIOUS flag.

[0166] Step 214: The NFS server sets the current state of the reaffirmation mark of the client that has resumed the open state to the resumed open state, creates a state ID corresponding to the resource in the resumed open state, and sends the state ID to the client.

[0167] Specifically, the current state of the reaffirmation mark of client a is set to the recovery open state, so that the resource recovery state can be clearly tracked and the recovery mark can be set for the next operation. The state ID is sent to the client so that it can synchronize and confirm the resource state to ensure the correctness of subsequent operations.

[0168] It is understandable that the state ID may be stateId.

[0169] Step 215: When the NFS server receives a lock status request sent by the client according to the status ID, and the client ID in the restore open status request is the same as the client ID of the client with the reaffirmation mark set, and the current state of the reaffirmation mark corresponding to the client ID is the restore open state, the lock state of the resource before the NFS server is restarted is restored.

[0170] Specifically, after client a sends a lock status request, it is necessary to first confirm whether the client ID of client a matches the client ID in the loaded client information, and preliminarily determine the legitimacy of the identity of client a through the client ID. Then confirm whether the current state of the reaffirmation mark of client a is the restored open state, and then confirm whether client a is allowed to restore the lock state of the resource to ensure the normal use of the resource.

[0171] It is understandable that the lock state request may be a LOCK request with a RECLAIM flag.

[0172] Step 216: The NFS server sends a confirmation message to the client indicating that the locking state has been restored.

[0173] Specifically, the client is explicitly informed that the lock status of a has been restored, ensuring that the client understands the current restored status of the resource.

[0174] Step 217: When the NFS server receives the reaffirmation completion request sent by the client according to the confirmation information to indicate that the reaffirmation status has been completed, it sends a status recovery notification to the client and sets the current status of the client's reaffirmation mark to status reaffirmation completed.

[0175] Specifically, the reaffirmation completion request sent by client a, such as a RECLAIM_COMPLETE request, serves as a formal notification of the completion of the state recovery. After receiving the reaffirmation completion request, the NFS server sends a state recovery notification to client a to notify client a that the open and locked states of the resources have been restored, ensuring the integrity of the session state. The reaffirmation flag of client a is set to state reaffirmation completed, indicating that client a has completed the state reaffirmation, and the reaffirmation completion counter is recorded.

[0176] Step 218: The NFS server determines whether the current status of the reaffirmation mark of each loaded client is status reaffirmation completed according to a preset detection period. If so, execute step 220; otherwise, execute step 219.

[0177] Specifically, according to a preset detection cycle, the re-status of all clients is confirmed, so as to confirm the fault recovery status of the NFS server.

[0178] Step 219: When the time difference between the current time point and the time point when the NFS server is restarted is greater than or equal to the preset fault recovery duration, the NFS server deletes the client information of the client whose status has not been marked as restated, and executes step 220.

[0179] Specifically, within the preset fault recovery period, if client b fails to complete the status reaffirmation, the client information of client b that has not been recovered after the timeout is cleared, the system resources are released, and the efficient operation of the system is ensured. The fault recovery period is forced to end to prevent the NFS server from not providing services for a long time.

[0180] Step 220: The NFS server executes a preset background task.

[0181] Specifically, the system is maintained by executing preset background tasks to ensure the long-term stable operation of the system. The client status information in the persistent storage is updated to ensure that all status changes are persistently stored, providing accurate data for possible future recovery operations.

[0182] like Figure 3 As shown, the present application provides an NFS server, including:

[0183] The information loading module 301 is used to load the client information of at least one client when the NFS server is restarted;

[0184] The tag processing module 302 is used to create a client ID for each client when receiving an access request from the client; and set a reaffirmation tag for the client according to the client information and the client ID loaded by the information loading module 301, wherein the reaffirmation tag is used to indicate that the client is allowed to perform a reaffirmation operation;

[0185] The session connection module 303 is used to send the client ID created by the tag processing module 302 to the client, triggering the client to establish a session connection with the NFS server;

[0186] The reaffirmation processing module 304 is used to restore the open state of the resources opened by the client before the NFS server is restarted according to the reaffirmation mark set by the mark processing module 302 after the client establishes the session connection triggered by the session connection module 303 with the NFS server; based on the open state, restore the locking state of the resources by the client before the NFS server is restarted;

[0187] The information updating module 305 is used to update the client information of at least one client loaded by the information loading module 301 and the corresponding reaffirmation mark set by the mark processing module 302 based on the open state and the locked state restored by the reaffirmation processing module 304 .

[0188] like Figure 4 As shown, the present application provides a fault recovery system, including: an NFS server 401 and at least one client 402;

[0189] The NFS server 401 is used to load the client information of at least one client when restarting;

[0190] Client 402, used to send access request to NFS server;

[0191] The NFS server 401 is used to create a client ID for the client when receiving an access request from the client; set a reaffirmation mark for the client according to the loaded client information and the client ID, wherein the reaffirmation mark is used to indicate that the client is allowed to perform a reaffirmation operation; send the client ID to the client to trigger the client to establish a session connection with the NFS server; after the client establishes a session connection with the NFS server, according to the reaffirmation mark, restore the open state of the resources that the client has opened before the NFS server is restarted; based on the open state, restore the lock state of the resources by the client before the NFS server is restarted; based on the open state and the lock state, update the client information and the corresponding reaffirmation mark of at least one client.

[0192] The embodiment of the present application provides a schematic diagram of the structure of an electronic device, and the specific embodiment of the present application does not limit the specific implementation of the electronic device.

[0193] The electronic device may include: a processor, a communication interface, a memory, and a communication bus.

[0194] The processor, the communication interface, and the memory communicate with each other via a communication bus.

[0195] Communication interface, used to communicate with other electronic devices or servers.

[0196] The processor is used to execute the program, and specifically can execute the relevant steps in the above method embodiment.

[0197] Specifically, the program may include program codes including computer operation instructions.

[0198] The processor may be a CPU, a GPU (Graphic Processing Unit), an ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of the present application. The one or more processors included in the smart device may be processors of the same type, such as one or more CPUs; or may be processors of different types, such as one or more CPUs and one or more ASICs.

[0199] The memory is used to store programs. The memory may include a high-speed RAM memory, and may also include a non-volatile memory, such as at least one disk memory.

[0200] The program may include multiple computer instructions. Specifically, the program may enable a processor to execute operations corresponding to the method described in any of the aforementioned method embodiments through the multiple computer instructions.

[0201] The specific implementation of each step in the program can refer to the corresponding description of the corresponding steps and units in the above method embodiment, and has corresponding beneficial effects, which will not be repeated here. The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, the specific working process of the above-described devices and modules can refer to the corresponding process description in the above method embodiment, which will not be repeated here.

[0202] The present application also provides a computer storage medium on which a computer program is stored, and when the program is executed by a processor, the method described in any of the above-mentioned multiple method embodiments is implemented. The computer storage medium includes but is not limited to: a compact disc read-only memory (CD-ROM), a random access memory (RAM), a floppy disk, a hard disk or a magneto-optical disk, etc.

[0203] An embodiment of the present application also provides a computer program product, including computer instructions, which instruct a computing device to execute operations corresponding to any one of the above-mentioned multiple method embodiments.

[0204] In addition, it should be noted that the user-related information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to sample data used to train the model, data used for analysis, stored data, displayed data, etc.) involved in the embodiments of the present application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data need to comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0205] It should be pointed out that, according to the needs of implementation, the various components / steps described in the embodiments of the present application can be split into more components / steps, or two or more components / steps or partial operations of components / steps can be combined into new components / steps to achieve the purpose of the embodiments of the present application.

[0206] The above-mentioned method according to the embodiment of the present application can be implemented in hardware, firmware, or implemented as software or computer code that can be stored in a recording medium (such as a CD-ROM, RAM, floppy disk, hard disk or magneto-optical disk), or implemented as a computer code originally stored in a remote recording medium or a non-temporary machine-readable medium downloaded through a network and stored in a local recording medium, so that the method described herein can be stored in such software processing on a recording medium using a general-purpose computer, a dedicated processor or programmable or dedicated hardware (such as an application-specific integrated circuit (ASIC) or a field programmable gate array (FPGA)). It can be understood that a computer, a processor, a microprocessor controller or programmable hardware includes a storage component (e.g., a random access memory (RAM), a read-only memory (ROM), a flash memory, etc.) that can store or receive software or computer code, and when the software or computer code is accessed and executed by a computer, a processor or hardware, the method described herein is implemented. In addition, when a general-purpose computer accesses the code for implementing the method shown here, the execution of the code converts the general-purpose computer into a dedicated computer for executing the method shown here.

[0207] Those of ordinary skill in the art will appreciate that the units and method steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for specific applications, but such implementation should not be considered to be beyond the scope of the embodiments of the present application.

[0208] The above implementation methods are only used to illustrate the embodiments of the present application, and are not limitations on the embodiments of the present application. Ordinary technicians in the relevant technical field can make various changes and modifications without departing from the spirit and scope of the embodiments of the present application. Therefore, all equivalent technical solutions also belong to the scope of the embodiments of the present application. The scope of patent protection of the embodiments of the present application should be limited by the claims.

Claims

1. A server failure recovery method, characterized in that: Applied to NFS server, including: When the NFS server is restarted, the client information of at least one client is loaded, and for each of the clients, the following operations are executed: When receiving an access request from the client, creating a client ID for the client; According to the loaded client information and the client ID, a reaffirmation mark is set for the client, wherein the reaffirmation mark is used to indicate that the client is allowed to perform a reaffirmation operation; Sending the client ID to the client to trigger the client to establish a session connection with the NFS server; After the client establishes a session connection with the NFS server, according to the reaffirmation mark, the open state of the resource opened by the client before the NFS server is restarted is restored; Based on the open state, restore the locking state of the resource by the client before the NFS server is restarted; Based on the open state and the locked state, the client information of the at least one client and the corresponding reaffirmation mark are updated.

2. The method according to claim 1, characterized in that When receiving an access request from the client, before creating a client ID for the client, the method further includes: Determining whether the access request is a heartbeat signal; If so, executing the step of creating a client ID for the client; If not, feedback information is sent to the client, wherein the feedback information is used to indicate that the NFS client is in a restart phase and rejects the non-re-assertion request.

3. The method according to claim 2, characterized in that When the access request is a heartbeat signal, before creating a client ID for the client, the method further includes: confirming whether the updating of the client information of the at least one client and the corresponding reaffirmation mark is completed; If yes, sending a confirmation signal to the client to indicate that the connection between the NFS server and the client is normal; If not, executing the step of creating a client ID for the client; and / or, When the access request is a heartbeat signal, creating a client ID for the client includes: Sending a status code indicating that the current session is invalid to the client; When receiving a session re-establishment request sent by the client according to the status code, sending to the client an error code indicating that the client ID in the session re-establishment request is invalid; When receiving a client ID change request sent by the client according to the error code, a corresponding client ID is created for the client based on information in the client ID change request.

4. The method according to claim 1, characterized in that: The updating of the client information of the at least one client and the corresponding reaffirmation mark based on the open state and the locked state includes: Sending a confirmation message to the client indicating that the locking state has been restored; When receiving a reaffirmation completion request sent by the client according to the confirmation information and used to indicate that the reaffirmation status has been completed, sending a status recovery notification to the client, wherein the status recovery notification is used to indicate that the open state and the locked state of the resource have been restored; Setting the current state of the reaffirmation mark of the client to state reaffirmation completed; The client information of the at least one client is updated according to the client whose status has been reaffirmed and the current time point.

5. The method according to claim 4, characterized in that The updating of the client information of the at least one client according to the client whose status has been reaffirmed and the current time point includes: According to a preset detection cycle, determining whether the current status of the reaffirmation marks of each of the loaded clients is that the status reaffirmation is completed; If yes, execute the preset background task; If not, determine whether the time difference between the current time point and the time point when the NFS server is restarted is greater than or equal to the preset fault recovery duration. If so, delete the client information of the at least one client whose status has not been marked as reaffirmed, and execute the preset background task.

6. The method according to any one of claims 1 to 5, characterized in that: The step of restoring the open state of the resource opened by the client before the NFS server is restarted according to the reaffirmation mark includes: Sending a status reaffirmation signal to the client, wherein the status reaffirmation signal is used to instruct the client to reaffirm the open status of the resource accessed by the client before the NFS server is restarted; When receiving the restore open state request sent by the client according to the state reaffirmation signal, determining whether the client ID in the restore open state request exists in the loaded client information; When the loaded client information contains the client ID in the restore open status request and the client has been set with a reaffirmation mark, restore the open status of the resource by the client before the NFS server is restarted; and / or, After the step of restoring the open state of the resource opened by the client before the NFS server is restarted according to the reaffirmation mark, and before the step of restoring the lock state of the resource by the client before the NFS server is restarted based on the open state, the method further comprises: Setting the current state of the reaffirmation flag of the client that has resumed the open state to the resumed open state; Creating a state ID corresponding to the resource in the restored open state, and sending the state ID to the client, so that the client can restore the locked state of the resource according to the state ID; The restoring, based on the open state, the locking state of the resource by the client before the NFS server is restarted, includes: When receiving the lock state request sent by the client according to the state ID, confirming whether the client ID in the restore open state request is the same as the client ID of the client for which the reaffirmation mark is set; If they are the same, confirm whether the current state of the reaffirmation mark corresponding to the client ID is the restored open state; If yes, restore the resource to the locked state before the NFS server was restarted; and / or, The step of setting a reaffirmation mark for the client according to the loaded client information and the client ID includes: Determine whether the client ID exists in the loaded client information; If yes, set a reiteration flag for the client; If not, the created client ID is used as the client information of the client and stored, and a reaffirmation mark is set for the client; and / or, The loading of the client information of at least one client includes: Clear the information in the memory; Set the initialization state of the data structure; storing client information of at least one client in the persistent storage into the set data structure; The data structure after loading the client information is stored in the memory.

7. An NFS server, characterized in that: include: An information loading module, used to load client information of at least one client when the NFS server is restarted; a tag processing module, configured to, for each of the clients, create a client ID for the client when receiving an access request from the client; and set a reaffirmation tag for the client according to the client information and the client ID loaded by the information loading module, wherein the reaffirmation tag is used to indicate that the client is allowed to perform a reaffirmation operation; A session connection module, used to send the client ID created by the tag processing module to the client, triggering the client to establish a session connection with the NFS server; a reaffirmation processing module, configured to restore the open state of the resource opened by the client before the NFS server is restarted according to the reaffirmation mark set by the mark processing module after the client establishes the session connection triggered by the session connection module with the NFS server; and restore the locking state of the resource by the client before the NFS server is restarted based on the open state; The information updating module is used to update the client information of the at least one client loaded by the information loading module and the corresponding reaffirmation mark set by the mark processing module based on the open state and the locked state restored by the reaffirmation processing module.

8. A fault recovery system, characterized in that: include: NFS server and at least one client; The NFS server is used to load the client information of at least one client when restarting; The client is used to send an access request to the NFS server; The NFS server is used to create a client ID for the client when receiving an access request from the client; According to the loaded client information and the client ID, a reaffirmation mark is set for the client, wherein the reaffirmation mark is used to indicate that the client is allowed to perform a reaffirmation operation; the client ID is sent to the client to trigger the client to establish a session connection with the NFS server; after the client establishes a session connection with the NFS server, according to the reaffirmation mark, the open state of the resource opened by the client before the NFS server is restarted is restored; based on the open state, the locking state of the resource by the client before the NFS server is restarted is restored; Based on the open state and the locked state, the client information of the at least one client and the corresponding reaffirmation mark are updated.

9. A computer program product comprising a computer program / instructions, wherein: When the computer program / instructions are executed by a processor, the method steps of any one of claims 1 to 6 are implemented.

10. A computer storage medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the method according to any one of claims 1 to 6.