Computer room disaster recovery control method, terminal and storage medium

By establishing a mechanism for transferring instructions and stored information between the user terminal and the cache database, the problem of backlog messages being unable to be consumed in time during disaster recovery in the computer room is solved, and the continued consumption and repetition of messages are achieved after failover.

CN112286723BActive Publication Date: 2025-03-04BEIJING DA MI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202011069024.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-09-30
Publication Date
2025-03-04
Estimated Expiration
2040-09-30

AI Technical Summary

Technical Problem

The existing computer room disaster recovery plan cannot consume backlog messages in time during failover, resulting in unacceptable delays in business or data loss.

Method used

By establishing a mechanism for transferring instructions and storage information between the user terminal and the cache database, an instruction is generated when a cluster failure is detected to enable the terminal to read messages from the target storage information, and restore the message reading start site when the fault is repaired.

Benefits of technology

After the host room fails to switch to the backup computer room, the unprocessed backlog messages in the original host room cluster can continue to be consumed, and the messages are basically not repeated, ensuring the effectiveness of disaster recovery processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112286723B_ABST
    Figure CN112286723B_ABST
Patent Text Reader

Abstract

The present application discloses a computer room disaster recovery control method, terminal and storage medium. The computer room disaster recovery control method includes generating a first instruction when the first user terminal detects a failure of the first cluster, the first instruction is used to instruct the second user terminal to obtain the target storage information in the cache database; sending the first instruction to the second user terminal, so that the second user terminal reads the message from the message corresponding to the target storage information in the second cluster as the message reading starting point. This solution implements disaster recovery processing when the main computer room fails, ensuring that after the main computer room fails and switches to the backup computer room, the backlog messages that have not been processed in the original main computer room cluster can still be consumed, and the messages are basically non-duplicate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer room disaster recovery, and in particular to a computer room disaster recovery control method, terminal and storage medium. Background Art

[0002] Kafka is a commonly used message queue middleware. For systems with high availability requirements, when they strongly rely on Kafka, if the computer room where Kafka is located fails, Kafka needs to provide cross-computer room disaster recovery capabilities. The current solution is to deploy two sets of Kafka clusters in two computer rooms. When one computer room fails, the Kafka traffic in the failed computer room is switched to the Kafka in the other computer room, and the servers that consume Kafka also consume the Kafka in the other computer room. The problem with this solution is that if there is a backlog of Kafka messages in the failed computer room, then when switching to another computer room, the backlog of messages cannot be consumed in time, which is unacceptable for some business scenarios. Summary of the invention

[0003] In order to solve the above problems, the embodiments of the present application provide a computer room disaster recovery control method, a terminal and a storage medium.

[0004] In a first aspect, an embodiment of the present application provides a method for disaster recovery control of a computer room, the method comprising the following steps:

[0005] When the first user terminal detects a failure of the first cluster, the first user terminal generates a first instruction, wherein the first instruction is used to instruct the second user terminal to obtain target storage information in the cache database, wherein the cache database includes storage information, and the storage information is generated based on a confirmation identifier sent by the first consumer client terminal and received by the first user terminal;

[0006] Sending the first instruction to the second user terminal so that the second user terminal reads a message from a message corresponding to the target storage information in the second cluster as a message reading start point;

[0007] When the first user terminal detects that the first cluster fault is repaired, the first user terminal obtains the target return storage information in the cache database; the cache database includes return storage information, and the return storage information is generated based on the second user terminal;

[0008] The target returns the stored information and reads the message at the corresponding message in the first cluster as the message reading start point.

[0009] Optionally, when the first user terminal detects a failure of the first cluster, before generating a first instruction, the method further includes:

[0010] When the confirmation identifier is received, storage information of a message corresponding to the confirmation identifier is generated, wherein the storage information includes a sequence number;

[0011] The storage information is sent to the cache database, and the serial number is sent to the first cluster.

[0012] Optionally, the sending the storage information to the cache database and sending the serial number to the first cluster includes:

[0013] Recording the amount of stored information;

[0014] When the amount of the storage information is greater than a preset amount, all the storage information is sent in batches to the cache database, and the serial numbers corresponding to all the storage information are sent in batches to the first cluster.

[0015] In a second aspect, the present application provides a computer room disaster recovery control method, the method comprising the following steps:

[0016] When the first cluster fails, the second user terminal receives a first instruction sent by the first user terminal, and obtains target storage information in the cache database, wherein the first instruction is used to instruct the second user terminal to obtain target storage information in the cache database, wherein the cache database includes storage information, and the storage information is generated based on a confirmation identifier sent by the first consumer client terminal and received by the first user terminal;

[0017] Based on the target storage information, a message reading start point is determined, and messages are read from the second cluster according to the message reading start point.

[0018] Optionally, the storage information includes a serial number;

[0019] When the first cluster fails, the second user terminal receives the first instruction sent by the first user terminal and obtains the target storage information in the cache database, including:

[0020] Receive a first instruction sent by the first user terminal, and obtain a sequence number group corresponding to the storage information written in batches for the last time from the cache database, wherein the sequence number group includes sequence numbers of all the storage information written in the same batch sorted by generation time;

[0021] Obtain storage information corresponding to the last sequence number in the sequence number group in the cache database;

[0022] The storage information is determined as target storage information.

[0023] Optionally, the target storage information includes a serial number, identification information, and a timestamp;

[0024] The determining a message reading start position based on the target storage information, and reading a message from the second cluster according to the message reading start position, comprises:

[0025] Acquire, in the second cluster, a message having the same sequence number as the target storage information, and acquire identification information of the message;

