Method, apparatus and device for supporting multiple instances

By allowing multiple directory trees to coexist on a single management device in a distributed file system and enabling dynamic migration, the problem of insufficient file storage flexibility in existing technologies is solved, achieving more efficient resource utilization and management.

CN115495432BActive Publication Date: 2026-07-07ALIBABA (CHINA) CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ALIBABA (CHINA) CO LTD
Filing Date
2022-09-30
Publication Date
2026-07-07

Smart Images

  • Figure CN115495432B_ABST
    Figure CN115495432B_ABST
Patent Text Reader

Abstract

The embodiment of the application provides a method, device and equipment supporting multiple instances, the method comprises the following steps: receiving an instance creation request, wherein the instance creation request comprises the identification of the instance; determining the identification of the directory tree corresponding to the instance according to the instance creation request; creating the directory tree in the device group, and generating the mapping relationship between the directory tree and the device group. Since multiple directory trees can be created in any device group, compared with only one directory tree in one device group, the flexibility of file storage in the distributed file system is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, and device that supports multiple instances. Background Technology

[0002] In the field of computer technology, user files can be distributed and stored on multiple storage servers, and file directories can be stored on multiple management devices. The system consisting of these multiple storage servers and multiple management devices can be called a distributed file system (DFS).

[0003] In related technologies, for any management device in a distributed file system, a directory tree can be stored. This directory tree can correspond to multiple user files. After a directory tree is created in the management device, it exclusively occupies the resources of that management device. When the directory tree occupies few resources, it may lead to resource waste. When the directory tree occupies many resources, it may lead to resource shortage. Therefore, it is clear that the flexibility of file storage in existing distributed file systems is relatively low. Summary of the Invention

[0004] This application provides a method, apparatus, and device that support multiple instances to improve the flexibility of file storage in a distributed file system.

[0005] In a first aspect, embodiments of this application provide a method supporting multiple instances, including:

[0006] Receive an instance creation request, the instance creation request including the instance identifier;

[0007] Based on the instance creation request, determine the identifier of the directory tree corresponding to the instance;

[0008] Create the directory tree in the device group and generate the mapping relationship between the directory tree and the device group.

[0009] In one possible implementation, the method further includes:

[0010] Receive a data access request sent by a client, wherein the data access request includes a file name;

[0011] Based on the data access request, the directory tree and target file node corresponding to the file name are determined, and the target file node is included among the multiple file nodes corresponding to the directory tree;

[0012] Based on the directory tree and the target file node, the storage location of the file to be accessed in the storage server is determined, and the storage location is sent to the client.

[0013] In one possible implementation, the method is applied to a distributed file system, which includes a first device group and a second device group; the method further includes:

[0014] A first directory tree to be migrated is determined from multiple directory trees in the first device group, wherein the first device group includes multiple first devices, and each of the multiple first devices includes the multiple directory trees;

[0015] The second device in the second device group is set to virtual state and obtains the first operation log of the first directory tree from the first device group. The second device group includes multiple second devices.

[0016] When the first operation log corresponding to the first directory tree in the second device is the same as the first operation log corresponding to the first directory tree in the first device, the permission device group of the first directory tree is switched to the second device group.

[0017] In one possible implementation, the second device in the second device group obtains the first operation log of the first directory tree from the first device group, including:

[0018] Receive the first operation log sent by the first master device, where the first master device is the master device in the first device group;

[0019] The first operation log is stored in the first storage space corresponding to the first directory tree.

[0020] In one possible implementation, receiving the first operation log sent by the first master device includes:

[0021] Receive the historical first operation log corresponding to the first directory tree sent by the first master device;

[0022] Store the historical first operation log and send a storage success response message to the first master device;

[0023] The system receives the latest first operation log corresponding to the first directory tree sent by the first master device and stores the latest first operation log, wherein the first operation log includes the historical first operation log and the latest first operation log.

[0024] In one possible implementation, when the first operation log corresponding to the first directory tree in the second device is the same as the first operation log corresponding to the first directory tree in the first device, the permission device group of the first directory tree is switched to the second device group, including:

[0025] When the first operation log corresponding to the first directory tree in the second device is the same as the first operation log corresponding to the first directory tree in the first device, a first indication information is sent to the first master device. The first indication information is used to indicate that the first operation log synchronization is completed.

[0026] Receive a switching log sent by the first master device, the switching log being used to indicate switching the permission device group of the first directory tree to the second device group;

[0027] Based on the switching log, the permission device group of the first directory tree is switched to the second device group.

[0028] In one possible implementation, the first operation log includes the identifier of the first directory tree and the identifiers of N second directory trees, where N is an integer; the method further includes:

[0029] Set the state of the N second directory trees to empty;

[0030] Switch the state of the second device from the virtual state to the running state.

[0031] In one possible implementation, the method further includes:

[0032] The second device obtains its device identifier from the first operation log;

[0033] The second device, based on the device identifier, performs a master device election within the second device group to determine a second master device within the second device group.

[0034] In one possible implementation, after the second device performs a master device election in the second device group based on the device identifier to determine a second master device in the second device group, the process further includes:

[0035] Send a second instruction message to the first master device. The second instruction message includes the identifier of the first directory tree. The second instruction message is used to instruct the first master device to delete the first directory tree.

[0036] In one possible implementation, the number of the first directory trees is greater than 1; the method further includes:

[0037] Generate a second operation log corresponding to each first directory tree;

[0038] The second operation log corresponding to each first directory tree is stored in the corresponding log directory, and the log directories corresponding to multiple first directory trees are located under the same parent directory.

[0039] In one possible implementation, the method further includes:

[0040] Determine the identifier of the second storage space occupied by the first directory tree in the storage server, wherein the identifier of the second storage space is allocated by the root server;

[0041] Based on the identifier of the second storage space, determine the storage file corresponding to the first directory tree in the storage server;

[0042] Based on the operation log corresponding to the first directory tree and the storage file, update the operation log and / or the storage file to make the operation log and the storage file consistent.

[0043] In one possible implementation, the method further includes:

[0044] Determine the target directory tree within the first directory tree;

[0045] Based on the identifier of the target directory tree, at least one of the following processes is performed on the target directory tree: detection processing, deletion processing, or copying processing.

[0046] Secondly, embodiments of this application provide a distributed file system, including a client, multiple management devices, and at least one storage server, wherein...

[0047] The management device is used to store a directory tree and to perform the method described in any of the first aspects to migrate the directory tree between different device groups, wherein the management device is located in one of the device groups;

[0048] The storage device is used to store the files corresponding to the directory tree;

