Content data storage method, device, server and storage medium
By detecting and storing long-term data in the distributed publish-subscribe messaging system to the distributed file system, the problem of slow response speed and resource waste is solved, a more efficient separation of data storage and computing is achieved, and the reading speed is improved.
Patent Information
- Application Number
- CN202010715874.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-23
- Publication Date
- 2024-10-25
- Estimated Expiration
- 2040-07-23
AI Technical Summary
In the existing technology, the distributed publish-subscribe messaging system responds slowly when the consumer client reads topic historical data, resulting in disk IO hot spots and resource waste.
By detecting content data whose storage duration is greater than or equal to the preset duration in the distributed publish-subscribe messaging system, and storing it in the distributed file system, HDFS is used for hierarchical storage to achieve the separation of storage and computing.
It improves the client's response speed when reading historical data, alleviates disk IO hot spots, and avoids resource waste and historical data loss.
Smart Images

Figure CN113971166B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of storage technology, and in particular to a content data storage method, device, server and storage medium. Background Art
[0002] A distributed publish-subscribe messaging system that can process all action stream data of consumers on a website. For example, Kafka, a distributed publish-subscribe messaging system, is used to process all action stream data of consumers on a website. In addition, the distributed publish-subscribe messaging system unifies online and offline message processing through Hadoop's parallel loading mechanism, and can provide real-time messages through clusters.
[0003] In the related art, most of the data of the topic content is stored on the disk in the distributed publish-subscribe message system. When the consumer client reads the historical data of a topic, it will read a large amount of data on the disk storing the topic content, while other disks will be relatively idle. It can be seen that the content data storage method in the related art will result in a slow response speed for the reading service. Summary of the invention
[0004] The present disclosure provides a content data storage method, device, server and storage medium to at least solve the problem of slow response speed of reading services in related technologies. The technical solution of the present disclosure is as follows:
[0005] According to a first aspect of an embodiment of the present disclosure, a content data storage method is provided, the content data storage method comprising:
[0006] Determine first target content data in the distributed publish-subscribe message system, the storage time of which is greater than or equal to a preset time;
[0007] The first target content data is stored in a distributed file system.
[0008] According to a second aspect of an embodiment of the present disclosure, a content data storage device is provided, the content data storage device comprising:
[0009] The detection module is configured to detect the storage duration of the content data stored in the distributed publish-subscribe messaging system at a preset time interval.
[0010] A first determining module is configured to determine, from the content data stored in the distributed publish-subscribe messaging system, first target content data whose storage duration is greater than or equal to a preset duration;
[0011] An acquisition module, configured to execute acquisition of first storage location information of the first target content data in the distributed publish-subscribe messaging system;
[0012] The first storage module is configured to store the first target content data in a distributed file system based on the first storage location information, wherein a storage location of the first target content data in the distributed file system is determined based on the first storage location information.
[0013] According to a third aspect of an embodiment of the present disclosure, a server is provided, the server comprising:
[0014] processor;
[0015] a memory for storing instructions executable by the processor;
[0016] The processor is configured to execute the instructions to implement the content data storage method as described in the first aspect.
[0017] According to a fourth aspect of an embodiment of the present disclosure, a storage medium is provided. When instructions in the storage medium are executed by a processor of a server, the server can execute the content data storage method as described in the first aspect.
[0018] According to a fifth aspect of an embodiment of the present disclosure, a computer program product is provided. When instructions of the computer program product are executed by a processor of a server, the server is enabled to execute the content data storage method as described in the first aspect.
[0019] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects: since the first target content data with a storage time greater than or equal to a preset time in the distributed publish-subscribe message system is stored in a distributed file system in the embodiments of the present disclosure, when the Consumer client reads the historical data of a topic, it can read it from the distributed file system, and the distributed file system can make full use of the capacity of the disk, thereby improving the response speed of the reading service.
[0020] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.
[0022] Figure 1 It is a block diagram of a content data storage system according to an exemplary embodiment.
[0023] Figure 2The invention is a block diagram of a distributed publish-subscribe messaging system according to an exemplary embodiment.
[0024] Figure 3 The present invention is a flowchart of a method for storing content data according to an exemplary embodiment.
[0025] Figure 4 The figure is a flow-time relationship image shown according to an exemplary embodiment.
[0026] Figure 5 The figure is a relationship image between util value and time according to an exemplary embodiment.
[0027] Figure 6 The figure is a relationship image between an iostat value and time according to an exemplary embodiment.
[0028] Figure 7 The figure is a time delay-time relationship image according to an exemplary embodiment.
[0029] Figure 8 The present invention is a block diagram of a content data storage device according to an exemplary embodiment.
[0030] Fig. 9 It is a block diagram of a server according to an exemplary embodiment. DETAILED DESCRIPTION
[0031] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.
[0032] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0033] See also Figure 1The embodiment of the present disclosure provides a content data storage system, which may include a distributed publish-subscribe messaging system and a distributed file system, and the distributed publish-subscribe messaging system includes a proxy server, a consumer client, and a producer client. The producer client, as a message producer, may send messages to the proxy server. The proxy server is used to store messages sent by the producer client. The consumer client, as a message consumer, may read messages from the proxy server. The distributed file system may receive and store content data sent by the distributed publish-subscribe messaging system.
[0034] In one possible implementation, Figure 2 As shown, the distributed publish-subscribe message system can be a Kafka system, and the Kafka system can include a Broker server, a Consumer client, and a Producer client. The message sources of the Kafka system processing resources are classified into different Topics, and multiple Topic content data can be stored on the same Broker server. In the case of a large amount of Topic content data, the content data of a Topic can also be distributed in multiple Broker servers. The producer client can produce messages and upload them to the proxy server; the consumer client can consume messages and obtain messages from the proxy server. The distributed file system can be HDFS (Hadoop Distributed File System).
[0035] Figure 3 is a flowchart of a method for storing content data according to an exemplary embodiment. Figure 3 As shown, the content data storage method can be used to Figure 1 The proxy server in the distributed publish-subscribe messaging system shown includes the following steps:
[0036] In step S101, the storage duration of content data stored in the distributed publish-subscribe messaging system is detected at preset time intervals.
[0037] The preset time interval may be a pre-set time interval, for example, 1 second, 3 seconds, 5 seconds, etc., which is not limited in the present embodiment. The distributed publish-subscribe messaging system may be a Kafka system, or other systems.
[0038] In step S102, first target content data having a storage duration greater than or equal to a preset duration is determined from content data stored in the distributed publish-subscribe messaging system.
[0039] The preset duration may be 1 hour, 3 hours, 5 hours, etc., which is not limited in this embodiment. The distributed publish-subscribe messaging system may store content data only through memory; or the distributed publish-subscribe messaging system may store content data only through disk; or the distributed publish-subscribe messaging system may store content data through memory and disk. The first target content data may be stored in the proxy server, or in a storage component such as a memory or disk of the proxy server. For example, the first target content data may be stored in memory; or the first target content data may be stored in disk; or the first target content data may be stored partially in memory and partially in disk.
[0040] In addition, the first target content data may be content data sent by the Producer client to the proxy server. After receiving the first target content data, the proxy server may save the first target content data in a memory or a disk.
[0041] In step S103, first storage location information of the first target content data in the distributed publish-subscribe messaging system is obtained.
[0042] The first storage location information can be used to search for the first target content data in the distributed publish-subscribe messaging system. The first storage location information can include the topic, partition, and offset corresponding to the first target content data. Taking the distributed publish-subscribe messaging system as a Kafka system as an example, the topic, partition, and offset corresponding to the first target content data can be: Topic A, Partition B, and offset 8000, respectively.
[0043] In step S104, the first target content data is stored in a distributed file system based on the first storage location information, wherein the storage location of the first target content data in the distributed file system is determined based on the first storage location information.
[0044] Among them, the distributed file system can store content data according to topics, partitions and offsets. After the content data stored in the distributed publish-subscribe messaging system is stored in the distributed file system, the storage location information can remain unchanged, so that the offset of the content data stored in the distributed publish-subscribe messaging system can be continuous with the offset of the content data stored in the distributed file system. For example, the topic, partition and offset of the content data most recently stored in the distributed file system can be respectively: Topic A, Partition B and offset 8001, and the topic, partition and offset corresponding to the first target content data can be respectively: Topic A, Partition B and offset 8000, then the storage address of the first target content data in the distributed file system can be continuous with the storage address of the content data most recently stored.
[0045] It should be noted that the first target content data can be read and the read first target content data can be stored in a distributed file system. A process can be started to store the first target content data in a distributed file system, and each process can start multiple synchronization threads, and the first target content data can be stored in a distributed file system through the multiple synchronization threads. Taking the distributed publish-subscribe messaging system as a Kafka system as an example, each Kafka process can start multiple synchronization threads, and the multiple synchronization threads can read the data stored in the disk of the Kafka system and write it to the distributed file system.
[0046] In addition, the first target content data whose storage time in the distributed publish-subscribe message system is greater than or equal to the preset time can be obtained in real time, and the first target content data is stored in the distributed file system. Taking the preset time as 3 hours as an example, if the current time is 16:00, it can be determined that the content data stored at 13:00 is the first target content data, and the content data stored at 13:00 is stored in the distributed file system; if the current time is 16:01, it can be determined that the content data stored at 13:01 is the first target content data, and the content data stored at 13:01 is stored in the distributed file system, thereby realizing the real-time storage of the first target content data in the distributed file system.
[0047] In this embodiment, by storing the first target content data with a storage time greater than or equal to the preset time in the distributed publish-subscribe message system in the distributed file system, the response speed of the read service can be improved. Taking the distributed publish-subscribe message system as the Kafka system as an example, it is assumed that a Broker server of the Kafka system stores content data of two topics, test1 and test2, respectively, each Topic has only one Partition, and is stored on two disks, disk1 and disk2, respectively. In the related art, when a consumer client reads content data stored on the Broker server, if the most recently written content data is read, the data cached in the operating system is read, and the disk is basically not read, so that the disk IO (input and output) resources are not consumed. If the consumer client reads the historical content data stored on the Broker server, a large amount of data on the disk is usually read, which consumes a large amount of disk IO resources. If the client reads a large amount of historical content data of Topic test1, the read service will be concentrated on disk disk1, while the IO of disk disk2 is relatively idle, which will cause a disk IO hot spot problem. In this embodiment, the first target content data in the Kafka system with a storage time greater than or equal to a preset time can be stored in HDFS, and the layered storage architecture of Kafka on HDFS can be realized, so that hot data can be stored locally in Kafka and cold data can be stored in HDFS, which can alleviate the disk IO hotspot problem.
[0048] In addition, by storing the first target content data whose storage time in the distributed publish-subscribe message system is greater than or equal to the preset time in the distributed file system, the separation of storage and computing can be achieved, which is convenient for the separate expansion of storage resources. Taking the distributed publish-subscribe message system as the Kafka system as an example, the Kafka system may include a Kafka cluster. Assuming that the Kafka cluster includes three Broker servers, the disk usage rates of the three Broker servers are greater than or equal to 90%, but the resources such as the CPU and the network card are relatively idle. In the related art, in order to increase the disk capacity of the Kafka cluster without restarting the Kafka cluster, only Broker servers can be added to the Kafka cluster. However, adding Broker servers not only increases the disk capacity of the entire Kafka cluster, but also increases resources such as the CPU and the network card. However, it is not necessary to increase resources such as the CPU and the network card at this time, which will cause a waste of resources. In this embodiment, the Kafka system can be used for local storage and HDFS for remote storage, and HDFS can be deployed on other nodes to achieve separation of storage and computing. The Kafka system only needs to focus on hot data stored locally, and cold data is stored on HDFS. The computing business can be arranged on HDFS, thereby achieving separation of the Kafka system and computing business.
[0049] Furthermore, by storing the first target content data in the distributed publish-subscribe message system with a storage time greater than or equal to a preset time in a distributed file system, the loss of historical content data can be avoided. Taking the distributed publish-subscribe message system as the Kafka system as an example, the content data stored in the Kafka system will be deleted periodically. When the content data stored in the Kafka system is greater than or equal to a certain time, the content data with a storage time greater than or equal to the certain time will be deleted, making it impossible to consume the content data with a storage time greater than or equal to the certain time. In this embodiment, through the Kafka hierarchical storage based on HDFS, the hot data of the last few hours can be stored in the Kafka local disk, and a large amount of historical data can be stored in the HDFS cluster, and the data on the HDFS cluster can be permanently saved, thereby avoiding the loss of historical content data.
[0050] In practical applications, taking the distributed publish-subscribe messaging system as the Kafka system and the distributed file system as HDFS as an example, the first target content data in the Kafka system with a storage time greater than or equal to the preset time can be stored in HDFS. A startup switch for reading HDFS can be designed. When the startup switch is not turned on, only the content data stored on the Kafka system can be read. When the startup switch is turned on, the content data stored on the Kafka system can be read. When processing the request of the Consumer client to read the content data of the Topic, such as Figures 4 to 7 As shown in the figure, at time a, the startup switch is turned on, and the Kafka system reads the data from HDFS and returns it to the Consumer client. Figure 4 It is the traffic situation of content data transmission before and after the start switch is turned on. Figure 5 As shown in the figure, after the startup switch is turned on, the util value of the Kafka system disk decreases. The util value of the disk can be used to indicate the busyness of the disk drive. Figure 6 As shown in the figure, after the startup switch is turned on, the iostat value of the Kafka system disk decreases. The iostat value of the disk can be used to indicate the statistics of disk input and output. Figure 7 As shown, after the startup switch is turned on, the latency in responding to the Consumer client decreases, and the request of the Consumer client to read the content data of the Topic can be responded to more quickly.
[0051] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects: since the first target content data with a storage time greater than or equal to the preset time in the distributed publish-subscribe message system is stored in the distributed file system in the embodiments of the present disclosure, when the Consumer client reads the historical data of a Topic, it can read it from the distributed file system, and the distributed file system can make full use of the capacity of the disk, thereby improving the response speed of the reading service.
[0052] Optionally, the content data storage method further includes:
[0053] receiving a request message sent by a consumer client for requesting to obtain second target content data;
[0054] If it is determined that the second target content data is stored in the distributed publish-subscribe messaging system, reading the second target content data from the distributed publish-subscribe messaging system;
[0055] If it is determined that the second target content data is stored in the distributed file system, reading the second target content data from the distributed file system;
[0056] The read second target content data is sent to the consumer client.
[0057] The request message may carry second storage location information corresponding to the second target content data, and the second storage location information may be used to determine whether the second target content data is stored in the distributed publish-subscribe message system or the distributed file system. The second target content data may be quickly found through the second storage location information.
[0058] In addition, if it is determined that the second target content data is stored in the distributed file system, the application interface can be called to read the second target content data. Taking the distributed publish-subscribe message system as the Kafka system as an example, the Handler thread on the Kafka system can call the API for reading HDFS, and can return the read second target content data to the Consumer client.
[0059] In this implementation, the consumer client can read content data whose storage time is within a preset time period from the distributed publish-subscribe message system, and can read content data whose storage time is greater than or equal to the preset time period from the distributed file system. The consumer client can utilize the fast response speed of the distributed file system for reading content data, thereby improving the response speed of the reading service.
[0060] Optionally, the request message carries second storage location information corresponding to the second target content data, where the second storage location information includes a subject, a partition, and an offset;
[0061] After receiving the request message sent by the consumer client for requesting to obtain the second target content data, the content data storage method further includes:
[0062] Based on the topic, partition, and offset corresponding to the second target content data, it is determined that the second target content data is stored in the distributed publish-subscribe message system or the distributed file system.
[0063] Among them, the message source of the distributed publish-subscribe message system processing resources can be classified by different topics, and multiple topic content data can be stored on the same proxy server. The content data of a topic can be divided into multiple partitions (Partitions), each Partition can be an ordered queue, and each message in the Partition can be set with an offset (offset), and the position of each message in the Partition can be determined by the offset. For example, the offset can be an ID number. Taking the distributed publish-subscribe message system as the Kafka system as an example, the storage file of the Kafka system can be named according to offset.kafka. For example, if the offset of a message is 2049, the message can be found by searching for the file 2048.kafka. The first message in a Partition can be thefirst offset (first offset), and the file name can be named 00000000000.kafka. By storing in the form of topics, partitions and offsets, content data can be stored in an orderly manner, and the stored content data can be quickly found based on topics, partitions and offsets.
[0064] In addition, the subject, partition and offset corresponding to the second target content data can be searched in the stored index information to determine whether the second target content data is stored in the distributed publish-subscribe messaging system or in the distributed file system; or it can be that based on the subject, partition and offset corresponding to the second target content data, it is searched whether the second target content data is stored in the distributed publish-subscribe messaging system; if the second target content data is not stored in the distributed publish-subscribe messaging system, it is searched whether the second target content data is stored in the distributed file system based on the subject, partition and offset corresponding to the second target content data.
[0065] In this implementation, the specific storage location of the second target content data can be quickly determined through the subject, partition and offset corresponding to the second target content data, so that the second target content data can be quickly found.
[0066] Optionally, the determining, based on the topic, partition, and offset corresponding to the second target content data, that the second target content data is stored in the distributed publish-subscribe message system or the distributed file system includes:
[0067] Searching for the subject, partition and offset corresponding to the second target content data in the stored index information, wherein the index information includes the subject, partition and offset of the content data stored in the distributed publish-subscribe messaging system, and the subject, partition and offset of the content data stored in the distributed file system;
[0068] It is determined based on the search result that the second target content data is stored in the distributed publish-subscribe messaging system or the distributed file system.
[0069] Among them, the index information can be stored in the distributed publish-subscribe messaging system. The index information can be stored in the distributed publish-subscribe messaging system in the form of a list or a linked list, and the present embodiment does not limit the storage method of the index information. Taking the distributed publish-subscribe messaging system as the Kafka system as an example, the index information stored in the Kafka system indicates that the messages with offsets of 1000 to 5000 in Partition B in Topic A are stored in the Kafka system, and the messages with offsets of 5000 to 8000 in Partition B in Topic A are stored in HDFS. If the topic, partition and offset corresponding to the second target content data are Topic A, Partition B and 3000 respectively, it can be determined that the second target content data is stored in the Kafka system.
[0070] In this implementation, the second target content data can be quickly located through the stored index information, avoiding the need to scan the content data stored in the distributed publish-subscribe message system and the distributed file system to search for the second target content data, which can reduce the time for locating the content data, thereby further improving the response speed of the reading service.
[0071] Optionally, the content data storage method further includes:
[0072] When the preset conditions are met, if it is determined that the first target content data has been stored in the distributed file system, the content data to be stored is stored in the storage location corresponding to the first target content data in the distributed publish-subscribe messaging system.
[0073] Among them, the satisfying of the preset condition may be that the storage time of the first target content data in the distributed publish-subscribe messaging system is greater than or equal to the preset time; or it may be that the storage space in the distributed publish-subscribe messaging system has stored the content data; or it may be other conditions, which are not limited in this embodiment. The determining that the first target content data has been stored in the distributed file system may be that, when the distributed publish-subscribe messaging system stores the first target content data in the distributed file system, the distributed publish-subscribe messaging system receives a response message sent by the distributed file system, and the response message is used to indicate that the first target content data has been stored in the distributed file system. Through the response message, the distributed publish-subscribe messaging system can accurately obtain the storage result of the content data stored in the distributed file system, which is convenient for the management of the content data.
[0074] In this implementation, after the first target content data is stored in the distributed file system, the content data to be stored is used to overwrite the first target content data in the distributed publish-subscribe messaging system, thereby making full use of the storage resources in the distributed publish-subscribe messaging system and avoiding the loss of content data stored in the distributed publish-subscribe messaging system.
[0075] Figure 8 is a block diagram of a content data storage device according to an exemplary embodiment. Figure 8 , the device comprises:
[0076] The detection module 201 is configured to detect the storage duration of the content data stored in the distributed publish-subscribe messaging system at a preset time interval.
[0077] The first determination module 202 is configured to determine, from the content data stored in the distributed publish-subscribe messaging system, first target content data whose storage duration is greater than or equal to a preset duration;
[0078] An acquisition module 203 is configured to acquire first storage location information of the first target content data in the distributed publish-subscribe messaging system;
[0079] The first storage module 204 is configured to store the first target content data in a distributed file system based on the first storage location information, wherein a storage location of the first target content data in the distributed file system is determined based on the first storage location information.
[0080] Optionally, the content data storage device further includes:
[0081] A receiving module is configured to receive a request message sent by a consumer client for requesting to obtain second target content data;
[0082] A first reading module is configured to read the second target content data from the distributed publish-subscribe messaging system if it is determined that the second target content data is stored in the distributed publish-subscribe messaging system;
[0083] A second reading module is configured to read the second target content data from the distributed file system if it is determined that the second target content data is stored in the distributed file system;
[0084] The sending module is configured to send the read second target content data to the consumer client.
[0085] Optionally, the request message carries second storage location information corresponding to the second target content data, where the second storage location information includes a subject, a partition, and an offset;
[0086] The content data storage device also includes:
[0087] The second determination module is configured to determine whether the second target content data is stored in the distributed publish-subscribe message system or the distributed file system based on the topic, partition and offset corresponding to the second target content data.
[0088] Optionally, the second determining module includes:
[0089] a search unit configured to search for a topic, a partition, and an offset corresponding to the second target content data in the stored index information, wherein the index information includes the topic, the partition, and the offset of the content data stored in the distributed publish-subscribe messaging system, and the topic, the partition, and the offset of the content data stored in the distributed file system;
[0090] A determining unit is configured to determine, based on the search result, whether the second target content data is stored in the distributed publish-subscribe messaging system or the distributed file system.
[0091] Optionally, the content data storage device further includes:
[0092] The second storage module is configured to execute, when a preset condition is met, if it is determined that the first target content data has been stored in the distributed file system, storing the content data to be stored in the storage location corresponding to the first target content data in the distributed publish-subscribe message system.
[0093] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0094] Fig. 9 is a block diagram of a server according to an exemplary embodiment. Fig. 9 , the server includes:
[0095] Processor 301;
[0096] A memory 302 for storing instructions executable by the processor 301;
[0097] The processor 301 is configured to execute the instructions to implement the content data storage method for the server in the above embodiment.
[0098] In an exemplary embodiment, a storage medium including instructions is also provided, such as a memory including instructions, and the instructions can be executed by a processor of a server to complete the above method. Optionally, the storage medium can be a non-transitory computer-readable storage medium, for example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0099] In an exemplary embodiment, a computer program product is also provided, including one or more instructions, which can be executed by a processor of a server to complete the above content data storage method.
[0100] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0101] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A content data storage method, It is characterized in that The content data storage method comprises: Detecting the storage duration of content data stored in the distributed publish-subscribe messaging system at preset time intervals; Determine, from the content data stored in the distributed publish-subscribe messaging system, first target content data whose storage duration is greater than or equal to a preset duration; Acquire first storage location information of the first target content data in the distributed publish-subscribe messaging system; storing the first target content data in a distributed file system based on the first storage location information, wherein a storage location of the first target content data in the distributed file system is determined based on the first storage location information; The content data storage method further includes: When the preset conditions are met, if it is determined that the first target content data has been stored in the distributed file system, the content data to be stored is stored in the storage location corresponding to the first target content data in the distributed publish-subscribe messaging system.
2. The content data storage method according to claim 1, It is characterized in that The content data storage method further includes: receiving a request message sent by a consumer client for requesting to obtain second target content data; If it is determined that the second target content data is stored in the distributed publish-subscribe messaging system, reading the second target content data from the distributed publish-subscribe messaging system; If it is determined that the second target content data is stored in the distributed file system, reading the second target content data from the distributed file system; The read second target content data is sent to the consumer client.
3. The content data storage method according to claim 2, It is characterized in that The request message carries second storage location information corresponding to the second target content data, where the second storage location information includes a subject, a partition, and an offset; After receiving the request message sent by the consumer client for requesting to obtain the second target content data, the content data storage method further includes: Based on the topic, partition, and offset corresponding to the second target content data, it is determined that the second target content data is stored in the distributed publish-subscribe message system or the distributed file system.
4. The content data storage method according to claim 3, It is characterized in that The determining, based on the topic, partition, and offset corresponding to the second target content data, whether the second target content data is stored in the distributed publish-subscribe message system or the distributed file system comprises: Searching for the subject, partition and offset corresponding to the second target content data in the stored index information, wherein the index information includes the subject, partition and offset of the content data stored in the distributed publish-subscribe messaging system, and the subject, partition and offset of the content data stored in the distributed file system; It is determined based on the search result that the second target content data is stored in the distributed publish-subscribe messaging system or the distributed file system.
5. A content data storage device, It is characterized in that The content data storage device comprises: The detection module is configured to detect the storage duration of the content data stored in the distributed publish-subscribe messaging system at a preset time interval. A first determining module is configured to determine, from the content data stored in the distributed publish-subscribe messaging system, first target content data whose storage duration is greater than or equal to a preset duration; An acquisition module, configured to execute acquisition of first storage location information of the first target content data in the distributed publish-subscribe messaging system; A first storage module is configured to store the first target content data in a distributed file system based on the first storage location information, wherein a storage location of the first target content data in the distributed file system is determined based on the first storage location information; The content data storage device also includes: The second storage module is configured to execute, when a preset condition is met, if it is determined that the first target content data has been stored in the distributed file system, storing the content data to be stored in the storage location corresponding to the first target content data in the distributed publish-subscribe message system.
6. The content data storage device according to claim 5, It is characterized in that The content data storage device also includes: A receiving module is configured to receive a request message sent by a consumer client for requesting to obtain second target content data; A first reading module is configured to read the second target content data from the distributed publish-subscribe messaging system if it is determined that the second target content data is stored in the distributed publish-subscribe messaging system; A second reading module is configured to read the second target content data from the distributed file system if it is determined that the second target content data is stored in the distributed file system; The sending module is configured to send the read second target content data to the consumer client.
7. The content data storage device according to claim 6, It is characterized in that The request message carries second storage location information corresponding to the second target content data, where the second storage location information includes a subject, a partition, and an offset; The content data storage device also includes: The second determination module is configured to determine whether the second target content data is stored in the distributed publish-subscribe message system or the distributed file system based on the topic, partition and offset corresponding to the second target content data.
8. The content data storage device according to claim 7, It is characterized in that The second determining module comprises: a search unit configured to search for a topic, a partition, and an offset corresponding to the second target content data in the stored index information, wherein the index information includes the topic, the partition, and the offset of the content data stored in the distributed publish-subscribe messaging system, and the topic, the partition, and the offset of the content data stored in the distributed file system; A determining unit is configured to determine, based on the search result, whether the second target content data is stored in the distributed publish-subscribe messaging system or the distributed file system.
9. A server, It is characterized in that The server comprises: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the content data storage method according to any one of claims 1 to 4.
10. A storage medium, It is characterized in that When the instructions in the storage medium are executed by a processor of the server, the server is enabled to execute the content data storage method according to any one of claims 1 to 4.