[0026] Determining whether the identification information of the message is consistent with the identification information of the target storage information;

[0027] If they are consistent, reading the message from the second cluster using the position of the message as the message reading start point;

[0028] If they are inconsistent, the message is read from the second cluster using the message in the second cluster corresponding to the timestamp of the target storage information as the message reading start point.

[0029] In a third aspect, an embodiment of the present application provides a first user terminal, the terminal comprising:

[0030] a generating module, configured to generate a first instruction when a failure of the first cluster is detected, wherein the first instruction is used to instruct the second user terminal to obtain target storage information in the cache database, wherein the cache database includes storage information, and the storage information is generated based on a confirmation identifier sent by the first consumer client terminal and received by the first user terminal;

[0031] A sending module, configured to send the first instruction to the second user terminal, so that the second user terminal reads a message from a message corresponding to the target storage information in the second cluster as a message reading starting point;

[0032] An acquisition module, configured to acquire target return storage information in the cache database when the first user terminal detects that the first cluster fault is repaired; the cache database includes return storage information, and the return storage information is generated based on the second user terminal;

[0033] The reading module is used to read the message from the corresponding message in the first cluster of the target returned storage information as the message reading starting point.

[0034] In a fourth aspect, an embodiment of the present application provides a first user terminal, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the method provided in the first aspect or any possible implementation of the first aspect are implemented.

[0035] In a fifth aspect, an embodiment of the present application provides a second user terminal, the terminal comprising:

[0036] A receiving module, configured to receive a first instruction sent by the first user terminal, and obtain target storage information from the cache database;

[0037] A starting point determination module is used to determine a message reading starting point based on the target storage information, and read the message from the second cluster according to the message reading starting point.

[0038] In the sixth aspect, an embodiment of the present application provides a second user terminal, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the method provided in the second aspect or any possible implementation of the second aspect are implemented.

[0039] In a seventh aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the method provided in the first aspect or any possible implementation manner of the first aspect is implemented.

[0040] In an eighth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the method provided in the second aspect or any possible implementation manner of the second aspect is implemented.

[0041] In one or more embodiments of the present application, when the first user terminal detects a failure in the first cluster, it generates a first instruction and sends it to the second user terminal. After receiving the first instruction, the second user terminal obtains the target storage information of its last storage from the storage information sent by the first user terminal to the cache database, and determines the message reading start point from the second cluster that synchronizes the first cluster message based on the target storage information to continue reading the message. Through the above scheme, since the messages of the first cluster and the second cluster are synchronized, when the first cluster fails and cannot read messages from the first cluster, the second user terminal can determine where the messages in the first cluster have been read before the failure according to the storage information stored in the cache database, and continue to read messages from the second cluster at that point, thereby realizing disaster recovery processing when the main computer room fails, ensuring that after the main computer room fails and switches to the backup computer room, the backlog messages that have not been processed in the original main computer room cluster can still be consumed, and the messages are basically non-duplicate. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0043] Figure 1 A schematic diagram of the architecture of a computer room disaster recovery control system provided in an embodiment of the present application;

[0044] Figure 2 A schematic diagram of a process flow of a computer room disaster recovery control method provided in an embodiment of the present application;

[0045] Figure 3 A flowchart of another computer room disaster recovery control method provided in an embodiment of the present application;

[0046] Figure 4 A flowchart of another computer room disaster recovery control method provided in an embodiment of the present application;

[0047] Figure 5 A schematic diagram of the structure of a first user terminal provided in an embodiment of the present application;

[0048] Figure 6 A schematic diagram of the structure of a second user terminal provided in an embodiment of the present application;

[0049] Figure 7 A schematic diagram of the structure of another first user terminal provided in an embodiment of the present application;

[0050] Figure 8 A schematic diagram of the structure of another second user terminal provided in an embodiment of the present application. DETAILED DESCRIPTION

[0051] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.

[0052] In the following introduction, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance. The following introduction provides multiple embodiments of the present application, and different embodiments can be replaced or combined, so the present application can also be considered to include all possible combinations of the same and / or different embodiments recorded. Therefore, if one embodiment includes features A, B, and C, and another embodiment includes features B and D, then the present application should also be considered to include embodiments containing one or more of all other possible combinations of A, B, C, and D, although the embodiment may not be clearly recorded in the following text.

[0053] The following description provides examples and does not limit the scope, applicability or examples set forth in the claims. Changes may be made to the functions and arrangements of the elements described without departing from the scope of the present application. Various processes or components may be appropriately omitted, substituted or added to each example. For example, the described method may be performed in an order different from the order described, and various steps may be added, omitted or combined. In addition, features described in some examples may be combined in other examples.

[0054] It should be noted that Kafka is a message system based on publishing and subscription. It is generally called "distributed commit log" or "distributed streaming platform". Its feature is that it can provide high throughput for both distribution and subscription. Kafka can produce about 250,000 messages (50MB) per second and process 550,000 messages (110MB) per second. Kafka generally consists of three parts: Kafka producer client terminal (producer, that is, the generator of messages), Kafka cluster, Kafka consumer client terminal (consumer, that is, the consumer of messages). Kafka producer client terminal is responsible for writing messages to Kafka cluster. Kafka cluster contains one or more brokers (that is, cache agents, one or more servers in Kafka cluster are collectively referred to as borkers). Kafka consumer client terminal is responsible for reading messages written in Kafka cluster and consuming messages.

