Cloud storage method and system based on Rocket MQ
By expanding the message storage engine in RocketMQ and introducing a distributed log system, the problem of fixed storage resources is solved, the separation of computing and storage is achieved, and the flexibility and performance of the system are improved.
Patent Information
- Application Number
- CN202410820430.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-24
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2044-06-24
AI Technical Summary
RocketMQ's local storage resources are fixed and cannot dynamically change on demand, resulting in uneven data distribution and affecting system performance and stability.
Expand the message storage engine in Apache RocketMQ distributed messaging, use the Apache Bookkeeper distributed log system to achieve separation of calculation and storage, manage data cache and index through LedgerManager and QueueLedger objects, check writing progress with asynchronous threads, and retrieve data based on IndexFile Technology optimizes data access.
This improves resource utilization, enhances the system's flexibility and adaptability to different loads and data growth, and improves overall performance and stability.
Smart Images

Figure CN118779128A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of cloud storage, and in particular relates to a cloud storage method and system based on RocketMQ. Background Art
[0002] Apache RocketMQ is a distributed messaging service with low latency, high concurrency, high availability and high reliability. It is widely adopted by many enterprise developers and cloud vendors due to its simple architecture, rich business functions and strong scalability.
[0003] However, the current local storage resources of RocketMQ are fixed and cannot be changed dynamically on demand, which limits the flexibility and adaptability of the system in the face of different loads and data growth, and easily leads to uneven data distribution, causing some Broker nodes to be overloaded while other nodes are relatively idle, affecting the overall performance and stability of the system. Summary of the invention
[0004] In view of the above shortcomings of the prior art, the purpose of the invention is to provide a cloud storage method and system based on RocketMQ. In the Apache RocketMQ distributed message, the message storage engine is extended to store the message data in the distributed log system. Without changing the cluster deployment architecture and being fully compatible with the open source ecosystem, the separation of computing and storage is achieved. It can change dynamically as needed, improve resource utilization, improve the flexibility and adaptability of the system in the face of different loads and data growth, and improve the overall performance and stability of the system.
[0005] In a first aspect of the present invention, a cloud storage method based on RocketMQ is proposed, comprising:
[0006] S1, in Apache RocketMQ distributed messaging, extends the message storage engine;
[0007] S2, create an access interface for the Apache Bookkeeper distributed log system;
[0008] S3, expand the access interface and maintain the LedgerManager object and the QueueLedger object;
[0009] S4, when writing data, obtain the QueueLedger object, construct the complete data of the CommitLOG object, and call the write interface on the QueueLedger object to update the data cache;
[0010] S5, the asynchronous thread checks the IndexFile writing progress of each QueueLedger object;
[0011] S6, when reading data, data cache reading is performed first to determine whether the corresponding data exists in the data cache. If so, the corresponding data is returned immediately. Otherwise, based on the IndexFile data retrieval technology, the data is loaded in the corresponding Ledger and returned.
[0012] Furthermore, the access interface is used to open a log, append log content, and / or randomly access one or more log data.
[0013] Furthermore, the LedgerManager object contains all Apache Bookkeeper's Ledger objects; the QueueLedger object contains metadata information of all Ledgers in the queue.
[0014] Furthermore, the cloud storage method based on RocketMQ also includes:
[0015] Maintaining the QueueOffset value through the QueueLedger object;
[0016] The QueueOffset value is used to determine the physical location of the message data.
[0017] Furthermore, the S5 specifically includes:
[0018] S501, maintaining an IndexLedger object, and caching IndexFile index data through the IndexLedger object;
[0019] S502, when there is data written, read the complete data of the CommitLOG object;
[0020] S503, generating IndexFile data according to the IndexFile index data and the complete data of the CommitLOG object;
[0021] S504, recording the IndexFile data into the Ledger object of IndexFile.
[0022] Furthermore, the IndexFile data retrieval technology in S6 specifically includes:
[0023] S601, calculating the Hash value of the query Key;
[0024] S602, calculate the modulus of the hash value and the number of buckets of the index data to obtain the offset value of the target bucket;
[0025] S603, determine whether the offset value is less than 0, if so, determine that there is no corresponding data, otherwise, read the IndexFile data corresponding to the offset of the IndexFileLedger, when the previous-index value of the IndexFile data is greater than or equal to 0, find the next IndexFile data based on the previous-index value as the offset, until all are found;
[0026] S604, compare the Hash value of the IndexFile data with the Hash value of the query Key to see if they are consistent. If so, read the corresponding CommitLOG data and return it.
[0027] Furthermore, the cloud storage method based on RocketMQ also includes:
[0028] Check the message storage strategy of each TOPIC regularly, obtain the last data write time of each Ledger in each Queue through the QueueLedger interface, and delete the corresponding Ledger data according to the message storage strategy.
[0029] A second aspect of the present invention provides a cloud storage system based on RocketMQ, comprising:
[0030] Extension module, used to extend the message storage engine in Apache RocketMQ distributed messaging;
[0031] Create a module to create an access interface for the Apache Bookkeeper distributed logging system;
[0032] A first maintenance module, used to expand the access interface and maintain the LedgerManager object and the QueueLedger object;
[0033] The writing module is used to obtain the QueueLedger object when writing data, construct the complete data of the CommitLOG object, and call the writing interface on the QueueLedger object to update the data cache;
[0034] A checking module, used for asynchronously checking the IndexFile writing progress of each QueueLedger object;
[0035] The reading module is used to give priority to data cache reading when reading data, and determine whether there is corresponding data in the data cache. If so, the corresponding data is returned immediately. Otherwise, based on the IndexFile data retrieval technology, the data is loaded in the corresponding Ledger and returned.
[0036] Furthermore, the access interface is used to open a log, append log content, and / or randomly access one or more log data.
[0037] Furthermore, the LedgerManager object contains all Apache Bookkeeper's Ledger objects; the QueueLedger object contains metadata information of all Ledgers in the queue.
[0038] Furthermore, the cloud storage method based on RocketMQ also includes:
[0039] A second maintenance module, used for maintaining the QueueOffset value through the QueueLedger object;
[0040] The QueueOffset value is used to determine the physical location of the message data.
[0041] Furthermore, the inspection module is specifically used for:
[0042] Maintaining the IndexLedger object, and caching the IndexFile index data through the IndexLedger object;
[0043] When data is written, read the complete data of the CommitLOG object;
[0044] Generate IndexFile data according to the IndexFile index data and the complete data of the CommitLOG object;
[0045] The IndexFile data is recorded into the Ledger object of the IndexFile.
[0046] Furthermore, the reading module is specifically used for:
[0047] Calculate the Hash value of the query Key;
[0048] Calculate the modulus of the hash value and the number of buckets of the index data to get the offset value of the target bucket;
[0049] Determine whether the offset value is less than 0. If so, determine that there is no corresponding data. Otherwise, read the IndexFile data corresponding to the offset of the IndexFile Ledger. When the previous-index value of the IndexFile data is greater than or equal to 0, find the next IndexFile data based on the previous-index value as the offset until all are found;
[0050] Compare the Hash value of the IndexFile data with the Hash value of the query Key to see if they are consistent. If so, read the corresponding CommitLOG data and return it.
[0051] Furthermore, the cloud storage method based on RocketMQ also includes:
[0052] The deletion module is used to periodically check the message storage strategy of each TOPIC, obtain the last data write time of each Ledger in each Queue through the QueueLedger interface, and delete the corresponding Ledger data according to the message storage strategy.
[0053] The beneficial effects of the present invention are as follows:
[0054] The method and system of the present invention extend the message storage engine in the Apache RocketMQ distributed message, so that the message data is stored in the distributed log system, and the separation of computing and storage is realized without changing the cluster deployment architecture and being fully compatible with the open source ecosystem. The method and system of the present invention can change dynamically as needed, improve resource utilization, improve the flexibility and adaptability of the system in the face of different loads and data growth, and improve the overall performance and stability of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] The accompanying drawings are only used to illustrate specific embodiments and are not considered to limit the present invention. In the entire drawings, the same reference symbols represent the same components. Obviously, the drawings described below are only some embodiments recorded in the embodiments of the present invention. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings.
[0056] Figure 1 A flowchart of a cloud storage method based on RocketMQ provided in an embodiment of the present invention;
[0057] Figure 2 A schematic diagram of the structure of a RocketMQ-based cloud storage system provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0058] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention, the technical solutions of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. It should be understood that these descriptions are only exemplary and are not intended to limit the scope of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in the field without making creative work should fall within the scope of protection of the present invention.
[0059] Furthermore, in the following description, descriptions of well-known structures and technologies are omitted to avoid unnecessarily obscuring the concepts disclosed in the present invention.
[0060] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the orientation or position relationship indicated by the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inside", "outside", etc. is based on the orientation or position relationship shown in the drawings, which is only for the convenience of describing the present invention and simplifying the description, and does not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation of the present invention. In addition, the terms "first", "second", and "third" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. The terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be a connection between the two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0061] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Instead, they are merely examples of methods and systems consistent with some aspects of the present invention as detailed in the appended claims.
[0062] The present invention proposes a cloud storage method and system based on RocketMQ, which solves the problem that the local storage resources of RocketMQ are fixed and cannot be changed dynamically as needed, which limits the flexibility and adaptability of the system when facing different loads and data growth, and easily leads to uneven data distribution, causing some Broker nodes to be overloaded while other nodes are relatively idle, affecting the overall performance and stability of the system.
[0063] Method Embodiment
[0064] Reference Manual Attached Figure 1 , showing a flow chart of a cloud storage method based on RocketMQ provided in an embodiment of the present invention.
[0065] An embodiment of the present invention provides a cloud storage method based on RocketMQ, comprising:
[0066] Specifically, the method includes steps S1 to S6.
[0067] S1, in Apache RocketMQ distributed messaging, extends the message storage engine.
[0068] Among them, Apache RocketMQ is a distributed messaging system with low latency, high concurrency, high availability and high reliability. It is widely adopted by many enterprise developers and cloud vendors due to its simple architecture, rich business functions and strong scalability.
[0069] Furthermore, RocketMQ's storage file contains three parts: CommitLOG for saving data, ConsumeQueue for saving logical queues, and IndexFile for saving string indexes.
[0070] It should be noted that by extending the storage engine of Apache RocketMQ and introducing an external distributed log system, the problem of single-point capacity bottleneck can be solved and resource utilization can be improved by separating data storage to the distributed log system and realizing the separation of computing and storage.
[0071] S2, create an access interface for the Apache Bookkeeper distributed log system.
[0072] Among them, Apache Bookkeeper is a distributed and naturally scalable log system. All data is written in an append-only manner, and the data that has been written cannot be modified.
[0073] Optionally, the access interface is used to open a log, append log content, and / or randomly access one or more log data.
[0074] In the present invention, creating an access interface for Apache Bookkeeper can bring higher flexibility, performance optimization, and data security to the message storage method based on RocketMQ. Through the design of the interface, the two systems can be effectively integrated, making full use of their respective advantages to provide a reliable message processing and storage solution for the application.
[0075] S3, expands the access interface and maintains the LedgerManager object and the QueueLedger object.
[0076] Optionally, the LedgerManager object contains all Apache Bookkeeper's Ledger objects.
[0077] Optionally, the QueueLedger object contains metadata information about all the Ledgers in the queue.
[0078] Ledger is a logical unit of Bookkeeeper. A Ledger can be understood as an independent log file or a message queue. The Ledger core interface has only two operations, one is APPEND data, and the other is random read data.
[0079] S4, when writing data, obtain the QueueLedger object, construct the complete data of the CommitLOG object, and call the write interface on the QueueLedger object to update the data cache.
[0080] In the present invention, the QueueLedger object is obtained, and the complete data of the CommitLOG object is constructed thereon, and then the write interface is called to update the data cache. This can effectively manage and update the data cache, ensuring that the written message data can be quickly obtained and processed by the system.
[0081] S5, the asynchronous thread checks the IndexFile writing progress of each QueueLedger object.
[0082] In a possible implementation, S5 specifically includes sub-steps S501 to S504:
[0083] S501, maintain the IndexLedger object, and cache the IndexFile index data through the IndexLedger object.
[0084] S502, when there is data written, read the complete data of the CommitLOG object.
[0085] S503: Generate IndexFile data according to the IndexFile index data and the complete data of the CommitLOG object.
[0086] S504, record the IndexFile data into the Ledger object of IndexFile.
[0087] In the present invention, the asynchronous thread checks the IndexFile writing progress of each QueueLedger object, and caches the IndexFile index data by maintaining the IndexLedger object. This method can realize asynchronous monitoring of data writing progress, avoid blocking the main processing flow, and optimize the overall performance and response speed of the system.
[0088] Furthermore, each time you write to IndexFile, you need to update the index data in memory. The index data is initially obtained by reading the last data from the IndexFile's Ledger. If the last data is missing, you need to read the corresponding CommitLog's Ledger and the IndexFile's Ledger in full to reconstruct the data. Each time you exit the program or release the index cache, you need to write the full amount of Index File index data to the IndexFile's Ledger.
[0089] S6, when reading data, data cache reading is performed first to determine whether the corresponding data exists in the data cache. If so, the corresponding data is returned immediately. Otherwise, based on the IndexFile data retrieval technology, the data is loaded in the corresponding Ledger and returned.
[0090] In the present invention, an attempt is first made to read data from the data cache. If the data already exists in the cache, the corresponding data can be returned immediately, which greatly shortens the response time of data access and improves the real-time and response performance of the system.
[0091] In a possible implementation, the IndexFile data retrieval technology in S6 specifically includes sub-steps S601 to S604:
[0092] S601, calculate the Hash value of the query Key.
[0093] S602: Calculate the modulus of the hash value and the number of buckets of the index data to obtain the offset value of the target bucket.
[0094] S603, determine whether the offset value is less than 0. If so, determine that there is no corresponding data. Otherwise, read the IndexFile data corresponding to the offset of the IndexFileLedger. When the previous-index value of the IndexFile data is greater than or equal to 0, find the next IndexFile data based on the previous-index value as the offset until all are found.
[0095] S604, compare the Hash value of the IndexFile data with the Hash value of the query Key to see if they are consistent. If so, read the corresponding CommitLOG data and return it.
[0096] In the present invention, the IndexFile data retrieval technology ensures the consistency and integrity of the data. By comparing the Hash value of the IndexFile data with the Hash value of the query Key, the corresponding CommitLOG data is read and returned after confirming the correctness of the data. This mechanism ensures that the data read by the system is accurate and complete, avoiding the problem of data error or loss.
[0097] In a possible implementation, the RocketMQ-based cloud storage method further includes:
[0098] The QueueOffset value is maintained through the QueueLedger object.
[0099] The QueueOffset value is used to determine the physical location of the message data.
[0100] In the present invention, the maintenance of QueueOffset allows the system to track the offset of consumed messages in each message queue. Consumers can use these offsets to know where they need to start consuming messages, ensuring the order and consistency of messages. This mechanism is essential for message consumers, especially when dealing with duplicate consumption or message redelivery. By accurately managing the QueueOffset value, consumers can effectively avoid duplicate consumption and lost messages. This precise message position management can improve the efficiency and reliability of message consumption, ensuring that consumers can consume messages in the expected order and rate.
[0101] In a possible implementation, the RocketMQ-based cloud storage method further includes:
[0102] Check the message storage strategy of each TOPIC regularly, obtain the last data write time of each Ledger in each Queue through the QueueLedger interface, and delete the corresponding Ledger data according to the message storage strategy.
[0103] In the present invention, regular inspection and cleaning of old Ledger data in the message storage strategy under each TOPIC, managed through the QueueLedger interface, is one of the important measures to maintain the efficient and stable operation of the RocketMQ system. This approach not only saves resources, but also helps ensure that the system can effectively support business needs in the long term.
[0104] Furthermore, the present invention uses a distributed log system to save RocketMQ information data, realizes the separation of computing and storage, reduces the use cost and improves the resource utilization rate, and solves the single-point storage capacity limitation. Compared with the open source RocketMQ solution stored in object storage, it has higher data reliability and better performance. At the same time, in conjunction with the distributed log system, it provides support for higher granularity and diverse data expiration strategies based on the topic level, is more adaptable to cloud-native features, is stateless, facilitates process transfer, and supports the ability to dynamically expand and shrink nodes.
[0105] The beneficial effects of the present invention are as follows:
[0106] The method and system of the present invention extend the message storage engine in the Apache RocketMQ distributed message, so that the message data is stored in the distributed log system, and the separation of computing and storage is realized without changing the cluster deployment architecture and being fully compatible with the open source ecosystem. The method and system of the present invention can change dynamically as needed, improve resource utilization, improve the flexibility and adaptability of the system in the face of different loads and data growth, and improve the overall performance and stability of the system.
[0107] System Example
[0108] Reference Manual Attached Figure 2 , showing a structural diagram of a RocketMQ-based cloud storage system provided in an embodiment of the present invention.
[0109] The embodiment of the present invention provides a RocketMQ-based cloud storage system 20, comprising:
[0110] Extension module 201, used to extend the message storage engine in Apache RocketMQ distributed messaging;
[0111] Creating module 202, for creating an access interface for the Apache Bookkeeper distributed log system;
[0112] A first maintenance module 203, used to extend the access interface and maintain the LedgerManager object and the QueueLedger object;
[0113] The writing module 204 is used to obtain the QueueLedger object, construct the complete data of the CommitLOG object, and call the writing interface on the QueueLedger object to update the data cache when writing data;
[0114] Checking module 205, used for asynchronous thread checking the IndexFile writing progress of each QueueLedger object;
[0115] The reading module 206 is used to give priority to data cache reading when reading data, and determine whether there is corresponding data in the data cache. If so, the corresponding data is returned immediately. Otherwise, based on the IndexFile data retrieval technology, the data is loaded in the corresponding Ledger and returned.
[0116] Furthermore, the access interface is used to open a log, append log content, and / or randomly access one or more log data.
[0117] Furthermore, the LedgerManager object contains all Apache Bookkeeper's Ledger objects; the QueueLedger object contains metadata information of all Ledgers in the queue.
[0118] Furthermore, the cloud storage method based on RocketMQ also includes:
[0119] A second maintenance module, used for maintaining the QueueOffset value through the QueueLedger object;
[0120] The QueueOffset value is used to determine the physical location of the message data.
[0121] Furthermore, the checking module 205 is specifically used for:
[0122] Maintaining the IndexLedger object, and caching the IndexFile index data through the IndexLedger object;
[0123] When data is written, read the complete data of the CommitLOG object;
[0124] Generate IndexFile data according to the IndexFile index data and the complete data of the CommitLOG object;
[0125] The IndexFile data is recorded into the Ledger object of the IndexFile.
[0126] Furthermore, the reading module 206 is specifically used for:
[0127] Calculate the Hash value of the query Key;
[0128] Calculate the modulus of the hash value and the number of buckets of the index data to get the offset value of the target bucket;
[0129] Determine whether the offset value is less than 0. If so, determine that there is no corresponding data. Otherwise, read the IndexFile data corresponding to the offset of the IndexFile Ledger. When the previous-index value of the IndexFile data is greater than or equal to 0, find the next IndexFile data based on the previous-index value as the offset until all are found;
[0130] Compare the Hash value of the IndexFile data with the Hash value of the query Key to see if they are consistent. If so, read the corresponding CommitLOG data and return it.
[0131] Furthermore, the cloud storage method based on RocketMQ also includes:
[0132] The deletion module is used to periodically check the message storage strategy of each TOPIC, obtain the last data write time of each Ledger in each Queue through the QueueLedger interface, and delete the corresponding Ledger data according to the message storage strategy.
[0133] The present invention provides a RocketMQ-based cloud storage system 20, which can implement the various steps and technical effects of the above-mentioned RocketMQ-based cloud storage method. To avoid repetition, the present invention will not go into details.
[0134] The beneficial effects of the present invention are as follows:
[0135] The method and system of the present invention extend the message storage engine in the Apache RocketMQ distributed message, so that the message data is stored in the distributed log system, and the separation of computing and storage is realized without changing the cluster deployment architecture and being fully compatible with the open source ecosystem. The method and system of the present invention can change dynamically as needed, improve resource utilization, improve the flexibility and adaptability of the system in the face of different loads and data growth, and improve the overall performance and stability of the system.
[0136] The applicant of the present invention has made a detailed explanation and description of the implementation examples of the present invention in conjunction with the drawings in the specification. However, those skilled in the art should understand that the above implementation examples are only preferred implementation schemes of the present invention, and the detailed description is only to help readers better understand the spirit of the present invention, but not to limit the scope of protection of the present invention. On the contrary, any improvements or modifications based on the inventive spirit of the present invention should fall within the scope of protection of the present invention.
[0137] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the embodiments of the present invention, rather than to limit them. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the above embodiments, or replace some of the technical features therein by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention. Any changes or replacements that can be easily thought of by those skilled in the art within the technical scope disclosed in the present invention should be covered within the protection scope of the present invention.
Claims
1. A cloud storage method based on RocketMQ, characterized in that: include: S1, in Apache RocketMQ distributed messaging, extends the message storage engine; S2, create an access interface for the Apache Bookkeeper distributed log system; S3, expand the access interface and maintain the LedgerManager object and the QueueLedger object; S4, when writing data, obtain the QueueLedger object, construct the complete data of the CommitLOG object, and call the write interface on the QueueLedger object to update the data cache; S5, the asynchronous thread checks the IndexFile writing progress of each QueueLedger object; S6, when reading data, data cache reading is performed first to determine whether the corresponding data exists in the data cache. If so, the corresponding data is returned immediately. Otherwise, based on the IndexFile data retrieval technology, the data is loaded in the corresponding Ledger and returned.
2. The RocketMQ-based cloud storage method according to claim 1, characterized in that: The access interface is used to open a log, append log content, and / or randomly access one or more log data.
3. The cloud storage method based on RocketMQ according to claim 1, characterized in that: The LedgerManager object contains all Apache Bookkeeper's Ledger objects; the QueueLedger object contains metadata information of all Ledgers in the queue.
4. The cloud storage method based on RocketMQ according to claim 1, characterized in that: Also includes: Maintaining the QueueOffset value through the QueueLedger object; The QueueOffset value is used to determine the physical location of the message data.
5. The RocketMQ-based cloud storage method according to claim 1, characterized in that: The S5 specifically includes: S501, maintaining an IndexLedger object, and caching IndexFile index data through the IndexLedger object; S502, when there is data written, read the complete data of the CommitLOG object; S503, generating IndexFile data according to the IndexFile index data and the complete data of the CommitLOG object; S504, recording the IndexFile data into the Ledger object of IndexFile.
6. The cloud storage method based on RocketMQ according to claim 1, characterized in that: The IndexFile data retrieval technology in S6 specifically includes: S601, calculating the Hash value of the query Key; S602, calculate the modulus of the hash value and the number of buckets of the index data to obtain the offset value of the target bucket; S603, determine whether the offset value is less than 0, if so, determine that there is no corresponding data, otherwise, read the IndexFile data corresponding to the offset of the IndexFileLedger, when the previous-index value of the IndexFile data is greater than or equal to 0, find the next IndexFile data based on the previous-index value as the offset, until all are found; S604, compare the Hash value of the IndexFile data with the Hash value of the query Key to see if they are consistent. If so, read the corresponding CommitLOG data and return it.
7. The RocketMQ-based cloud storage method according to claim 1, characterized in that: Also includes: Check the message storage strategy of each TOPIC regularly, obtain the last data write time of each Ledger in each Queue through the QueueLedger interface, and delete the corresponding Ledger data according to the message storage strategy.
8. A cloud storage system based on RocketMQ, characterized in that: include: Extension module, used to extend the message storage engine in Apache RocketMQ distributed messaging; Create a module to create an access interface for the Apache Bookkeeper distributed logging system; A first maintenance module, used to expand the access interface and maintain the LedgerManager object and the QueueLedger object; The writing module is used to obtain the QueueLedger object when writing data, construct the complete data of the CommitLOG object, and call the writing interface on the QueueLedger object to update the data cache; A checking module, used for asynchronously checking the IndexFile writing progress of each QueueLedger object; The reading module is used to give priority to data cache reading when reading data, and determine whether there is corresponding data in the data cache. If so, the corresponding data is returned immediately. Otherwise, based on the IndexFile data retrieval technology, the data is loaded in the corresponding Ledger and returned.
9. The RocketMQ-based cloud storage system according to claim 8, characterized in that: The access interface is used to open a log, append log content, and / or randomly access one or more log data.
10. The RocketMQ-based cloud storage system according to claim 8, characterized in that: The LedgerManager object contains all Apache Bookkeeper's Ledger objects; the QueueLedger object contains metadata information of all Ledgers in the queue.
Citation Information
Patent Citations
Secret-level setting information management system and secret-level setting information management method
CN103093154A
Retrieval method and device based on double-cache mechanism and storage medium
CN109710639A
Database log storage method and database log analysis method and device
CN114817245A
Storage system and data access method
US20150106468A1
Scalable logging control for distributed network devices
US20160094620A1
Cited By
Cloud storage method and system based on rocketmq
WO2026000821A1
