CN110674099A - Copy balancing method and device, storage medium and electronic equipment - Google Patents
Copy balancing method and device, storage medium and electronic equipment Download PDFInfo
- Publication number
- CN110674099A CN110674099A CN201910909624.8A CN201910909624A CN110674099A CN 110674099 A CN110674099 A CN 110674099A CN 201910909624 A CN201910909624 A CN 201910909624A CN 110674099 A CN110674099 A CN 110674099A
- Authority
- CN
- China
- Prior art keywords
- copy
- rack
- backup data
- node
- copies
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/18—File system types
- G06F16/182—Distributed file systems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/11—File system administration, e.g. details of archiving or snapshots
- G06F16/119—Details of migration of file systems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/11—File system administration, e.g. details of archiving or snapshots
- G06F16/122—File system administration, e.g. details of archiving or snapshots using management policies
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The application provides a copy balancing method and device, a storage medium and electronic equipment. The method comprises the steps of determining whether all copies of backup data are stored on nodes of a first rack or not according to each backup data, and if so, storing the copies of the backup data on nodes of at least one second rack to adjust the copy distribution of the copies, thereby achieving the effect of copy balance. When the copies are balanced, one rack can be integrally moved when the rack is moved, so that the moving efficiency can be improved.
Description
Technical Field
The present application relates to the field of distributed storage, and in particular, to a method and an apparatus for copy balancing, a storage medium, and an electronic device.
Background
Today, big data development is more and more rapid, various kinds of data stored by each big data company are more and more, and the demands of machine room expansion and multiple data centers are necessarily met to a certain degree, wherein a Hadoop distributed file system plays a role in bottom storage in a large-scale cluster, has natural advantages in the aspects of expansibility, safety and large data storage, and is a main storage scheme in the industry at present.
In the distributed file system, at least two corresponding copies exist in any stored data, and the two copies are respectively stored in different nodes, so that when one node is powered off, the copy corresponding to the data can be obtained from the other node, and high availability is achieved. In the existing system, when the copies are not distributed in a balanced manner, only 1 node can be moved at a time when a machine room is moved, so that the moving efficiency is limited, and the manpower is wasted.
Disclosure of Invention
In order to solve the above problems, an object of the present application is to provide a copy balancing method, apparatus, storage medium, and electronic device.
The technical scheme adopted by the embodiment of the application is as follows:
in a first aspect, an embodiment of the present application provides a copy balancing method, which is applied to a master management node, and the method includes:
for each backup data, determining whether a copy of the backup data is stored entirely on a node of a first chassis; when the copies of the backup data are all stored on the nodes of the first chassis, storing the copies of the backup data on the nodes of at least one second chassis.
In a second aspect, an embodiment of the present application provides a duplicate balancing apparatus, which is applied to a master management node, and the apparatus includes:
the system comprises a copy processing module, a storage module and a processing module, wherein the copy processing module is used for determining whether all copies of backup data are stored on nodes of a first rack or not aiming at each backup data; and the copy storage module is used for storing the copy of the backup data on at least one node of the second rack when the copy of the backup data is completely stored on the node of the first rack.
In a third aspect, embodiments of the present application provide a storage medium having stored thereon computer instructions, which when executed by a processor, implement the copy balancing method described above.
In a fourth aspect, an embodiment of the present application provides an electronic device, which includes a memory and a processor, where the memory is used to store one or more instructions; the one or more instructions, when executed by the processor, implement the copy balancing method described above.
Compared with the prior art, the copy balancing method, the copy balancing device, the storage medium and the electronic equipment provided by the embodiment of the application have the beneficial effects that: the method comprises the steps of determining whether all copies of backup data are stored on nodes of a first rack or not according to each backup data, and if so, storing the copies of the backup data on nodes of at least one second rack to adjust the copy distribution of the copies, thereby achieving the effect of copy balance. When the copies are balanced, one rack can be integrally moved when the rack is moved, so that the moving efficiency can be improved.
In order to make the aforementioned objects, features and advantages of the present application more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and it will be apparent to those skilled in the art that other related drawings can be obtained from the drawings without inventive effort.
Fig. 1 is a system architecture provided in an embodiment of the present application;
FIG. 2 is another system architecture provided by embodiments of the present application;
fig. 3 is a schematic structural diagram of a master management node according to an embodiment of the present application;
FIG. 4 is a schematic flow chart diagram of a method for balancing duplicates provided in the embodiment of the present application;
FIG. 5 is another system architecture provided by embodiments of the present application;
FIG. 6 is another system architecture provided by embodiments of the present application;
FIG. 7 is a schematic flow chart diagram of another copy balancing method provided in the embodiments of the present application;
FIG. 8 is another system architecture provided by embodiments of the present application;
fig. 9 is a schematic diagram of switching between active and standby management nodes according to an embodiment of the present application;
FIG. 10 is a schematic flow chart diagram of another copy balancing method provided in embodiments of the present application;
fig. 11 is a schematic flowchart of a substep of S106 provided in an embodiment of the present application;
FIG. 12 is another system architecture provided by embodiments of the present application;
FIG. 13 is a functional block diagram of a replica balancing apparatus according to an embodiment of the present application;
fig. 14 is a schematic diagram of functional units of another replica balancing apparatus according to an embodiment of the present application.
In the figure: 101-a processor; 102-a memory; 103-a bus; 104-a communication interface; 201-a rack division module; 202-a replica processing module; 203-duplicate storage module.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. The components of the embodiments of the present application, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the present application, presented in the accompanying drawings, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures. Meanwhile, in the description of the present application, the terms "first", "second", and the like are used only for distinguishing the description, and are not to be construed as indicating or implying relative importance.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
In the description of the present application, it should be noted that the terms "upper", "lower", "inner", "outer", and the like indicate orientations or positional relationships based on orientations or positional relationships shown in the drawings or orientations or positional relationships conventionally found in use of products of the application, and are used only for convenience in describing the present application and for simplification of description, but do not indicate or imply that the referred devices or elements must have a specific orientation, be constructed in a specific orientation, and be operated, and thus should not be construed as limiting the present application.
In the description of the present application, it is also to be noted that, unless otherwise explicitly specified or limited, the terms "disposed" and "connected" are to be interpreted broadly, e.g., as being either fixedly connected, detachably connected, or integrally connected; can be mechanically or electrically connected; they may be connected directly or indirectly through intervening media, or they may be interconnected between two elements. The specific meaning of the above terms in the present application can be understood in a specific case by those of ordinary skill in the art.
Some embodiments of the present application will be described in detail below with reference to the accompanying drawings. The embodiments described below and the features of the embodiments can be combined with each other without conflict.
Today, big data development is more and more rapid, and various data stored by each big data company are more and more, and when the data volume reaches a certain degree, the demands of machine room expansion and multiple data centers are inevitable. A distributed storage System (HDFS) is taken as a main storage scheme at present, has good expansibility and high availability, and has irreplaceable advantages at present.
However, through careful observation and detailed summary by the inventor, it is found that, under the condition of high availability, when the system architecture of the HDFS in the computer room is as shown in fig. 1, the computer room needs to be moved by taking the node as a unit when the computer room is moved, so that the moving efficiency of the computer room is low, and manpower and material resources are wasted. Referring to fig. 1, the system architecture of the HDFS in the computer room is not divided into racks, and all nodes in the computer room default to the same rack, which may be named default-rack, for example. Wherein, the nodes 1 to X represent different servers, and each node cross-backs up data copies.
It should be noted that the racks referred to in the embodiments of the present application are logical racks, where a logical rack is a set of nodes and can be used as a basic unit for relocation in the present solution, actual positions of the nodes in the logical rack may be located in different physical racks, and are determined according to actual situations, and in most cases, the logical rack and the physical rack correspond to a better solution.
Take a highly available scenario as an example: when a user needs to acquire the copy a stored in the node 1, it is found that the current node 1 cannot be accessed (for example, power is off), and at this time, the user can acquire the copy a through the access node 3, so that the acquisition of the data copy by the user is not affected.
In a computer room as shown in fig. 1, when the computer room needs to be moved and high availability needs to be satisfied, only one node can be moved at a time. For example, the node X includes the copy B, the copy C, and the copy F, and the number and name of the copies stored in each node are not limited herein, which is only for ease of understanding. Backup copies of copy B, copy C, and copy F in node X are stored in node 1, node 2, and node 3, respectively. When the node X is moved, in order to ensure that the user can obtain the data copy, it is necessary to ensure that the node 1, the node 2, and the node 3 operate normally, and at this time, only the node X is moved alone. When the node X finishes the relocation and can normally work after being electrified and debugged, other nodes can be relocated continuously. When the number of nodes in the machine room is large, the relocation usually consumes a large amount of time, and the relocation efficiency is low. Through a great deal of thinking and practice, the inventor summarizes that the reason for the low moving efficiency is related to the distribution of the copies in the computer room.
The embodiment of the application provides a copy balancing method, which is applied to a main management node shown in fig. 2. In a possible implementation manner, the copy balancing method provided by the embodiment of the present application is implemented based on an HDFS. As shown in fig. 2, the master management node (with the master NameNode process installed), the standby management node (with the standby NameNode process installed), and the nodes 1 to X (with the DataNode process installed) all belong to the default rack default-rack. The main management node and the standby management node are used for managing metadata of the HDFS, and the metadata comprises a mapping relation between the copies and the nodes.
The main management node provides read-write service, the standby management node provides metadata merging service, and when the main management node is down, the standby management node can provide read-write service. And the nodes 1 to X are execution nodes and are used for storing the corresponding copies of the data.
The embodiment of the application provides a possible implementation mode of a main management node. Fig. 3 is a schematic diagram of a partial structure of a master management node. The master management node is a server corresponding to the master NameNode process, and comprises a processor 101, a memory 102 and a bus 103.
The processor 101 and the memory 102 are connected by a bus 103, and the processor 101 is configured to execute an executable module, such as a computer program, stored in the memory 102.
The processor 101 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the copy balancing method may be performed by instructions in the form of hardware integrated logic circuits or software in the processor 101. The Processor 101 may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the device can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component.
The Memory 102 may comprise a high-speed Random Access Memory (RAM) and may also include a non-volatile Memory (non-volatile Memory), such as at least one disk Memory.
The bus 103 may be an ISA (Industry Standard architecture) bus, a PCI (peripheral component interconnect) bus, an EISA (extended Industry Standard architecture) bus, or the like. Only one bi-directional arrow is shown in fig. 3, but this does not indicate only one bus 103 or one type of bus 103.
The memory 102 is used for storing programs, such as programs corresponding to the HDFS-based copy balancing apparatus. The duplicate balancing device includes at least one software functional module which may be stored in the memory 102 in the form of software or firmware (firmware) or solidified in an Operating System (OS) of the primary management node. The processor 101, upon receiving the execution instruction, executes the program to implement the copy balancing method.
The master management node may also have at least one communication interface 104, which may support wired or wireless communication protocols, to enable communication connections with other devices external. In one possible implementation, the master management node may communicate with any one of nodes 1 to X through the communication interface 104.
It should be understood that the structure shown in fig. 3 is merely a structural schematic diagram of a master management node, which may also include more or fewer components than shown in fig. 3, or have a different configuration than shown in fig. 3. The components shown in fig. 3 may be implemented in hardware, software, or a combination thereof.
The copy balancing method provided in the embodiment of the present invention can be applied to, but is not limited to, the main management node shown in fig. 3, and please refer to fig. 4 for a specific process:
s101, determining whether all the copies of the backup data are stored on the nodes of the first rack or not for each backup data. If yes, executing S104; if not, the process is ended.
Specifically, when the user side uploads the backup data, the same backup data may be stored in different nodes in the same copy form. Each node may store multiple copies of different backup data. The specific storage location of the copy corresponding to each backup data may affect the relocation efficiency of the computer room, so it is necessary to determine whether all the copies of the backup data are stored on the node of the first rack for each backup data. If yes, it indicates that the current copy storage is unbalanced, and S104 needs to be performed to adjust the copy storage condition. When the copies of each backup data are stored on at least two racks, the copies are distributed in a balanced manner, and can be directly moved by taking the racks as units.
It should be noted that the first rack in the embodiment of the present invention is only for convenience of description, and does not specifically refer to a certain rack, and may be any rack that meets the condition, and similarly, the following second rack also does not specifically refer to a certain rack.
And S104, storing the copy of the backup data on the node of the at least one second rack.
In the copy balancing method provided in the embodiment of the present application, it is first determined, for each backup data, whether all copies of the backup data are stored in a node of a first rack, and if so, a copy of the backup data is stored in a node of at least one second rack to adjust the copy distribution thereof, thereby achieving copy balancing. When the copies are balanced, one rack can be integrally moved when the rack is moved, so that the moving efficiency can be improved.
The following describes a flow method of the copy balancing method provided in fig. 4, taking the system architecture shown in fig. 5 as an example. Referring to fig. 5, for example, backup data a corresponds to copy a, it should be noted that, each copy a corresponding to backup data a is backed up with each other, and as shown in fig. 5, there are 3 copies a shown on Rack2, so when a in node N +1 is called backup data a, a in node N +2 and a in node M are called copies; similarly, when A in node N +2 is called backup data A, then A in node N +1 and node M is called a copy. The nodes storing the copy a are respectively node N +1, node N +2 and node M. Node N +1, node N +2 and node M all belong to Rack 2. The Rack2 can be understood as the first Rack described above.
It should be noted that each node may also store multiple copies corresponding to different backup data. For example, in addition to the copy corresponding to the backup data a, a copy corresponding to other backup data may be included, for example, the copy B corresponds to the backup data B, the copy C corresponds to the backup data C, and the like. Taking the backup data B as an example, the nodes storing the copy B are respectively node M +2 and node M + 3. And the node M +2 and the node M +3 both belong to a Rack Rack n. For backup data B, the Rack n is the first Rack, and the copies B are all stored on the node of the first Rack (Rack n). For a plurality of different backup data, it can be realized by performing the steps of fig. 4 above to balance the respective copies, and for example, the backup data B can be stored in at least one of the racks Rack 1-Rack n-1, and each of Rack 1-Rack n-1 can be referred to as a second Rack.
Alternatively, for S101, to determine whether copies of backup data are all stored on nodes of the first chassis. One possible implementation is to obtain the mapping relationship between the copy of the backup data and each node through the metadata, so as to determine whether all the copies are stored on the nodes of the first chassis.
Specifically, the metadata includes a namespace (FSImage) of a file system and an edit log file (Editlog) of the metadata. The FSImage is used for recording the stored backup data and the index relationship of the backup data corresponding to the FSImage, for example, the backup data a corresponds to the copy a, and the backup data B corresponds to the copy B. The Editlog is used for recording the index relationship between the newly written backup data and the copy corresponding to the newly written backup data. And after a period of time, the processor 101 merges the original FSImage and Editlog into a new FSImage.
When the main management node communicates with the execution node, the execution node sends the stored copy information and the information of the rack to which the execution node belongs to the main management node at preset time intervals. For example, the executing node is the node N +1 in fig. 5, and in this case, the stored copy information may be "the copy a is stored in the node N + 1", and the information of the Rack to which the node N +1 belongs may be "the node N +1 belongs to the Rack 2". On the basis, the mapping relation between the copy of the backup data and each node can be obtained by combining the namespace of the file system and the editing log file of the metadata. Continuing with FIG. 5, taking backup data A as an example, for backup data A, no copy A is stored in any node except Rack Rack2, so any Rack except Rack Rack2 can be the second Rack in S104. Of course, in another possible implementation, in addition to using an existing rack as a second rack, the second rack may be obtained by constructing a new rack.
Optionally, for the above S104, a possible implementation manner of the backup mechanism is given as follows:
specifically, continuing with fig. 5, the copy a corresponding to the backup data a is taken as an example. First, a first copy instruction is transmitted to any one of the nodes (N +1, N +2, M) storing the copy a. The first copy instruction may include identity information of a copy corresponding to the backup data and address information of at least one target node, where the target node is on the second rack. For example, when the node N +1 receives the first copy instruction, the corresponding copy a is sent to the node X according to the address information of the target node (e.g., the address information of the node X). And after receiving the first copy copying instruction, the target node stores the corresponding copy, and then feeds back corresponding finished information to the main management node. And the main management node judges whether the copies corresponding to the backup data are distributed and balanced or not by judging whether the completed information fed back by each target node is received or not.
Referring to fig. 6, after storing a copy of backup data on a node of at least one second chassis, one possible system architecture is presented in an embodiment of the present application. The copy corresponding to each backup data is stored in the nodes of different racks, that is, any copy stored in the node on each rack has backup in the nodes of other racks. In this case, the transfer can be performed in units of racks.
On the basis of fig. 4, regarding the construction of the second rack, the embodiment of the present application further provides a possible implementation manner, please refer to fig. 7, before S104, the copy balancing method further includes:
and S102, determining whether a second rack exists. If yes, executing S104; if not, S103 is executed.
Specifically, when the master management node communicates with other nodes, any other node sends information of the rack to which the master management node belongs to the master management node. The main management node determines whether all the nodes in the machine room belong to the same rack as shown in fig. 1 according to the information of the rack to which the main management node belongs, which is sent by other nodes. If all the nodes belong to the same rack, it is indicated that a second rack does not exist, and the copies cannot be distributed in a balanced manner, and at this time, S103 needs to be executed; otherwise, S104 is executed.
S103, constructing at least one second rack, wherein each second rack comprises at least one node.
In one possible implementation, a new node may be introduced to form at least one new rack, and the new rack is used as a second rack, each of which contains at least one node. In another possible implementation manner, the nodes originally belonging to the first chassis may also be divided into new second chassis.
Regarding the construction of the second rack, in another possible implementation:
before S101, S102 is performed to determine whether all nodes in the current machine room belong to the same rack. If yes, executing S103; if not, S101 is executed.
Regarding the content in S103, the embodiment of the present application further provides a possible rack partitioning policy:
the nodes in the computer room are divided into at least two racks (including a first rack and at least one second rack) according to the rack configuration file input by a user.
The configuration file may include a mapping relationship between each node and the corresponding rack. And the main management node divides the nodes into at least two racks according to the mapping relation between each node and the corresponding rack. Optionally, nodes that are closer in distance (e.g., subordinate nodes of the same switch or router) are mapped to the same chassis in the configuration file.
Referring to fig. 8, a plurality of nodes include a primary management node, a standby management node, and nodes 1 to X. The number of the racks (Rack 1-Rack) is more than or equal to 2, namely n is more than or equal to 2, and n is a positive integer.
In one possible implementation, the plurality of nodes further includes: a plurality of journal nodes and a plurality of Zookeeper (abbreviated as ZK) nodes. And the Zookeeper node is used for switching the standby management node into the main management node when the main management node is down. The journal node is used for storing Editlog. The journal node is a server on which the journal node process is installed. The Zookeeper node is a server provided with a Zookeeper process.
In one possible implementation, any node may install multiple non-repeating processes. For example, when a node is installed with a journal node process and a DataNode process, the node is both a journal node and an execution node.
When the number of the racks is more than or equal to 3, the number of the journal node and the Zookeeper node is more than or equal to 3. In one possible embodiment, it is preferable that any two journalnde nodes do not belong to the same chassis, and that any two Zookeeper nodes do not belong to the same chassis.
When the number of the racks is 2, the number of the journal node and the Zookeeper node is 3, each journal node is distributed on the two racks, and each Zookeeper node is distributed on the two racks.
Through a plurality of Zookeeper nodes, the active-standby switching can be automatically realized when the main management node goes down.
Regarding the main/standby switching, the embodiment of the present application provides a possible implementation scenario:
referring to fig. 9, a main failover (FailoverController Active) process corresponding to the main namenode (namenode Active) process is further installed in the main management node, and a Standby failover (FailoverController Standby) process corresponding to the Standby namenode (namenode Standby) process is further installed in the Standby management node.
The main failover process is used for monitoring the Health state of the main NameNode (Monitor Health of NameNode. os. hw), and the standby failover process is used for monitoring the Health state of the standby NameNode (Monitor Health of NameNode. os. hw). The primary failover process may send commands (cmds) to the primary NameNode process. The primary and backup failover processes may interact with the ZooKeeper process in the ZooKeeper node via Heartbeat (Heartbeat). The master and standby NameNode processes may share a metadata store (Shared NN state with single writer (entered)).
The FailoverController Active process and the FailoverController Standby process are also used for completing the election of the main NameNode process through the zooKeeper node cluster when the state of the main NameNode process of the main management node changes. For example, when the state of the master NameNode process of the master management node changes to dead, any one of the nodes 1 to X cannot be acquired, and in order to ensure that the user can acquire the copy in the node, the FailoverController standard process uses the backup NameNode process in the backup management node as a new master NameNode process through the ZooKeeper node cluster, switches the backup management node to a new master management node, and the user can access the copy in each node through the new master management node. At this time, the standby management node (new main management node) provides read-write service, and high availability is met.
It should be noted that, it is not limited to which rack the master management node and the standby management node belong, as long as the master management node and the standby management node do not belong to the same rack. The corresponding relationship between the node 1 and the node X and the racks is not limited, and the node 1 to the node X are distributed on at least two racks, that is, the node 1 to the node X do not belong to the same rack completely.
In order to ensure that the HDFS system can automatically realize the master-slave switching, the number of the JournalNode nodes which need to normally work is more than half of the total number of the JournalNode nodes; the number of Zookeeper nodes that need to work properly is more than half of the total number of Zookeeper nodes.
On the basis of fig. 4, based on the importance of the copy, multiple backup of the important copy is needed to prevent the copy from being lost, and the embodiment of the present application further provides a possible copy balancing method, please refer to fig. 10, where the copy balancing method further includes:
and S105, respectively acquiring copy coefficients corresponding to the backup data and the current copy number of the backup data.
Specifically, the current copy number and the corresponding copy coefficient of each backup data are obtained. And the copy coefficient is the maximum value of the number of the copies corresponding to the backup data. In one possible implementation, the copy coefficient may be set by the user based on the scene requirements.
S106, adjusting the copy number of the backup data according to the relative relation between the current copy number and the copy coefficient so as to enable the adjusted copy number to be consistent with the copy coefficient.
Specifically, the copy storage condition of the backup data is adjusted, so that the number of the adjusted copies of the backup data is consistent with the copy coefficient, the copies are prevented from being lost, and the waste of the storage space is avoided.
On the basis of fig. 10, there are many possible cases for the relative relationship between the current copy number and the copy coefficient, and a possible implementation manner of step 106 is described below for different cases, please refer to fig. 11, where S106 includes:
s106-1, determining whether the current copy number is larger than the copy coefficient. If yes, executing S106-2; if not, S106-3 is executed.
If the number of the current copies is larger than the copy coefficient, the redundant storage space is occupied, the redundant copies need to be deleted, the occupied storage space is released, and at this time, S106-2 is executed. Otherwise, S106-3 is executed.
S106-2, deleting the N copies of the backup data, so that the number of the adjusted copies is consistent with the copy coefficient, and determining that the rest copies of the backup data are stored in different racks.
The target rack may be a first rack or at least one second rack, and optionally, the target rack may also be the first rack and the at least one second rack.
When the N copies to be deleted are distributed on the first rack and the at least one second rack, respectively, the target rack is the first rack and the at least one second rack.
In a possible implementation manner, N copies to be deleted are determined, and a copy deletion instruction is sent to N nodes storing the copies to be deleted, so that the N nodes storing the copies to be deleted delete the corresponding copies respectively. The duplicate deletion instruction contains identity information of the duplicate to be deleted. And after the N nodes delete the corresponding copies to be deleted, updating the copy information stored by the N nodes.
With continued reference to FIG. 11, S106-3, a determination is made whether the current number of copies is less than the copy factor. If yes, executing S106-4; if not, the process is ended.
If the number of the current copies is smaller than the copy coefficient, it indicates that the security of the copies does not meet the specified requirement, and there may be a hidden danger of missing the copies, and at this time, S106-4 needs to be executed.
S106-4, storing M copies of the backup data on the nodes of at least one target rack so that the number of the adjusted copies is consistent with the copy coefficient.
The target rack is a first rack and/or at least one second rack; and M is the difference value between the copy coefficient and the current copy number. It should be noted that the target rack in S106-4 is not identical to the target rack in S106-2. The target rack in the S106-4 needs to store a corresponding copy; the target chassis in S106-2 needs to delete the corresponding copy.
For example, when there are still at least M available nodes for the first chassis and/or the at least one second chassis, M available nodes are selected as target nodes. When the number y of available nodes still existing in the first rack and/or the at least one second rack is less than M, x available nodes are selected from the available nodes of other racks to be used together with the y available nodes still existing in the first rack and/or the at least one second rack as target nodes, wherein x + y is M. And the rack where the target node is located is the target rack. And after the M nodes respectively store the corresponding copies, updating the copy information stored by the nodes.
It should be noted that, the embodiment of the present application does not limit the specific execution order of S106-1 and S106-3, and in a possible implementation manner, S106-3 may be executed before S106-1. In the embodiment of the present application, the copy coefficient may be 2, 3, 4, 5 or other positive integers greater than 1, and preferably, the copy coefficient is 2 or 3.
When the copies are in distribution balance, as shown in fig. 12, all nodes in the computer room are distributed on racks Rack1 to Rack n, where the master management node is distributed on Rack1 and the standby management nodes are distributed on Rack 2.
When any Rack except the Rack Rack1 and the Rack2 is moved, the Datanode processes installed in each node on the Rack to be moved are closed, so that all the Datanode processes on the Rack are in the dead state. And then checking whether the nodes on other racks are lost or not, and timely processing if the nodes are lost. When no error is confirmed, other services on the rack are stopped, and the rack can be moved down at the moment. And after the rack is moved to the designated position, powering on and debugging the rack, checking the system and starting a corresponding process, and after each service is normal, if other racks need to be moved, moving the next rack at the moment.
Taking fig. 12 as an example, when the Rack2 is moved, the standby nano process installed in the standby management node is first closed. After the standby Namenode process is closed, if the system is confirmed to normally operate, the Datanode processes installed in the nodes on the Rack Rack2 are closed again, so that all the Datanode processes on the Rack are in the dead state, and the rest steps are the same as the above.
When the Rack1 is moved, the states of the main and standby management nodes need to be switched first, so that the management node on the Rack1 is the standby management node, the management node on the Rack2 is the main management node, and the rest steps are the same as above. The Rack2 may be an already moved Rack or an unmoved Rack.
When the journal node process or the Zookeeper process exists on the rack to be moved, the journal node process or the Zookeeper process is closed firstly. After the journal node process or the Zookeeper process is closed, if the system is confirmed to normally operate, the dataode process installed in each node on the rack to be moved is closed again, so that all the dataode processes on the rack are in the dead state, and the rest steps are the same as the above.
Referring to fig. 13, fig. 13 is a schematic diagram of a duplicate balancing apparatus according to an embodiment of the present application, where optionally, the duplicate balancing apparatus is applied to the master management node.
The replica balancing apparatus includes a replica processing module 202 and a replica storage module 203.
A copy processing module 202, configured to determine, for each backup data, whether all copies of the backup data are stored on nodes of the first chassis.
Specifically, the duplicate processing module 202 may perform S101 described above.
A copy storage module 203 for storing a copy of the backup data on a node of at least one second rack when the copy of the backup data is stored entirely on the node of the first rack.
Specifically, the copy storage module 203 may perform S104 described above.
It should be noted that the replica balancing apparatus provided in this embodiment may execute the method flows shown in the above method flow embodiments to achieve the corresponding technical effects. For the sake of brevity, the corresponding contents in the above embodiments may be referred to where not mentioned in this embodiment.
An embodiment of the present application further provides a possible duplicate copy balancing apparatus, as shown in fig. 14, the duplicate copy balancing apparatus further includes: the rack division module 201.
A rack partitioning module 201 for determining whether a second rack exists before storing a copy of the backup data on a node of the at least one second rack; if not, at least one second rack is constructed, and each second rack comprises at least one node. Specifically, the rack dividing module 201 may perform S102 and S103 described above.
In one possible implementation:
the copy processing module 202 is further configured to obtain copy coefficients corresponding to the backup data and the number of current copies of the backup data; the copy coefficient is the maximum value of the number of the copies corresponding to the backup data; and adjusting the copy number of the backup data according to the relative relation between the current copy number and the copy coefficient so as to enable the adjusted copy number to be consistent with the copy coefficient. Specifically, the replica processing module 202 may perform S105 and S106 described above.
The copy processing module 202 is specifically configured to delete the N copies of the backup data when the current copy number is greater than the copy coefficient, so that the adjusted copy number is consistent with the copy coefficient and it is determined that the remaining copies of the backup data are stored in different racks.
And N is the difference value between the current copy number and the copy coefficient, the deleted N copies come from at least one target rack, the target rack stores multiple copies of backup data, and the target rack is a first rack and/or at least one second rack.
The copy processing module 202 is further configured to store M copies of the backup data on a node of the at least one target chassis when the current number of copies is less than the copy factor, such that the adjusted number of copies is consistent with the copy factor.
The target rack is a first rack and/or at least one second rack; and M is the difference value between the copy coefficient and the current copy number.
Specifically, the replica processing module 202 may perform S106-1 to S106-4 described above.
The embodiment of the application also provides a storage medium, and the storage medium stores computer instructions, and the computer instructions execute the copy balancing method of the embodiment when being read and executed. The storage medium may include memory, flash memory, registers, or a combination thereof, etc.
The embodiments of the present application further provide an electronic device, and various nodes and servers related to the above embodiments of the present application may all be implemented by using a structure of the electronic device, for example, the above-mentioned primary management node. Of course, the electronic device may also operate a combination of various components under the HDFS system, such as NameNode, DataNode, and SecondaryNameNode. Specifically, referring to fig. 3, the electronic device point may include: a processor 101, a memory 102, a bus 103, and a communication interface 104. The processor 101 may be a CPU.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The apparatus embodiments described above are merely illustrative, and for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only a preferred embodiment of the present application and is not intended to limit the present application, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application.
It will be evident to those skilled in the art that the present application is not limited to the details of the foregoing illustrative embodiments, and that the present application may be embodied in other specific forms without departing from the spirit or essential attributes thereof. The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the application being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference sign in a claim should not be construed as limiting the claim concerned.
Claims (10)
1. A copy balancing method applied to a primary management node is characterized by comprising the following steps:
for each backup data, determining whether a copy of the backup data is stored entirely on a node of a first chassis;
when the copies of the backup data are all stored on the nodes of the first chassis, storing the copies of the backup data on the nodes of at least one second chassis.
2. The copy balancing method of claim 1, wherein prior to storing the copy of the backup data on the node of the at least one second chassis, further comprising:
determining whether the second rack is present;
and if not, constructing at least one second rack, wherein each second rack comprises at least one node.
3. The copy balancing method of claim 1, further comprising:
respectively acquiring copy coefficients corresponding to the backup data and the current copy number of the backup data; the copy coefficient is the maximum value of the number of copies corresponding to the backup data;
and adjusting the copy number of the backup data according to the relative relation between the current copy number and the copy coefficient so as to make the adjusted copy number consistent with the copy coefficient.
4. The copy balancing method of claim 3, wherein the adjusting the number of copies of the backup data according to the relative relationship between the current number of copies and the copy coefficient so that the adjusted number of copies is consistent with the copy coefficient comprises:
deleting the N copies of the backup data when the current copy number is greater than the copy coefficient, so that the adjusted copy number is consistent with the copy coefficient and the remaining copies of the backup data are determined to be stored in different racks;
wherein N is a difference between the current copy number and the copy coefficient, the N deleted copies originate from at least one target rack, the target rack stores multiple copies of the backup data, and the target rack is the first rack and/or at least one second rack.
5. The copy balancing method of claim 3, wherein the adjusting the number of copies of the backup data according to the relative relationship between the current number of copies and the copy coefficient so that the adjusted number of copies is consistent with the copy coefficient comprises:
when the current copy number is less than the copy coefficient, storing M copies of the backup data on a node of at least one target rack so that the adjusted copy number is consistent with the copy coefficient;
wherein the target rack is the first rack and/or at least one of the second racks; and M is the difference value between the copy coefficient and the current copy number.
6. A duplicate balancing device applied to a main management node is characterized by comprising:
the system comprises a copy processing module, a storage module and a processing module, wherein the copy processing module is used for determining whether all copies of backup data are stored on nodes of a first rack or not aiming at each backup data;
and the copy storage module is used for storing the copy of the backup data on at least one node of the second rack when the copy of the backup data is completely stored on the node of the first rack.
7. The copy balancing apparatus of claim 6, further comprising:
a rack partitioning module to determine whether a second rack exists before storing a copy of the backup data on a node of the at least one second rack; and if not, constructing at least one second rack, wherein each second rack comprises at least one node.
8. The copy balancing apparatus of claim 6, further comprising:
the copy processing module is used for respectively acquiring copy coefficients corresponding to the backup data and the current copy number of the backup data; the copy coefficient is the maximum value of the number of copies corresponding to the backup data; and adjusting the copy number of the backup data according to the relative relation between the current copy number and the copy coefficient so as to make the adjusted copy number consistent with the copy coefficient.
9. A storage medium having stored thereon computer instructions, characterized in that the computer instructions, when executed by a processor, implement the method according to any one of claims 1-5.
10. An electronic device, comprising: a memory to store one or more instructions and a processor; the one or more instructions, when executed by the processor, implement the method of any of claims 1-5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910909624.8A CN110674099A (en) | 2019-09-25 | 2019-09-25 | Copy balancing method and device, storage medium and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910909624.8A CN110674099A (en) | 2019-09-25 | 2019-09-25 | Copy balancing method and device, storage medium and electronic equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110674099A true CN110674099A (en) | 2020-01-10 |
Family
ID=69079234
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910909624.8A Pending CN110674099A (en) | 2019-09-25 | 2019-09-25 | Copy balancing method and device, storage medium and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110674099A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112083888A (en) * | 2020-09-10 | 2020-12-15 | 北京金山云网络技术有限公司 | File storage method and device and electronic equipment |
CN114722114A (en) * | 2020-12-22 | 2022-07-08 | 金篆信科有限责任公司 | Node switching method, electronic device and computer-readable storage medium |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104615606A (en) * | 2013-11-05 | 2015-05-13 | 阿里巴巴集团控股有限公司 | Hadoop distributed file system and management method thereof |
CN107729514A (en) * | 2017-10-25 | 2018-02-23 | 郑州云海信息技术有限公司 | A kind of Replica placement node based on hadoop determines method and device |
CN108023967A (en) * | 2017-12-20 | 2018-05-11 | 联想(北京)有限公司 | A kind of management equipment in data balancing method, apparatus and distributed memory system |
-
2019
- 2019-09-25 CN CN201910909624.8A patent/CN110674099A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104615606A (en) * | 2013-11-05 | 2015-05-13 | 阿里巴巴集团控股有限公司 | Hadoop distributed file system and management method thereof |
CN107729514A (en) * | 2017-10-25 | 2018-02-23 | 郑州云海信息技术有限公司 | A kind of Replica placement node based on hadoop determines method and device |
CN108023967A (en) * | 2017-12-20 | 2018-05-11 | 联想(北京)有限公司 | A kind of management equipment in data balancing method, apparatus and distributed memory system |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112083888A (en) * | 2020-09-10 | 2020-12-15 | 北京金山云网络技术有限公司 | File storage method and device and electronic equipment |
CN114722114A (en) * | 2020-12-22 | 2022-07-08 | 金篆信科有限责任公司 | Node switching method, electronic device and computer-readable storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US12056025B2 (en) | Updating the membership of a pod after detecting a change to a set of storage systems that are synchronously replicating a dataset | |
US11500552B2 (en) | Configurable hyperconverged multi-tenant storage system | |
US20110153570A1 (en) | Data replication and recovery method in asymmetric clustered distributed file system | |
AU2018202365B2 (en) | Storage cluster | |
US9201742B2 (en) | Method and system of self-managing nodes of a distributed database cluster with a consensus algorithm | |
EP2414928B1 (en) | Data redistribution in data replication systems | |
US20170093980A1 (en) | Storage system architecture | |
CN109597567B (en) | Data processing method and device | |
CN110362381A (en) | HDFS cluster High Availabitity dispositions method, system, equipment and storage medium | |
US9201747B2 (en) | Real time database system | |
CN107368260A (en) | Memory space method for sorting, apparatus and system based on distributed system | |
CN111049928B (en) | Data synchronization method, system, electronic device and computer readable storage medium | |
JP6816072B2 (en) | Distributed database system, distributed database management method, and distributed database management program | |
US11671496B2 (en) | Load balacing for distibuted computing | |
WO2021082465A1 (en) | Method for ensuring data consistency and related device | |
WO2024148856A1 (en) | Data writing method and system, and storage hard disk, electronic device and storage medium | |
CN104054076B (en) | Date storage method, database purchase node failure processing method and processing device | |
CN110674099A (en) | Copy balancing method and device, storage medium and electronic equipment | |
CN108462756B (en) | Data writing method and device | |
US10970177B2 (en) | Methods and systems of managing consistency and availability tradeoffs in a real-time operational DBMS | |
US10067949B1 (en) | Acquired namespace metadata service for controlling access to distributed file system | |
CN116389233A (en) | Container cloud management platform active-standby switching system, method and device and computer equipment | |
CN115470041A (en) | Data disaster recovery management method and device | |
CN103685359A (en) | Data processing method and device | |
CN118535638A (en) | Data processing method and device and computing equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20200110 |
|
RJ01 | Rejection of invention patent application after publication |