[0055] In an embodiment of the present application, in order to avoid the frequent upgrades of the Kafka client affecting the business, a Kafka producer proxy terminal and a Kafka consumer proxy terminal are added. The Kafka producer client terminal and the Kafka consumer client terminal only produce and consume messages, while the Kafka producer proxy and the Kafka consumer proxy are also used for traffic scheduling, disaster recovery and other tasks.

[0056] See also Figure 1 , Figure 1 It is a schematic diagram of the architecture of a computer room disaster recovery control system provided in an embodiment of the present application.

[0057] like Figure 1 As shown, the computer room disaster recovery control system may include a first computer room 10 and a second computer room 20. The first computer room 10 includes a first producer client terminal 101, a first producer proxy terminal 102, a first cluster 103, a first user terminal 104, and a first consumer client terminal 105. The second computer room 20 includes a second cluster 201, a second user terminal 203, and a cache database 202. The first computer room 10 and the second computer room 20 may be two computer rooms located in different geographical locations.

[0058] A cluster may have multiple servers, and a server may be regarded as a broker, that is, the first cluster 103 and the second cluster 201 may be a server group integrating multiple servers.

[0059] The producer client terminal may be a message producer that only produces messages. The messages it produces will be written to the cluster terminal by the producer proxy terminal. The first producer client terminal 101 may be a user terminal equipped with a producer client.

[0060] The message production agent established by the producer proxy terminal to avoid frequent client upgrades affecting the business will replace the producer client terminal to write messages to the cluster terminal, and is also responsible for traffic scheduling, disaster recovery, etc. The first producer proxy terminal 102 can be a server equipped with producer proxy software. The first producer proxy terminal 102 will synchronously write the message written to the first cluster 103 to the second cluster 201, so that the messages of the first cluster 103 and the second cluster 201 are synchronized, which is convenient for disaster recovery when the computer room fails.

[0061] The consumer proxy terminal is a message consumption agent set up to avoid frequent client upgrades affecting the business. It will read messages from the cluster instead of the consumer client terminal and is also responsible for traffic scheduling, disaster recovery, etc. The first user terminal 104 and the second user terminal 203 can be servers equipped with consumer proxy software.

[0062] The consumer client terminal is a message consumer, responsible for monitoring the messages read by the consumer proxy terminal from the cluster. When the consumer client terminal monitors that the consumer proxy terminal has read a new message, it will pull the message for business processing. The first consumer client terminal 105 can be a user terminal equipped with a consumer client.

[0063] The cache database 202 is redis, which is used to store relevant information corresponding to the consumed messages so as to quickly find the backlog of messages in response to a computer room failure. The cache database 202 can be a server equipped with stored information.

[0064] Possibly, redis can be a separate server dedicated to storing storage information.

[0065] Possibly, redis can be integrated into other servers (such as a second cluster server, a second consumer proxy server, etc.) to reduce the occupation of server resources.

[0066] Exemplarily, when a teacher wants to send red envelopes to students in a class group, the terminal used by the teacher to send the red envelopes is the first producer client 101, and the red envelope message produced by the teacher is written into the first cluster 103 with a red envelope theme via the first producer proxy terminal 102. The terminal used by students to receive red envelopes is the first consumer client 105, which discovers new messages sent by the teacher through monitoring the messages read by the first user terminal 104 from the first cluster 103. After obtaining the message, the students can receive the red envelope information sent by the teacher and collect the red envelope. When the first cluster 103 fails during the red envelope sending process, the first user terminal 104 will send an instruction to the second user terminal 203, so that the second user terminal 203 can determine from redis where the red envelope message sending process has progressed to, and continue to send subsequent red envelope messages from there.

[0067] Under normal circumstances, the system can use the first computer room 10 as the main computer room, which normally takes over 100% of the business write requests. The second computer room 20 can be used as a backup computer room to take over the traffic of the main computer room when the main computer room fails.

[0068] See also Figure 2 , Figure 2 is a flow chart of a computer room disaster recovery control method provided in an embodiment of the present application. In an embodiment of the present application, the method can be applied to Figure 1 The computer room disaster recovery control system shown, the method includes:

[0069] S201. When the first user terminal detects a failure of the first cluster, the first user terminal generates a first instruction, where the first instruction is used to instruct the second user terminal to obtain target storage information in the cache database, where the cache database includes storage information, and the storage information is generated based on a confirmation identifier sent by the first consumer client terminal and received by the first user terminal.

[0070] In an embodiment of the present application, the first user terminal may detect the failure of the first cluster by failing to read messages from the first cluster. When the first user terminal detects the failure of the first cluster, it generates a first instruction, which can instruct the object receiving the first instruction to obtain target storage information from the storage information stored in the cache database redis to perform disaster recovery for the computer room failure.

[0071] S202: The first user terminal sends the first instruction to the second user terminal, so that the second user terminal reads a message from a message corresponding to the target storage information in the second cluster as a message reading starting point.

[0072] In an embodiment of the present application, the first user terminal sends the first instruction generated above to the second user terminal, so that the second user terminal can determine the message reading position before the failure of the first computer room according to the target storage information in redis as the message reading starting point to continue the message reading work.

[0073] S203: The second user terminal receives the first instruction sent by the first user terminal, and obtains the target storage information in the cache database.

[0074] In an embodiment of the present application, if the first cluster of the first computer room fails, the second user terminal will receive the first instruction sent by the first user terminal, and obtain the target storage information in the cache database redis according to the first instruction. The cache database stores the storage information generated by the first user terminal after consuming the new message, and the storage information includes the target storage information corresponding to the message last processed before the failure of the first computer room.

[0075] S204: The second user terminal determines a message reading start point based on the target storage information, and reads a message from the second cluster according to the message reading start point.

