A method, device, equipment and medium for storing NFS files
By receiving NFS requests, collecting and summarizing the IO information of each node, and determining the master node and storage method, the problem of low efficiency in storing NFS files in the existing technology is solved, and an automated and efficient storage process is realized.
Patent Information
- Application Number
- CN202210831354.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-15
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2042-07-15
AI Technical Summary
The existing method of storing NFS files requires manual aggregation of logs of each node, resulting in low storage efficiency and the inability to store NFS files at the same time.
By receiving NFS requests, the IO information of each node is collected, the master node is determined, and the IO information is sent to the master node for summary, and the storage method and unit are determined based on the IO information to realize the automated storage process.
Improved storage efficiency, reduced node log opening time, increased IO information collection rate, and achieved a more efficient storage process.
Smart Images

Figure CN115102972B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, apparatus, device and medium for storing NFS files. Background Art
[0002] With the rapid development of computer technology, corresponding requirements have been put forward for the development of the Network File System (NFS). As a distributed file system, NFS can generally be used to solve distributed services, data sharing and other functions. The existing method of storing NFS files is that technicians manually summarize the logs of each node operation, find the read and write IO of the same file from different node logs, summarize and count them according to the time sequence, and determine the storage method of the file, and store the NFS file with this storage method. In this process, it is necessary to open the node log to find the read and write IO information of the same NFS file. Since the storage of NFS files cannot be realized at the same time when the node log is opened, the storage efficiency is low.
[0003] In view of the above-mentioned problems, finding out how to improve storage efficiency is a problem that those skilled in the art are trying their best to solve. Summary of the invention
[0004] The purpose of this application is to provide a method, apparatus, device and medium for storing NFS files, so as to improve storage efficiency.
[0005] To solve the above technical problems, the present application provides a method for storing NFS files, including:
[0006] Receive NFS requests;
[0007] Collect IO information of NFS files on each node based on NFS requests;
[0008] Determine the master node among each node;
[0009] Send IO information to the master node for aggregation;
[0010] Determine the storage method of NFS files based on IO information;
[0011] Store NFS files according to the storage method.
[0012] Preferably, determining the master node in each node includes:
[0013] The master node is determined among each node according to the preset rules.
[0014] Preferably, determining the master node among the nodes according to a preset rule includes:
[0015] Set the corresponding time weight value according to the time sequence in which the IO information appears at each node;
[0016] The master node is determined based on the time weight value.
[0017] Preferably, determining the master node among the nodes according to a preset rule includes:
[0018] The memory weight value corresponding to the memory setting recorded in each node according to the IO information;
[0019] The master node is determined based on the memory weight value.
[0020] Preferably, the method for determining the storage of NFS files according to IO information includes:
[0021] Determine the storage unit of the NFS file based on IO information;
[0022] The storage method of the NFS file is determined according to the storage unit, the storage units are respectively a first storage unit and a second storage unit, and the first storage unit is larger than the second storage unit.
[0023] Preferably, storing the NFS file according to the storage method includes:
[0024] Determine whether the storage unit reaches the preset storage unit;
[0025] If yes, the NFS file is stored according to the first storage unit;
[0026] If not, the NFS file is stored according to the second storage unit.
[0027] Preferably, after storing the NFS file according to the storage method, the method further includes:
[0028] Outputs a prompt message indicating that the NFS file storage is complete.
[0029] To solve the above technical problems, the present application also provides a device for storing NFS files, which is applied to all the above-mentioned methods for storing NFS files, including:
[0030] A receiving module, used for receiving NFS requests;
[0031] The collection module is used to collect the IO information of NFS files on each node according to NFS requests;
[0032] A first determination module is used to determine a master node among each node;
[0033] The sending and summarizing module is used to send IO information to the master node for summarization;
[0034] A second determination module is used to determine the storage method of the NFS file according to the IO information;
[0035] The first storage module is used to store the NFS file according to the storage method.
[0036] In addition, the device for storing NFS files also includes the following modules:
[0037] The third determination module is used to determine the master node among the nodes according to a preset rule.
[0038] The first setting module is used to set the corresponding time weight value according to the time sequence of the IO information appearing at each node;
[0039] The fourth determination module is used to determine the master node according to the time weight value.
[0040] The second setting module is used to set the memory weight value corresponding to the memory recorded in each node according to the IO information;
[0041] The fifth determination module is used to determine the master node according to the memory weight value.
[0042] A sixth determination module, used to determine the storage unit of the NFS file according to the IO information;
[0043] The seventh determination module is used to determine the storage method of the NFS file according to the storage unit, the storage unit is a first storage unit and a second storage unit, and the first storage unit is larger than the second storage unit.
[0044] A judging module, used to judge whether the storage unit reaches a preset storage unit;
[0045] If yes, triggering the second storage module to store the NFS file according to the first storage unit;
[0046] If not, the third storage module is triggered to store the NFS file according to the second storage unit.
[0047] The output module is used to output prompt information indicating that the NFS file storage is complete.
[0048] To solve the above technical problems, the present application also provides a device for storing NFS files, including:
[0049] Memory for storing computer programs;
[0050] The processor is used to point to the computer program to implement the steps of the method for storing NFS files.
[0051] In order to solve the above technical problems, the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, all the steps of the above method for storing NFS files are implemented.
[0052] The present application provides a method for storing NFS files, the method comprising: receiving an NFS request; collecting IO information of NFS files at each node according to the NFS request; determining a master node in each node; sending the IO information to the master node for aggregation; determining a storage method for NFS files according to the IO information; and storing NFS files according to the storage method. The operation of receiving NFS requests and collecting IO information of NFS files at each node replaces the original manual aggregation of IO information in the logs of each node by the technicians. Since the collection of IO information of NFS files at each node according to the NFS request is an operation executed by the computer, the rate of collecting IO information is increased within the limited time period of opening the node log, thereby improving storage efficiency.
[0053] The present application also provides a device, equipment and medium for storing NFS files, with the same effect as above. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0055] Figure 1 A flow chart of a method for storing NFS files provided in an embodiment of the present application;
[0056] Figure 2 A structural diagram of a device for storing NFS files provided in an embodiment of the present application;
[0057] Figure 3 A structural diagram of a device for storing NFS files provided in an embodiment of the present application. DETAILED DESCRIPTION
[0058] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only 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 creative work are within the scope of protection of this application.
[0059] The core of this application is to provide a method, apparatus, device and medium for storing NFS files, which can improve storage efficiency.
[0060] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0061] NFS files allow client hosts to access server-side files, and the process is similar to accessing local storage. Its implementation is based on RPC and relies on the UDP / TCP protocol. Among them, the Transmission Control Protocol (TCP) and the User Data Protocol (UDP) are the two most important protocols in the transport layer, providing the upper-layer users with a level of communication reliability. The TCP protocol defines the format of data and confirmation information exchanged for reliable transmission between two computers, as well as the measures taken by the computer to ensure the correct arrival of data. The protocol specifies how TCP software identifies multiple destination processes on a given computer and how to recover from errors such as packet duplication. The protocol also specifies how two computers initialize a TCP data stream transmission and how to end the transmission. The biggest feature of TCP is that it provides a connection-oriented, reliable byte stream service. The UDP protocol is a simple datagram-oriented transport layer protocol. It provides non-connection-oriented, unreliable data stream transmission. UDP does not provide reliability, nor does it provide functions such as message arrival confirmation, sorting, and flow control. It only sends the datagrams passed by the application to the IP layer, but it cannot guarantee that they can reach the destination. Therefore, the messages may be lost, duplicated, and out of order. However, since UDP does not need to establish a connection between the client and the server before transmitting the datagram, and does not have mechanisms such as timeout retransmission, the transmission speed is very fast.
[0062] For example: NFS files can be used for snapshot backup and / or recovery of Elasticsearch. You can use NFS files to mount the backup directory of the server, and the client accesses the backup directory for real-time backup and recovery. For example, for the distributed construction of Gitlab, multiple instance hosts access the warehouse directory to implement distributed service construction. For another example, web services upload files through the NFS system storage and synchronize them to the server directory, so that they can directly access their own server file directory.
[0063] Because the implementation of NFS relies on Remote Procedure Call (RPC), the communication between the client and the server is also based on RPC. NFS has many functions, and different functions correspond to different server ports. Therefore, when the client initially accesses, it is unknown to the corresponding server port, so it first needs to request the port corresponding to different NFS functions. At this time, port 111 (RPC port) is used. As the default port of the server RPC, it is provided to the client to access the port of all NFS functions, and then data is transmitted with the server according to the required function.
[0064] The following description is made about the statelessness of NFS: Here, we refer to the operating system. The statelessness can be understood as the http protocol, which is stateless. For example, during the web service process, each mouse click request will carry the required parameters, which may include: the user information to be queried. At this time, the userid parameter will definitely be carried in this query process, and the server will query the database based on the userid parameter to obtain the user's information. Therefore, using the above understanding method, NFS can also be understood. For example, using the statement vim / home / foo.txt and writing "aaaa", if this is a stateful protocol, the first transmission will need to access foo.txt in the home directory, and the second transmission will write "aaaa". If the intermediate transmission is disconnected due to external influences, the server will not be able to identify what file was transmitted the second time; while the stateless protocol will transmit the complete file handle and operation content each time. If the server crashes or the client and server networks are lost, the service under the stateful protocol will fail to transmit data due to information loss.
[0065] Among them, the file handle is used to uniquely describe a file or directory. Therefore, many protocol requests include a file handle. Generally speaking, a file handle has three important components: volume identifier, inode number, and generation number. These three items together constitute a unique identifier for the file or directory that the user wants to access. The volume identifier is used to export multiple files; the inode number is used to access NFS files in each partition (which can be understood as a node); the generation number is required when reusing the inode number, and the generation number is incremented when reusing the inode number to ensure that clients with old file handles do not accidentally access newly allocated NFS files. Each time a file handle is requested through the LooKup protocol, the server returns the file handle + file attributes to the client; the attributes are the meta information of each file tracked by the NFS file, including the file creation time, last modification time, size, ownership and permission information, etc., that is, the information returned by calling the stat() statement on the file. Among them, it should be noted that the client's operations are generally idempotent, so the server crashes and restarts without affecting the operation. Except for files like mkdir, when the file already exists, the server will report an error when it crashes and restarts.
[0066] The following is a description of NFS cache consistency: According to the above description of NFS, the NFS cache will exist on both the client and the server. It should be noted that the cache also includes the write cache. At this time, when the client makes a modification, the write cache can quickly return a response, cache the written content in memory, and then send it to the server. Because of the write operation on the server, the server calls to refresh the cache. However, the modification operation on the client will be inconsistent with the server due to network and other reasons. At this time, the following two problems will occur:
[0067] The first problem is: Client A modified the content and cached it but did not send it to the server; Client B then reads the old content that has not been updated on the server. This problem can be solved by refreshing on close. As long as Client A closes the NFS file after updating, it will be sent to the server immediately.
[0068] The second problem is: the content modified by client A is sent to the server and the content on the server is modified; however, due to the cache, client B still reads the old content that has not been updated. This problem confirms whether the file has been updated by reading the file attributes. For example, each time client B uses the cache, it uses GETATTR to confirm whether the file attributes are consistent.
[0069] NFS has at least two main parts, namely, an NFS server (server) and several clients (clients). The client remotely accesses the data stored on the NFS server through the TCP / IP network. Before the NFS server is officially started, some NFS parameters need to be configured according to the actual environment and requirements.
[0070] NFS is one of the file systems supported by FreeBSD. It allows computers in the network to share resources through the TCP / IP network. There are three network file systems: NFS, samba, and FTP.
[0071] In the application of NFS, local client applications can transparently read and write files located on the remote NFS server, just like accessing local files; NFS is suitable for file sharing between Linux and Unix, but cannot realize file sharing between Linux and Windows; NFS is a protocol running at the application layer; NFS service can only be authenticated based on IP, and can only be used in the intranet, not in the public network. However, NFS can save local storage space, store commonly used data on an NFS server and access it through the network, so the local terminal will be able to reduce its own storage space usage; users do not need to build a home directory on each machine in the network, the home directory can be placed on the NFS server and can be accessed and used on the network; some storage devices such as floppy drives, CDROMs, and Zip (a high-storage-density disk drive and disk) can be used by other machines on the network. This can reduce the number of removable media devices on the entire network.
[0072] Based on the above-mentioned NFS content, for this application, the existing method of storing NFS files is that the technician manually summarizes the logs of each node operation, finds the read and write IO of the same file from different node logs, summarizes and counts them according to the time sequence, and determines the storage method of the file, and stores the NFS file with the storage method. In this process, it is necessary to open the node log to find the read and write IO information of the same NFS file. Since the storage of NFS files cannot be realized at the same time when the node log is opened, the storage efficiency is low.
[0073] In order to solve the above technical problems, the present application provides a method for storing NFS files. Figure 1 A flow chart of a method for storing NFS files provided in an embodiment of the present application. Figure 1 As shown, the method for storing NFS files includes:
[0074] S10: Receive an NFS request.
[0075] It should be noted that the NFS request can be expressed in text form or in the form of a data string. When the NFS request is expressed in text form, it can be expressed as "request access"; when the NFS request is expressed in the form of a data string, it can be expressed using a data string of 1 bit, 2 bits, 4 bits, 8 bits, etc., which can be specifically expressed as "1", "01", "1101", "11010001". It can be understood that whether the NFS request is expressed in text form or in the form of a data string, the above-mentioned embodiments are only a few of many embodiments, and do not limit the NFS request mentioned in this application. The implementation method can be determined according to the specific implementation scenario. At the same time, it should be noted that when the NFS request is expressed in the form of a data string, the NFS request can be expressed by the binary number corresponding to the data string or by the number of 0 or 1 in the data string. The above-mentioned embodiments are only a few of many embodiments, and do not limit the NFS request mentioned in this application. The implementation method can be determined according to the specific implementation scenario.
[0076] S11: Collect IO information of NFS files on each node according to the NFS request.
[0077] The IO information may include the inode identifier of the NFS file, the size of the NFS file (for example, the size of one of the NFS files is 1GB), the log file path corresponding to the NFS file, etc. It can be understood that the above-mentioned embodiments regarding IO information are only a few of many embodiments, and do not limit the IO information mentioned in this application. The implementation method can be determined according to the specific implementation scenario.
[0078] S12: Determine a master node among each node.
[0079] When selecting a master node from multiple nodes, it should be noted that since the IO information of each NFS file in the log file of each node is different, the master node is not fixed. For example, one type of NFS file corresponds to master node A, and another type of NFS file corresponds to master node B. It can be understood that the selection of the master node is related to each node, so the master node is determined in each node according to the preset rules.
[0080] Among them, determining the master node among the nodes according to the preset rules includes:
[0081] Set the corresponding time weight value according to the time sequence in which the IO information appears at each node;
[0082] The master node is determined according to the time weight value. As a more preferred implementation, the node with the largest time weight value can be selected as the master node.
[0083] Alternatively, determining the master node in each node according to a preset rule includes:
[0084] The memory weight value corresponding to the memory setting recorded in each node according to the IO information;
[0085] The master node is determined according to the memory weight value. As a more preferred implementation, the node with the largest memory weight value can be selected as the master node.
[0086] The above-mentioned embodiments for determining the master node in each node are only a few of many embodiments. The size weight value of the corresponding NFS file can also be set according to the size of the NFS file to determine the master node. Therefore, the above-mentioned embodiments for determining the master node in each node do not limit the IO information mentioned in this application, and its implementation method can be determined according to the specific implementation scenario.
[0087] S13: Send the IO information to the master node for aggregation.
[0088] Since a node can only transmit information or data if the web service is enabled, only the node that serves as the master node can enable the web service and further transmit IO information. The remaining non-master nodes cannot transmit IO information, so the IO information needs to be summarized in the master node.
[0089] S14: Determine the storage method of the NFS file according to the IO information.
[0090] The method for determining the storage of NFS files according to IO information includes:
[0091] Determine the storage unit of the NFS file based on IO information;
[0092] The storage method of the NFS file is determined according to the storage unit, the storage units are respectively a first storage unit and a second storage unit, and the first storage unit is larger than the second storage unit.
[0093] The storage unit in this embodiment is described in terms of blocks. It should be noted that the first storage unit can be understood as a small block, and the NFS file is stored in small blocks; the second storage unit can be understood as a large block, and the NFS file is stored in large blocks.
[0094] S15: The NFS file is stored according to the storage method.
[0095] Storing NFS files according to the storage method includes:
[0096] Determine whether the storage unit reaches the preset storage unit;
[0097] If yes, the NFS file is stored according to the first storage unit;
[0098] If not, the NFS file is stored according to the second storage unit.
[0099] The present application provides a method for storing NFS files, the method comprising: receiving an NFS request; collecting IO information of NFS files at each node according to the NFS request; determining a master node in each node; sending the IO information to the master node for aggregation; determining a storage method for NFS files according to the IO information; and storing NFS files according to the storage method. The operation of receiving NFS requests and collecting IO information of NFS files at each node replaces the original manual aggregation of IO information in the logs of each node by the technicians. Since the collection of IO information of NFS files at each node according to the NFS request is an operation executed by the computer, the rate of collecting IO information is increased within the limited time period of opening the node log, thereby improving storage efficiency.
[0100] Based on the above embodiment, as a preferred embodiment, after storing the NFS file according to the storage method, the method further includes:
[0101] Outputs a prompt message indicating that the NFS file storage is complete.
[0102] In order to be able to directly obtain whether the NFS file has been stored, after storing the NFS file according to the storage method, it is necessary to output prompt information indicating that the NFS file has been stored. It should be noted that the prompt information can be expressed in text form or in the form of a data string. When the prompt information is expressed in text form, it can be expressed as "storage completed"; when the prompt information is expressed in the form of a data string, it can be expressed using a data string of 1, 2, 4, 8, etc. bits, specifically "0", "10", "1001", "11101001", it can be understood that whether the prompt information is expressed in text form or in the form of a data string, the above-mentioned embodiments are only a few of many embodiments, and do not limit the prompt information mentioned in this application, and its implementation method can be determined according to the specific implementation scenario. It should also be noted that when the prompt information is represented in the form of a data string, the prompt information can be represented by the binary number corresponding to the data string, or the prompt information can be represented by the number of 0 or 1 in the data string. The above-mentioned embodiments are only a few of many embodiments, and do not limit the prompt information mentioned in this application. The implementation method can be determined according to the specific implementation scenario.
[0103] NFS enables multiple machines to share a CDROM or other device. This makes it more convenient to install software on multiple machines. In a large network, it may be convenient to configure a central NFS server to store the home directories of all users. These directories can be exported to the network so that users can always get the same home directory no matter which workstation they log in from. Different clients can watch movie files on NFS, saving local space. The work data completed on the client can be backed up and saved to the user's own path on the NFS server.
[0104] In the above embodiments, the method for storing NFS files is described in detail, and the present application also provides an embodiment corresponding to the device for storing NFS files. It should be noted that the present application describes the embodiments of the device part from two perspectives, one is based on the perspective of functional modules, and the other is based on the perspective of hardware.
[0105] Figure 2 This is a structural diagram of a device for storing NFS files provided in an embodiment of the present application. Figure 2 As shown, the present application also provides a device for storing NFS files, including:
[0106] A receiving module 20, configured to receive an NFS request;
[0107] It should be noted that the NFS request can be expressed in text form or in the form of a data string. When the NFS request is expressed in text form, it can be expressed as "request access"; when the NFS request is expressed in the form of a data string, it can be expressed using a data string of 1 bit, 2 bits, 4 bits, 8 bits, etc., which can be specifically expressed as "1", "01", "1101", "11010001". It can be understood that whether the NFS request is expressed in text form or in the form of a data string, the above-mentioned embodiments are only a few of many embodiments, and do not limit the NFS request mentioned in this application. The implementation method can be determined according to the specific implementation scenario. At the same time, it should be noted that when the NFS request is expressed in the form of a data string, the NFS request can be expressed by the binary number corresponding to the data string or by the number of 0 or 1 in the data string. The above-mentioned embodiments are only a few of many embodiments, and do not limit the NFS request mentioned in this application. The implementation method can be determined according to the specific implementation scenario.
[0108] The collecting module 21 is used to collect the IO information of the NFS file on each node according to the NFS request;
[0109] The IO information may include the inode identifier of the NFS file, the size of the NFS file (for example, the size of one of the NFS files is 1GB), the log file path corresponding to the NFS file, etc. It can be understood that the above-mentioned embodiments regarding IO information are only a few of many embodiments, and do not limit the IO information mentioned in this application. The implementation method can be determined according to the specific implementation scenario.
[0110] A first determination module 22, used to determine a master node among the nodes;
[0111] The sending and summarizing module 23 is used to send the IO information to the master node for summarization; since the node can only transmit information or data if the web service is enabled, only the node that serves as the master node can enable the web service and further transmit the IO information. The remaining non-master nodes cannot transmit IO information, so the IO information needs to be summarized at the master node.
[0112] A second determination module 24, configured to determine a storage method of the NFS file according to the IO information;
[0113] The first storage module 25 is used to store NFS files according to the storage method.
[0114] In addition, the device for storing NFS files also includes the following modules:
[0115] The third determination module is used to determine the master node among the nodes according to a preset rule.
[0116] The first setting module is used to set the corresponding time weight value according to the time sequence of the IO information appearing at each node;
[0117] The fourth determination module is used to determine the master node according to the time weight value.
[0118] The second setting module is used to set the memory weight value corresponding to the memory recorded in each node according to the IO information;
[0119] The fifth determination module is used to determine the master node according to the memory weight value.
[0120] A sixth determination module, used to determine the storage unit of the NFS file according to the IO information;
[0121] The seventh determination module is used to determine the storage method of the NFS file according to the storage unit, the storage unit is a first storage unit and a second storage unit, and the first storage unit is larger than the second storage unit.
[0122] A judging module, used to judge whether the storage unit reaches a preset storage unit;
[0123] If yes, then enter the second storage module for storing the NFS file according to the first storage unit;
[0124] If not, enter the third storage module to store the NFS file according to the second storage unit.
[0125] The output module is used to output prompt information indicating that the NFS file storage is complete.
[0126] Since the method for storing NFS files provided in the present application is also applicable to the device for storing NFS files provided in the present application. Therefore, the device for storing NFS files can achieve the same beneficial effects as the method for storing NFS files. Then, the above-mentioned method for storing NFS files includes: receiving NFS requests; collecting IO information of NFS files at each node according to NFS requests; determining a master node in each node; sending IO information to the master node for aggregation; determining a storage method for NFS files according to IO information; and storing NFS files according to the storage method. The operation of receiving NFS requests and collecting IO information of NFS files at each node replaces the original manual aggregation of IO information in the logs of each node by technicians. Since the collection of IO information of NFS files at each node according to NFS requests is an operation executed by a computer, the rate of collecting IO information is increased within the limited time period of opening the node log, thereby improving storage efficiency.
[0127] Since the embodiments of the apparatus part correspond to the embodiments of the method part, please refer to the description of the embodiments of the method part for the embodiments of the apparatus part, which will not be repeated here.
[0128] Figure 3 A device structure diagram for storing NFS files provided in an embodiment of the present application, such as Figure 3 As shown in the figure, the devices storing NFS files include:
[0129] A memory 30, for storing computer programs;
[0130] The processor 31 is configured to implement the steps of the method for storing NFS files mentioned in the above embodiment when executing a computer program.
[0131] The device for storing NFS files provided in this embodiment may include but is not limited to a smart phone, a tablet computer, a laptop computer, or a desktop computer.
[0132] Among them, the processor 31 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 31 can be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), and programmable logic array (PLA). The processor 31 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a central processing unit (CPU); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 31 may be integrated with a graphics processing unit (GPU), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 31 may also include an artificial intelligence (AI) processor, which is used to process computing operations related to machine learning.
[0133] The memory 30 may include one or more computer-readable storage media, which may be non-transitory. The memory 30 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In this embodiment, the memory 30 is at least used to store the following computer program, wherein, after the computer program is loaded and executed by the processor 31, the relevant steps of the method for storing NFS files disclosed in any of the aforementioned embodiments can be implemented. In addition, the resources stored in the memory 30 may also include an operating system and data, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system may include Windows, Unix, Linux, etc. The data may include, but is not limited to, a method for storing NFS files, etc.
[0134] In some embodiments, the device storing the NFS file may further include a display screen, an input and output interface, a communication interface, a power supply, and a communication bus.
[0135] Those skilled in the art will understand that Figure 3 The structure shown in the figure does not constitute a limitation on the device for storing NFS files, and may include more or less components than those shown in the figure.
[0136] The device for storing NFS files provided in the embodiment of the present application includes a memory 30 and a processor 31. When the processor 31 executes the program stored in the memory 30, the method for storing NFS files can be implemented.
[0137] Finally, the present application also provides an embodiment corresponding to a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps recorded in the above method embodiment are implemented.
[0138] It is understandable that if the method in the above embodiment is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory), ROM, random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program code.
[0139] The above is a detailed introduction to a method, device, equipment and medium for storing NFS files provided by the present application. The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the various embodiments can be referenced to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of the present application.
[0140] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
Claims
1. A method for storing NFS files, It is characterized in that include: Receive NFS requests; Collecting IO information of NFS files on each node according to the NFS request; Determining a master node among the nodes; Start the web service on the master node and send the IO information to the master node for aggregation; Determine a storage method for the NFS file according to the IO information; Storing the NFS file according to the storage method; Outputting a prompt message indicating that the NFS file has been stored; Wherein, the determining of the master node in each of the nodes includes: setting a corresponding time weight value according to the time order in which the IO information appears in each of the nodes, and taking the node with the largest time weight value as the master node; or, the determining of the master node in each of the nodes includes: setting a corresponding memory weight value according to the memory recorded in each of the nodes by the IO information, and taking the node with the largest memory weight value as the master node; or, the determining of the master node in each of the nodes includes: setting a corresponding size weight value of the NFS file according to the size of the NFS file and determining the master node; The method for determining the storage of the NFS file according to the IO information includes: determining the storage unit of the NFS file according to the IO information; determining the storage method of the NFS file according to the storage unit, the storage units are respectively a first storage unit and a second storage unit, and the first storage unit is larger than the second storage unit; wherein, storing the NFS file according to the storage method includes: judging whether the storage unit reaches a preset storage unit; if so, storing the NFS file according to the first storage unit; if not, storing the NFS file according to the second storage unit; The type of the IO information includes the inode identifier of the NFS file, the size of the NFS file, and the log file path corresponding to the NFS file.
2. A device for storing NFS files, It is characterized in that include: A receiving module, used for receiving NFS requests; A collection module, used to collect IO information of NFS files on each node according to the NFS request; A first determination module, used to determine a master node among the nodes; A sending and summarizing module, used to start the web service on the master node and send the IO information to the master node for summarization; A second determining module, configured to determine a storage method of the NFS file according to the IO information; A storage module, used for storing the NFS file according to the storage method; An output module, used for outputting prompt information indicating that the NFS file has been stored; Wherein, the determining of the master node in each of the nodes includes: setting a corresponding time weight value according to the time order in which the IO information appears in each of the nodes, and taking the node with the largest time weight value as the master node; or, the determining of the master node in each of the nodes includes: setting a corresponding memory weight value according to the memory recorded in each of the nodes by the IO information, and taking the node with the largest memory weight value as the master node; or, the determining of the master node in each of the nodes includes: setting a corresponding size weight value of the NFS file according to the size of the NFS file and determining the master node; The method for determining the storage of the NFS file according to the IO information includes: determining the storage unit of the NFS file according to the IO information; determining the storage method of the NFS file according to the storage unit, the storage units are respectively a first storage unit and a second storage unit, and the first storage unit is larger than the second storage unit; wherein, storing the NFS file according to the storage method includes: judging whether the storage unit reaches a preset storage unit; if so, storing the NFS file according to the first storage unit; if not, storing the NFS file according to the second storage unit; The type of the IO information includes the inode identifier of the NFS file, the size of the NFS file, and the log file path corresponding to the NFS file.
3. A device for storing NFS files, It is characterized in that include: Memory for storing computer programs; A processor, configured to implement the steps of the method for storing NFS files as claimed in claim 1 when executing the computer program.
4. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for storing NFS files according to claim 1 are implemented.
