A network range resource disk expansion method and system
By allowing resource disks to be inserted into any node and dynamically synchronizing resource copies on the network range platform, the problems of limited resource disk insertion and performance bottlenecks in the existing technology are solved, resource disk expansion and load balancing are achieved, and user experience is improved.
Patent Information
- Application Number
- CN202410711854.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-04
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2044-06-04
AI Technical Summary
The existing network shooting range resource disk can only be inserted on the server where the shooting range platform is located. The number of insertions is limited, which leads to difficulties in resource import and performance bottlenecks. It is also impossible to remove the resource disk for expansion during the running of the shooting range service.
Design a resource disk expansion method and system that allows the resource disk to be inserted into any node of the shooting range platform, monitors the insertion event through the resource disk configuration agent service, generates a shared ID, mounts the resource directory, and synchronizes resource information in the database to support multiple hosts. Share paths and dynamically synchronize hotspot resource copies to balance node load.
It realizes the expansion and load balancing of resource disks, supports the insertion of resource disks on any server in the cluster, improves the flexibility of resource use and user experience, and avoids network and disk IO bottlenecks.
Smart Images

Figure CN118276791B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a network range resource disk expansion method and system, belonging to the field of information technology. Background Art
[0002] The network range platform generally contains a large number of courses, exercises, targets, scenes and other resources. These resources usually take up a lot of disk space, and these resources will be continuously produced and updated. In order to solve the problems in the distribution and use of network range resources, patent CN113268206B provides a method and system for implementing hot-swappable network range resources. The patent scheme designs the structure of the network range resource disk, which can generate a resource disk based on the resources selected by the user and the resources on which the selected resources depend. The partition volume label of the resource disk uses a unified name to facilitate the network range platform to identify; monitor the disk status on the network range platform server, identify the resource disk through the disk characteristics, and after the resource disk is inserted into the server of the network range platform, the network range platform scans the resources on the resource disk, imports the resources into the platform and enables them; after the resource disk is unplugged from the server of the network range platform or the resource disk fails, the network range platform deactivates the corresponding resources.
[0003] In actual use, the above existing patent solution still has the following problems: the resource disk can only be placed on the server where the shooting range platform is located, and the number of resource disks that can be inserted is limited, making it difficult to import more resources or expand the capacity of the resource disk, which will cause network and disk IO bottlenecks when used concurrently. Moreover, the resource disk cannot be removed during the operation of the shooting range service, otherwise it will cause the resource to be unavailable. Summary of the invention
[0004] Purpose of the invention: In view of the problems existing in the above-mentioned prior art, the purpose of the present invention is to provide a method and system for expanding the resource disk of a network target range. The resource disk can be inserted into any node of the target range platform (including control nodes and computing nodes), and can support the expansion of the resource disk and balance the performance load of each node.
[0005] Technical solution: To achieve the above-mentioned invention object, the present invention adopts the following technical solution:
[0006] A method for expanding the capacity of a network range resource disk comprises the following steps:
[0007] Step 1: When a resource disk insertion event is detected on any server in the range platform cluster, the resource disk is mounted to the local directory of the server and set as a shared directory;
[0008] Step 2: Generate a shared ID for the shared directory and save it;
[0009] Step 3: Mount the shared directory to the resource directory of the server, and add the shared ID to the mount path;
[0010] Step 4: Synchronize resource information and resource paths to the database, and record the corresponding relationship between the resource ID and the host where the resource is located, shared path, basic path, shared ID and resource relative path through the resource table. The same resource ID can correspond to multiple hosts and different paths on the same host.
[0011] Step 5: Send the resource disk shared directory to other servers in the range platform cluster, and other servers mount the shared directory;
[0012] Step 6: When a request to obtain a resource is received, the host list where the resource is located is queried from the resource table according to the resource ID, and a resource path is obtained based on the rule of least physical resource usage or randomly.
[0013] Furthermore, when multiple resource disks are inserted into one server or multiple servers, the mounting operation of each resource disk is performed according to step 1 to step 5.
[0014] Preferably, the method calculates the physical resource usage weight of the host according to the CPU idleness, available memory size and remaining disk size of the host, and filters out the host with the least physical resource usage based on the weight.
[0015] Furthermore, when the resource disk is pulled out, all paths corresponding to the host where the resource is located are deleted from the resource table.
[0016] Furthermore, the method also includes: synchronizing hot resources to multiple resource disks and registering the paths of resource copies in a resource table; the hot resources are based on statistical identification and / or user settings; the resource copies have the same resource ID as the original resources.
[0017] Furthermore, the method also includes: for course resources, before the course, training or competition starts, synchronizing the course resources to multiple servers with resource disks inserted according to the course schedule, and registering the paths of multiple resource copies in the resource table after the resources are synchronized; after the course, training or competition ends, cleaning up the synchronized course resources.
[0018] A network range resource disk expansion system includes a resource disk configuration agent service deployed on a server in a range platform cluster, and a resource management module on a range platform server;
[0019] The resource disk configuration proxy service is used to monitor the resource disk insertion event on the server, mount the resource disk to the server local directory and set it as a shared directory; mount the shared directory to the server local resource directory, and add the shared ID to the mount path; and synchronize resource information and resource paths to the database, and record the corresponding relationship between the resource ID and the host where the resource is located, the shared path, the basic path, the shared ID and the relative path of the resource through the resource table, wherein the same resource ID supports corresponding to multiple hosts and different paths on the same host;
[0020] The resource management module is used to generate and save a shared ID for a shared directory; and when a resource disk is inserted into any server in the shooting range platform cluster, the resource disk shared directory is sent to other servers in the shooting range platform cluster, and the resource disks on other servers are configured with a proxy service to mount the shared directory; and when a request to obtain a resource is received, the list of hosts where the resource is located is queried from the resource table according to the resource ID, and a resource path is obtained based on the rule of minimum physical resource usage or randomly.
[0021] Furthermore, the system also includes a dynamic multi-copy synchronization module: used to synchronize hot resources to multiple resource disks and register the paths of resource copies in the resource table; the hot resources are based on statistical identification and / or user settings; the resource copies have the same resource ID as the original resources.
[0022] Furthermore, the system also includes a dynamic multi-copy synchronization module: for synchronizing course resources to multiple servers with resource disks inserted before the start of courses, training or competitions according to the course schedule, and registering the paths of multiple resource copies in the resource table after resource synchronization; after the course, training or competition, the synchronized course resources are cleaned up.
[0023] Beneficial effects: Compared with the prior art, the present invention has the following advantages: the present invention uses network storage to replace local storage, inserts a resource disk on any server in the cluster, and other servers can synchronize to the resource information, can support resource disk expansion, resource disks can be inserted into any node of the range platform, and can balance the performance load of each node. In addition, the present invention also dynamically synchronizes resource copies according to the course schedule, and the use of dynamic multiple copies can ensure a better user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 It is a framework structure diagram of an embodiment of the present invention.
[0025] Figure 2 The figure is a schematic diagram of the resource disk import process according to an embodiment of the present invention.
[0026] Figure 3 The diagram is a schematic diagram of a resource access process according to an embodiment of the present invention. DETAILED DESCRIPTION
[0027] The technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings and specific embodiments.
[0028] like Figure 1 As shown, a network range resource disk expansion method disclosed in an embodiment of the present invention uses a network method to mount a resource disk, supports mounting multiple resource disks to one or more server nodes, and can achieve rapid expansion and load balancing of resource disks. The embodiment of the present invention implements resource disk identification, resource import, and resource synchronization functions through resource disk configuration proxy services.
[0029] The shooting range platform is generally composed of a server cluster. The shooting range platform server is deployed on the control node in the cluster, and the virtual machine of the shooting range scene is deployed on the computing node. Before implementing the scheme of the present invention, the resource disk configuration proxy service is deployed on the server. The resource disk configuration proxy service monitors the insertion and removal events of the local hard disk, and the NFS server and client software (network file system software can also be used) are installed on the server in advance.
[0030] like Figure 2 , 3 As shown, a method for expanding the capacity of a network range resource disk disclosed in an embodiment of the present invention includes: when a resource disk insertion event on any server in a range platform cluster is monitored, the resource disk is mounted to a local directory of the server and set as a shared directory; a shared ID is generated for the shared directory and saved; the shared directory is mounted to a local resource directory of the server, and the shared ID is added to the mount path; resource information and resource paths are synchronized to a database, and the corresponding relationship between the resource ID and the host where the resource is located, the shared path, the basic path, the shared ID and the relative path of the resource is recorded in a resource table, wherein the same resource ID supports corresponding to multiple hosts and different paths on the same host; the resource disk shared directory is sent to other servers in the range platform cluster, and the other servers mount the shared directory; when a request to obtain a resource is received, a list of hosts where the resource is located is queried from the resource table according to the resource ID, and a resource path is obtained based on the rule of minimum physical resource usage or randomly.
[0031] The following is a detailed description of the resource disk import process with a specific example. The specific steps are as follows:
[0032] Step 1: When the user inserts a resource disk, the resource disk configuration agent service recognizes the resource disk insertion event and mounts the corresponding resource disk to a local directory, such as / mnt / resource1.
[0033] Step 2: Configure the resource disk proxy service to set the directory / mnt / resource1 where the resource disk was just mounted as an nfs shared directory and allow LAN access.
[0034] Step 3: The target range generates a unique shared ID for the current nfs shared directory, such as e4a8aee9b7bd5b806dc4c72a1baff543, and stores the corresponding relationship between the shared ID and the shared directory in the database, as shown in Table 1.
[0035] Table 1: Shared directory storage example
[0036]
[0037] Step 4: The resource disk configuration proxy service mounts the nfs shared directory to the local resource directory, and adds the unique shared ID generated in the previous step to the mount path, such as: / data / e4a8aee9b7bd5b806dc4c72a1baff543 /
[0038] Mount command example:
[0039] mount -t nfs 10.100.1.11: / mnt / resource1 / data / e4a8aee9b7bd5b806dc4c72a1baff543 /
[0040] Step 5: The resource disk configuration agent synchronizes resource information and resource paths to the database. Resources and resource paths are one-to-many relationships. The resource table includes resource ID, resource host, shared path, basic path, shared ID, and resource relative path. The same resource ID in the resource table can correspond to multiple hosts and different paths on the same host.
[0041] Table 2: Example of resource table structure
[0042]
[0043] Step 6: The range platform server sends the resource disk shared directory to the resource disk configuration proxy service on other nodes, and notifies the resource disk configuration proxy service to mount the directory. For the directory mounting steps, refer to step 4.
[0044] Step 7: When the user uses resources on the front-end page, the range platform server will query the host list where the current resource is stored based on the resource ID.
[0045] Step 8. The range platform server will collect the physical resource usage of the resource storage host and filter out the host with the least physical resource usage. For example, the weight of the current host is calculated based on the CPU, memory, and disk size. The one with the highest weight is given priority. Weight = CPU idle amount × α + available memory size (GB) × β + remaining resource disk space (GB) × γ; where α, β, and γ are weight coefficients, such as: weight = 80% × 100 + 100 × 1 + 2000 × 0.1. Resource usage can be directly queried using the python psutil library.
[0046] Step 9: The range platform server queries the resource path list based on the resource ID and the filtered hosts. If the number of paths in the list is greater than 1, a random path is returned.
[0047] Step 10: The range platform server returns the real path corresponding to the resource to the front-end page for use.
[0048] When a new resource disk is to be inserted, the resource disk can be inserted into any server, including a server that has already inserted a resource disk. The resource disk configuration agent service will execute the above steps 1 to 6 to mount the resource disk after identifying the resource disk insertion event.
[0049] After the above steps, each server node mounts all shared paths and can access all shared resources. The same resource can be stored in multiple copies, that is, the same ID will have multiple data, which can be different paths of the same host or different hosts.
[0050] Unplugging the resource disk will delete all paths stored on the current host in the resource table. If only one copy of the resource is stored, when you access the resource again after deletion, you will be prompted that the corresponding resource cannot be found.
[0051] In the shooting range, teachers will create courses, training, competitions, etc. according to the curriculum. Generally, there will be many students in a class. When many students access the same large resource at the same time (such as playing videos or downloading tool software), the disk and network IO load of a server will be too high, resulting in a poor user experience. To address this problem, the embodiment of the present invention further provides a dynamic multi-copy synchronization function, which mainly involves two points:
[0052] First, commonly used hot resources are automatically synchronized to multiple resource disks, and the resource paths are registered with the range platform server. Users can specify which resources are hot resources. The resource IDs of hot resources in multiple synchronized resource disks are the same. After a resource is stored on the resource disks of multiple servers, it will correspond to multiple resource paths. When using this resource, first obtain the resource path list based on the resource ID, and then randomly select one or select a real path based on scheduling and return it.
[0053] Second, when the teacher creates a course, training or competition in the shooting range's schedule, the shooting range platform will automatically call the resource disk configuration proxy service to synchronize the resources to the resource disks of multiple servers one to two days before the start of the course, training or competition and when the platform load is light, based on the start time of the schedule, and register multiple resource copies in the resource table after the resource synchronization, so that students can disperse requests when using them to obtain a better user experience. After the course, training or competition, the shooting range platform server will also automatically call the resource disk proxy service to clean up these temporary resources to ensure that the resource disk is not full.
[0054] Based on the same inventive concept, an embodiment of the present invention also discloses a network range resource disk expansion system, including a resource disk configuration agent service deployed on a server in a range platform cluster, and a resource management module on the range platform server; the resource disk configuration agent service is used to monitor the resource disk insertion event on the server, mount the resource disk to the server local directory and set it as a shared directory; mount the shared directory to the resource directory of the server local, and add a shared ID to the mount path; and synchronize resource information and resource paths to the database, and record the correspondence between the resource ID and the host where the resource is located, the shared path, the basic path, the shared ID and the relative path of the resource through the resource table; the resource management module is used to generate and save a shared ID for the shared directory; and when a resource disk is inserted on any server in the range platform cluster, the resource disk shared directory is sent to other servers in the range platform cluster, and the resource disk configuration agent service on the other servers mounts the shared directory; and when a request to obtain a resource is received, the list of hosts where the resource is located is queried from the resource table according to the resource ID, and a resource path is obtained based on the rule of minimum physical resource usage or randomly.
[0055] To further optimize the user experience, the system also includes a dynamic multi-copy synchronization module: used to synchronize hot resources to multiple resource disks and register the paths of resource copies in the resource table; the hot resources are based on statistical identification and / or user settings; the resource copies have the same resource ID as the original resources, and for course resources, according to the course schedule, before the start of the course, training or competition, to synchronize course resources to multiple servers with resource disks inserted, and register the paths of multiple resource copies in the resource table after resource synchronization; after the course, training or competition, the synchronized course resources are cleaned up.
Claims
1. A method for expanding the capacity of a network range resource disk, characterized in that: The steps include: Step 1: When a resource disk insertion event is detected on any server in the range platform cluster, the resource disk is mounted to the local directory of the server and set as a shared directory; Step 2: Generate a shared ID for the shared directory and save it; Step 3: Mount the shared directory to the resource directory of the server, and add the shared ID to the mount path; Step 4: Synchronize resource information and resource paths to the database, and record the corresponding relationship between the resource ID and the host where the resource is located, shared path, basic path, shared ID and resource relative path through the resource table. The same resource ID can correspond to multiple hosts and different paths on the same host. Step 5: Send the resource disk shared directory to other servers in the range platform cluster, and other servers mount the shared directory; Step 6: When a request to obtain a resource is received, the host list where the resource is located is queried from the resource table according to the resource ID, and a resource path is obtained based on the rule of least physical resource usage or randomly.
2. A method for expanding the capacity of a network range resource disk according to claim 1, characterized in that: When multiple resource disks are inserted into one server or multiple servers, follow steps 1 to 5 to mount each resource disk.
3. A method for expanding the capacity of a network range resource disk according to claim 1, characterized in that: The physical resource usage weight of the host is calculated according to the CPU idleness, available memory size and remaining disk size of the host, and the host with the least physical resource usage is filtered out based on the weight.
4. A method for expanding the capacity of a network range resource disk according to claim 1, characterized in that: When the resource disk is unplugged, all paths corresponding to the host where the resource is located are deleted from the resource table.
5. A method for expanding the capacity of a network range resource disk according to claim 1, characterized in that: Also includes: Synchronize hotspot resources to multiple resource disks, and register the paths of resource copies in a resource table; the hotspot resources are based on statistical identification and / or user settings; the resource copies have the same resource ID as the original resources.
6. A method for expanding the capacity of a network range resource disk according to claim 1, characterized in that: Also includes: For course resources, before the course, training or competition starts, the course resources are synchronized to multiple servers with resource disks inserted according to the course schedule, and the paths of multiple resource copies are registered in the resource table after the resources are synchronized; after the course, training or competition ends, the synchronized course resources are cleaned up.
7. A network range resource disk expansion system, characterized in that: It includes the resource disk configuration proxy service deployed on the server in the range platform cluster, and the resource management module on the range platform server side; The resource disk configuration proxy service is used to monitor the resource disk insertion event on the server, mount the resource disk to the server local directory and set it as a shared directory; mount the shared directory to the server local resource directory, and add the shared ID to the mount path; And synchronize resource information and resource paths to the database, and record the corresponding relationship between resource ID and the host where the resource is located, shared path, basic path, shared ID and resource relative path through the resource table, where the same resource ID supports corresponding to multiple hosts and different paths on the same host; The resource management module is used to generate and save a shared ID for a shared directory; and when a resource disk is inserted into any server in the range platform cluster, the resource disk shared directory is sent to other servers in the range platform cluster, and the resource disks on other servers are configured with proxy services to mount the shared directory; When a request for obtaining a resource is received, a list of hosts where the resource is located is queried from the resource table according to the resource ID, and a resource path is obtained based on the rule of least physical resource usage or randomly.
8. A network range resource disk expansion system according to claim 7, characterized in that: The physical resource usage weight of the host is calculated according to the CPU idleness, available memory size and remaining disk size of the host, and the host with the least physical resource usage is filtered out based on the weight.
9. A network range resource disk expansion system according to claim 7, characterized in that: It also includes a dynamic multi-copy synchronization module: used to synchronize hot resources to multiple resource disks and register the paths of resource copies in the resource table; the hot resources are based on statistical identification and / or user settings; the resource copies have the same resource ID as the original resources.
10. A network range resource disk expansion system according to claim 7, characterized in that: It also includes a dynamic multi-copy synchronization module: for course resources, according to the course schedule, before the start of the course, training or competition, to synchronize course resources to multiple servers with resource disks inserted, and register the paths of multiple resource copies in the resource table after the resource synchronization; after the course, training or competition, the synchronized course resources are cleaned up.