[0076] In an embodiment of the present application, after obtaining the target storage information, the second user terminal will determine the message reading starting point in the second cluster according to the target storage information, that is, determine the position to which the messages in the topic have been consumed before the failure of the first computer room, and use this position as the starting point for continuing to consume messages. Since the messages in the first cluster will be synchronously written to the second cluster as a backup, this method can determine the position of the last message consumed by the first cluster before the failure in the second cluster when the first cluster fails, and then continue to read messages from the second cluster.

[0077] S205: When the first user terminal detects that the first cluster failure is repaired, the first user terminal obtains the target return storage information in the cache database.

[0078] In the embodiment of the present application, the cache database includes return storage information, and the return storage information is generated based on the second user terminal. After the failure of the first cluster is repaired, the entire service needs to be switched back to the first cluster, so the first user terminal will obtain the target return storage information stored in the cache database, so as to determine the message reading start point in the first cluster according to the target return storage information.

[0079] S206: The first user terminal reads a message from the corresponding message in the first cluster from the target returned storage information as a message reading start point.

[0080] In an embodiment of the present application, after obtaining the target return storage information, the first user terminal will determine the message reading starting point in the first cluster according to the target return storage information, that is, determine the position to which the message of the topic in the second cluster has been consumed when the fault of the first machine is repaired, and use this position as the starting point for continuing to consume messages. After the fault of the first machine is repaired, the messages in the second cluster will be synchronously written to the first cluster as a backup. This method can be used to determine the position of the message last consumed by the second cluster in the first cluster, and then continue to read messages from the first cluster.

[0081] Through the above steps, disaster recovery processing is achieved when the main computer room fails, ensuring that after the main computer room fails and switches to the backup computer room, the backlog of messages that have not been processed in the original main computer room cluster can still be consumed, and the messages are basically non-duplicate.

[0082] See also Figure 3 , Figure 3 FIG. 1 is a flow chart of another method for disaster recovery control of a computer room provided in an embodiment of the present application. Figure 3 As shown, in the embodiment of the present application, the method can be applied to Figure 1 The computer room disaster recovery control system shown, the method includes:

[0083] S301. When the first user terminal receives the confirmation identifier, it generates storage information of a message corresponding to the confirmation identifier, where the storage information includes a sequence number.

[0084] In an embodiment of the present application, after the first consumer client terminal listens to a new message and pulls it to complete the business, it will return a confirmation mark ack to the first user terminal to indicate that the business processing of the pulled message is completed. After receiving the confirmation mark sent by the first consumer client terminal, the first user terminal will generate storage information of the message corresponding to the confirmation mark. The storage information is used to facilitate the search of related messages during disaster recovery. The storage information may include the topic information corresponding to the message in the first cluster, the group team information of the message under the topic, the offset information used to confirm the specific position of the message in the queue (a continuous serial number used to locate each message appended to the partition), the timestamp used to confirm the time when the message was written to the first cluster (data generated using digital signature technology, the objects of the signature include original file information, signature parameters, signature time and other information), and the unique ID of each message, that is, identification information.

[0085] S302: The first user terminal sends the storage information to the cache database, and sends the serial number to the first cluster.

[0086] In the embodiment of the present application, the first user terminal sends the generated storage information to redis, and at the same time, the first user terminal sends the offset information of the message to the first cluster. The former is used to ensure that when the first cluster fails, the second user terminal can obtain the storage information from redis to determine the location of the message to continue processing, and the latter is used when the first cluster does not fail, by sending the offset of the consumed message to the first cluster to indicate that the message has been consumed, thereby ensuring that the first consumer client terminal will not repeatedly obtain the processed message.

[0087] In one possible implementation, step S302 specifically includes:

[0088] Recording the amount of stored information;

[0089] When the amount of the storage information is greater than a preset amount, all the storage information is sent in batches to the cache database, and the serial numbers corresponding to all the storage information are sent in batches to the first cluster.

[0090] In the embodiment of the present application, if the first user terminal immediately sends out the generated storage information after processing each message, it will cause a large burden on the server. Therefore, after the first user terminal generates each storage information, it will record the number of storage information at this time. When the number of storage information reaches the preset number, the first user terminal will batch send all the accumulated storage information and sequence numbers. The preset number can be 5 or 10, and the specific number can be set in advance by the staff according to the message consumption speed, and it is not limited.

[0091] S303. When the first user terminal detects a failure of the first cluster, the first user terminal generates a first instruction, where the first instruction is used to instruct the second user terminal to obtain target storage information in the cache database, where the cache database includes storage information, and the storage information is generated based on a confirmation identifier sent by the first consumer client terminal and received by the first user terminal.

[0092] The specific process is shown in step S201 and will not be repeated here.

[0093] S304: The first user terminal sends the first instruction to the second user terminal, so that the second user terminal reads the message from the message corresponding to the target storage information in the second cluster as the message reading starting point.

[0094] The specific process is shown in step S202 and will not be repeated here.

[0095] S305: The second user terminal receives the first instruction sent by the first user terminal, and obtains the target storage information in the cache database.

[0096] The specific process is shown in step S203 and will not be repeated here.

[0097] S306: The second user terminal determines a message reading start point based on the target storage information, and reads a message from the second cluster according to the message reading start point.

[0098] The specific process is shown in step S204 and will not be repeated here.

[0099] In one possible implementation, the first cluster has the same number of servers and the same number of partitions as the second cluster.