[0049] The client is used to access files in the storage device through the directory tree in the management device.

[0050] Thirdly, embodiments of this application provide an apparatus supporting multiple instances, comprising: a first receiving module, a first determining module, and a creating module, wherein...

[0051] The first receiving module is used to receive an instance creation request, wherein the instance creation request includes an instance identifier;

[0052] The first determining module is used to determine the identifier of the directory tree corresponding to the instance based on the instance creation request;

[0053] The creation module is used to create the directory tree in the device group and generate the mapping relationship between the directory tree and the device group.

[0054] In one possible implementation, the apparatus further includes: a second determining module, the second determining module being configured to,

[0055] Receive a data access request sent by a client, wherein the data access request includes a file name;

[0056] Based on the data access request, the directory tree and target file node corresponding to the file name are determined, and the target file node is included among the multiple file nodes corresponding to the directory tree;

[0057] Based on the directory tree and the target file node, the storage location of the file to be accessed in the storage server is determined, and the storage location is sent to the client.

[0058] In one possible implementation, the device further includes: a third determining module, a setting module, an acquiring module, and a switching module, wherein,

[0059] The third determining module is used to determine the first directory tree to be migrated among the multiple directory trees of the first device group. The first device group includes multiple first devices, and the multiple first devices respectively include the multiple directory trees.

[0060] The setting module is used to set the second device in the second device group to a virtual state;

[0061] The acquisition module is used to acquire the first operation log of the first directory tree from the first device group, wherein the second device group includes multiple second devices;

[0062] The switching module is used to switch the permission device group of the first directory tree to the second device group when the first operation log corresponding to the first directory tree in the second device is the same as the first operation log corresponding to the first directory tree in the first device.

[0063] In one possible implementation, the acquisition module is specifically used for:

[0064] Receive the first operation log sent by the first master device, where the first master device is the master device in the first device group;

[0065] The first operation log is stored in the first storage space corresponding to the first directory tree.

[0066] In one possible implementation, the acquisition module is specifically used for:

[0067] Receive the historical first operation log corresponding to the first directory tree sent by the first master device;

[0068] Store the historical first operation log and send a storage success response message to the first master device;

[0069] The system receives the latest first operation log corresponding to the first directory tree sent by the first master device and stores the latest first operation log, wherein the first operation log includes the historical first operation log and the latest first operation log.

[0070] In one possible implementation, the switching module is specifically used for:

[0071] When the first operation log corresponding to the first directory tree in the second device is the same as the first operation log corresponding to the first directory tree in the first device, a first indication information is sent to the first master device. The first indication information is used to indicate that the first operation log synchronization is completed.

[0072] Receive a switching log sent by the first master device, the switching log being used to indicate switching the permission device group of the first directory tree to the second device group;

[0073] Based on the switching log, the permission device group of the first directory tree is switched to the second device group.

[0074] In one possible implementation, the first operation log includes the identifier of the first directory tree and the identifiers of N second directory trees, where N is an integer; the setting module is further configured to,

[0075] Set the state of the N second directory trees to empty;

[0076] In one possible implementation, the switching module is further configured to,

[0077] Switch the state of the second device from the virtual state to the running state.

[0078] In one possible implementation, the apparatus further includes an election module, the election module being used to,

[0079] The second device obtains its device identifier from the first operation log;

[0080] The second device, based on the device identifier, performs a master device election within the second device group to determine a second master device within the second device group.

[0081] In one possible implementation, the device further includes: a transmitting module.

[0082] The sending module is used to send a second instruction message to the first master device, the second instruction message including the identifier of the first directory tree, the second instruction message being used to instruct the first master device to delete the first directory tree.

[0083] In one possible implementation, the number of the first directory trees is greater than 1; the apparatus further includes: a storage module, the storage module being used for,

[0084] Generate a second operation log corresponding to each first directory tree;

[0085] The second operation log corresponding to each first directory tree is stored in the corresponding log directory, and the log directories corresponding to multiple first directory trees are located under the same parent directory.

[0086] In one possible implementation, the apparatus further includes an update module, the update module being used to,

[0087] Determine the identifier of the second storage space occupied by the first directory tree in the storage server, wherein the identifier of the second storage space is allocated by the root server;

[0088] Based on the identifier of the second storage space, determine the storage file corresponding to the first directory tree in the storage server;

[0089] Based on the operation log corresponding to the first directory tree and the storage file, update the operation log and / or the storage file to make the operation log and the storage file consistent.

[0090] In one possible implementation, the apparatus further includes a processing module, the processing module being used to,

[0091] Determine the target directory tree within the first directory tree;

[0092] Based on the identifier of the target directory tree, at least one of the following processes is performed on the target directory tree: detection processing, deletion processing, or copying processing.

[0093] Fourthly, embodiments of this application provide an electronic device, including: a memory and a processor;

[0094] The memory stores computer-executed instructions;

[0095] The processor executes computer execution instructions stored in the memory, causing the processor to perform the method supporting multiple instances as described in any of the first aspects.

[0096] Fifthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the method supporting multiple instances as described in any of the first aspects.

[0097] In a sixth aspect, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the method for supporting multiple instances as described in any of the first aspects.

[0098] This application provides a method, apparatus, and device that support multiple instances. The management device can receive instance creation requests, which include an instance identifier. Based on the instance creation request, the management device can determine the identifier of the directory tree corresponding to the instance, create the directory tree in the device group, and generate a mapping relationship between the directory tree and the device group. Since multiple directory trees can be created in any device group, compared to only one directory tree in a device group, the flexibility of file storage in a distributed file system is improved. Attached Figure Description

[0099] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0100] Figure 1 A schematic diagram of the architecture of a distributed file system provided for an exemplary embodiment of this application;

[0101] Figure 2A A schematic diagram of a centralized metadata service provided for an exemplary embodiment of this application;

[0102] Figure 2B A schematic diagram of a distributed metadata service provided as an exemplary embodiment of this application;

[0103] Figure 3 An illustration of an application scenario provided for an exemplary embodiment of this application;

[0104] Figure 4 A flowchart illustrating a method for supporting multiple instances, provided as an exemplary embodiment of this application;

[0105] Figure 5 A flowchart illustrating a data access method provided for an exemplary embodiment of this application;

[0106] Figure 6 A flowchart illustrating a directory tree migration method provided for an exemplary embodiment of this application;

[0107] Figure 7A schematic diagram of a directory tree provided for an exemplary embodiment of this application;

[0108] Figure 8 A flowchart illustrating another directory tree migration method provided in this application embodiment;

