A file storage method, device, equipment and storage medium
By listening to file saving events and broadcasting file transfer information, the problem of insufficient storage capacity of large files is solved, and the intelligent storage of files in the LAN is realized, which reduces storage costs.
Patent Information
- Application Number
- CN202411612809.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-13
- Publication Date
- 2025-03-11
- Estimated Expiration
- 2044-11-13
AI Technical Summary
When existing file storage methods face large files, it is difficult to effectively manage storage capacity, resulting in an increase in additional storage costs.
By listening to file saving events, obtain relevant file information, and when the storage disk capacity is insufficient, the file transfer information is broadcast to the candidate host in the target LAN, determine the available host that meets the storage capacity, and store the files to the host.
It realizes the storage of files between different hosts in the same LAN, avoids the need to purchase additional hard disks or expanded disks, and reduces storage costs.
Smart Images

Figure CN119127798B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a file storage method, device, equipment and storage medium. Background Art
[0002] With the exponential growth of data volume, data storage has become a very important issue. When faced with large files ranging in size from 10MB to 5GB, such as BIM (Building Information Modeling) files, video surveillance files, and corporate promotional video files in the construction industry, the existing file storage methods usually purchase large-capacity hard drives or dedicated storage hardware (such as high-performance disk arrays) to store large files, which increases additional storage costs when the original file save path of the large files cannot meet the storage requirements. Summary of the invention
[0003] The present invention provides a file storage method, device, equipment and storage medium to reduce file storage costs.
[0004] According to one aspect of the present invention, there is provided a file storage method, the method comprising:
[0005] After the monitoring interface monitors the file saving event, the relevant file information corresponding to the file saving event is obtained; wherein the relevant file information includes the file to be stored, the file storage capacity, the file storage disk, and the original host to which the file storage disk belongs;
[0006] When it is detected that the remaining capacity of the file storage disk does not meet the file storage capacity, and the remaining capacity of the candidate disks in the original host does not meet the file storage capacity, determine the target local area network where the original host is located, and broadcast the file transfer information of the file to be stored to the candidate hosts in the target local area network; wherein the candidate disk refers to the disk in the original host except the file storage disk; the candidate host refers to the host in the target local area network except the original host;
[0007] Determine, based on the received response information sent by the responding host, an available host that satisfies the file storage capacity from at least one responding host;
[0008] When there are multiple available hosts, a target host is determined from the multiple available hosts according to the file transfer time threshold, the file storage capacity and the available host information corresponding to each available host, and the file to be stored is stored in the target host.
[0009] According to another aspect of the present invention, there is provided a file storage device, the device comprising:
[0010] The relevant file information acquisition module is used to acquire the relevant file information corresponding to the file saving event after the monitoring interface monitors the file saving event; wherein the relevant file information includes the file to be stored, the file storage capacity, the file storage disk, and the original host to which the file storage disk belongs;
[0011] The file transfer information broadcast module is used to determine the target LAN where the original host is located, and broadcast the file transfer information of the to-be-stored file to the candidate hosts in the target LAN when it is detected that the remaining capacity of the file storage disk does not meet the file storage capacity, and the remaining capacity of the candidate disks in the original host does not meet the file storage capacity; wherein the candidate disk refers to the disk in the original host except the file storage disk; the candidate host refers to the host in the target LAN except the original host;
[0012] An available host determination module, used to determine an available host that meets the file storage capacity from at least one responding host according to the response information received from the responding host;
[0013] The target host determination module is used to determine the target host from multiple available hosts according to the file transfer time threshold, file storage capacity and available host information corresponding to each available host when there are multiple available hosts, and store the files to be stored in the target host.
[0014] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0015] at least one processor; and
[0016] a memory communicatively connected to at least one processor; wherein,
[0017] The memory stores a computer program that can be executed by at least one processor. The computer program is executed by at least one processor so that the at least one processor can execute the file storage method of any embodiment of the present invention.
[0018] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the file storage method of any embodiment of the present invention when executed.
[0019] According to another aspect of the present invention, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the file storage method of any embodiment of the present invention is implemented.
[0020] The technical solution of the embodiment of the present invention is as follows: after a monitoring interface monitors a file saving event, relevant file information corresponding to the file saving event is obtained; wherein the relevant file information includes the file to be stored, the file storage capacity, the file storage disk, and the original host to which the file storage disk belongs; when it is detected that the remaining disk capacity of the file storage disk does not meet the file storage capacity, and the remaining disk capacity of the candidate disks in the original host does not meet the file storage capacity, the target local area network where the original host is located is determined, and the file transfer information of the file to be stored is broadcast to the candidate hosts in the target local area network; wherein the candidate disk refers to the disk other than the file storage disk in the original host; the candidate host refers to the host other than the original host in the target local area network; according to the response information sent by the received responding host, an available host that meets the file storage capacity is determined from at least one responding host; when there are multiple available hosts, according to the file transfer time threshold, the file storage capacity and the available host information corresponding to each available host, the target host is determined from the multiple available hosts, and the file to be stored is stored in the target host. The above technical solution, when it is detected that the remaining disk capacity of the file storage disk does not meet the file storage capacity, and the remaining disk capacity of the candidate disks in the original host does not meet the file storage capacity, will transfer the file to be stored to other hosts in the target LAN where the original host is located, thereby realizing the storage of files between different hosts in the same LAN, without the need to purchase additional large-capacity hard disks or dedicated storage hardware, and without the need to expand the disk of the original host, thereby reducing the downtime and data migration costs related to expansion, and further reducing file storage costs.
[0021] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0023] Figure 1 is a flowchart of a file storage method provided according to Embodiment 1 of the present invention;
[0024] Figure 2A is a flowchart of a file storage method provided according to Embodiment 2 of the present invention;
[0025] Figure 2Bis a flowchart of another file storage method provided according to Embodiment 2 of the present invention;
[0026] Figure 3 is a schematic diagram of the structure of a file storage device provided according to Embodiment 3 of the present invention;
[0027] Figure 4 It is a structural schematic diagram of an electronic device for implementing the file storage method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0028] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0029] It should be noted that the terms "original", "candidate", "intermediate" and "target" in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0030] In addition, it should be noted that in the technical solution of the present invention, the collection, storage, use, processing, transmission, provision and disclosure of file transfer time thresholds and file storage time thresholds, etc., are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0031] Embodiment 1
[0032] Figure 1 This is a flowchart of a file storage method provided in the first embodiment of the present invention. This embodiment is applicable to the case of storing files in an application system on an operating system, and is particularly applicable to the case of storing large files (i.e., files with a size ranging from 10MB to 5GB) in an application system on an operating system. The method can be executed by a file storage device, which can be implemented in the form of hardware and / or software and can be configured in an electronic device. Figure 1As shown, the method includes:
[0033] S101. After a monitoring interface monitors a file saving event, obtain relevant file information corresponding to the file saving event; wherein the relevant file information includes the file to be stored, the file storage capacity, the file storage disk, and the original host to which the file storage disk belongs.
[0034] Among them, the monitoring interface refers to an interface specifically used to monitor file saving events in the application system; optionally, the monitoring interface can be pre-configured in the operating system according to actual business needs, for example, the monitoring interface can be inotify in the Linux system. The application system refers to the system running on the operating system, for example, the application system can be a management system for managing construction industry projects, or a game, chat software or browser.
[0035] The file to be stored refers to the file that needs to be stored. The file storage capacity refers to the capacity required to store the file to be stored; optionally, the file storage capacity can be determined according to the file size of the file to be stored. The file storage disk refers to the disk specified in the original file save path of the file to be stored. For example, if the original file save path of the file to be stored is C: / upload / data / test.txt, then the file storage disk is the C drive. The original file save path refers to the file save path recorded in the file save event.
[0036] Specifically, after the monitoring interface monitors the file saving event, the file saving event is captured, and relevant file information is extracted from the file saving event.
[0037] S102. When it is detected that the remaining disk capacity of the file storage disk does not meet the file storage capacity, and the remaining disk capacity of the candidate disks in the original host does not meet the file storage capacity, determine the target LAN where the original host is located, and broadcast the file transfer information of the file to be stored to the candidate hosts in the target LAN.
[0038] Among them, the candidate disk refers to the disk other than the file storage disk in the original host; the candidate host refers to the host other than the original host in the target LAN. It should be noted that the number of candidate hosts is at least one. The target LAN refers to the LAN where the original host is located. File transfer information refers to information related to the transfer of the file to be stored; optionally, the file transfer information includes but is not limited to the file name of the file to be stored, the file storage capacity, the original file storage address and the original host name.
[0039] Specifically, when it is detected that the remaining disk capacity of the file storage disk is less than the file storage capacity, and the remaining disk capacity of the candidate disks in the original host is less than the file storage capacity, the IP address (Internet Protocol Address) of the original host is obtained, and based on the correspondence between the candidate LANs and the IP address ranges in the LAN setting table, according to the IP address of the original host, the target LAN where the original host is located is determined from at least one candidate LAN in the LAN setting table; thereafter, the file transfer information of the file to be stored can be broadcast to the candidate hosts in the target LAN based on the LAN broadcast method.
[0040] Among them, the candidate LAN refers to the LAN pre-set in the LAN setting table. It should be noted that the LAN setting table can be pre-configured according to actual business needs, and the embodiment of the present invention does not specifically limit it. The LAN broadcast mode can be pre-set according to actual business needs. For example, the LAN broadcast mode can be a UDP (User Datagram Protocol) broadcast mode. For example, the LAN broadcast mode can be a LAN broadcast mechanism built into the operating system.
[0041] Optionally, in order to quickly propagate file transfer information in the target LAN and reduce network latency, the file transfer information of the files to be stored can also be broadcast to the candidate hosts in the target LAN through a private KCP (Kernel Control Protocol) protocol. The private KCP protocol can be obtained by modifying the standard KCP protocol according to actual business needs.
[0042] S103: Determine an available host that meets the file storage capacity from at least one responding host according to the received response information sent by the responding host.
[0043] Among them, the responding host refers to the candidate host that responds to the file transfer information in the target local area network. The response information includes the remaining capacity of the host disk. Among them, the remaining capacity of the host disk refers to the remaining capacity of the responding host disk. For each responding host, the remaining capacity of the host disk can be equal to the sum of the remaining capacity of each disk in the responding host, or it can be equal to the largest remaining capacity of the remaining capacity of each disk in the responding host, or it can be equal to the average or median of the remaining capacity of each disk in the responding host. It should be noted that one candidate host sends one response message. A responding host includes at least one disk. An available host refers to a responding host whose remaining capacity of the host disk is greater than or equal to the file storage capacity.
[0044] Optionally, the response information also includes the total number of disks of the responding host, the remaining disk capacity and disk storage speed of each disk in the responding host, and the network status of the responding host.
[0045] Specifically, available hosts that meet the file storage capacity may be screened out from at least one responding host according to the remaining capacity of the host disk of each responding host.
[0046] More specifically, based on the remaining capacity of the host disks of the responding hosts, available hosts whose remaining capacity of the host disks is greater than or equal to the file storage capacity may be screened out from at least one responding host.
[0047] It is understandable that not all responding hosts in the target LAN have a host disk remaining capacity that satisfies the file storage capacity. Therefore, based on the host disk remaining capacity of each responding host, available hosts that meet the file storage capacity are screened out from at least one responding host, which can further narrow the host range for determining the target host, thereby speeding up the determination of the target host.
[0048] Optionally, if the response information sent by the responding host is not received within the preset time, the file transfer information of the file to be stored is broadcasted again to the candidate hosts in the target local area network until the number of broadcasts reaches the broadcast number threshold. The preset time and the broadcast number threshold can be pre-set according to the experience of those skilled in the art, and the embodiments of the present invention do not specifically limit them.
[0049] It can be understood that when no response information is received from the responding host within the preset time, the file transfer information of the file to be stored is re-broadcast to the candidate hosts in the target LAN, which increases the probability that the candidate hosts in the target LAN receive the file transfer information, thereby increasing the number of responding hosts and effectively avoiding the waste of time and resources caused by continuously waiting for the candidate hosts in the target LAN to respond.
[0050] Optionally, the number of responding hosts can also be counted. If the number of responding hosts is equal to or greater than the host number threshold, then based on the response information sent by the received responding hosts, an available host that meets the file storage capacity is determined from at least one responding host; if the number of responding hosts is less than the host number threshold, the file transfer information of the file to be stored is rebroadcasted to the candidate hosts in the target local area network until the number of responding hosts reaches the host number threshold, or the number of broadcasts reaches the broadcast number threshold. The host number threshold can be preset according to the experience of those skilled in the art, and the embodiment of the present invention does not specifically limit it.
[0051] It is understandable that, when the number of responding hosts is less than the host number threshold, the file transfer information of the to-be-stored files is rebroadcasted to the candidate hosts in the target local area network to increase the number of responding hosts, so as to facilitate the subsequent screening of the most suitable target host from at least one responding host. At the same time, when the number of responding hosts has not yet reached the host number threshold, but the number of broadcasts has reached the broadcast number threshold, the file transfer information of the to-be-stored files is stopped from being broadcasted to the candidate hosts in the target local area network, effectively avoiding excessive consumption and waste of network resources.
[0052] S104: When there are multiple available hosts, determine a target host from the multiple available hosts according to the file transfer time threshold, the file storage capacity, and the available host information corresponding to each available host, and store the file to be stored in the target host.
[0053] The file transfer time threshold can be preset according to actual business needs or the experience of those skilled in the art, and the embodiment of the present invention does not specifically limit it. Available host information refers to relevant information of available hosts; optionally, the available host information includes the host file transfer speed, host disk storage speed, and host disk remaining capacity of the available host. The host disk storage speed can be determined based on the disk storage speed of each disk in the available host. For example, the host disk storage speed can be equal to the average disk storage speed of each disk in the available host. For another example, the host disk storage speed can be equal to the minimum value of the disk storage speed of each disk in the available host.
[0054] Specifically, when there are multiple available hosts, the minimum file transfer speed of the available hosts is determined based on the host file transfer speed and the host disk storage speed of the available hosts; the file transfer time of the available hosts is determined based on the file storage capacity and the minimum file transfer speed; the intermediate hosts are screened out from the multiple available hosts based on the file transfer time threshold and the file transfer time of each available host; when there are multiple intermediate hosts, the target hosts are screened out from the multiple intermediate hosts based on the remaining capacity of the host disk of each intermediate host, and the files to be stored are stored in the target hosts. Among them, the minimum file transfer speed refers to the minimum file transfer speed of the available hosts. The intermediate host refers to the host generated in the process of determining the target host. The file transfer time refers to the time required for the available host to complete the storage of the files to be stored.
[0055] Specifically, when there are multiple available hosts, for each available host, the host file transfer speed of the available host is compared with the host disk storage speed of the available host, and the smaller speed between the host file transfer speed and the host disk storage speed is used as the minimum file transfer speed of the available host; then, the time obtained by dividing the file storage capacity by the minimum file transfer speed of the available host is used as the file transfer time of the available host, so as to obtain the file transfer time of each available host. Then, according to the file transfer time threshold and the file transfer time of each available host, the available hosts whose file transfer time is less than or equal to the file transfer time threshold are selected from the multiple available hosts as intermediate hosts; when there are multiple intermediate hosts, the intermediate host with the smallest remaining host disk capacity is selected as the target host; and the files to be stored are stored in the target host.
[0056] Exemplarily, if the file transfer time threshold is 1 second (i.e. 1s), the file storage capacity is 100MB, and there are three available hosts, namely available host A, available host B and available host C; wherein, the host file transfer speed of available host A is 100MB / s, the host disk storage speed is 80MB / s, and the remaining capacity of the host disk is 10GB; the host file transfer speed of available host B is 100MB / s, the host disk storage speed is 100MB / s, and the remaining capacity of the host disk is 40GB; the host file transfer speed of available host C is 100MB / s, the host disk storage speed is 500MB / s, and the remaining capacity of the host disk is 20GB. For available host A, the host file transfer speed of available host A is compared with the host disk storage speed of available host A, and the smaller speed of the host file transfer speed and the host disk storage speed is used as the minimum file transfer speed of available host A, that is, the minimum file transfer speed of available host A is 80MB / s; similarly, the minimum file transfer speed of available host B is 100MB / s, and the minimum file transfer speed of available host C is 100MB / s; then, the time obtained by dividing the file storage capacity (i.e. 100MB) by the minimum file transfer speed of available host A (i.e. 80MB / s) is used as the file transfer time of available host A, that is, the file transfer time of available host A is ; Similarly, it can be obtained that the file transfer time of available host B is 1s, and the file transfer time of available host C is 1s. Afterwards, according to the file transfer time threshold (i.e. 1s) and the file transfer time of each available host, available hosts with file transfer time less than or equal to the file transfer time threshold are selected from available host A, available host B and available host C as intermediate hosts, i.e., the intermediate hosts include available host B and available host C; the intermediate host with the smallest remaining host disk capacity is selected as the target host, i.e., the target host is available host C; and the file to be stored is stored in available host C.
[0057] For example, if the file transfer time threshold is 1s, the file storage capacity is 50MB, and the available hosts are still available host A, available host B, and available host C, then the minimum file transfer speed of available host A is 80MB / s, the minimum file transfer speed of available host B is 100MB / s, and the minimum file transfer speed of available host C is 100MB / s. Then, the time obtained by dividing the file storage capacity (i.e., 50MB) by the minimum file transfer speed of available host A (i.e., 80MB / s) is used as the file transfer time of available host A, that is, the file transfer time of available host A is ; Similarly, it can be obtained that the file transfer time of available host B is 0.5s, and the file transfer time of available host C is 0.5s. Afterwards, according to the file transfer time threshold (i.e. 1s) and the file transfer time of each available host, available hosts with file transfer time less than or equal to the file transfer time threshold are selected from available host A, available host B and available host C as intermediate hosts, i.e., the intermediate hosts include available host A, available host B and available host C; the intermediate host with the smallest remaining host disk capacity is selected as the target host, i.e., the target host is available host A; and the file to be stored is stored in available host A.
[0058] It can be understood that, in the case where there are multiple available hosts, based on the file transfer time threshold, file storage capacity, and the host file transfer speed corresponding to each available host, the host disk storage speed, and the remaining capacity of the host disk, the available hosts whose file transfer time meets the file transfer time threshold and can make better use of storage resources are screened from the multiple available hosts as target hosts. In the case where the remaining host disk capacity of each available host meets the file storage capacity, an intermediate host with a smaller remaining host disk capacity is selected from the intermediate hosts whose file transfer time meets the file transfer time threshold for storage, thereby more effectively utilizing the existing storage resources and reducing the waste of storage space.
[0059] Optionally, when no intermediate host exists, the target host is determined from multiple available hosts according to the minimum file transfer speed of each available host and the remaining capacity of the host disk.
[0060] Specifically, when there is no intermediate host, that is, when there is no available host whose file transfer time is less than or equal to the file transfer time threshold among the available hosts, the minimum file transfer speeds of the available hosts are sorted from high to low to obtain the candidate host with the highest minimum file transfer speed; if there is one candidate host, the candidate host is used as the target host; if there are multiple candidate hosts, the candidate host with the smallest remaining host disk capacity is selected from the multiple candidate hosts as the target host. The candidate host refers to a host among the available hosts that may become the target host.
[0061] For example, if the file transfer time threshold is 1s, the file storage capacity is 1000MB, and the available hosts are still available host A, available host B, and available host C. If it is known that the minimum file transfer speed of available host A is 80MB / s, the minimum file transfer speed of available host B is 100MB / s, and the minimum file transfer speed of available host C is 100MB / s, according to the file storage capacity (i.e., 1000MB) and the minimum file transfer speed of each available host, it can be obtained that the file transfer time of available host A is 12.5s, the file transfer time of available host B is 10s, and the file transfer time of available host C is 10s. It can be seen that there is no available host with a file transfer time less than or equal to the file transfer time threshold (i.e., 1s) among available host A, available host B, and available host C, that is, there is no intermediate host. In this case, the minimum file transfer speeds of the available hosts are sorted from high to low to obtain the candidate hosts with the highest minimum file transfer speed, that is, the candidate hosts include available host B and available host C; then, the candidate host with the smallest remaining host disk capacity is selected from available host B and available host C as the target host, that is, the target host is available host C.
[0062] It is understandable that when all available hosts are unable to complete the storage of the files to be stored within the file transfer time threshold, the available host with the highest minimum file transfer speed and the smallest remaining host disk capacity is selected as the target host. This not only achieves fast storage of the files to be stored, but also optimizes the use of storage resources, reduces the need for additional storage devices, reduces unnecessary expansion operations, and thus reduces file storage costs.
[0063] Optionally, when the number of available hosts is one, the file to be stored is directly stored in the available host.
[0064] Optionally, after the file to be stored is stored in the target host, a soft link of the file to be stored can be established in the original host, that is, the IP address of the storage host of the file to be stored, the actual file storage path and the original file storage path are recorded in the original host, so as to refer to and trace the file to be stored later. The actual file storage path refers to the actual storage path of the file to be stored.
[0065] The technical solution of the embodiment of the present invention is as follows: after a monitoring interface monitors a file saving event, relevant file information corresponding to the file saving event is obtained; wherein the relevant file information includes the file to be stored, the file storage capacity, the file storage disk, and the original host to which the file storage disk belongs; when it is detected that the remaining disk capacity of the file storage disk does not meet the file storage capacity, and the remaining disk capacity of the candidate disks in the original host does not meet the file storage capacity, the target local area network where the original host is located is determined, and the file transfer information of the file to be stored is broadcast to the candidate hosts in the target local area network; wherein the candidate disk refers to the disk other than the file storage disk in the original host; the candidate host refers to the host other than the original host in the target local area network; according to the response information sent by the received responding host, an available host that meets the file storage capacity is determined from at least one responding host; when there are multiple available hosts, according to the file transfer time threshold, the file storage capacity and the available host information corresponding to each available host, the target host is determined from the multiple available hosts, and the file to be stored is stored in the target host. The above technical solution, when it is detected that the remaining disk capacity of the file storage disk does not meet the file storage capacity, and the remaining disk capacity of the candidate disks in the original host does not meet the file storage capacity, will transfer the file to be stored to other hosts in the target LAN where the original host is located, thereby realizing the storage of files between different hosts in the same LAN, without the need to purchase additional large-capacity hard disks or dedicated storage hardware, and without the need to expand the disk of the original host, thereby reducing the downtime and data migration costs related to expansion, and further reducing file storage costs.
[0066] On the basis of the above embodiment, as an optional method of the embodiment of the present invention, when it is detected that the remaining disk capacity of the file storage disk meets the file storage capacity, that is, when it is detected that the remaining disk capacity of the file storage disk is greater than or equal to the file storage capacity, the file to be stored is directly stored in the file storage disk.
[0067] Embodiment 2
[0068] Figure 2AThis is a flowchart of a file storage method provided in the second embodiment of the present invention. Based on the above embodiment, this embodiment provides an optional implementation scheme for storing the to-be-stored file when it is detected that the remaining capacity of the file storage disk does not meet the file storage capacity, and there is a candidate disk in the original host whose remaining capacity meets the file storage capacity. It should be noted that for the parts not described in detail in the embodiment of the present invention, reference can be made to the relevant descriptions of other embodiments. Figure 2A As shown, the method includes:
[0069] S201. After the monitoring interface monitors a file saving event, obtain relevant file information corresponding to the file saving event; wherein the relevant file information includes the file to be stored, the file storage capacity, the file storage disk, and the original host to which the file storage disk belongs.
[0070] S202: When it is detected that the remaining capacity of the file storage disk does not meet the file storage capacity, and there are candidate disks meeting the file storage capacity in the original host, count the number of candidate disks meeting the file storage capacity in the original host.
[0071] The number of candidate disks refers to the total number of candidate disks in the original host whose remaining disk capacity is greater than or equal to the file storage capacity.
[0072] Specifically, when it is detected that the remaining disk capacity of the file storage disk is less than the file storage capacity, and there are candidate disks in the original host whose remaining disk capacity is greater than or equal to the file storage capacity, the number of candidate disks in the original host that meet the file storage capacity is counted through a specially set counter.
[0073] Optionally, after counting the number of candidate disks that meet the file storage capacity in the original host, if the number of candidate disks is one, the file to be stored is directly stored in this candidate disk that meets the file storage capacity, and a soft connection for the file to be stored is established in the original host, that is, the IP address of the storage host of the file to be stored, the actual file saving path and the original file saving path are recorded in the original host, so as to facilitate subsequent reference and tracing of the file to be stored.
[0074] S203: When there are multiple candidate disks, determine the file storage time of each candidate disk according to the file storage capacity and the disk storage speed of each candidate disk.
[0075] The file storage time refers to the time required for the candidate disk to complete the storage of the file to be stored. It should be noted that the candidate disk mentioned here refers to the candidate disk in the original host that meets the file storage capacity.
[0076] Specifically, when there are multiple candidate disks, for each candidate disk in the original host that meets the file storage capacity, the time obtained by dividing the file storage capacity by the disk storage speed of the candidate disk is used as the file storage time of the candidate disk.
[0077] For example, if the file storage capacity is 50MB, there are three candidate disks, that is, there are three candidate disks in the original host that meet the file storage capacity, namely candidate disk 1, candidate disk 2 and candidate disk 3; wherein, the disk storage speed of candidate disk 1 is 80MB / s, and the remaining disk capacity is 10GB; the disk storage speed of candidate disk 2 is 100MB / s, and the remaining disk capacity is 40GB; the disk storage speed of candidate disk 3 is 500MB / s, and the remaining disk capacity is 20GB. For candidate disk 1, the time obtained by dividing the file storage capacity (i.e., 50MB) by the disk storage speed of candidate disk 1 (i.e., 80MB / s) is used as the file storage time of candidate disk 1, that is, the file storage time of candidate disk 1 is 0.625s. Similarly, it can be obtained that the file storage time of candidate disk 2 is 0.5s, and the file storage time of candidate disk 3 is 0.1s.
[0078] For example, the file storage capacity is 100MB, and the candidate disks that meet the file storage capacity in the original host are still candidate disk 1, candidate disk 2, and candidate disk 3; for candidate disk 1, the time obtained by dividing the file storage capacity (i.e., 100MB) by the disk storage speed of candidate disk 1 (i.e., 80MB / s) is used as the file storage time of candidate disk 1, that is, the file storage time of candidate disk 1 is 1.25s. Similarly, it can be obtained that the file storage time of candidate disk 2 is 1s, and the file storage time of candidate disk 3 is 0.2s.
[0079] S204: Filter out an intermediate disk from multiple candidate disks according to a file storage time threshold and the file storage time of each candidate disk.
[0080] The file storage time threshold can be preset according to actual business requirements or the experience of those skilled in the art, and the embodiment of the present invention does not specifically limit it. The intermediate disk refers to a disk generated in the process of determining the target disk. It should be noted that the candidate disk mentioned here refers to a candidate disk in the original host that meets the file storage capacity.
[0081] Specifically, according to the file storage time threshold and the file storage time of each candidate disk, a candidate disk whose file storage time is less than or equal to the file storage time threshold is screened out from multiple candidate disks that meet the file storage capacity as the intermediate disk.
[0082] For example, if the file storage time threshold is 1 second (i.e., 1s), the file storage capacity is 50MB, and the candidate disks that meet the file storage capacity in the original host are still candidate disk 1, candidate disk 2, and candidate disk 3, then it can be obtained that the file storage time of candidate disk 1 is 0.625s, the file storage time of candidate disk 2 is 0.5s, and the file storage time of candidate disk 3 is 0.1s. Afterwards, according to the file storage time threshold and the file storage time of each candidate disk, the candidate disks whose file storage time is less than or equal to the file storage time threshold are screened out from candidate disk 1, candidate disk 2, and candidate disk 3 as intermediate disks, that is, the intermediate disks include candidate disk 1, candidate disk 2, and candidate disk 3.
[0083] For example, if the file storage time threshold is 1s, the file storage capacity is 100MB, and the candidate disks that meet the file storage capacity in the original host are still candidate disk 1, candidate disk 2, and candidate disk 3, then it can be obtained that the file storage time of candidate disk 1 is 1.25s, the file storage time of candidate disk 2 is 1s, and the file storage time of candidate disk 3 is 0.2s. Afterwards, according to the file storage time threshold and the file storage time of each candidate disk, the candidate disks whose file storage time is less than or equal to the file storage time threshold are screened out from candidate disk 1, candidate disk 2, and candidate disk 3 as intermediate disks, that is, the intermediate disks include candidate disk 2 and candidate disk 3.
[0084] It can be understood that when there are multiple candidate disks that meet the file storage capacity in the original host, by determining the file storage time of each candidate disk, a candidate disk whose file storage time is less than or equal to the file storage time threshold is screened out from the multiple candidate disks that meet the file storage capacity and used as an intermediate disk, which helps to achieve fast storage of the files to be stored.
[0085] S205: In the case that there are multiple intermediate disks, a target disk is selected from the multiple intermediate disks according to the remaining capacity of each intermediate disk, and the file to be stored is stored in the target disk.
[0086] The target disk refers to the disk that is ultimately used to store the files to be stored.
[0087] Specifically, when there are multiple intermediate disks, an intermediate disk with the smallest remaining capacity is selected from the multiple intermediate disks as the target disk, and the file to be stored is stored in the target disk.
[0088] Optionally, when no intermediate disk exists, the target disk is determined from multiple candidate disks according to the disk storage speed and remaining disk capacity of each candidate disk.
[0089] Specifically, when the intermediate disk does not exist, that is, when there is no candidate disk whose file storage time is less than or equal to the file storage time threshold among multiple candidate disks that meet the file storage capacity, the disk storage speed of each candidate disk is sorted from high to low to obtain the candidate disk with the highest disk storage speed; if the number of candidate disks is one, the candidate disk is used as the target disk; if the number of candidate disks is multiple, the candidate disk with the smallest remaining disk capacity is selected from the multiple candidate disks as the target disk. Among them, the candidate disk refers to a disk among the candidate disks that may become the target disk. It should be noted that the candidate disk mentioned here refers to the candidate disk that meets the file storage capacity in the original host.
[0090] For example, if the file transfer time threshold is 1s, the file storage capacity is 1000MB, and the candidate disks that meet the file storage capacity in the original host are still candidate disk 1, candidate disk 2, and candidate disk 3, then it can be obtained that the file storage time of candidate disk 1 is 12.5s, the file storage time of candidate disk 2 is 10s, and the file storage time of candidate disk 3 is 2s. Therefore, it can be seen that there is no candidate disk whose file storage time is less than or equal to the file storage time threshold among candidate disk 1, candidate disk 2, and candidate disk 3, that is, there is no intermediate disk. In this case, the disk storage speeds of candidate disk 1, candidate disk 2, and candidate disk 3 are sorted from high to low, and the candidate disk with the highest disk storage speed is obtained, that is, the candidate disk is candidate disk 3; then, candidate disk 3 is used as the target disk.
[0091] It can be understood that when all candidate disks that meet the file storage capacity in the original host are unable to complete the storage of the file to be stored within the file storage time threshold, the candidate disk with the highest disk storage speed is selected as the target disk, thereby achieving rapid storage of the file to be stored; when there are multiple candidate disks with the highest disk storage speed, the candidate disk with the smallest remaining disk capacity is further selected as the target disk, thereby achieving optimal utilization of storage resources in the original host and facilitating storage of the file to be stored in the most suitable location in the original host.
[0092] Optionally, when the number of the intermediate disk is one, the file to be stored is directly stored in the intermediate disk.
[0093] Optionally, after storing the file to be stored in the target disk, a soft link of the file to be stored can be established in the original host, that is, the IP address of the storage host of the file to be stored, the actual file saving path and the original file saving path are recorded in the original host, so as to refer to and trace the file to be stored later.
[0094] The technical solution of the embodiment of the present invention is to obtain relevant file information corresponding to the file saving event after the listening interface listens to the file saving event; wherein the relevant file information includes the file to be stored, the file storage capacity, the file storage disk, and the original host to which the file storage disk belongs; when it is detected that the remaining disk capacity of the file storage disk does not meet the file storage capacity, and there are candidate disks that meet the file storage capacity in the original host, the number of candidate disks that meet the file storage capacity in the original host is counted; when there are multiple candidate disks, the file storage time of each candidate disk is determined according to the file storage capacity and the disk storage speed of each candidate disk; according to the file storage time threshold and the file storage time of each candidate disk, an intermediate disk is screened out from the multiple candidate disks; when there are multiple intermediate disks, a target disk is screened out from the multiple intermediate disks according to the remaining disk capacity of each intermediate disk, and the file to be stored is stored in the target disk. The above technical solution, when it is detected that the remaining capacity of the file storage disk does not meet the file storage capacity, and there is a candidate disk that meets the file storage capacity in the original host, transfers the file to be stored to other disks in the original host except the file storage disk, thereby realizing the storage of files between different disks of the same host, without the need to purchase additional large-capacity hard disks or dedicated storage hardware, and without the need to expand the capacity of the original host's disk, thereby reducing the downtime and data migration costs related to capacity expansion, and further reducing file storage costs.
[0095] Based on the above embodiment, a preferred file storage method is provided. Figure 2B , the method comprising:
[0096] S1. After the monitoring interface monitors a file saving event, obtain relevant file information corresponding to the file saving event; wherein the relevant file information includes the file to be stored, the file storage capacity, the file storage disk, and the original host to which the file storage disk belongs.
[0097] It should be noted that after executing S1, when it is detected that the remaining disk capacity of the file storage disk meets the file storage capacity, the file to be stored is directly stored in the file storage disk; when it is detected that the remaining disk capacity of the file storage disk does not meet the file storage capacity, and the remaining disk capacity of the candidate disks in the original host does not meet the file storage capacity, S2, S3 and S4 are executed sequentially; when it is detected that the remaining disk capacity of the file storage disk does not meet the file storage capacity, and there are candidate disks that meet the file storage capacity in the original host, S5, S6, S7 and S8 are executed sequentially.
[0098] S2. Determine the target local area network where the original host is located, and broadcast the file transfer information of the file to be stored to the candidate hosts in the target local area network.
[0099] S3. Determine an available host that meets the file storage capacity from at least one responding host according to the received response information sent by the responding host.
[0100] It should be noted that if the number of available hosts is one, the file to be stored is directly stored in the available host.
[0101] S4. When there are multiple available hosts, determine a target host from the multiple available hosts according to the file transfer time threshold, the file storage capacity, and the available host information corresponding to each available host, and store the file to be stored in the target host.
[0102] Optionally, storing the file to be stored in the target host can be: obtaining the remaining disk capacity of each disk in the target host, and taking the disk whose remaining disk capacity is greater than or equal to the file storage capacity as the available disk; if there is only one available disk, directly storing the file to be stored in the available disk of the target host; if there are multiple available disks, sorting the disk storage speeds of the available disks in the target host from high to low, and selecting the available disk with the highest disk storage speed from the available disks as the target disk; if there is only one target disk, directly storing the file to be stored in the target disk; if there are multiple target disks, storing the file to be stored in the target disk with the smallest remaining disk capacity.
[0103] S5. Count the number of candidate disks in the original host that meet the file storage capacity.
[0104] It should be noted that if the number of candidate disks is one, the file to be stored is directly stored in the candidate disk that meets the file storage capacity.
[0105] S6. When there are multiple candidate disks, determine the file storage time of each candidate disk according to the file storage capacity and the disk storage speed of each candidate disk.
[0106] S7. Filter out an intermediate disk from multiple candidate disks according to a file storage time threshold and the file storage time of each candidate disk.
[0107] It should be noted that if there is only one intermediate disk, the file to be stored is directly stored in the intermediate disk; if the intermediate disk does not exist, the target disk is determined from multiple candidate disks based on the disk storage speed and remaining disk capacity of each candidate disk.
[0108] S8. In the case that there are multiple intermediate disks, a target disk is selected from the multiple intermediate disks according to the remaining capacity of each intermediate disk, and the file to be stored is stored in the target disk.
[0109] The technical solution of the embodiment of the present invention, when it is detected that the remaining disk capacity of the file storage disk does not meet the file storage capacity, and the remaining disk capacity of the candidate disks in the original host does not meet the file storage capacity, the file to be stored is transferred to other hosts in the target local area network where the original host is located, thereby realizing the storage of files between different hosts in the same local area network; when it is detected that the remaining disk capacity of the file storage disk does not meet the file storage capacity, and there are candidate disks that meet the file storage capacity in the original host, the file to be stored is transferred to other disks in the original host except the file storage disk, thereby realizing the storage of files between different disks of the same host. During the entire file storage process, there is no need to purchase additional large-capacity hard disks or dedicated storage hardware, nor is there any need to expand the disk of the original host, thereby reducing the downtime and data migration costs related to expansion, and further reducing the file storage cost.
[0110] Embodiment 3
[0111] Figure 3 This is a schematic diagram of the structure of a file storage device provided in the third embodiment of the present invention. This embodiment is applicable to the case of storing files in an application system on an operating system, and is particularly applicable to the case of storing large files (i.e., files with a size ranging from 10MB to 5GB) in an application system on an operating system. The device can be implemented in the form of hardware and / or software and can be configured in an electronic device. Figure 3 As shown, the device comprises:
[0112] The relevant file information acquisition module 301 is used to acquire relevant file information corresponding to the file saving event after the monitoring interface monitors the file saving event; wherein the relevant file information includes the file to be stored, the file storage capacity, the file storage disk, and the original host to which the file storage disk belongs;
[0113] The file transfer information broadcast module 302 is used to determine the target LAN where the original host is located, and broadcast the file transfer information of the to-be-stored file to the candidate hosts in the target LAN when it is detected that the remaining capacity of the file storage disk does not meet the file storage capacity, and the remaining capacity of the candidate disks in the original host does not meet the file storage capacity; wherein the candidate disk refers to the disk in the original host except the file storage disk; the candidate host refers to the host in the target LAN except the original host;
[0114] An available host determination module 303 is used to determine an available host that meets the file storage capacity from at least one responding host according to the response information received from the responding host;
[0115] The target host determination module 304 is used to determine the target host from the multiple available hosts according to the file transfer time threshold, the file storage capacity and the available host information corresponding to each available host when there are multiple available hosts, and store the file to be stored in the target host.
[0116] The technical solution of the embodiment of the present invention is as follows: after a monitoring interface monitors a file saving event, relevant file information corresponding to the file saving event is obtained; wherein the relevant file information includes the file to be stored, the file storage capacity, the file storage disk, and the original host to which the file storage disk belongs; when it is detected that the remaining disk capacity of the file storage disk does not meet the file storage capacity, and the remaining disk capacity of the candidate disks in the original host does not meet the file storage capacity, the target local area network where the original host is located is determined, and the file transfer information of the file to be stored is broadcast to the candidate hosts in the target local area network; wherein the candidate disk refers to the disk other than the file storage disk in the original host; the candidate host refers to the host other than the original host in the target local area network; according to the response information sent by the received responding host, an available host that meets the file storage capacity is determined from at least one responding host; when there are multiple available hosts, according to the file transfer time threshold, the file storage capacity and the available host information corresponding to each available host, the target host is determined from the multiple available hosts, and the file to be stored is stored in the target host. The above technical solution, when it is detected that the remaining disk capacity of the file storage disk does not meet the file storage capacity, and the remaining disk capacity of the candidate disks in the original host does not meet the file storage capacity, will transfer the file to be stored to other hosts in the target LAN where the original host is located, thereby realizing the storage of files between different hosts in the same LAN, without the need to purchase additional large-capacity hard disks or dedicated storage hardware, and without the need to expand the disk of the original host, thereby reducing the downtime and data migration costs related to expansion, and further reducing file storage costs.
[0117] Optionally, the response information includes the remaining capacity of the host disk;
[0118] The available host determination module 303 is specifically used for:
[0119] According to the remaining capacity of the host disk of each responding host, an available host that meets the file storage capacity is screened out from at least one responding host.
[0120] Optionally, the available host information includes a host file transfer speed, a host disk storage speed, and a host disk remaining capacity of the available host;
[0121] The target host determination module 304 includes:
[0122] A minimum file transfer speed determination unit, used to determine the minimum file transfer speed of the available host according to the host file transfer speed of the available host and the host disk storage speed;
[0123] A file transfer time determination unit, used to determine the file transfer time of an available host according to the file storage capacity and the minimum file transfer speed;
[0124] An intermediate host screening unit, used to screen out an intermediate host from multiple available hosts according to a file transfer time threshold and a file transfer time of each available host;
[0125] The target host screening unit is used to screen out the target host from the multiple intermediate hosts according to the remaining capacity of the host disk of each intermediate host when there are multiple intermediate hosts.
[0126] Optionally, the target host determination module 304 further includes a target host determination unit, and the target host determination unit is specifically configured to:
[0127] In the absence of an intermediate host, the target host is determined from multiple available hosts based on the minimum file transfer speed of each available host and the remaining capacity of the host disk.
[0128] Optionally, the device further comprises:
[0129] A candidate disk quantity statistics module is used to count the number of candidate disks that meet the file storage capacity in the original host when it is detected that the remaining disk capacity of the file storage disk does not meet the file storage capacity and there are candidate disks whose remaining disk capacity meets the file storage capacity in the original host;
[0130] A file storage time determination module, for determining the file storage time of each candidate disk according to the file storage capacity and the disk storage speed of each candidate disk when there are multiple candidate disks;
[0131] The intermediate disk screening module is used to screen out the intermediate disk from multiple candidate disks according to the file storage time threshold and the file storage time of each candidate disk;
[0132] The target disk screening module is used to screen out a target disk from the plurality of intermediate disks according to the remaining capacity of each intermediate disk when there are a plurality of intermediate disks, and store the files to be stored in the target disk.
[0133] Optionally, the device further comprises:
[0134] The target disk determination module is used to determine the target disk from multiple candidate disks according to the disk storage speed and the remaining disk capacity of each candidate disk when the intermediate disk does not exist.
[0135] The file storage device provided in the embodiment of the present invention can execute the file storage method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects for executing each file storage method.
[0136] According to an embodiment of the present invention, the present invention also provides an electronic device, a readable storage medium and a computer program product.
[0137] Embodiment 4
[0138] Figure 4 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0139] like Figure 4 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11 in communication, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, ROM 12 and RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0140] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0141] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as a file storage method.
[0142] In some embodiments, the file storage method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the file storage method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute the file storage method in any other appropriate manner (e.g., by means of firmware).
[0143] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0144] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0145] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, device, or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0146] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0147] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0148] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0149] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0150] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A file storage method, characterized in that: include: After the monitoring interface monitors the file saving event, the relevant file information corresponding to the file saving event is obtained; wherein the relevant file information includes the file to be stored, the file storage capacity, the file storage disk, and the original host to which the file storage disk belongs; When it is detected that the remaining disk capacity of the file storage disk does not meet the file storage capacity, and the remaining disk capacity of the candidate disks in the original host does not meet the file storage capacity, determine the target local area network where the original host is located, and broadcast the file transfer information of the to-be-stored file to the candidate hosts in the target local area network; wherein the candidate disk refers to the disk in the original host except the file storage disk; the candidate host refers to the host in the target local area network except the original host; Determine, based on the received response information sent by the responding host, an available host that satisfies the file storage capacity from at least one responding host; In the case that there are multiple available hosts, a target host is determined from the multiple available hosts according to the file transfer time threshold, the file storage capacity and available host information corresponding to each available host, and the file to be stored is stored in the target host; the available host information includes the host file transfer speed of the available host, the host disk storage speed and the remaining capacity of the host disk; Wherein, determining a target host from a plurality of available hosts according to a file transfer time threshold, the file storage capacity, and available host information corresponding to each available host includes: Determining a minimum file transfer speed of the available host according to the host file transfer speed and the host disk storage speed of the available host; Determining the file transfer time of the available host according to the file storage capacity and the minimum file transfer speed; According to the file transfer time threshold and the file transfer time of each available host, select an available host whose file transfer time is less than or equal to the file transfer time threshold from multiple available hosts as an intermediate host; In the case that there are multiple intermediate hosts, the intermediate host with the smallest remaining host disk capacity is selected as the target host according to the remaining host disk capacity of each intermediate host.
2. The method according to claim 1, characterized in that The response information includes the remaining capacity of the host disk; The step of determining, based on the received response information sent by the responding host, an available host that satisfies the file storage capacity from at least one responding host comprises: According to the remaining capacity of the host disk of each responding host, an available host that meets the file storage capacity is screened out from at least one responding host.
3. The method according to claim 1, characterized in that The method further comprises: In the case that the intermediate host does not exist, the target host is determined from multiple available hosts according to the minimum file transfer speed of each available host and the remaining capacity of the host disk.
4. The method according to claim 1, characterized in that: The method further comprises: When it is detected that the remaining disk capacity of the file storage disk does not satisfy the file storage capacity, and there is a candidate disk whose remaining disk capacity satisfies the file storage capacity in the original host, counting the number of candidate disks that satisfy the file storage capacity in the original host; In the case where there are multiple candidate disks, determining the file storage time of each candidate disk according to the file storage capacity and the disk storage speed of each candidate disk; Selecting an intermediate disk from multiple candidate disks according to a file storage time threshold and the file storage time of each candidate disk; In the case that there are multiple disks of the intermediate disk, a target disk is selected from the multiple intermediate disks according to the remaining capacity of each intermediate disk, and the file to be stored is stored in the target disk.
5. The method according to claim 4, characterized in that The method further comprises: In the case that the intermediate disk does not exist, the target disk is determined from a plurality of candidate disks according to the disk storage speed and the remaining capacity of each candidate disk.
6. A file storage device, characterized in that: include: A related file information acquisition module is used to acquire related file information corresponding to the file saving event after the monitoring interface monitors the file saving event; wherein the related file information includes the file to be stored, the file storage capacity, the file storage disk, and the original host to which the file storage disk belongs; The file transfer information broadcast module is used to determine the target local area network where the original host is located, and broadcast the file transfer information of the to-be-stored file to the candidate hosts in the target local area network when it is detected that the remaining disk capacity of the file storage disk does not meet the file storage capacity and the remaining disk capacity of the candidate disks in the original host does not meet the file storage capacity; wherein the candidate disk refers to the disk in the original host except the file storage disk; the candidate host refers to the host in the target local area network except the original host; An available host determination module, configured to determine an available host that satisfies the file storage capacity from at least one responding host according to the response information received from the responding host; a target host determination module, configured to determine a target host from the multiple available hosts according to a file transfer time threshold, the file storage capacity, and available host information corresponding to each available host, and store the file to be stored in the target host when there are multiple available hosts; the available host information includes a host file transfer speed of the available host, a host disk storage speed, and a remaining capacity of the host disk; Wherein, the target host determination module includes: A minimum file transfer speed determining unit, configured to determine the minimum file transfer speed of the available host according to the host file transfer speed and the host disk storage speed of the available host; A file transmission time determination unit, configured to determine the file transmission time of the available host according to the file storage capacity and the minimum file transmission speed; An intermediate host screening unit, configured to screen out, from a plurality of available hosts, available hosts whose file transfer time is less than or equal to the file transfer time threshold value according to the file transfer time threshold value and the file transfer time of each available host, as an intermediate host; The target host screening unit is used to select the intermediate host with the smallest remaining host disk capacity as the target host according to the remaining host disk capacity of each intermediate host when there are multiple intermediate hosts.
7. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the file storage method according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the file storage method according to any one of claims 1 to 5 when executed.
9. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the file storage method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Server system based on computer cluster in local area network
CN108595367A