[0100] In an embodiment of the present application, when the first computer room goes down, if one wants to retrieve in the second computer room which message the corresponding group under the topic in the first computer room has consumed and consume it, that is, if one wants the offset of the first computer room to be reused in the second computer room, it is necessary to ensure that the number of brokers and the number of partitions in the first computer room and the second computer room are consistent, and when the first producer proxy terminal writes a message to the cluster, the load balancing algorithm for which partition the message falls on should not use a random algorithm, and a hash algorithm can be used to ensure that the message falls on the same partition in both computer rooms.

[0101] S307: When the first user terminal detects that the first cluster failure is repaired, the first user terminal obtains the target return storage information in the cache database.

[0102] The specific process is as described in step S205, so it will not be repeated here.

[0103] S308: The first user terminal reads a message from the corresponding message in the first cluster from the target returned storage information as a message reading start point.

[0104] The specific process is as described in step S206, so it will not be repeated here.

[0105] Through the above steps, the generation and sending of storage information when the main computer room is not faulty are completed. At the same time, the serial number in the storage information is sent to the cluster of the main computer room to ensure the normal consumption of messages when the main computer room is not faulty. Disaster recovery processing when the main computer room fails is also realized, ensuring that after the main computer room fails and switches to the backup computer room, the backlog messages that have not been processed in the original main computer room cluster can still be consumed, and the messages are basically non-duplicate.

[0106] See also Figure 4 , Figure 4FIG. 1 is a flow chart of a computer room disaster recovery control method provided by an embodiment of the present application. Figure 4 As shown, in the embodiment of the present application, the method can be applied to Figure 1 The computer room disaster recovery control system shown, the method includes:

[0107] S401: When the first user terminal detects a failure of the first cluster, the first user terminal generates a first instruction.

[0108] The specific process is shown in step S201 and will not be repeated here.

[0109] S402: The first user terminal sends the first instruction to the second user terminal.

[0110] The specific process is shown in step S202 and will not be repeated here.

[0111] S403. The second user terminal receives the first instruction sent by the first user terminal, and obtains the serial number group corresponding to the storage information written in the last batch from the cache database, wherein the serial number group includes the serial numbers of all the storage information written in the same batch sorted by generation time.

[0112] In an embodiment of the present application, in order to reduce the burden of message sending and receiving on the server, the first user terminal will not write the storage information into the cache database redis immediately after generating it, but will write it in batches when the accumulated storage information is greater than the preset amount. The storage information may include the topic information corresponding to the message in the first cluster, the group team information of the message under the topic, the offset information used to confirm the specific position of the message in the queue (a continuous sequence number used to locate each message appended to the partition), the timestamp used to confirm the time when the message was written into the first cluster (data generated using digital signature technology, the object of the signature includes original file information, signature parameters, signature time and other information), and the unique ID of each message, i.e., identification information.

[0113] After receiving the first instruction, the second user terminal will obtain from Redis a sequence number group consisting of sequence numbers corresponding to the last batch of storage information written in batches into Redis by the first user terminal.

[0114] S404: The second user terminal obtains storage information corresponding to the last sequence number in the sequence number group in the cache database.

[0115] In an embodiment of the present application, the sequence numbers arranged in the sequence number group must be sorted in sequence according to the time when the storage information is generated. Therefore, the message corresponding to the last sequence number in the sequence number group is the last message processed before the failure of the first cluster, and the first user terminal will obtain the storage information corresponding to the last sequence number.

[0116] S405: The second user terminal determines the storage information as target storage information.

[0117] In the embodiment of the present application, after obtaining the storage information corresponding to the last sequence number, the first user terminal will determine the storage information as the target storage information.

[0118] S406: The second user terminal obtains a message having the same sequence number as the target storage information in the second cluster, and obtains identification information of the message.

[0119] In the embodiment of the present application, although the messages in the second cluster are synchronized with the messages in the first cluster, in practice, there may be jitters in the message transmission process, or the first cluster may already have written messages before synchronization, and the sequence numbers are generated in sequence, which will result in the same message in the first cluster and the second cluster having different sequence numbers. Therefore, the second user terminal will first find the message with the same sequence number as the target storage information in the second cluster and obtain the identification information of the message.

[0120] S407: The second user terminal determines whether the identification information of the message is consistent with the identification information of the target storage information;

[0121] If they are consistent, reading the message from the second cluster using the position of the message as the message reading start point;

[0122] If they are inconsistent, the message is read from the second cluster using the message in the second cluster corresponding to the timestamp of the target storage information as the message reading start point.

[0123] In an embodiment of the present application, the identification information of each message, i.e., the message ID, is separate and unique, and the second user terminal will determine whether the identification information of the message found in the second cluster is consistent with the identification information in the target storage information. If the identification information of the two is consistent, the second user terminal will consider that the message in the second cluster is the last message consumed before the failure of the first computer room, and continue to read the message with the position of the message as the message reading starting point. If the identification information of the two is inconsistent, it means that jitter or other reasons may have occurred during message synchronization, so that the message corresponding to the serial number in the second cluster is not the message corresponding to the target storage information. The second user terminal will obtain the timestamp in the target storage information, determine the target message in the second cluster with the time point when the message is written, and read the message from the second cluster with the message as the message reading starting point.

[0124] S408: When the first user terminal detects that the first cluster failure is repaired, the first user terminal obtains the target return storage information in the cache database.

[0125] The specific process is as described in step S205, so it will not be repeated here.

[0126] S409: The first user terminal reads a message from the corresponding message in the first cluster from the target returned storage information as a message reading start point.

[0127] The specific process is as described in step S206, so it will not be repeated here.