[0109] Figure 9 A schematic diagram of the structure of a device supporting multiple instances provided for an exemplary embodiment of this application. Figure 1 ;

[0110] Figure 10 A second schematic diagram of the structure of a device supporting multiple instances provided for an exemplary embodiment of this application;

[0111] Figure 11 This is a schematic diagram of the structure of an electronic device provided as an exemplary embodiment of this application. Detailed Implementation

[0112] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0113] Below, in order to facilitate understanding of the technical solution of this application, in conjunction with Figure 1 First, the overall architecture of the distributed file system in this application will be introduced.

[0114] Figure 1 A schematic diagram of the architecture of a distributed file system provided for an exemplary embodiment of this application. Please refer to... Figure 1 This includes clients, devices, and storage servers.

[0115] A distributed file system can include multiple management devices. Figure 1 In this example, we will use a management device as an illustration. Figure 1 As shown, the management device may include multiple first storage spaces, namely first storage space 1, ..., first storage space m. For any one of the first storage spaces, a directory tree can be stored. For example, first storage space 1 can store directory tree 1, and first storage space m can store directory tree m. The first storage space can also be called a storage container (volume).

[0116] Optionally, the management device can include a default tree, through which temporary data can be uploaded. When uploading data via the default tree, it is not necessary to specify the directory tree format, thus handling compatibility issues.

[0117] The management device can store a file node list (FileNodeTable), which can include multiple file nodes (FileNode). Each directory tree can have its own corresponding file node list, or multiple directory trees can share a single file node list, including the following two scenarios:

[0118] Case 1: A directory tree corresponds to a list of file nodes.

[0119] In this case, the file node list includes file nodes corresponding to each file in the directory tree. Each file node includes a file identifier (ID) and metadata information, which may include file size, modification time, file storage location, etc.

[0120] For example, the list of file nodes can be shown in Table 1:

[0121] Table 1

[0122]

[0123]

[0124] Scenario 2: Multiple directory trees share a single list of file nodes, meaning that one list of file nodes corresponds to multiple directory trees.

[0125] In this case, the file node list includes file nodes corresponding to each file in the multiple directory trees. Each file node includes the file's identifier (ID), the directory tree to which the file belongs, and metadata information. The metadata information may include file size, modification time, file storage location, etc.

[0126] For example, the list of file nodes can be shown in Table 2:

[0127] Table 2

[0128]

[0129] A distributed file system can include multiple storage service (ChunkServer) servers. Storage servers can be used to store files corresponding to a directory tree. For example... Figure 1 In a distributed file system, storage server 1, storage server 2, ..., storage server q can be included. For any given storage server, it can include multiple secondary storage spaces. For example, storage server 1 can include secondary storage space 1, ..., secondary storage space n.

[0130] When a client needs to access a file, it can send a request to the management device, which may include the file name. This file name can also be referred to as the mount point. Upon receiving the request, the management device can match the file name in the request using the longest prefix matching principle within the directory tree, and then find the corresponding file node in the corresponding file node list. For example, if the file name included in the request is "ProjectA / ", the management device can match this file name in directory tree 1 using the longest prefix matching principle, and then determine the FileNode information corresponding to the file name "ProjectA / " in FileNodeTable1 corresponding to directory tree 1. The management device can then send this FileNode information to the client.

[0131] After the client determines the corresponding FileNode information, since the FileNode information includes the file ID, file size, modification time, file storage location, etc., the client can determine the file storage location on the storage server based on the FileNode information, and thus access the corresponding file.

[0132] It should be noted that metadata services can be divided into centralized metadata services and distributed metadata services.

[0133] Below, in conjunction with Figures 2A-2B The centralized metadata service and the distributed metadata service are explained separately.

[0134] Figure 2A This is a schematic diagram illustrating a centralized metadata service provided for an exemplary embodiment of this application. Please refer to... Figure 2A A centralized metadata service refers to a system where the MetaServer, NameSpaceServer, and RGServer are all integrated within a single process. Specifically, the MetaServer manages file metadata and ensures data security, including file lock holders; the NameSpaceServer manages the file system's directory tree; and the RGServer handles data replication and garbage collection.

[0135] Figure 2B This is a schematic diagram illustrating a distributed metadata service provided as an exemplary embodiment of this application. Please refer to... Figure 2A Distributed metadata service refers to MetaServer, NameSpaceServer, and RGServer residing in different independent processes, with services interacting through Remote Procedure Call (RPC).

[0136] Figure 3This is a schematic diagram illustrating an application scenario provided for an exemplary embodiment of this application. For example... Figure 3 As shown, a distributed file system may include a first device group and a second device group.

[0137] A first device group may include multiple first devices. For example, a first device group may include first device 1, first device 2, ..., first device n. For any one first device, the first device may include multiple directory trees. For example, first device 1 may include directory tree 1-1, directory tree 1-2, ..., directory tree 1-x. The directory trees included in each first device are the same. The first device group may also be called a Raft group. The first devices in the Raft group have a redundant backup relationship. At any given time, there is one first master device in the Raft group, and the other devices are first slave devices.

[0138] Similarly, a second device group may include multiple second devices. These multiple second devices are in an empty state, meaning that they do not store a directory tree.

[0139] If the directory trees to be migrated in the first device group are directory tree 1-1 and directory tree 1-2, and the second device 1 in the second device group is in a virtual state, then the operation logs corresponding to directory tree 1-1 and directory tree 1-2 can be migrated to the second device 1, so as to migrate directory tree 1-1 and directory tree 1-2 to the second device 1.

[0140] After the migration of directory tree 1-1 and directory tree 1-2 is completed, the second device 2, ..., second device m in the second device group can also be redundantly backed up so that any second device in the second device group stores directory tree 1-1 and directory tree 1-2.

[0141] It should be noted that the first and second devices can be Figure 1 The management device in the Chinese embodiment.

[0142] In related technologies, for any management device in a distributed file system, a directory tree can be stored. This directory tree can correspond to multiple user files. After creating a directory tree in the management device, the directory tree exclusively occupies the resources of that management device. When the directory tree occupies few resources, it may lead to resource waste; when the directory tree occupies many resources, it may lead to resource shortage. Therefore, it can be seen that the flexibility of file storage in existing distributed file systems is relatively low.

[0143] In this embodiment of the application, for any one management device in the distributed file system, multiple directory trees can be stored in the management device, and one or more directory trees in any one management device can be migrated, which improves the flexibility of file storage in the distributed file system.

