A method, system, device and medium for building a cluster based on centralized storage
Patent Information
- Application Number
- CN202210732771.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-24
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2042-06-24
AI Technical Summary
这种方式存在一个缺点,有节点产生异常时,集群内节点各自的数据可能会发生不一致的情况
[0026] The present invention proposes a method and system for building a cluster based on centralized storage. The method includes allocating memory space for writing data of each node in the cluster, controlling node data to be written into the memory, and merging the written data for centralized storage; When performing centralized storage, a second cache for data read and write control is added; the cache uses a local disk to store incremental data. The method also includes directly deleting data from the centralized storage when a node in the cluster needs to delete data. Based on a method of building a cluster based on centralized storage, a system, equipment and media for building a cluster based on centralized storage are also proposed. The present invention ensures the consistency of data by configuring all nodes of the cluster to use the same centralized storage and solves the problem of data security. Using centralized storage can ensure that the data used by each node is consistent. Multiple nodes using the same centralized storage can not only ensure the high availability and throughput of cluster services, but also ensure data security.
Smart Images

Figure CN115118779B
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of cluster construction, and in particular relates to a method, system, device and medium for building a cluster based on centralized storage. Background Art
[0002] RabbitMQ: A message middleware that can be used for message production and consumption. After the client connects to the RabbitMQ service, it can send messages to the RabbitMQ server and receive messages from the server. Sending messages is production, and receiving messages is consumption. As a mature and widely used message middleware, RabbitMQ is used in many products. In order to ensure high availability of the service and the throughput of the RabbitMQ service, the RabbitMQ service is generally deployed in the form of a cluster.
[0003] Currently, RabbitMQ uses a distributed storage architecture, where data is stored on multiple nodes. Figure 1 The following figure shows the data storage of a general rabbitmq cluster. Each node uses local storage data (local disk), and data synchronization is required between the nodes in the cluster. Each node in the cluster can provide services. This method has a disadvantage. When a node is abnormal, the data of each node in the cluster may be inconsistent. If this inconsistency cannot be repaired by synchronizing the data in the cluster, the rabbitmq service will fail to start. This problem is the data security problem of rabbitmq. Summary of the invention
[0004] In order to solve the above technical problems, the present invention proposes a method, system, device and medium for building a cluster based on centralized storage, which ensures the security of cluster data while maintaining the high availability function of the cluster without significantly reducing the cluster throughput.
[0005] To achieve the above object, the present invention adopts the following technical solutions:
[0006] A method for building a cluster based on centralized storage, comprising the following steps:
[0007] Allocate memory space for writing data to each node in the cluster, control the writing of node data into memory, and merge the written data for centralized storage;
[0008] When performing centralized storage, a second cache for data read and write control is added; the cache uses a local disk to store incremental data.
[0009] Furthermore, the method also includes directly deleting data from the centralized storage when a node in the cluster needs to delete data.
[0010] Furthermore, the data of each node in the cluster is located in the first cache, and the data of each node in the cluster adopts memory cache data.
[0011] Furthermore, in the process of controlling the node data to be written into the memory, global control is added to ensure that only one node is written at a time, and the next node can be written only after the current node is written.
[0012] Furthermore, the method for centrally storing the merged written data includes:
[0013] The same part of the data of each node is only saved in a centralized storage;
[0014] Different parts of the data of each node are saved separately to centralized storage.
[0015] Furthermore, after the data increments are saved, the data read-write control will periodically control the data to be merged and written into the centralized storage.
[0016] The present invention also proposes a system for building a cluster based on centralized storage, including: a writing module and a storage module;
[0017] The writing module is used to allocate memory space for writing data of each node in the cluster, control the writing of node data into memory and merge the written data for centralized storage;
[0018] The storage module is used to add a second cache for data read and write control when performing centralized storage; the cache uses a local disk to store incremental data.
[0019] Furthermore, the system also includes a deletion module;
[0020] The deletion module is used to directly delete data from the centralized storage when a node in the cluster needs to delete data.
[0021] The present invention also proposes a device, comprising:
[0022] Memory for storing computer programs;
[0023] A processor is used to implement the method steps described above when executing the computer program.
[0024] The present invention also proposes a readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the method steps described above are implemented.
[0025] The effects provided in the content of the invention are only the effects of the embodiments, not all the effects of the invention. One of the above technical solutions has the following advantages or beneficial effects:
[0026] The present invention proposes a method and system for building a cluster based on centralized storage, the method comprising allocating memory space for writing data of each node in the cluster, controlling the writing of node data into the memory and merging the written data for centralized storage; when performing centralized storage, adding a second cache for data read and write control; the cache uses a local disk to store incremental data. The method also includes directly deleting data from the centralized storage when a node in the cluster needs to delete data. Based on a method for building a cluster based on centralized storage, a system, device and medium for building a cluster based on centralized storage are also proposed. The present invention solves the problem of data security by configuring all nodes in the cluster to use the same centralized storage to ensure data consistency. The use of centralized storage can ensure that the data used by each node is consistent. Multiple nodes using the same centralized storage can ensure both high availability and throughput of cluster services and data security.
[0027] The Rabbitmq service in the present invention does not use local storage, but cached data. Data synchronization is no longer performed between the nodes of the cluster. The security of the cluster data is guaranteed on the basis of maintaining the high availability function of the cluster without significantly reducing the cluster throughput.
[0028] After the data increments are saved in the present invention, the data read-write control part will periodically merge the data and write them into the centralized storage. By delaying the merging of the data and writing them into the centralized storage, the number of storage writes is reduced. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] like Figure 1 It is a schematic diagram of the common RabbitMQ cluster structure in the prior art;
[0030] like Figure 2 This is a schematic diagram of the structure of a rabbitmq cluster with centralized storage according to embodiment 1 of the present invention;
[0031] like Figure 3 This is a flow chart of a method for building a cluster based on centralized storage according to Embodiment 1 of the present invention;
[0032] like Figure 4 This is a schematic diagram of the structure of controlling node data writing into memory and merging in Embodiment 1 of the present invention;
[0033] like Figure 5 This is a schematic diagram of the structure of incremental storage in Example 1 of the present invention;
[0034] like Figure 6This is a schematic diagram of a system for building a cluster based on centralized storage according to Embodiment 2 of the present invention. DETAILED DESCRIPTION
[0035] In order to clearly illustrate the technical features of the present solution, the present invention is described in detail below through specific implementation methods and in conjunction with the accompanying drawings. The disclosure below provides many different embodiments or examples for realizing different structures of the present invention. In order to simplify the disclosure of the present invention, the components and settings of specific examples are described below. In addition, the present invention may repeat reference numbers and / or letters in different examples. This repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed. It should be noted that the components illustrated in the accompanying drawings are not necessarily drawn to scale. The present invention omits the description of known components and processing techniques and processes to avoid unnecessary limitations on the present invention.
[0036] Example 1
[0037] Embodiment 1 of the present invention proposes a method for building a cluster based on centralized storage, which ensures data consistency by configuring all nodes of the cluster to use the same centralized storage, thereby solving the data security problem existing in the prior art.
[0038] like Figure 2 This is a schematic diagram of the RabbitMQ cluster structure with centralized storage in Example 1 of the present invention; using centralized storage can ensure that the data used by each node is consistent, and multiple nodes using the same centralized storage can ensure both high availability and throughput of cluster services and data security.
[0039] like Figure 3 This is a flow chart of a method for building a cluster based on centralized storage according to Example 1 of the present invention.
[0040] In step S300, memory space is allocated for writing data of each node in the cluster, and the writing of node data into memory is controlled and the written data is merged for centralized storage;
[0041] In this application, the Rabbitmq service does not use local storage, but cached data. Data is no longer synchronized between nodes in the cluster. Data is no longer synchronized between nodes in the cluster.
[0042] The original RabbitMQ cluster architecture is that each node uses local storage data (local disk), and data synchronization is required between cluster nodes. Each node in the cluster can provide services.
[0043] Because the present invention is designed to use centralized storage for each node, each node does not need to save data on a local disk, and each node does not need to synchronize data (data is written to centralized storage). You can use cache data, allocate an area in memory, and the RabbitMQ service reads and writes data from memory.
[0044] like Figure 4 This is a schematic diagram of the structure of controlling node data writing into memory and merging in embodiment 1 of the present invention.
[0045] In the process of controlling node data writing into memory, global control is added to ensure that only one node is written at a time. After the current node is written, the next node can be written.
[0046] The RabbitMQ data of each node in the cluster needs to be written to the centralized storage. The data read and write control part is needed to control the reading and writing of data. There is an obvious problem in using centralized storage. There will be conflicts when each node writes data. For example, the data written by node 1 is ABC, and the data written by node 2 is BCD. Writing directly to the storage will cause errors. The more common way to deal with it is to add a global control. When node 1 is writing, other nodes cannot write. After node 1 has finished writing, another node can write. It must be ensured that there is only one write operation at a time.
[0047] The method for solving this problem in the present invention is to control data writing through a data read-write control part. The data control part allocates space (memory) for each node to write, and after each node data is written, the data is merged.
[0048] The method for merging written data for centralized storage includes: only one copy of the same part of the data of each node is saved in the centralized storage; and the different parts of the data of each node are saved in the centralized storage respectively.
[0049] Figure 4 In the example, the data written by node 1 is ABC, the data written by node 2 is BCD, and the data written by node 3 is ACD.
[0050] The data read and write control part allocates memory space in advance to save the write data of the three nodes, and then merges the data according to the write data of the nodes. The merged data is ABCD.
[0051] Since RabbitMQ is a message middleware, the composition of the message is two parts: the message header and the message content. The message header contains some characteristics and attributes of the message, and the message content is the specific data of the message. Messages can be classified and merged according to the information in the message header.
[0052] In step S310, when performing centralized storage, a second cache for data read and write control is added; the cache uses a local disk to store incremental data.
[0053] Due to the production and consumption of RabbitMQ messages, data changes in real time. In order to reduce the number of times data is written to centralized storage, a cache design is introduced in the data read and write control part. The data in the cache is written to the centralized storage after a certain delay time.
[0054] The cache design of the data read and write control part saves data on the local disk in the form of incremental storage.
[0055] like Figure 5 This is a structural diagram of incremental storage in Example 1 of the present invention; after the data is incrementally saved, the data read and write control part will periodically merge the data and write it into the centralized storage.
[0056] The present invention also includes directly deleting data from the centralized storage when a node in the cluster needs to delete data.
[0057] exist Figure 5 In the example, if A and D need to be deleted in node 3, they are deleted in the centralized storage, and BCE remains in the centralized storage.
[0058] Rabbitmq itself uses local disk to store data. This method no longer uses local disk, but uses memory cache data, which is read from centralized storage.
[0059] The method for building a cluster based on centralized storage proposed in Example 1 of the present invention solves the problem of data security by configuring all nodes of the cluster to use the same centralized storage to ensure data consistency. The use of centralized storage can ensure that the data used by each node is consistent. Multiple nodes using the same centralized storage can ensure high availability and throughput of cluster services as well as data security.
[0060] In a method for building a cluster based on centralized storage proposed in Example 1 of the present invention, the Rabbitmq service does not use local storage, but cached data. Data synchronization is no longer performed between the nodes of the cluster. The security of the cluster data is guaranteed on the basis of maintaining the high availability function of the cluster without significantly reducing the cluster throughput.
[0061] In a method for building a cluster based on centralized storage proposed in Example 1 of the present invention, after the data increments are saved, the data read and write control part will periodically merge the data and write it to the centralized storage. By delaying the merging of the data and writing it to the centralized storage, the number of storage writes is reduced.
[0062] Example 2
[0063] Based on the method for building a cluster based on centralized storage proposed in Example 1 of the present invention, Example 2 of the present invention proposes a system for building a cluster based on centralized storage, such as Figure 6 This is a schematic diagram of a system for building a cluster based on centralized storage according to Embodiment 2 of the present invention, the system comprising a writing module and a storage module;
[0064] The write module is used to allocate memory space for writing data to each node in the cluster, control the writing of node data into memory, and merge the written data for centralized storage;
[0065] The storage module is used to add a second cache for data read and write control when performing centralized storage; the cache uses a local disk to store incremental data.
[0066] The system also includes a deletion module; the deletion module is used to directly delete data from the centralized storage when a node in the cluster needs to delete data.
[0067] The data of each node in the cluster in the write module is located in the first cache, and the data of each node in the cluster adopts memory cache data.
[0068] In the process of controlling node data writing into memory, global control is added to ensure that only one node is written at a time. After the current node is written, the next node can be written.
[0069] The method for merging written data for centralized storage includes: only one copy of the same part of the data of each node is saved to the centralized storage; the different parts of the data of each node are saved to the centralized storage separately.
[0070] In the storage module, due to the production and consumption of RabbitMQ messages, data changes in real time. In order to reduce the number of times data is written to centralized storage, a cache design is introduced in the data read and write control part. The data in the cache is written to the centralized storage after a certain delay time.
[0071] The cache design of the data read-write control part saves the data in the local disk in increments. After the data increments are saved, the data read-write control part will periodically merge the data and write it to the centralized storage.
[0072] The system for building a cluster based on centralized storage proposed in Example 2 of the present invention solves the problem of data security by configuring all nodes of the cluster to use the same centralized storage to ensure data consistency. The use of centralized storage can ensure that the data used by each node is consistent. Multiple nodes using the same centralized storage can ensure high availability and throughput of cluster services as well as data security.
[0073] In a system for building a cluster based on centralized storage, the Rabbitmq service proposed in Example 2 of the present invention does not use local storage, but uses cached data. Data is no longer synchronized between nodes in the cluster. Data synchronization is no longer performed between nodes in the cluster. The security of cluster data is guaranteed on the basis of maintaining the high availability function of the cluster without significantly reducing the cluster throughput.
[0074] In a system for building a cluster based on centralized storage, according to Embodiment 2 of the present invention, after data increments are saved, the data read-write control part will periodically merge the data and write it to the centralized storage. By delaying the merging of data and writing it to the centralized storage, the number of storage writes can be reduced.
[0075] Example 3
[0076] The present invention also proposes a device, comprising:
[0077] Memory for storing computer programs;
[0078] The processor is used to implement the following method steps when executing the computer program:
[0079] like Figure 3 This is a flow chart of a method for building a cluster based on centralized storage according to Example 1 of the present invention.
[0080] In step S300, memory space is allocated for writing data of each node in the cluster, and the writing of node data into memory is controlled and the written data is merged for centralized storage;
[0081] In this application, the Rabbitmq service does not use local storage, but cached data. Data is no longer synchronized between nodes in the cluster. Data is no longer synchronized between nodes in the cluster.
[0082] The original RabbitMQ cluster architecture is that each node uses local storage data (local disk), and data synchronization is required between cluster nodes. Each node in the cluster can provide services.
[0083] Because the present invention is designed to use centralized storage for each node, each node does not need to save data on a local disk, and each node does not need to synchronize data (data is written to centralized storage). You can use cache data, allocate an area in memory, and the RabbitMQ service reads and writes data from memory.
[0084] like Figure 4 This is a schematic diagram of the structure of controlling node data writing into memory and merging in embodiment 1 of the present invention.
[0085] In the process of controlling node data writing into memory, global control is added to ensure that only one node is written at a time. After the current node is written, the next node can be written.
[0086] The RabbitMQ data of each node in the cluster needs to be written to the centralized storage. The data read and write control part is needed to control the reading and writing of data. There is an obvious problem in using centralized storage. There will be conflicts when each node writes data. For example, the data written by node 1 is ABC, and the data written by node 2 is BCD. Writing directly to the storage will cause errors. The more common way to deal with it is to add a global control. When node 1 is writing, other nodes cannot write. After node 1 has finished writing, another node can write. It must be ensured that there is only one write operation at a time.
[0087] The method for solving this problem in the present invention is to control data writing through a data read-write control part. The data control part allocates space (memory) for each node to write, and after each node data is written, the data is merged.
[0088] The method for merging written data for centralized storage includes: only one copy of the same part of the data of each node is saved in the centralized storage; and the different parts of the data of each node are saved in the centralized storage respectively.
[0089] Figure 4 In the example, the data written by node 1 is ABC, the data written by node 2 is BCD, and the data written by node 3 is ACD.
[0090] The data read and write control part allocates memory space in advance to save the write data of the three nodes, and then merges the data according to the write data of the nodes. The merged data is ABCD.
[0091] Since RabbitMQ is a message middleware, the composition of the message is two parts: the message header and the message content. The message header contains some characteristics and attributes of the message, and the message content is the specific data of the message. Messages can be classified and merged according to the information in the message header.
[0092] In step S310, when performing centralized storage, a second cache for data read and write control is added; the cache uses a local disk to store incremental data.
[0093] Due to the production and consumption of RabbitMQ messages, data changes in real time. In order to reduce the number of times data is written to centralized storage, a cache design is introduced in the data read and write control part. The data in the cache is written to the centralized storage after a certain delay time.
[0094] The cache design of the data read and write control part saves data on the local disk in the form of incremental storage.
[0095] like Figure 5 This is a structural diagram of incremental storage in Example 1 of the present invention; after the data is incrementally saved, the data read and write control part will periodically merge the data and write it into the centralized storage.
[0096] The present invention also includes directly deleting data from the centralized storage when a node in the cluster needs to delete data.
[0097] exist Figure 5 In the example, if A and D need to be deleted in node 3, they are deleted in the centralized storage, and BCE remains in the centralized storage.
[0098] Rabbitmq itself uses local disk to store data. This method no longer uses local disk, but uses memory cache data, which is read from centralized storage.
[0099] A device proposed in Embodiment 3 of the present invention solves the problem of data security by configuring all nodes of the cluster to use the same centralized storage to ensure data consistency. The use of centralized storage can ensure that the data used by each node is consistent. Multiple nodes using the same centralized storage can ensure high availability and throughput of cluster services as well as data security.
[0100] In a device proposed in Example 3 of the present invention, the Rabbitmq service does not use local storage but cached data. Data is no longer synchronized between nodes in the cluster. Data synchronization is no longer performed between nodes in the cluster. On the premise of not significantly reducing the cluster throughput, the high availability function of the cluster is maintained and the security of the cluster data is guaranteed.
[0101] In a device proposed in Example 3 of the present invention, after the data is incrementally saved, the data read and write control part will periodically merge the data and write it into the centralized storage. By delaying the merging of the data and writing it into the centralized storage, the number of storage writes is reduced.
[0102] It should be noted that the technical solution of the present invention also provides an electronic device, including: a communication interface, which can exchange information with other devices such as network devices; a processor, connected to the communication interface to realize information interaction with other devices, and used to execute a method of building a cluster based on centralized storage provided by one or more of the above technical solutions when running a computer program, and the computer program is stored in the memory. Of course, in actual application, the various components in the electronic device are coupled together through a bus system. It can be understood that the bus system is used to realize the connection and communication between these components. In addition to the data bus, the bus system also includes a power bus, a control bus and a status signal bus. The memory in the embodiment of the present application is used to store various types of data to support the operation of the electronic device. Examples of these data include: any computer program for operating on an electronic device. It can be understood that the memory can be a volatile memory or a non-volatile memory, and can also include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory, a magnetic surface memory, an optical disk, or a compact disc read-only memory (CD-ROM); the magnetic surface memory can be a disk memory or a tape memory. The volatile memory can be a random access memory (RAM), which is used as an external cache.By way of exemplary but not limiting explanation, many forms of RAM are available, such as static random access memory (SRAM), synchronous static random access memory (SSRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), direct memory bus random access memory (DRRAM). The memory described in the embodiment of the present application is intended to include but is not limited to these and any other suitable types of memory. The method disclosed in the above embodiment of the present application can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in a processor or an instruction in the form of software. The above processor can be a general-purpose processor, a DSP (Digital Signal Processing, which refers to a chip that can implement digital signal processing technology), or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The processor can implement or execute the methods, steps and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor can be a microprocessor or any conventional processor, etc. In conjunction with the steps of the method disclosed in the embodiments of the present application, it can be directly embodied as a hardware decoding processor to perform, or it can be performed by a combination of hardware and software modules in a decoding processor. The software module can be located in a storage medium, which is located in a memory, and the processor reads the program in the memory and completes the steps of the above method in combination with its hardware. When the processor executes the program, the corresponding process in each method of the embodiment of the present application is implemented, and for the sake of brevity, it is not repeated here.
[0103] Example 4
[0104] The present invention also provides a readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the following method steps are implemented:
[0105] like Figure 3 This is a flow chart of a method for building a cluster based on centralized storage according to Example 1 of the present invention.
[0106] In step S300, memory space is allocated for writing data of each node in the cluster, and the writing of node data into memory is controlled and the written data is merged for centralized storage;
[0107] In this application, the Rabbitmq service does not use local storage, but cached data. Data is no longer synchronized between nodes in the cluster. Data is no longer synchronized between nodes in the cluster.
[0108] The original RabbitMQ cluster architecture is that each node uses local storage data (local disk), and data synchronization is required between cluster nodes. Each node in the cluster can provide services.
[0109] Because the present invention is designed to use centralized storage for each node, each node does not need to save data on a local disk, and each node does not need to synchronize data (data is written to centralized storage). You can use cache data, allocate an area in memory, and the RabbitMQ service reads and writes data from memory.
[0110] like Figure 4 This is a schematic diagram of the structure of controlling node data writing into memory and merging in embodiment 1 of the present invention.
[0111] In the process of controlling node data writing into memory, global control is added to ensure that only one node is written at a time. After the current node is written, the next node can be written.
[0112] The RabbitMQ data of each node in the cluster needs to be written to the centralized storage. The data read and write control part is needed to control the reading and writing of data. There is an obvious problem in using centralized storage. There will be conflicts when each node writes data. For example, the data written by node 1 is ABC, and the data written by node 2 is BCD. Writing directly to the storage will cause errors. The more common way to deal with it is to add a global control. When node 1 is writing, other nodes cannot write. After node 1 has finished writing, another node can write. It must be ensured that there is only one write operation at a time.
[0113] The method for solving this problem in the present invention is to control data writing through a data read-write control part. The data control part allocates space (memory) for each node to write, and after each node data is written, the data is merged.
[0114] The method for merging written data for centralized storage includes: only one copy of the same part of the data of each node is saved in the centralized storage; and the different parts of the data of each node are saved in the centralized storage respectively.
[0115] Figure 4 In the example, the data written by node 1 is ABC, the data written by node 2 is BCD, and the data written by node 3 is ACD.
[0116] The data read and write control part allocates memory space in advance to save the write data of the three nodes, and then merges the data according to the write data of the nodes. The merged data is ABCD.
[0117] Since RabbitMQ is a message middleware, the composition of the message is two parts: the message header and the message content. The message header contains some characteristics and attributes of the message, and the message content is the specific data of the message. Messages can be classified and merged according to the information in the message header.
[0118] In step S310, when performing centralized storage, a second cache for data read and write control is added; the cache uses a local disk to store incremental data.
[0119] Due to the production and consumption of RabbitMQ messages, data changes in real time. In order to reduce the number of times data is written to centralized storage, a cache design is introduced in the data read and write control part. The data in the cache is written to the centralized storage after a certain delay time.
[0120] The cache design of the data read and write control part saves data on the local disk in the form of incremental storage.
[0121] like Figure 5 This is a structural diagram of incremental storage in Example 1 of the present invention; after the data is incrementally saved, the data read and write control part will periodically merge the data and write it into the centralized storage.
[0122] The present invention also includes directly deleting data from the centralized storage when a node in the cluster needs to delete data.
[0123] exist Figure 5 In the example, if A and D need to be deleted in node 3, they are deleted in the centralized storage, and BCE remains in the centralized storage.
[0124] Rabbitmq itself uses local disk to store data. This method no longer uses local disk, but uses memory cache data, which is read from centralized storage.
[0125] A storage medium proposed in Example 4 of the present invention solves the problem of data security by configuring all nodes of the cluster to use the same centralized storage to ensure data consistency. The use of centralized storage can ensure that the data used by each node is consistent. Multiple nodes using the same centralized storage can ensure high availability and throughput of cluster services as well as data security.
[0126] A storage medium is proposed in Example 4 of the present invention. The Rabbitmq service does not use local storage but cached data. Data is no longer synchronized between nodes in the cluster. Data synchronization is no longer performed between nodes in the cluster. The security of cluster data is guaranteed on the basis of maintaining the high availability function of the cluster without significantly reducing the cluster throughput.
[0127] A storage medium proposed in Example 4 of the present invention, after the data increments are saved, the data read and write control part will periodically merge the data and write it to the centralized storage, and the number of storage writes will be reduced by delaying the merging of the data and writing it to the centralized storage.
[0128] The embodiment of the present application also provides a storage medium, namely a computer storage medium, specifically a computer-readable storage medium, for example, a memory storing a computer program, and the computer program can be executed by a processor to complete the steps of the aforementioned method. The computer-readable storage medium can be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, Flash Memory, magnetic surface storage, optical disk, or CD-ROM.
[0129] It can be understood by those skilled in the art that all or part of the steps of the above-mentioned method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiment are executed; and the aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, RAM, disks or optical disks. Alternatively, if the above-mentioned integrated unit of the present application is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the embodiment of the present application can be essentially or partly embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable an electronic device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in each embodiment of the present application. And the aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, RAM, disks or optical disks.
[0130] For the description of the relevant parts of the processing device and storage medium for building a cluster based on centralized storage provided in the embodiment of the present application, please refer to the detailed description of the corresponding parts of the method for building a cluster based on centralized storage provided in Example 1 of the present application, which will not be repeated here.
[0131] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. Moreover, the term "include", "comprise" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, article or equipment that includes a series of elements are inherent to the elements. In the absence of more restrictions, the elements limited by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or equipment that includes the elements. In addition, the above-mentioned technical solution provided in the embodiment of the present application is consistent with the corresponding technical solution in the prior art in principle, and the part is not described in detail, so as not to repeat too much.
[0132] Although the above describes the specific implementation of the present invention in conjunction with the accompanying drawings, it is not intended to limit the scope of protection of the present invention. For those skilled in the art, other different forms of modifications or deformations can be made on the basis of the above description. It is not necessary and impossible to list all the implementation methods here. On the basis of the technical solution of the present invention, various modifications or deformations that can be made by those skilled in the art without creative work are still within the scope of protection of the present invention.
Claims
1. A method for building a cluster based on centralized storage, characterized in that: The following steps are involved: Allocate memory space for writing data of each node in the RabbitMQ cluster, control the writing of node data into memory, merge the written data and store them centrally; the data of each node in the cluster is located in the first cache, and the data of each node in the cluster uses memory cache data; In the process of writing the control node data into the memory, global control is added to ensure that only one node is written at a time, and the next node can be written after the current node is written; When performing centralized storage, a second cache for data read and write control is added; the cache uses a local disk to store incremental data; The method also includes directly deleting data from the centralized storage when a node in the cluster needs to delete data.
2. A method for building a cluster based on centralized storage according to claim 1, characterized in that: The method for centrally storing the merged written data includes: The same part of the data of each node is only saved in a centralized storage; Different parts of the data of each node are saved separately to centralized storage.
3. The method for building a cluster based on centralized storage according to claim 1, characterized in that: After the data increments are saved, the data read-write control will periodically control the data to be merged and written into the centralized storage.
4. A system for building a cluster based on centralized storage, used to execute a method for building a cluster based on centralized storage as claimed in any one of claims 1 to 3, characterized in that: include: Write module and storage module; The writing module is used to allocate memory space for writing data of each node in the RabbitMQ cluster, control the writing of node data into memory, merge the written data and perform centralized storage; The storage module is used to add a second cache for data read and write control when performing centralized storage; the cache uses a local disk to store incremental data; The system further comprises a deletion module; the deletion module is used to directly delete data from the centralized storage when a node in the cluster needs to delete data.
5. A device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the method steps as claimed in any one of claims 1 to 3 when executing the computer program.
6. A readable storage medium, characterized in that: The readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps according to any one of claims 1 to 3 are implemented.
Citation Information
Patent Citations
Electronic file concentrated storing and optimizing method based on HDFS
CN103366016A
Centralized memory management method in video monitoring and control network
CN103401705A
System integrating design development, post production and data storage and based on cloud platform
CN103442036A
Data processing method and system and computer readable storage medium
CN107870982A
Metadata updating method and device, equipment and medium
CN111488128A