[0128] Through the above steps, the first user terminal submits information such as offset to redis. In case of a failure, after the traffic in the computer room is switched, before the second user terminal consumes the message, it obtains information such as offset from redis to continue the last consumption of the first computer room, thereby realizing disaster recovery processing when the main computer room fails, and ensuring that after the main computer room fails and switches to the backup computer room, the backlog messages that have not been processed in the original main computer room cluster can still be consumed, and the messages are basically non-duplicate.

[0129] It should be noted that when the failure of the first computer room is restored, the first user terminal will obtain the return storage information from the cache database, and determine the message reading starting point from the first cluster based on the return storage information to read the message. The return storage information is the last storage information generated after the second user terminal consumes the message in the second cluster when the first computer room fails. The first user terminal can determine where the message in the second cluster is read based on the return storage information, and determine the corresponding position of the message in the first cluster, and continue to read the message with the position as the message reading starting point, so as to switch the service back to the first computer room. Among them, since the second cluster is still being written to during the failure of the first computer room, the message corresponding to the return storage information may not be written to the first cluster and cannot be found. When the corresponding message cannot be found in the first cluster, the first user terminal will continuously obtain the newly generated return storage information until the message corresponding to the return storage information can be found in the first cluster.

[0130] The following will be combined with the attached Figure 5 , the first user terminal provided in the embodiment of the present application is introduced in detail. It should be noted that the attached Figure 5 The first user terminal shown is used to execute the present application Figure 2-Figure 4 For the convenience of explanation, only the part related to the embodiment of the present application is shown. For the specific technical details not disclosed, please refer to the present application. Figure 2-Figure 4 The embodiment shown.

[0131] See also Figure 5 , Figure 5 is a schematic diagram of the structure of a first user terminal provided in an embodiment of the present application, such as Figure 5 As shown, the first user terminal is applied to Figure 1 In the system shown, the terminal comprises:

[0132] A generating module 501 is configured to generate a first instruction when a failure of the first cluster is detected, wherein the first instruction is used to instruct the second user terminal to obtain target storage information in the cache database, wherein the cache database includes storage information, and the storage information is generated based on a confirmation identifier sent by the first consumer client terminal and received by the first user terminal;

[0133] A sending module 502, configured to send the first instruction to the second user terminal, so that the second user terminal reads a message from a message corresponding to the target storage information in the second cluster as a message reading start point;

[0134] An acquisition module 503 is configured to acquire target return storage information in the cache database when the first user terminal detects that the first cluster fault is repaired; the cache database includes return storage information, and the return storage information is generated based on the second user terminal;

[0135] The reading module 504 is used to read the message from the corresponding message in the first cluster of the target returned storage information as the message reading starting point.

[0136] In one possible implementation, the generating module 501 is further used for:

[0137] When the confirmation identifier is received, storage information of a message corresponding to the confirmation identifier is generated, wherein the storage information includes a sequence number;

[0138] The sending module 502 is also used for:

[0139] The storage information is sent to the cache database, and the serial number is sent to the first cluster.

[0140] In one possible implementation, the sending module 502 specifically includes:

[0141] A recording unit, used to record the amount of the stored information;

[0142] The judgment unit is configured to send all the storage information in batches to the cache database when the amount of the storage information is greater than a preset amount, and send the serial numbers corresponding to all the storage information in batches to the first cluster.

[0143] Those skilled in the art can clearly understand that the technical solutions of the embodiments of the present application can be implemented with the help of software and / or hardware. The "unit" and "module" in this specification refer to software and / or hardware that can independently complete or cooperate with other components to complete specific functions, where the hardware can be, for example, a field programmable gate array (Field-Programmable Gate Array, FPGA), an integrated circuit (Integrated Circuit, IC), etc.

[0144] Each processing unit and / or module of the embodiments of the present application may be implemented by an analog circuit that implements the functions described in the embodiments of the present application, or may be implemented by software that executes the functions described in the embodiments of the present application.

[0145] See also Figure 6 , which shows a schematic diagram of the structure of a first user terminal involved in an embodiment of the present application, the first user terminal can be used to implement Figure 2-Figure 4 The method in the embodiment shown. Figure 6As shown, the first user terminal 600 may include: at least one central processor 601 , at least one network interface 604 , a user interface 603 , a memory 605 , and at least one communication bus 602 .

[0146] The communication bus 602 is used to realize the connection and communication between these components.

[0147] The user interface 603 may include a display screen (Display) and a camera (Camera), and the optional user interface 603 may also include a standard wired interface and a wireless interface.

[0148] The network interface 604 may optionally include a standard wired interface or a wireless interface (such as a WI-FI interface).

[0149] Among them, the central processing unit 601 may include one or more processing cores. The central processing unit 601 uses various interfaces and lines to connect various parts in the entire terminal 600, and executes various functions and processes data of the terminal 600 by running or executing instructions, programs, code sets or instruction sets stored in the memory 605, and calling data stored in the memory 605. Optionally, the central processing unit 601 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The central processing unit 601 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the central processing unit 601, and can be implemented separately through a chip.

[0150] Among them, the memory 605 may include a random access memory (Random Access Memory, RAM) and may also include a read-only memory (Read-Only Memory). Optionally, the memory 605 includes a non-transitory computer-readable storage medium. The memory 605 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 605 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned method embodiments, etc.; the data storage area may store data involved in the above-mentioned method embodiments, etc. The memory 605 may optionally be at least one storage device located away from the aforementioned central processor 601. As Figure 6 As shown, the memory 605 as a computer storage medium may include an operating system, a network communication module, a user interface module, and program instructions.