[0144] The technical solutions shown in this application will now be described in detail through specific embodiments. It should be noted that the following embodiments may exist independently or in combination with each other; for identical or similar content, the description will not be repeated in different embodiments.

[0145] The technical solution of this application mainly involves three processes: the process of creating a directory tree, the process of data access, and the process of directory tree migration. Below, we will discuss these processes in conjunction with... Figure 4 This section explains the process of creating a directory tree.

[0146] Figure 4 This is a flowchart illustrating a method for supporting multiple instances, provided as an exemplary embodiment of this application. Please refer to... Figure 4 The method may include:

[0147] S401, Receive instance creation request.

[0148] For any given management device, the management device can receive an instance creation request, which may include the instance's identifier. For example, the instance creation request may include the identifier ID of instance 1.

[0149] S402. Based on the instance creation request, determine the identifier of the directory tree corresponding to the instance.

[0150] Since the instance creation request can include the instance's identifier, the management device can determine the identifier of the directory tree corresponding to the instance based on the instance's identifier. For example, the management device can determine the identifier of directory tree 1 based on the identifier of instance 1.

[0151] S403. Create a directory tree in the device group and generate a mapping relationship between the directory tree and the device group.

[0152] For any given group of devices, the group can include multiple devices. These multiple devices can be... Figure 1 The management device shown.

[0153] In one optional embodiment, the management device can identify a device group with more resources from multiple device groups and create a directory tree on the devices in that device group. Optionally, the device group may include multiple created directory trees, or it may not include any directory trees.

[0154] For example, if the directory tree to be created is directory tree 1, and there are 10 device groups, with device group 2 having more resources, then directory tree 1 can be created in device group 2. If device group 2 includes the two directory trees that have already been created, then after creating directory tree 1 in device group 2, device group 2 can include three directory trees.

[0155] Optionally, after the directory tree is successfully created, a mapping relationship between the directory tree and the device group can be generated.

[0156] For example, if directory tree 1 is created in device group 2, the resulting mapping relationship can be: directory tree 1 corresponds to device group 2.

[0157] In this embodiment, the management device can receive an instance creation request, which includes an instance identifier. Based on the instance creation request, the management device can determine the identifier of the directory tree corresponding to the instance, create the directory tree in the device group, and generate a mapping relationship between the directory tree and the device group. Since multiple directory trees can be created in any device group, compared to only one directory tree in a device group, the flexibility of file storage in a distributed file system is improved.

[0158] Below, in conjunction with Figure 5 This section explains the data access process.

[0159] Figure 5 This is a flowchart illustrating a data access method provided for an exemplary embodiment of this application. Please refer to [link / reference]. Figure 5 The method includes:

[0160] S501: Receive data access requests sent by the client.

[0161] The client can send a data access request to the management device, which will then receive the request. The data access request includes the file name. For example, the file name included in the data access request could be "ProjectA / ".

[0162] S502. Based on the data access request, determine the directory tree and target file node corresponding to the file name.

[0163] For any given file node, it can include the file's identifier (ID), the directory tree to which the file belongs, and metadata information. The metadata information can include the file size, modification time, file storage location, etc.

[0164] Optionally, the directory tree may have a corresponding list of file nodes. The list of file nodes may include multiple file nodes, among which the target file node may be included.

[0165] In one optional embodiment, after receiving a data access request, the management device can match the file name in the data access request in the directory tree according to the longest prefix matching principle to determine the directory tree corresponding to the file name, and then determine the target file node corresponding to the file name in the file node list (FileNodeTable) corresponding to the directory tree.

[0166] For example, if a data access request includes a filename named "ProjectA / ", and the management device can match this filename in directory tree 1 according to the longest prefix matching principle, then directory tree 1 can be determined as the directory tree corresponding to the filename "ProjectA / ". Furthermore, the FileNode information corresponding to the filename "ProjectA / ", i.e., the target file node, can be determined in FileNodeTable1 corresponding to directory tree 1.

[0167] S503. Based on the directory tree and the target file node, determine the storage location of the file to be accessed in the storage server and send the storage location to the client.

[0168] Optionally, after the management device determines the directory tree and the target file node, since the target file node includes the file storage location, the management device can determine the storage location of the file to be accessed in the storage server based on the target file node. Optionally, the management device can send the target file node information to the client, that is, send the storage location of the file to be accessed to the client.

[0169] Optionally, after the client determines the corresponding target file node information, since the target file node information includes the file ID, file size, modification time, file storage location, etc., the client can determine the file storage location in the storage server based on the target file node information, and thus access the corresponding file.

[0170] In this embodiment, the management device can receive data access requests sent by clients and, based on the requests, determine the directory tree and file node corresponding to the file name. Then, based on the directory tree and the directory tree containing the target file node, it can determine the storage location of the file to be accessed on the storage server and send the storage location to the client. Since the storage location of the file to be accessed on the storage server can be determined through the target file node, the accuracy of data access is improved.

[0171] Below, in conjunction with Figure 6 This section explains the process of migrating the directory tree.

[0172] Figure 6 This is a flowchart illustrating a directory tree migration method provided for an exemplary embodiment of this application. Please refer to [link / reference]. Figure 6 The method may include:

[0173] S601. Determine the first directory tree to be migrated among the multiple directory trees of the first device group.

[0174] The execution entity in this application embodiment can be a second device or a multi-instance supporting device disposed in the second device. The multi-instance supporting device can be implemented in software or a combination of software and hardware. The multi-instance supporting device can be a processor in the second device. The second device can be... Figure 1 The management device in the embodiment. For ease of understanding, the following description will use the second device as the execution subject.

[0175] The first device group can be a cluster of devices supported by a distributed protocol. A first device group can include multiple first devices. For example, a first device group can include 5 first devices.

[0176] The distributed protocol can be the Raft protocol. The Raft protocol can solve the consistency problem of replica data across multiple devices in a distributed file system.

[0177] The first device group may include multiple directory trees. For any one directory tree, the directory tree may include a root directory and multiple subdirectories under the root directory.

[0178] Below, in conjunction with Figure 7 Explain the directory tree.

[0179] Figure 7 A schematic diagram of a directory tree provided for an exemplary embodiment of this application. Please refer to... Figure 7 Directory tree 1 can include a root directory and multiple subdirectories. The multiple subdirectories can be subdirectory 1, subdirectory 2, and subdirectory 3. Subdirectory 1 can include subdirectories 1-1 and 1-2; subdirectory 2 can include subdirectories 2-1, 2-2, and 2-3; and subdirectory 3 can include subdirectory 3-1.

[0180] The first device group may include multiple first devices, and each of the multiple first devices may include multiple directory trees. Depending on the actual situation, at least one first directory tree can be determined within the first device group to be migrated. For example, if, during actual operation, the directory trees in each of the first devices in the first device group consume excessive resources, and the first devices cannot provide sufficient resources, at least one first directory tree can be determined within the first device group and migrated to the second device group.

[0181] For example, if the first device group includes 5 first devices, namely first device 1, first device 2, first device 3, first device 4 and first device 5, and each of the 5 first devices includes directory tree-1, directory tree-2 and directory tree-3, the second device can determine the first directory tree to be migrated in the first device group as directory tree-1 and directory tree-2 in first device 1.

[0182] S602, the second device in the second device group is set to virtual state, and the first operation log of the first directory tree is obtained from the first device group.

[0183] The second device group can be another cluster of devices supported by a distributed protocol. A second device group can include multiple second devices. For example, a second device group can include eight second devices.

[0184] In virtual mode, the second device can receive operation logs (oplog) but does not process service requests.

[0185] The first operation log includes records of operations performed on the first directory tree. The first operation log can include historical first operation logs and the latest first operation log corresponding to the first directory tree. Historical first operation logs can be operation logs generated before the current time, and the latest operation log can be operation logs generated at the current time. For example, if the current time is 14:55, then historical first operation logs can be operation logs generated before 14:55, and the latest operation log can be operation logs generated at 14:55.

[0186] Optionally, the second device can be set to a virtual state to obtain the first operation log of the first directory tree from the first device group.

[0187] In one optional embodiment, the first operation log of the first directory tree can be obtained from the first device group in the following feasible manner: receiving the first operation log sent by the first master device; and storing the first operation log in the first storage space corresponding to the first directory tree.

[0188] The first master device refers to the master device in the first device group, which can be determined by election from multiple first devices in the first device group. For example, the first device group may include 5 first devices, namely first device 1, first device 2, first device 3, first device 4, and first device 5. For example, first device 2 can be determined as the first master device through election from these 5 first devices.

[0189] For any device in a distributed system, the device may include multiple first storage spaces to store multiple directory trees. For example, first device 1 may include 5 first storage spaces to store 5 directory trees.

[0190] For any given first storage space, it can be specified by the root server in the distributed file system when creating the directory tree. There can be a correspondence between the directory tree and the first storage spaces, and this correspondence can be persistently stored in the root server.

[0191] For example, the correspondence between the directory tree and the first storage space can be shown in Table 3:

[0192] Table 3

[0193]

[0194]

[0195] As shown in Table 3, directory tree 1 can include directory tree 1 / subdirectory 1 and directory tree 1 / subdirectory 2. Different subdirectories can correspond to different storage spaces, that is, different subdirectories under a directory tree can be stored in different storage spaces. In other words, a part of a directory tree can be stored in one storage space. Directory tree 2 can correspond to the first storage space 3, and directory tree 4 can correspond to the first storage space 4. Thus, a complete directory tree can be stored in one storage space.

[0196] In one optional embodiment, the first operation log sent by the first master device can be received in the following feasible manner: receiving the historical first operation log corresponding to the first directory tree sent by the first master device; storing the historical first operation log and sending a storage success response message to the first master device; receiving the latest first operation log corresponding to the first directory tree sent by the first master device and storing the latest first operation log.

[0197] For example, if the first master device is the first device 2 in the first device group, the first directory tree is directory tree 1 in the first device 2, the first operation log includes the historical first operation log and the latest operation log corresponding to directory tree 1, and the storage space corresponding to directory tree 1 is the first storage space 1 in the second device 1, then the second device 1 can be set to a virtual state. The second device 1 can receive the historical first operation log sent by the first device 2 and store it in storage space 1. After successful storage, the second device 1 can send a storage success response message to the first device 2. The first device 2 can send the latest first operation log to the second device 1, and after receiving the latest first operation log, the second device 1 can store it in the first storage space 1.

[0198] S603. When the first operation log corresponding to the first directory tree in the second device is the same as the first operation log corresponding to the first directory tree in the first device, the permission device group of the first directory tree is switched to the second device group.

[0199] In an optional embodiment, the permission device group of the first directory tree can be switched to the second device group in the following manner: when the first operation log corresponding to the first directory tree in the second device is the same as the first operation log corresponding to the first directory tree in the first device, a first indication message is sent to the first master device; the switching log sent by the first master device is received; and the permission device group of the first directory tree is switched to the second device group according to the switching log.

[0200] The first indication information can be used to indicate that the first operation log synchronization is complete, that is, the first operation log corresponding to the first directory tree in the second device has the same content as the first operation log corresponding to the first directory tree in the first device.

[0201] The switch log is used to indicate when the permission device group of the first directory tree is switched to the second device group. The switch log may include: records of the migration of the first directory tree, the address of the second device, and the device identifier of the second device.

[0202] The address of the second device can be a Transmission Control Protocol (TCP) address.

[0203] The device identifier can be a globally unique identifier (GUID). A GUID can be a 32-bit hexadecimal value. For example, a GUID could be 6F9619FF-8B86-D011-B42D-00C04FC964FF.

[0204] For example, if the first primary device is first device 1, the first directory tree is directory tree 1 in first device 1, and the second device is second device 1, then the switchover log can be "Migrate directory tree 1 from first device 1 to second device 1. The address of second device 1 is TCP address 1, and the GUID of second device 1 is 6F9619FF-8B86-D011-B42D-00C04FC964FF".

[0205] A permissioned device group refers to a group of devices that a user has access to.

[0206] For example, if the current time is 14:55, and the first operation log is the operation log corresponding to directory tree 1 in the first device 1, including historical first operation logs generated before 14:55 and the latest first operation log generated at 14:55, and the first master device is the first device 1 and the second device is the second device 1, then when the first operation log corresponding to the first directory tree in the second device 1 is the same as the first operation log corresponding to the first directory tree in the first device 1, the second device 1 can send a first indication message to the first device 1 to indicate that the first operation log synchronization is complete. The second device 1 can receive the switch log sent by the first device 1. If the switch log is "Migrate directory tree 1 from the first device 1 to the second device 1, the address of the second device 1 is TCP address 1, and the GUID of the second device 1 is 6F9619FF-8B86-D011-B42D-00C04FC964FF", then the second device 1 can switch the permission device group of directory tree 1 from the first device group to the second device group according to the switch log, and the migration of directory tree 1 is successful.