[0151] The following will be combined with the attached Figure 7 , the second user terminal provided in the embodiment of the present application is introduced in detail. It should be noted that the attached Figure 7 The second user terminal shown is used to execute the present application Figure 2-Figure 4 For the convenience of explanation, only the part related to the embodiment of the present application is shown. For the specific technical details not disclosed, please refer to the present application. Figure 2-Figure 4 The embodiment shown.

[0152] See also Figure 7 , Figure 7 is a schematic diagram of the structure of a second user terminal provided in an embodiment of the present application, such as Figure 7 As shown, the second user terminal is applied to Figure 1 In the system shown, the terminal comprises:

[0153] The receiving module 701 is used to receive a first instruction sent by the first user terminal, and obtain target storage information in the cache database.

[0154] In one possible implementation, the receiving module 701 specifically includes:

[0155] a receiving unit, configured to receive a first instruction sent by the first user terminal, and obtain, from the cache database, a sequence number group corresponding to the storage information written in batches for the last time, the sequence number group comprising sequence numbers of all the storage information written in the same batch sorted by generation time;

[0156] A first acquisition unit is used to acquire storage information corresponding to the last sequence number in the sequence number group in the cache database;

[0157] The first determining unit is configured to determine the storage information as target storage information.

[0158] The starting point determination module 702 is used to determine a message reading starting point based on the target storage information, and read the message from the second cluster according to the message reading starting point.

[0159] In one embodiment, the starting point determination module 702 specifically includes:

[0160] A second acquisition unit, configured to acquire, in the second cluster, a message having the same sequence number as the target storage information, and acquire identification information of the message;

[0161] a second determining unit, configured to determine whether the identification information of the message is consistent with the identification information of the target storage information;

[0162] If they are consistent, reading the message from the second cluster using the position of the message as the message reading start point;

[0163] If they are inconsistent, the message is read from the second cluster using the message in the second cluster corresponding to the timestamp of the target storage information as the message reading start point.

[0164] See also Figure 8 , which shows a schematic diagram of the structure of a second user terminal involved in an embodiment of the present application, the second user terminal can be used to implement Figure 2-Figure 4 The method in the embodiment shown. Figure 8 As shown, the second user terminal 800 may include: at least one central processor 801 , at least one network interface 804 , a user interface 803 , a memory 805 , and at least one communication bus 802 .

[0165] The communication bus 802 is used to realize the connection and communication between these components.

[0166] The user interface 803 may include a display screen (Display) and a camera (Camera), and the optional user interface 803 may also include a standard wired interface and a wireless interface.

[0167] The network interface 804 may optionally include a standard wired interface or a wireless interface (such as a WI-FI interface).

[0168] Among them, the central processing unit 801 may include one or more processing cores. The central processing unit 801 uses various interfaces and lines to connect various parts in the entire terminal 800, and executes various functions and processes data of the terminal 800 by running or executing instructions, programs, code sets or instruction sets stored in the memory 805, and calling data stored in the memory 805. Optionally, the central processing unit 801 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The central processing unit 801 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics central processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the central processing unit 801, and can be implemented separately through a chip.

[0169] Among them, the memory 805 may include a random access memory (Random Access Memory, RAM) and may also include a read-only memory (Read-Only Memory). Optionally, the memory 805 includes a non-transitory computer-readable storage medium. The memory 805 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 805 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned method embodiments, etc.; the data storage area may store data involved in the above-mentioned method embodiments, etc. The memory 805 may optionally be at least one storage device located away from the aforementioned central processor 801. As Figure 8 As shown, the memory 805 as a computer storage medium may include an operating system, a network communication module, a user interface module, and program instructions.

[0170] The present application also provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the steps of the above method are implemented. The computer-readable storage medium may include, but is not limited to, any type of disk, including a floppy disk, an optical disk, a DVD, a CD-ROM, a micro drive, and a magneto-optical disk, a ROM, a RAM, an EPROM, an EEPROM, a DRAM, a VRAM, a flash memory device, a magnetic card or an optical card, a nanosystem (including a molecular memory IC), or any type of medium or device suitable for storing instructions and / or data.

[0171] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.

[0172] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0173] In the several embodiments provided in the present application, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of the units, which is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some service interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.

[0174] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0175] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0176] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a memory, including a number of instructions to enable a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned memory includes: U disk, read-only memory (ROM), random access memory (RAM), mobile hard disk, disk or optical disk and other media that can store program code.

[0177] A person skilled in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by entering a program to instruct the relevant hardware. The program may be stored in a computer-readable memory, and the memory may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0178] The above is only an exemplary embodiment of the present disclosure, and the scope of the present disclosure cannot be limited thereto. That is, any equivalent changes and modifications made according to the teachings of the present disclosure are still within the scope of the present disclosure. After considering the specification and practicing the disclosure here, those skilled in the art will easily think of the implementation scheme of the present disclosure. This application is intended to cover any modification, use or adaptation of the present disclosure, which follows the general principles of the present disclosure and includes common knowledge or customary technical means in the technical field not recorded in the present disclosure. The description and examples are regarded as exemplary only, and the scope and spirit of the present disclosure are defined by the claims.

Claims