[0207] In this embodiment, the second device can determine the first directory tree to be migrated from multiple directory trees in the first device group. The second device in the second device group is set to a virtual state and obtains the first operation log of the first directory tree from the first device group. When the first operation log corresponding to the first directory tree in the second device is the same as the first operation log corresponding to the first directory tree in the first device, the permission device group of the first directory tree can be switched to the second device group. Since the first and second devices can store multiple directory trees and can migrate one or more directory trees in any device, the first and second devices can dynamically support multiple directory trees, improving the flexibility of file storage in the distributed file system.

[0208] Below, in Figure 6 Based on the illustrated embodiments, combined with Figure 8 The above-mentioned directory tree migration method will be further explained.

[0209] Figure 8 This is a flowchart illustrating another directory tree migration method provided in an embodiment of this application. Please refer to... Figure 8 The method may include:

[0210] S801. Determine the first directory tree to be migrated among the multiple directory trees of the first device group.

[0211] It should be noted that the execution process of step S801 can be found in step S601, and will not be repeated here.

[0212] S802, the second device in the second device group is set to virtual state, and the first operation log of the first directory tree is obtained from the first device group.

[0213] It should be noted that the execution process of step S802 can be found in step S602, and will not be repeated here.

[0214] S803. When the first operation log corresponding to the first directory tree in the second device is the same as the first operation log corresponding to the first directory tree in the first device, the permission device group of the first directory tree is switched to the second device group.

[0215] It should be noted that the execution process of step S803 can be found in step S603, and will not be repeated here.

[0216] S804. Set the state of N second directory trees to empty.

[0217] The first operation log may include the identifier of the first directory tree and the identifiers of N second directory trees. For any given directory tree, the identifier can be a GUID.

[0218] After the migration is complete, the second device includes the first directory tree but not the second directory tree. However, the first operation log in the second device still contains N identifiers for the second directory trees. To make the directory trees in the second device consistent with the first operation log, the status of these N second directory trees can be set to empty, thus deleting their identifiers from the first operation log of the second device.

[0219] For example, the first operation log may include the identifiers of directory tree 1, directory tree 2, directory tree 3, directory tree 4, and directory tree 5, where directory tree 1 is the first directory tree, and directory tree 2, directory tree 3, directory tree 4, and directory tree 5 are the second directory trees. The second device can determine the identifiers of directory tree 2, directory tree 3, directory tree 4, and directory tree 5, and set the status of the four second directory trees to empty according to the identifiers of the four second directory trees, so as to delete the identifiers of the four second directory trees from the first operation log of the second device.

[0220] S805, Switch the status of the second device from virtual status to running status.

[0221] After switching the permission device group in the first directory tree to the second device group, the device status of the second device can be switched from virtual to running, so that the second device can provide normal service.

[0222] S806. Obtain the device identifier of the second device, and elect the master device in the second device group based on the device identifier.

[0223] The first operation log may include the device identifier of the second device, and the second device can obtain the device identifier of the second device from the first operation log.

[0224] In an optional embodiment, the master device election can be carried out in the second device group as follows: determine the device identifier of each second device in the second device group; vote according to the device identifier, and determine the second device with the most votes as the second master device.

[0225] For example, if the second device group includes second device 1, second device 2, second device 3, second device 4, and second device 5, with corresponding device identifiers GUID-1, GUID-2, GUID-3, GUID-4, and GUID-5 respectively, then a vote can be taken based on the device identifiers. If GUID-3 receives the most votes, then the corresponding second device 3 can be determined as the second master device.

[0226] Optionally, after the second master device is determined, redundant backups can be performed on the second master device and the second slave device in the second device group to ensure that the directory trees stored in the second master device and the second slave device are consistent.

[0227] In this embodiment, the second device can determine the first directory tree to be migrated from multiple directory trees in the first device group. The second device in the second device group is set to a virtual state and obtains the first operation log of the first directory tree from the first device group. When the first operation log corresponding to the first directory tree in the second device is the same as the first operation log corresponding to the first directory tree in the first device, the permission device group of the first directory tree can be switched to the second device group. The state of the second device can also be switched from virtual to running, and the device identifier of the second device can be obtained. A master device election is then performed in the second device group based on the device identifier. Since the first and second devices can store multiple directory trees and can migrate one or more directory trees in any device, the first and second devices can dynamically support multiple directory trees, improving the flexibility of file storage in a distributed file system.

[0228] In practice, after the second device group is running normally, the following management and maintenance can be performed on the directory tree, as well as the corresponding operation logs and storage files:

[0229] 1. Optionally, after the second device is operating normally, the second device may send a second instruction message to the first master device. The second instruction message may include an identifier of the first directory tree, used to instruct the first master device to delete the first directory tree. The first master device may delete the first directory tree according to the second instruction message to release the memory of the first device.

[0230] For example, if the first directory tree is directory tree 1, then the second instruction information includes the identifier of directory tree 1. The second device can send the second instruction information to the first master device so that the first master device can delete directory tree 1 according to the identifier of directory tree 1.

[0231] 2. Optionally, the number of first directory trees can be at least one. The second device can generate a second operation log corresponding to each first directory tree and store each second operation log in a corresponding log directory. The log directory can be a Cross Platform Toolkit (CPT) directory. These multiple log directories can be located under the same parent directory. In this way, the second operation log corresponding to each first directory tree can be stored relatively independently, so that the second device can independently handle each first directory tree.

[0232] 3. Optionally, since the storage storage server (ChunkServer) stores the storage file corresponding to the first directory tree, the second device can also determine the identifier of the second storage space occupied by the first directory tree in the storage server, and determine the storage file corresponding to the first directory tree in the storage server according to the identifier of the storage space, and then update the operation log and / or storage file according to the operation log and storage file corresponding to the first directory tree.

[0233] The identifier for a secondary storage space can be represented by a ChunkServer Identification (ChunkServer ID). These identifiers can be uniformly assigned by the root server in the distributed file system, ensuring that each secondary storage space identifier is globally unique within the distributed file system.

[0234] Optionally, the identifiers of the first directory tree and the second storage space can be persistently stored in the root server.

[0235] For example, if the first directory tree is directory tree 1, the second device can determine that the identifier of the storage space occupied by directory tree 1 in the storage server can be ChunkServer ID-1, and determine the storage file corresponding to directory tree 1 in the storage server based on ChunkServer ID-1.

[0236] Since the operation log corresponding to the first directory tree records all information about it, including the name of the corresponding storage file, the corresponding storage file can be searched for on the storage server based on the storage file name recorded in the operation log to confirm its existence. If the corresponding storage file does not exist on the storage server, the storage file name can be deleted from the operation log to ensure consistency between the operation log and the storage file.

[0237] 4. Optionally, since the second device includes at least one directory tree, the second device can also determine the target directory tree in the first directory tree, and perform detection processing, deletion processing or copying processing on the target directory tree according to the identifier of the target directory tree.

[0238] The identifier of a target directory tree can be represented by a GUID. The target directory tree can be processed based on its identifier so that the persistent operation log can carry the identifier of each target directory tree.

[0239] Detection processing refers to using an algorithm to traverse the target directory tree and check whether the storage files corresponding to the target directory tree are consistent with the storage files in the storage server.

[0240] Deletion processing refers to deleting the target directory tree from the first directory tree if the storage file corresponding to the target directory tree does not exist.

[0241] Replication processing refers to the ability to copy the target directory tree during master-slave backup of the target directory tree so that it can be backed up on other devices in a device group.

[0242] For example, if the first directory tree that has been migrated in the second device group includes directory tree 1 and directory tree 2, and if directory tree 1 is the target directory tree, then directory tree 1 can be probed to check whether the storage file corresponding to the target directory tree is consistent with the storage file in the storage server; if the storage file corresponding to directory tree 1 does not exist, then directory tree 1 can be deleted.

[0243] For example, if the second device group includes 5 second devices, namely second device 1, second device 2, second device 3, second device 4 and second device 5, and if directory tree 1 and directory tree 2 are both in second device 1, but not in the other 4 second devices, then directory tree 1 and directory tree 2 can be copied to back up the other 4 devices.

[0244] Figure 9 A schematic diagram of the structure of a device supporting multiple instances provided for an exemplary embodiment of this application. Figure 1 Please see. Figure 9 The multi-instance supporting device 100 includes: a first receiving module 101, a first determining module 102, and a creating module 103, wherein,

[0245] The first receiving module 101 is used to receive an instance creation request, wherein the instance creation request includes an instance identifier;

[0246] The first determining module 102 is used to determine the identifier of the directory tree corresponding to the instance based on the instance creation request;

[0247] The creation module 103 is used to create the directory tree in the device group and generate a mapping relationship between the directory tree and the device group.

[0248] The apparatus supporting multiple instances provided in this application embodiment can execute the technical solutions shown in the above method embodiments. Its implementation principle and beneficial effects are similar, and will not be repeated here.

[0249] Figure 10 A second schematic diagram illustrates the structure of a device supporting multiple instances, provided for an exemplary embodiment of this application. Please refer to [link to schematic diagram]. Figure 8 ,exist Figure 9 Based on the illustrated embodiment, the device supporting multiple instances may further include: a second determining module 104.

[0250] In one possible embodiment, the second determining module 104 is specifically used for:

[0251] Receive a data access request sent by a client, wherein the data access request includes a file name;

[0252] Based on the data access request, the directory tree and target file node corresponding to the file name are determined, and the target file node is included among the multiple file nodes corresponding to the directory tree;

[0253] Based on the directory tree and the target file node, the storage location of the file to be accessed in the storage server is determined, and the storage location is sent to the client.

[0254] In one possible implementation, the device may further include: a third determining module 105, a setting module 106, an acquiring module 107, and a switching module 108, wherein,

[0255] The third determining module 105 is used to determine a first directory tree to be migrated among multiple directory trees of the first device group, wherein the first device group includes multiple first devices and each of the multiple first devices includes the multiple directory trees;

[0256] The setting module 106 is used to set the second device in the second device group to a virtual state;

[0257] The acquisition module 107 is used to acquire the first operation log of the first directory tree from the first device group, wherein the second device group includes multiple second devices;

[0258] The switching module 108 is used to switch the permission device group of the first directory tree to the second device group when the first operation log corresponding to the first directory tree in the second device is the same as the first operation log corresponding to the first directory tree in the first device.

[0259] In one possible implementation, the acquisition module 107 is specifically used for:

[0260] Receive the first operation log sent by the first master device, where the first master device is the master device in the first device group;

[0261] The first operation log is stored in the first storage space corresponding to the first directory tree.

[0262] In one possible implementation, the acquisition module 107 is specifically used for:

[0263] Receive the historical first operation log corresponding to the first directory tree sent by the first master device;

[0264] Store the historical first operation log and send a storage success response message to the first master device;

[0265] The system receives the latest first operation log corresponding to the first directory tree sent by the first master device and stores the latest first operation log, wherein the first operation log includes the historical first operation log and the latest first operation log.

[0266] In one possible implementation, the switching module 108 is specifically used for:

[0267] When the first operation log corresponding to the first directory tree in the second device is the same as the first operation log corresponding to the first directory tree in the first device, a first indication information is sent to the first master device. The first indication information is used to indicate that the first operation log synchronization is completed.

[0268] Receive a switching log sent by the first master device, the switching log being used to indicate switching the permission device group of the first directory tree to the second device group;

[0269] Based on the switching log, the permission device group of the first directory tree is switched to the second device group.

[0270] In one possible implementation, the first operation log includes the identifier of the first directory tree and the identifiers of N second directory trees, where N is an integer; the setting module 106 is further configured to,

[0271] Set the state of the N second directory trees to empty;

[0272] In one possible implementation, the switching module 108 is further configured to,

[0273] Switch the state of the second device from the virtual state to the running state.

[0274] In one possible implementation, the apparatus may further include: an election module 109, the election module 109 being used for,

[0275] The second device obtains its device identifier from the first operation log;

[0276] The second device, based on the device identifier, performs a master device election within the second device group to determine a second master device within the second device group.

[0277] In one possible implementation, the device may further include: a transmitting module 110.

[0278] The sending module 110 is used to send a second instruction message to the first master device, the second instruction message including the identifier of the first directory tree, the second instruction message being used to instruct the first master device to delete the first directory tree.

[0279] In one possible implementation, the number of the first directory trees is greater than 1; the apparatus may further include: a storage module 111, the storage module 111 being used for:

[0280] Generate a second operation log corresponding to each first directory tree;

[0281] The second operation log corresponding to each first directory tree is stored in the corresponding log directory, and the log directories corresponding to multiple first directory trees are located under the same parent directory.

[0282] In one possible implementation, the device further includes an update module 112, the update module 112 being used to,

[0283] Determine the identifier of the second storage space occupied by the first directory tree in the storage server, wherein the identifier of the second storage space is allocated by the root server;

[0284] Based on the identifier of the second storage space, determine the storage file corresponding to the first directory tree in the storage server;