1. A computer room disaster recovery control method, characterized in that: The method comprises: When the first user terminal detects a failure in the first cluster, a first instruction is generated, wherein the first instruction is used to instruct the second user terminal to obtain target storage information in a cache database, wherein the cache database includes storage information, and the storage information is generated based on a confirmation identifier sent by a first consumer client terminal and received by the first user terminal, wherein both the first user terminal and the second user terminal are servers equipped with consumer agent software; and the first cluster belongs to a first computer room; Send the first instruction to the second user terminal, so that the second user terminal reads the message from the message corresponding to the target storage information in the second cluster as the message reading starting point, the second cluster belongs to the second computer room, and the second computer room and the first computer room are different computer rooms; the number of cache agents and the number of partitions in the first computer room and the second computer room are consistent; the messages in the first cluster and the second cluster are messages synchronously written by the first producer proxy terminal through the hash algorithm; When the first user terminal detects that the first cluster fault is repaired, the first user terminal obtains the target return storage information in the cache database; the cache database includes return storage information, and the return storage information is generated based on the second user terminal; The target returns the stored information and reads the message at the corresponding message in the first cluster as the message reading start point.

2. The method according to claim 1, characterized in that When the first user terminal detects a failure of the first cluster, before generating a first instruction, the method further includes: When the confirmation identifier is received, storage information of a message corresponding to the confirmation identifier is generated, wherein the storage information includes a sequence number; The storage information is sent to the cache database, and the serial number is sent to the first cluster.

3. The method according to claim 2, characterized in that The sending the storage information to the cache database and sending the serial number to the first cluster includes: Recording the amount of stored information; When the amount of the storage information is greater than a preset amount, all the storage information is sent in batches to the cache database, and the serial numbers corresponding to all the storage information are sent in batches to the first cluster.

4. A computer room disaster recovery control method, characterized in that: The method comprises: When the first cluster fails, the second user terminal receives the first instruction sent by the first user terminal, and obtains the target storage information in the cache database, the first instruction is used to instruct the second user terminal to obtain the target storage information in the cache database, the cache database includes storage information, the storage information is generated based on the confirmation identifier sent by the first consumer client terminal received by the first user terminal, the first user terminal and the second user terminal are both servers equipped with consumer agent software; the first cluster belongs to the first computer room; Based on the target storage information, determine the message reading starting point, read the message from the second cluster according to the message reading starting point, the second cluster belongs to the second computer room, and the second computer room and the first computer room are different computer rooms; the number of cache proxies and the number of partitions in the first computer room and the second computer room are consistent; the messages in the first cluster and the second cluster are messages written synchronously by the first producer agent terminal through the hash algorithm.

5. The method according to claim 4, characterized in that The storage information includes a serial number; When the first cluster fails, the second user terminal receives the first instruction sent by the first user terminal and obtains the target storage information in the cache database, including: Receive a first instruction sent by the first user terminal, and obtain a sequence number group corresponding to the storage information written in batches for the last time from the cache database, wherein the sequence number group includes sequence numbers of all the storage information written in the same batch sorted by generation time; Obtain storage information corresponding to the last sequence number in the sequence number group in the cache database; The storage information is determined as target storage information.

6. The method according to claim 4, characterized in that The target storage information includes a serial number, identification information, and a timestamp; The determining a message reading start position based on the target storage information, and reading a message from the second cluster according to the message reading start position, comprises: Acquire, in the second cluster, a message having the same sequence number as the target storage information, and acquire identification information of the message; Determining whether the identification information of the message is consistent with the identification information of the target storage information; If they are consistent, reading the message from the second cluster using the position of the message as the message reading start point; If they are inconsistent, the message is read from the second cluster using the message in the second cluster corresponding to the timestamp of the target storage information as the message reading start point.

7. A first user terminal, characterized in that: The terminal comprises: a generating module, configured to generate a first instruction when a first cluster failure is detected, wherein the first instruction is used to instruct a second user terminal to obtain target storage information in a cache database, wherein the cache database includes storage information, and the storage information is generated based on a confirmation identifier sent by a first consumer client terminal and received by the first user terminal, wherein both the first user terminal and the second user terminal are servers equipped with consumer agent software; and the first cluster belongs to a first computer room; A sending module, used for sending the first instruction to the second user terminal, so that the second user terminal reads the message from the message corresponding to the target storage information in the second cluster as the message reading starting point, the second cluster belongs to the second computer room, and the second computer room and the first computer room are different computer rooms; the number of cache agents and the number of partitions in the first computer room and the second computer room are consistent; the messages in the first cluster and the second cluster are messages synchronously written by the first producer proxy terminal through the hash algorithm; An acquisition module, configured to acquire target return storage information in the cache database when the first user terminal detects that the first cluster fault is repaired; the cache database includes return storage information, and the return storage information is generated based on the second user terminal; The reading module is used to read the message from the corresponding message in the first cluster of the target returned storage information as the message reading starting point.

8. A first user terminal, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 3 are implemented.

9. A second user terminal, characterized in that: The terminal comprises: a receiving module, configured to receive a first instruction sent by a first user terminal to obtain target storage information in a cache database when a first cluster fails, wherein the first instruction is used to instruct the second user terminal to obtain target storage information in the cache database, wherein the cache database includes storage information, and the storage information is generated based on a confirmation identifier sent by a first consumer client terminal received by the first user terminal, wherein both the first user terminal and the second user terminal are servers equipped with consumer agent software, and both the first user terminal and the second user terminal are servers equipped with consumer agent software; and the first cluster belongs to a first computer room; A starting position determination module is used to determine a message reading starting position based on the target storage information, and read messages from a second cluster according to the message reading starting position, wherein the second cluster belongs to a second computer room, and the second computer room and the first computer room are different computer rooms; the number of cache proxies and the number of partitions in the first computer room and the second computer room are consistent; the messages in the first cluster and the second cluster are messages written synchronously by a first producer proxy terminal through a hash algorithm.

10. A second user terminal, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 4 to 6 are implemented.

11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Data processing system, method and apparatus

    CN109309698A

  • Disaster recovery method, device and system for cloud storage

    CN111176888A