[0285] Based on the operation log corresponding to the first directory tree and the storage file, update the operation log and / or the storage file to make the operation log and the storage file consistent.

[0286] In one possible implementation, the apparatus further includes a processing module 113, which is configured to determine a target directory tree in the first directory tree;

[0287] Based on the identifier of the target directory tree, at least one of the following processes is performed on the target directory tree: detection processing, deletion processing, or copying processing.

[0288] The apparatus supporting multiple instances provided in this application embodiment can execute the technical solutions shown in the above method embodiments. Its implementation principle and beneficial effects are similar, and will not be repeated here.

[0289] An exemplary embodiment of this application provides a structural schematic diagram of an electronic device. Please refer to [link / reference]. Figure 11 The electronic device 20 may include a processor 21 and a memory 22. Exemplarily, the processor 21 and the memory 22 are interconnected via a bus 23.

[0290] The memory 22 stores computer-executed instructions;

[0291] The processor 21 executes the computer execution instructions stored in the memory 22, causing the processor 21 to perform the multi-instance method as shown in the above method embodiments.

[0292] Figure 11 The electronic device shown can be either the first device or the second device in the above embodiments.

[0293] Accordingly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the method supporting multiple instances described in the above method embodiments.

[0294] Accordingly, embodiments of this application may also provide a computer program product, including a computer program, which, when executed by a processor, can implement the method supporting multiple instances as shown in the above method embodiments.

[0295] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0296] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0297] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0298] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0299] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0300] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0301] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0302] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0303] The above description is merely an embodiment of this application and is not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

Claims

1. A method supporting multiple instances, characterized in that, The method includes: Receive an instance creation request, the instance creation request including the instance identifier; Based on the instance creation request, determine the identifier of the directory tree corresponding to the instance; Create the directory tree in the device group and generate the mapping relationship between the directory tree and the device group; The method is applied to a distributed file system, which includes a first device group and a second device group. The method further includes: A first directory tree to be migrated is determined from multiple directory trees in the first device group, wherein the first device group includes multiple first devices, and each of the multiple first devices includes the multiple directory trees; The second device in the second device group is set to virtual state and obtains the first operation log of the first directory tree from the first device group. The second device group includes multiple second devices. When the first operation log corresponding to the first directory tree in the second device is the same as the first operation log corresponding to the first directory tree in the first device, the permission device group of the first directory tree is switched to the second device group.

2. The method according to claim 1, characterized in that, The method further includes: Receive a data access request sent by a client, wherein the data access request includes a file name; Based on the data access request, the directory tree and target file node corresponding to the file name are determined, and the target file node is included among the multiple file nodes corresponding to the directory tree; Based on the directory tree and the target file node, the storage location of the file to be accessed in the storage server is determined, and the storage location is sent to the client.

3. The method according to claim 1, characterized in that, The second device in the second device group obtains the first operation log of the first directory tree from the first device group, including: Receive the first operation log sent by the first master device, where the first master device is the master device in the first device group; The first operation log is stored in the first storage space corresponding to the first directory tree.

4. The method according to claim 3, characterized in that, Receive the first operation log sent by the first master device, including: Receive the historical first operation log corresponding to the first directory tree sent by the first master device; Store the historical first operation log and send a storage success response message to the first master device; The system receives the latest first operation log corresponding to the first directory tree sent by the first master device and stores the latest first operation log, wherein the first operation log includes the historical first operation log and the latest first operation log.

5. The method according to any one of claims 1-4, characterized in that, When the first operation log corresponding to the first directory tree in the second device is the same as the first operation log corresponding to the first directory tree in the first device, the permission device group of the first directory tree is switched to the second device group, including: When the first operation log corresponding to the first directory tree in the second device is the same as the first operation log corresponding to the first directory tree in the first device, a first indication information is sent to the first master device. The first indication information is used to indicate that the first operation log synchronization is completed. Receive a switching log sent by the first master device, the switching log being used to indicate switching the permission device group of the first directory tree to the second device group; Based on the switching log, the permission device group of the first directory tree is switched to the second device group.

6. The method according to claim 5, characterized in that, The first operation log includes the identifier of the first directory tree and the identifiers of N second directory trees, where N is an integer; the method further includes: Set the state of the N second directory trees to empty; Switch the state of the second device from the virtual state to the running state.

7. The method according to any one of claims 1-4, 6, characterized in that, The method further includes: The second device obtains its device identifier from the first operation log; The second device, based on the device identifier, performs a master device election within the second device group to determine a second master device within the second device group.

8. The method according to claim 7, characterized in that, The second device, based on the device identifier, performs a master device election within the second device group. After determining the second master device within the second device group, the process further includes: Send a second instruction message to the first master device. The second instruction message includes the identifier of the first directory tree. The second instruction message is used to instruct the first master device to delete the first directory tree.

9. The method according to any one of claims 1-4, 6, and 8, characterized in that, The number of the first directory trees is greater than 1; the method further includes: Generate a second operation log corresponding to each first directory tree; The second operation log corresponding to each first directory tree is stored in the corresponding log directory, and the log directories corresponding to multiple first directory trees are located under the same parent directory.

10. The method according to any one of claims 1-4, 6, characterized in that, The method further includes: Determine the identifier of the second storage space occupied by the first directory tree in the storage server, wherein the identifier of the second storage space is allocated by the root server; Based on the identifier of the second storage space, determine the storage file corresponding to the first directory tree in the storage server; Based on the operation log corresponding to the first directory tree and the storage file, update the operation log and / or the storage file to make the operation log and the storage file consistent.

11. The method according to any one of claims 1-4, 6, and 8, characterized in that, The method further includes: Determine the target directory tree within the first directory tree; Based on the identifier of the target directory tree, at least one of the following processes is performed on the target directory tree: detection processing, deletion processing, or copying processing.

12. A distributed file system, characterized in that, It includes clients, multiple management devices, and at least one storage server, wherein, The management device is used to store a directory tree and to perform the method according to any one of claims 1-11 to migrate the directory tree in different device groups, wherein the management device is located in one of the device groups; The storage server is used to store the files corresponding to the directory tree; The client is used to access files in the storage server through the directory tree in the management device.

13. An electronic device, characterized in that, include: Memory and processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory, causing the processor to perform the method supporting multiple instances as described in any one of claims 1 to 11.

14. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions that, when executed by a processor, are used to implement the method supporting multiple instances as described in any one of claims 1 to 11.

15. A computer program product comprising a computer program that, when executed by a processor, implements the method for supporting multiple instances as described in any one of claims 1 to 11.