CN114827171A - Information synchronization method and device, computer equipment and storage medium - Google Patents

Information synchronization method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN114827171A
CN114827171A CN202210287295.XA CN202210287295A CN114827171A CN 114827171 A CN114827171 A CN 114827171A CN 202210287295 A CN202210287295 A CN 202210287295A CN 114827171 A CN114827171 A CN 114827171A
Authority
CN
China
Prior art keywords
database instance
state information
service
database
client
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202210287295.XA
Other languages
Chinese (zh)
Other versions
CN114827171B (en
Inventor
刘云生
郭庆
张正阳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Qingdao Zhongke Shuguang Technology Service Co ltd
Original Assignee
Qingdao Zhongke Shuguang Technology Service Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Qingdao Zhongke Shuguang Technology Service Co ltd filed Critical Qingdao Zhongke Shuguang Technology Service Co ltd
Priority to CN202210287295.XA priority Critical patent/CN114827171B/en
Publication of CN114827171A publication Critical patent/CN114827171A/en
Application granted granted Critical
Publication of CN114827171B publication Critical patent/CN114827171B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/50Queue scheduling

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application relates to an information synchronization method, an information synchronization device, a computer device, a storage medium and a computer program product. The method comprises the following steps: when a target service node in a service layer consumes database instance state information in a message queue, the database instance state information is issued to a remote dictionary database redis through the target service node; the database instance state information is changed database instance state information monitored by a service layer; based on preset subscription relations between service nodes of the service layer and the redis, publishing the database instance state information stored in the redis to the service nodes; and sending the database instance state information to the corresponding client based on the long connection relation between each service node and the client. By adopting the method, the high-efficiency synchronization of the database instance state information between the service layer and the client is realized.

Description

Information synchronization method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of internet technologies, and in particular, to an information synchronization method, apparatus, computer device, storage medium, and computer program product.
Background
In a business system, when a service layer creates a database instance, information synchronization needs to be performed between state information generated by the created database instance and a client, so as to ensure that a user knows the current service layer operation state.
The current information synchronization method between a service layer and a client is mainly implemented in a service system deployed by a single node, namely, a unique long connection relation is established between the service layer and a single-node service layer as well as between the service layer and a single client, and further, based on the unique long connection relation, the service layer pushes state information generated by creating a database instance to the corresponding unique client through the single service node (service layer), so that data message transmission of the long connection is completed.
However, the current service system mostly adopts a cluster deployment form, and includes a plurality of service nodes and a plurality of clients, so each client can only select one of the plurality of service nodes for long connection creation. When the service layer pushes the data information to a certain service node in the service layer, the client which is not connected with the service node cannot receive the state information of the database instance, so that the message synchronization between the service layer and all the clients cannot be ensured.
Disclosure of Invention
In view of the above, it is necessary to provide an information synchronization method, apparatus, computer device, computer readable storage medium and computer program product for solving the above technical problems.
In a first aspect, the present application provides an information synchronization method. The method comprises the following steps:
when a target service node in a service layer consumes database instance state information in a message queue, the database instance state information is issued to a remote dictionary database redis through the target service node; the database instance state information is changed database instance state information monitored by a service layer;
based on preset subscription relations between service nodes of the service layer and the redis, publishing the database instance state information stored in the redis to the service nodes;
and sending the database instance state information to the corresponding client based on the long connection relation between each service node and the client.
By adopting the method, the asynchronous transmission processing of the database instance state information is realized through the transmission middleware of the message queue, the stability of message transmission is enhanced, further, the database instance state information consumed by a certain service node is synchronized to other service nodes of a service layer according to a subscription and release mechanism of redis, and the efficient synchronization of the database instance state information between the service layer and the client is realized through the long connection relationship between each service node and the client.
In one embodiment, before issuing, by a target service node in a service layer, database instance state information in a message queue to a remote dictionary database redis when the target service node consumes the database instance state information, the method further includes:
responding to a long connection establishment request sent by a client, and sending the long connection establishment request to each service node of a service layer through a proxy server reverse proxy; the long connection establishing request carries client identification information corresponding to the client;
and establishing a long connection relation between each service node and the client so as to be used for pushing database instance state information to the client.
In the embodiment, a long connection relation is pre-established between the client and the service node, so that a transmission path is formed among the service layer, the service layer and the client, the condition that the service layer pushes the database instance state information to the client in real time can be met, and the transmission efficiency of the database instance state information is improved.
In one embodiment, before issuing, by a target service node in a service layer, database instance state information in a message queue to a remote dictionary database redis when the target service node consumes the database instance state information, the method further includes:
monitoring the running state of each database instance in the service layer database through the service layer;
if the running state of the target database instance in the service layer database changes, the changed database instance state information of the target database instance is sent to a pre-established message queue through the service layer;
and receiving and storing the database instance state information through the message queue.
In this embodiment, the service layer monitors the running state of each database instance stored in the service layer database, so that if the running state of a certain database instance recorded in the database changes, the service layer can timely sense the change, timely update the changed state information of the database instance and push the updated state information to a middleware (message queue) for information transmission to perform asynchronous processing, and the transmission timeliness of the state information of the database instance is improved.
In one embodiment, before the monitoring the operation status of each database instance in the service layer database by the service layer, the method further includes:
responding to a database instance creating request sent by a client, and creating a database instance according to configuration parameter information carried in the database instance creating request;
and storing the created database instance to a service layer database.
In this embodiment, the client sends a database instance creation request to a service node of a service layer, and the service layer in the service system completes creation of the database instance.
In one embodiment, the publishing the database instance state information stored in the redis to the service nodes includes:
inquiring and determining a client identifier for subscribing a target transmission channel in advance in the redis;
and according to the client identification, issuing database instance state information to a client corresponding to the client identification through the target transmission channel.
In the embodiment of the application, the database instance state information consumed by a certain service node is synchronously issued to other service nodes in a service layer through a subscription and issuance mechanism of a redis database, so that the problem that the database instance state information can be received after long connection is performed between different clients and corresponding different service nodes in the service layer is solved, and information synchronization between the service layer and multiple clients is realized under the condition of cluster deployment.
In a second aspect, the present application further provides an information synchronization apparatus. The device comprises:
the consumption transmission module is used for releasing the database instance state information to a remote dictionary database redis through a target service node when the target service node in a service layer consumes the database instance state information in a message queue; the database instance state information is changed database instance state information monitored by a service layer;
the publishing module is used for publishing the database instance state information stored in the redis to each service node based on a preset subscription relationship between each service node of the service layer and the redis;
and the sending module is used for sending the database instance state information to the corresponding client based on the long connection relation between each service node and the client.
By adopting the device, asynchronous transmission processing of database instance state information is realized through a transmission middleware of a message queue, the stability of message transmission is enhanced, further, the database instance state information consumed by a certain service node is synchronized to other service nodes of a service layer according to a subscription and release mechanism of redis, and efficient synchronization of the database instance state information between the service layer and a client is realized through long connection relations between the service nodes and the client.
In a third aspect, the present application further provides an information synchronization system. The system comprises:
the service layer is used for monitoring whether the running state of each database instance in the service layer changes; if the running state of the target database instance changes, sending the changed state information of the target database instance to a pre-established message queue;
the service layer is used for issuing the database instance state information to a remote dictionary database redis through a target service node when the target service node in the service layer consumes the database instance state information in the message queue; based on preset subscription relations between service nodes of the service layer and the redis, publishing the database instance state information stored in the redis to the service nodes; based on the long connection relation between the service node and the client, the state information of the database instance is sent to the corresponding client;
the client is used for creating a database instance and receiving the database instance state information pushed by each service node in the service layer.
By adopting the system, the asynchronous transmission processing of the database instance state information is realized through the transmission middleware of the message queue, the stability of message transmission is enhanced, further, the database instance state information consumed by a certain service node is synchronized to other service nodes of a service layer according to a subscription and release mechanism of redis, and the efficient synchronization of the database instance state information between the service layer and the client is realized through the long connection relationship between each service node and the client.
In a fourth aspect, the present application further provides a computer device. The computer device comprises a memory storing a computer program and a processor implementing the following steps when executing the computer program:
when a target service node in a service layer consumes database instance state information in a message queue, the database instance state information is issued to a remote dictionary database redis through the target service node; the database instance state information is changed database instance state information monitored by a service layer;
based on preset subscription relations between service nodes of the service layer and the redis, publishing the database instance state information stored in the redis to the service nodes;
and sending the database instance state information to the corresponding client based on the long connection relation between each service node and the client.
In a fifth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of:
when a target service node in a service layer consumes database instance state information in a message queue, the database instance state information is issued to a remote dictionary database redis through the target service node; the database instance state information is changed database instance state information monitored by a service layer;
based on preset subscription relations between service nodes of the service layer and the redis, publishing the database instance state information stored in the redis to the service nodes;
and sending the database instance state information to the corresponding client based on the long connection relation between each service node and the client.
In a fifth aspect, the present application further provides a computer program product. The computer program product comprising a computer program which when executed by a processor performs the steps of:
when a target service node in a service layer consumes database instance state information in a message queue, the database instance state information is issued to a remote dictionary database redis through the target service node; the database instance state information is changed database instance state information monitored by a service layer;
based on preset subscription relations between service nodes of the service layer and the redis, publishing the database instance state information stored in the redis to the service nodes;
and sending the database instance state information to the corresponding client based on the long connection relation between each service node and the client.
According to the information synchronization method, the information synchronization device, the computer equipment, the storage medium and the computer program product, when the target service node in the service layer consumes the database instance state information in the message queue, the database instance state information is issued to the remote dictionary database redis through the target service node; the database instance state information is changed database instance state information monitored by a service layer; based on preset subscription relations between service nodes of the service layer and the redis, publishing the database instance state information stored in the redis to the service nodes; and sending the database instance state information to the corresponding client based on the long connection relation between each service node and the client. By adopting the method, the asynchronous transmission processing of the database instance state information is realized through the transmission middleware of the message queue, the stability of message transmission is enhanced, further, the database instance state information consumed by a certain service node is synchronized to other service nodes of a service layer according to a subscription and release mechanism of redis, and the high-efficiency synchronization of the database instance state information between the service layer and the client side is realized through the long connection relationship between each service node and the client side.
Drawings
FIG. 1 is a diagram of an exemplary embodiment of a method for synchronizing information;
FIG. 2 is a flow diagram illustrating a method for synchronizing information according to one embodiment;
FIG. 3 is a flowchart illustrating a long-connection creation step in one embodiment;
FIG. 4 is a flowchart illustrating steps performed by the service layer to monitor database instance state information in one embodiment;
FIG. 5 is a flowchart illustrating the database instance creation step in one embodiment;
FIG. 6 is a flowchart illustrating a step of pushing database instance state information between a service layer and a client in one embodiment;
FIG. 7 is a block diagram showing the structure of an information synchronization apparatus according to an embodiment;
FIG. 8 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The information synchronization method provided by the embodiment of the present application may be applied to the service system 100 shown in fig. 1. Where clients 106 communicate with business layer 104 over a network. The data storage system (i.e., the service layer database) may store data needed by the service layer 104. The data storage system may be integrated on a service node of the service layer 104, or may be placed on a cloud or other network server. Specifically, in the service system, when a target service node in the service layer 104 consumes the database instance state information in the message queue, the database instance state information is published to the remote dictionary database redis through the target service node. The database instance state information is changed database instance state information monitored by the service layer 102. Then, based on the preset subscription relationship between each service node and the redis in the service layer 104, the database instance state information stored in the redis is published to each service node. Finally, based on the long connection relationship between each service node and the client 106, the service layer 104 sends the database instance state information to the corresponding client 106.
In one embodiment, as shown in fig. 2, an information synchronization method is provided, which is described by taking the method as an example of being applied to the service system in fig. 1, and includes the following steps:
step 202, when the target service node in the service layer consumes the database instance state information in the message queue, the database instance state information is issued to the remote dictionary database redis through the target service node.
The database instance state information is changed database instance state information monitored by a service layer;
in implementation, a service layer of a service system adopts a cluster deployment mode and comprises a plurality of service nodes, and each service node establishes a subscription relationship with a consumption queue in advance, that is, each service node is set to be in the same topic with a message queue. When data consumption transmission is carried out, based on a priority principle, each database instance state information contained in a message queue can only be consumed by the first service node each time, and other service nodes cannot acquire the database instance state information, so that when a certain target service node (namely the service node which consumes the database instance state information firstly) in a service layer consumes the database instance state information in the message queue, a service system issues the database instance state information to a remote Dictionary database redis (remote Dictionary server).
And step 204, based on the preset subscription relationship between each service node and the redis of the service layer, publishing the database instance state information stored in the redis to each service node.
In implementation, each service node and the redis in the service layer are configured with a subscription relationship in advance, that is, each service node and the redis in the service layer are all maintained in an rdsredisTopic channel, and further, when the redis receives database instance state information transmitted by a message queue, the redis re-publishes the information to all service nodes of the service layer, so that all service nodes in the service layer know the database instance state information.
And step 206, sending the database instance state information to the corresponding client based on the long connection relation between each service node and the client.
In implementation, a long connection relationship is pre-established between the client and the service node of the service layer, wherein the service node configured to establish the long connection relationship of each client is not fixed, reverse proxy can be performed through the proxy server, and a plurality of clients are deployed with different service nodes to determine the long connection relationship according to a load balancing standard. And after the long connection relationship is established between each client and the service node, the received database instance state information is sent to the client with the established long connection based on the synchronized database instance state information among the service nodes.
In the information synchronization method, in a service system, when a target service node in a service layer consumes database instance state information in a message queue, the database instance state information is issued to a remote dictionary database redis through the target service node; then, based on the preset subscription relationship between each service node and the redis in the service layer, the redis database publishes the database instance state information stored in the redis to each service node. And finally, based on the long connection relation between each service node and the client, the service layer sends the state information of the database instance to the corresponding client. By adopting the method, the asynchronous transmission processing of the database instance state information is realized through the transmission middleware of the message queue, the stability of message transmission is enhanced, further, the database instance state information consumed by a certain service node is synchronized to other service nodes of a service layer according to a subscription and release mechanism of redis, and the efficient synchronization of the database instance state information between the service layer and the client is realized through the long connection relationship between each service node and the client.
In one embodiment, as shown in fig. 3, prior to step 102, the method further comprises:
step 302, responding to the long connection establishment request sent by the client, and sending the long connection establishment request to each service node of the service layer through the reverse proxy of the proxy server.
The long connection establishing request carries client identification information corresponding to the client.
In implementation, in a service system, in order to synchronize data information between a client and a service layer, information transmission is implemented in a websocket manner, and the client first sends a websocket long connection creation request. Each service node in the service layer responds to the long connection request sent by the client, and the proxy server reversely proxies the long connection establishment request to a target service node of the service layer. The proxy server may be a nginx server, a Squid server, a Varnish server, an Apache TS server, a haprox server, or the like, and the embodiments of the present application are not limited thereto.
Specifically, the WebSocket transmission form allows the server to actively push data to the client. In the WebSocket API, the browser and the server only need to complete one handshake, and the two directly establish a persistent connection (i.e., a long connection) and perform bidirectional data transmission, so that in the WebSocket method, the client establishes a long connection relationship with each service node in a service layer in a service system in advance, and establishes a long connection relationship between the service node and the service layer, thereby realizing a transmission path of information between the service layer and the client. Therefore, when a plurality of clients synchronously initiate a long connection establishment request, a plurality of long connection establishment requests are subjected to reverse proxy based on a pre-deployed proxy server, and are distributed to each service node of a service layer according to the standard of load balancing, so that each service node responds to the long connection establishment request to establish a long connection relationship.
Step 304, establishing a long connection relationship between each service node and the client, so as to push database instance state information to the client.
In implementation, after receiving a long connection establishment request sent by a client, each service node responds to the long connection establishment request, and establishes a long connection relationship between the node and the corresponding client based on a client identifier, so as to push database instance state information to the client.
In the embodiment, a long connection relation is pre-established between the client and the service node, so that a transmission path is formed among the service layer, the service layer and the client, the service layer can push the database instance state information to the client in real time, and the transmission efficiency of the database instance state information is improved.
In one embodiment, as shown in fig. 4, prior to step 102, the method further comprises:
step 402, monitoring the operation state of each database instance in the service layer database through the service layer.
In implementation, in a service system, configuration information, running state information, and the like of database instances are stored in a database of a service layer, and the service system monitors the running state of each database instance stored in the database of the service layer through the service layer to detect whether the running state of the database instance is updated, for example, the running state information of a certain database instance changes from stop to running.
Step 404, if the operation state of the target database instance in the service layer database changes, the changed database instance state information of the target database instance is sent to a pre-created message queue through the service layer.
In implementation, if the service layer monitors that the running state of the target database instance in the service layer database changes, the service layer sends the changed database instance state information of the target database instance to a pre-created message queue (e.g., RabbitMQ).
The message queue is middleware pre-deployed between a service layer and a service layer of the service system, and the state information of the database instance between the service layer and the service layer is transmitted asynchronously through the message queue.
At step 406, database instance state information is received and stored via the message queue.
In implementation, the service system sends the changed database instance state information of the target database instance (i.e. the database instance with the changed running state) to a pre-created message queue through the service layer. The message queue may be a RabbitMQ message queue, where the RabbitMQ is an open source message agent software (also called message-oriented middleware) that implements Advanced Message Queue Protocol (AMQP), and implements asynchronous transmission of messages between a service layer and a service layer through the RabbitMQ message queue.
In this embodiment, the service layer monitors the running state of each database instance stored in the service layer database, so that if the running state of a certain database instance recorded in the database changes, the service layer can timely sense the change, timely update the changed state information of the database instance and push the updated state information to a middleware (message queue) for information transmission to perform asynchronous processing, and the transmission timeliness of the state information of the database instance is improved.
In one embodiment, as shown in fig. 5, prior to step 402, the method further comprises:
step 502, responding to a database instance creation request sent by a client, and creating a database instance according to configuration parameter information carried in the database instance creation request.
The creating request of the database instance carries configuration parameter information.
In implementation, a user sends a database instance creation request to a service layer through a client based on actual service requirements, wherein the database instance creation request carries configuration parameter information required by creation of a database instance to be created. And then, the service node receiving the creation request in the service layer creates a corresponding database instance according to the configuration parameter information carried in the creation request.
Optionally, the long connection relationship is established between the client and the service node in the service layer, and is not fixed as a one-to-one correspondence relationship, but may be a many-to-one correspondence relationship, that is, a long connection relationship may be established between a plurality of clients and the same service node. Therefore, when the client sends a request for creating the database instance to the corresponding service node, the request for creating also carries the client identifier of the client.
Step 504, store the created database instance to the service layer database.
In implementation, the service node stores the created database instance to the service layer database. The service layer database may record a client identifier, a database instance, a current operating state of the database instance, and the like, and the embodiment of the present application does not limit the database instance information included in the service layer database.
Optionally, the user may also perform operations such as deleting, starting, and stopping on each database instance based on a display page provided by the service system to the client, and the configuration processing of the database instance is not limited in the embodiment of the present application.
In this embodiment, the client sends a database instance creation request to a service node of a service layer, and the service layer in the service system completes creation of the database instance.
In one embodiment, as shown in fig. 6, the specific process of publishing the database instance state information stored in the redis to each service node in step 106 includes the following steps:
step 602, querying and determining the client identifier subscribing to the target transmission channel in the redis.
In implementation, a subscription publishing mechanism exists in the redis database, and the publish subscription (pub/sub) is a message communication mode: the sender (pub) sends a message and the subscriber (sub) receives the message. Therefore, after the target service node sends the database instance state information to the redis, the redis queries and determines the target transmission channel and the corresponding client identifier in each subscription relationship based on the pre-subscription relationship between each service node and the redis.
For example, in order to maintain the subscription transmission relationship between the redis database and each service node, the redis database and each service node may be located in an rdsredisTopic channel (target transmission channel), and the pushing of the database instance state information is realized through the channel, which is not limited in the embodiment of the present application.
Step 604, according to the client identifier, issuing the database instance state information to the client corresponding to the client identifier through the target transmission channel.
In implementation, the redis issues the database instance state information to the client corresponding to the client identifier through the target transmission channel according to the client identifier determined by the query.
In the embodiment of the application, the database instance state information consumed by a certain service node is synchronously issued to other service nodes in a service layer through a subscription and issuance mechanism of a redis database, so that the problem that the database instance state information can be received after long connection is performed between different clients and corresponding different service nodes in the service layer is solved, and information synchronization between the service layer and multiple clients is realized under the condition of cluster deployment.
In one embodiment, the specific processing procedure of step 108 includes the following steps:
and pushing the state information of the database instance to the corresponding client through each service node of the service layer according to the long connection relation between the service node and the client which is created in advance.
In implementation, each service node in the service layer pushes the database instance state information issued by the redis to a corresponding client according to a long connection relation pre-established with the client, so that the client can feed back the updated database instance state information to a user in time.
It should be understood that, although the steps in the flowcharts related to the embodiments as described above are sequentially displayed as indicated by arrows, the steps are not necessarily performed sequentially as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least a part of the steps in the flowcharts related to the embodiments described above may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, and the execution order of the steps or stages is not necessarily sequential, but may be rotated or alternated with other steps or at least a part of the steps or stages in other steps.
Based on the same inventive concept, the embodiment of the present application further provides an information synchronization apparatus for implementing the above-mentioned information synchronization method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme described in the above method, so specific limitations in one or more embodiments of the information synchronization device provided below can be referred to the limitations of the information synchronization method in the foregoing, and details are not described herein again.
In one embodiment, as shown in fig. 7, there is provided an information synchronization apparatus 700 including: a consumption transmission module 710, a publishing module 720 and a sending module 730, wherein:
the consumption transmission module 710 is configured to, when a target service node in the service layer consumes the database instance state information in the message queue, publish the database instance state information to a remote dictionary database redis through the target service node; the database instance state information is the changed database instance state information monitored by the service layer;
the publishing module 720 is configured to publish the database instance state information stored in the redis to each service node based on a preset subscription relationship between each service node and the redis in the service layer;
and a sending module 730, configured to send the database instance state information to the corresponding client based on the long connection relationship between each service node and the client.
By adopting the device, asynchronous transmission processing of database instance state information is realized through a transmission middleware of a message queue, the stability of message transmission is enhanced, further, the database instance state information consumed by a certain service node is synchronized to other service nodes of a service layer according to a subscription and release mechanism of redis, and efficient synchronization of the database instance state information between the service layer and a client is realized through long connection relations between the service nodes and the client.
In one embodiment, the apparatus 700 further comprises:
the request module is used for responding to a long connection establishing request sent by a client, and sending the long connection establishing request to each service node of a service layer through a proxy server reverse proxy; the long connection establishing request carries client identification information corresponding to the client;
and the creating module is used for creating a long connection relation between each service node and the client so as to push database instance state information to the client.
In one embodiment, the apparatus 700 further comprises:
the monitoring module is used for monitoring the running state of each database instance in the service layer database through the service layer;
the transmission module is used for transmitting the changed database instance state information of the target database instance to a pre-established message queue through the service layer if the running state of the target database instance in the service layer database changes;
and the storage module is used for receiving and storing the database instance state information through the message queue.
In one embodiment, the apparatus 700 further comprises:
the system comprises a creating module, a database processing module and a database processing module, wherein the creating module is used for responding to a creating request of a database instance sent by a client and creating the database instance according to configuration parameter information carried in the creating request of the database instance;
and the storage module is used for storing the created database instance to a business layer database.
In one embodiment, the apparatus 700 further comprises:
a determining module, configured to query and determine a client identifier of a pre-subscribed target transmission channel in the redis;
and the publishing module is used for publishing the database instance state information to the client corresponding to the client identification through the target transmission channel according to the client identification.
The modules in the information synchronization device can be wholly or partially realized by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, as shown in FIG. 1, there is provided an information synchronization system 100, the system 100 comprising:
the service layer 102 is used for monitoring whether the running state of each database instance in the service layer changes; if the running state of the target database instance changes, sending the changed state information of the target database instance to a pre-established message queue;
the service layer 104 is used for issuing the database instance state information to the remote dictionary database redis through the target service node when the target service node in the service layer consumes the database instance state information in the message queue; based on a preset subscription relationship between each service node and the redis of the service layer, publishing the database instance state information stored in the redis to each service node; based on the long connection relation between the service node and the client, sending the state information of the database instance to the corresponding client;
and the client 106 is used for creating a database instance and receiving the database instance state information pushed by each service node in the service layer.
In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as shown in fig. 8. The computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the computer device is used for storing data. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement an information synchronization method.
Those skilled in the art will appreciate that the architecture shown in fig. 8 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having a computer program stored therein, the processor implementing the following steps when executing the computer program:
when a target service node in a service layer consumes database instance state information in a message queue, the database instance state information is issued to a remote dictionary database redis through the target service node; the database instance state information is the changed database instance state information monitored by the service layer;
based on a preset subscription relationship between each service node and the redis of the service layer, publishing the database instance state information stored in the redis to each service node;
and sending the database instance state information to the corresponding client based on the long connection relation between each service node and the client.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
responding to a long connection establishment request sent by a client, and sending the long connection establishment request to each service node of a service layer through a proxy server reverse proxy; the long connection establishing request carries client identification information corresponding to the client;
and establishing a long connection relation between each service node and the client so as to push database instance state information to the client.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
monitoring the running state of each database instance in the service layer database through the service layer;
if the running state of the target database instance in the service layer database changes, the changed database instance state information of the target database instance is sent to a pre-established message queue through a service layer;
database instance state information is received and stored via a message queue.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
responding to a database instance creating request sent by a client, and creating a database instance according to configuration parameter information carried in the database instance creating request;
and storing the created database instance to the service layer database.
In one embodiment, the computer program when executed by the processor further performs the steps of:
inquiring and determining a client identifier of a pre-subscribed target transmission channel in the redis;
and according to the client identification, issuing database instance state information to the client corresponding to the client identification through the target transmission channel.
In an embodiment, a computer-readable storage medium is provided, on which a computer program is stored which, when being executed by a processor, carries out the steps of the above-mentioned method embodiments.
In an embodiment, a computer program product is provided, comprising a computer program which, when being executed by a processor, carries out the steps of the above-mentioned method embodiments.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, database, or other medium used in the embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high-density embedded nonvolatile Memory, resistive Random Access Memory (ReRAM), Magnetic Random Access Memory (MRAM), Ferroelectric Random Access Memory (FRAM), Phase Change Memory (PCM), graphene Memory, and the like. Volatile Memory can include Random Access Memory (RAM), external cache Memory, and the like. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), among others. The databases referred to in various embodiments provided herein may include at least one of relational and non-relational databases. The non-relational database may include, but is not limited to, a block chain based distributed database, and the like. The processors referred to in the embodiments provided herein may be general purpose processors, central processing units, graphics processors, digital signal processors, programmable logic devices, quantum computing based data processing logic devices, etc., without limitation.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present application. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present application shall be subject to the appended claims.

Claims (10)

1. A method for synchronizing information, the method comprising:
when a target service node in a service layer consumes database instance state information in a message queue, the database instance state information is issued to a remote dictionary database redis through the target service node; the database instance state information is changed database instance state information monitored by a service layer;
based on preset subscription relations between service nodes of the service layer and the redis, publishing the database instance state information stored in the redis to the service nodes;
and sending the database instance state information to the corresponding client based on the long connection relation between each service node and the client.
2. The method of claim 1, wherein when a target service node in a service layer consumes database instance state information in a message queue, the method further comprises, before publishing the database instance state information into a remote dictionary database redis by the target service node:
responding to a long connection establishment request sent by a client, and sending the long connection establishment request to each service node of a service layer through a proxy server reverse proxy; the long connection establishing request carries client identification information corresponding to the client;
and establishing a long connection relation between each service node and the client so as to push database instance state information to the client.
3. The method of claim 1, wherein when a target service node in a service layer consumes database instance state information in a message queue, the method further comprises, before publishing the database instance state information into a remote dictionary database redis by the target service node:
monitoring the running state of each database instance in the service layer database through the service layer;
if the running state of the target database instance in the service layer database changes, the changed database instance state information of the target database instance is sent to a pre-established message queue through the service layer;
and receiving and storing the database instance state information through the message queue.
4. The method of claim 3, wherein prior to monitoring the operational status of database instances in the service layer database by the service layer, the method further comprises:
responding to a database instance creating request sent by a client, and creating a database instance according to configuration parameter information carried in the database instance creating request;
and storing the created database instance to a service layer database.
5. The method of claim 1, wherein said publishing the database instance state information stored in the redis to the service nodes comprises:
inquiring and determining a client identifier for subscribing a target transmission channel in advance in the redis;
and according to the client identification, issuing database instance state information to a client corresponding to the client identification through the target transmission channel.
6. An information synchronization apparatus, characterized in that the apparatus comprises:
the consumption transmission module is used for releasing the database instance state information to a remote dictionary database redis through a target service node when the target service node in a service layer consumes the database instance state information in a message queue; the database instance state information is changed database instance state information monitored by a service layer;
the publishing module is used for publishing the database instance state information stored in the redis to each service node based on a preset subscription relationship between each service node of the service layer and the redis;
and the sending module is used for sending the database instance state information to the corresponding client based on the long connection relation between each service node and the client.
7. An information synchronization system, the system comprising:
the service layer is used for monitoring whether the running state of each database instance in the service layer changes; if the running state of the target database instance changes, sending the changed state information of the target database instance to a pre-established message queue;
the service layer is used for issuing the database instance state information to a remote dictionary database redis through a target service node when the target service node in the service layer consumes the database instance state information in the message queue; based on preset subscription relations between service nodes of the service layer and the redis, publishing the database instance state information stored in the redis to the service nodes; based on the long connection relation between the service node and the client, the state information of the database instance is sent to the corresponding client;
the client is used for creating a database instance and receiving the database instance state information pushed by each service node in the service layer.
8. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor, when executing the computer program, implements the steps of the method of any of claims 1 to 5.
9. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 5.
10. A computer program product comprising a computer program, characterized in that the computer program realizes the steps of the method of any one of claims 1 to 5 when executed by a processor.
CN202210287295.XA 2022-03-23 2022-03-23 Information synchronization method, apparatus, computer device and storage medium Active CN114827171B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210287295.XA CN114827171B (en) 2022-03-23 2022-03-23 Information synchronization method, apparatus, computer device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210287295.XA CN114827171B (en) 2022-03-23 2022-03-23 Information synchronization method, apparatus, computer device and storage medium

Publications (2)

Publication Number Publication Date
CN114827171A true CN114827171A (en) 2022-07-29
CN114827171B CN114827171B (en) 2023-12-15

Family

ID=82531294

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210287295.XA Active CN114827171B (en) 2022-03-23 2022-03-23 Information synchronization method, apparatus, computer device and storage medium

Country Status (1)

Country Link
CN (1) CN114827171B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115292097A (en) * 2022-08-22 2022-11-04 广州鼎甲计算机科技有限公司 Database instance creation method, database instance creation apparatus, database instance creation device, storage medium, and program product

Citations (19)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080177857A1 (en) * 2007-01-19 2008-07-24 International Business Machines Corporation Autonomic optimization of presence server performance
CN104408132A (en) * 2014-11-28 2015-03-11 北京京东尚科信息技术有限公司 Data push method and system
CN104935658A (en) * 2015-06-17 2015-09-23 交通银行股份有限公司 Bank task allocation method and device
CN106657394A (en) * 2017-02-10 2017-05-10 山东浪潮商用系统有限公司 Equipment information collection system and method based on Internet of Things big data
CN107026917A (en) * 2017-06-16 2017-08-08 智者四海(北京)技术有限公司 The method and system pushed for message
US20180019985A1 (en) * 2016-07-18 2018-01-18 Fugue, Inc. Distributed key/value store system using asynchronous messaging systems
US20180176122A1 (en) * 2016-12-20 2018-06-21 Striim, Inc. Data Stream Processor with Both in Memory and Persisted Messaging
CN108197263A (en) * 2017-12-30 2018-06-22 苏州精易会信息技术有限公司 Method of data synchronization
WO2020062793A1 (en) * 2018-09-29 2020-04-02 平安科技(深圳)有限公司 Message queue-based request processing method, apparatus and device, and storage medium
CN111131501A (en) * 2019-12-31 2020-05-08 郑州信大捷安信息技术股份有限公司 MQTT protocol-based message pushing system and method
CN111241101A (en) * 2020-01-09 2020-06-05 深圳市东深电子股份有限公司 Distributed water conservancy RTU data acquisition system and method
CN111787055A (en) * 2020-05-22 2020-10-16 中国科学院信息工程研究所 Redis-based transaction mechanism and multi-data center oriented data distribution method and system
CN112351068A (en) * 2020-09-29 2021-02-09 苏宁云计算有限公司 Information synchronization method, system, device, computer equipment and storage medium
CN113190778A (en) * 2021-04-30 2021-07-30 深圳壹账通创配科技有限公司 Business data pushing method, system, computer equipment and computer storage medium
CN113382048A (en) * 2021-05-28 2021-09-10 广东好太太智能家居有限公司 Message pushing method, system, equipment and storage medium
CN113452774A (en) * 2021-06-25 2021-09-28 睿视(苏州)视频科技有限公司 Message pushing method, device, equipment and storage medium
CN113867958A (en) * 2021-09-29 2021-12-31 浪潮通用软件有限公司 Method, device and equipment for pushing task corner mark and readable medium
CN114024972A (en) * 2021-10-28 2022-02-08 平安科技(深圳)有限公司 Long connection communication method, system, device, equipment and storage medium
CN114039961A (en) * 2021-10-08 2022-02-11 中移(杭州)信息技术有限公司 Message pushing method, device, server and storage medium based on WebSocket

Patent Citations (19)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080177857A1 (en) * 2007-01-19 2008-07-24 International Business Machines Corporation Autonomic optimization of presence server performance
CN104408132A (en) * 2014-11-28 2015-03-11 北京京东尚科信息技术有限公司 Data push method and system
CN104935658A (en) * 2015-06-17 2015-09-23 交通银行股份有限公司 Bank task allocation method and device
US20180019985A1 (en) * 2016-07-18 2018-01-18 Fugue, Inc. Distributed key/value store system using asynchronous messaging systems
US20180176122A1 (en) * 2016-12-20 2018-06-21 Striim, Inc. Data Stream Processor with Both in Memory and Persisted Messaging
CN106657394A (en) * 2017-02-10 2017-05-10 山东浪潮商用系统有限公司 Equipment information collection system and method based on Internet of Things big data
CN107026917A (en) * 2017-06-16 2017-08-08 智者四海(北京)技术有限公司 The method and system pushed for message
CN108197263A (en) * 2017-12-30 2018-06-22 苏州精易会信息技术有限公司 Method of data synchronization
WO2020062793A1 (en) * 2018-09-29 2020-04-02 平安科技(深圳)有限公司 Message queue-based request processing method, apparatus and device, and storage medium
CN111131501A (en) * 2019-12-31 2020-05-08 郑州信大捷安信息技术股份有限公司 MQTT protocol-based message pushing system and method
CN111241101A (en) * 2020-01-09 2020-06-05 深圳市东深电子股份有限公司 Distributed water conservancy RTU data acquisition system and method
CN111787055A (en) * 2020-05-22 2020-10-16 中国科学院信息工程研究所 Redis-based transaction mechanism and multi-data center oriented data distribution method and system
CN112351068A (en) * 2020-09-29 2021-02-09 苏宁云计算有限公司 Information synchronization method, system, device, computer equipment and storage medium
CN113190778A (en) * 2021-04-30 2021-07-30 深圳壹账通创配科技有限公司 Business data pushing method, system, computer equipment and computer storage medium
CN113382048A (en) * 2021-05-28 2021-09-10 广东好太太智能家居有限公司 Message pushing method, system, equipment and storage medium
CN113452774A (en) * 2021-06-25 2021-09-28 睿视(苏州)视频科技有限公司 Message pushing method, device, equipment and storage medium
CN113867958A (en) * 2021-09-29 2021-12-31 浪潮通用软件有限公司 Method, device and equipment for pushing task corner mark and readable medium
CN114039961A (en) * 2021-10-08 2022-02-11 中移(杭州)信息技术有限公司 Message pushing method, device, server and storage medium based on WebSocket
CN114024972A (en) * 2021-10-28 2022-02-08 平安科技(深圳)有限公司 Long connection communication method, system, device, equipment and storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
李洋;: "基于消息队列遥测传输协议的智能家居消息中间件设计", 计算机应用, no. 1 *
王苗苗;: "基于分布式架构的光伏电站远程监测系统设计", 西安航空学院学报, no. 05 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115292097A (en) * 2022-08-22 2022-11-04 广州鼎甲计算机科技有限公司 Database instance creation method, database instance creation apparatus, database instance creation device, storage medium, and program product

Also Published As

Publication number Publication date
CN114827171B (en) 2023-12-15

Similar Documents

Publication Publication Date Title
US9191463B2 (en) Stream processing using a client-server architecture
US20100100626A1 (en) Methods and apparatus related to inter-widget interactions managed by a client-side master
CN102333029B (en) Routing method in server cluster system
CN112069265B (en) Synchronization method of configuration data, business data system, computer system and medium
US20160261480A1 (en) Client-side fault tolerance in a publish-subscribe system
CN108353020A (en) System and method for transmitting message data
US7970856B2 (en) System and method for managing and distributing assets over a network
US10579595B2 (en) Method and device for calling a distributed file system
CN108370346A (en) System and method for storing and transmitting message data
US20180248825A1 (en) Selective distribution of messages in a scalable, real-time messaging system
US20150363340A1 (en) Providing multiple synchronous serial console sessions using data buffering
CN108093015B (en) File transmission system
CN109783151B (en) Method and device for rule change
CA2923896C (en) Email webclient notification queuing
US10447623B2 (en) Data storage systems and methods using a real-time messaging system
CN110837423A (en) Method and device for automatically acquiring data of guided transport vehicle
CN112351068A (en) Information synchronization method, system, device, computer equipment and storage medium
CN114827171B (en) Information synchronization method, apparatus, computer device and storage medium
CN111460038A (en) Quasi-real-time data synchronization method and device
CN110798495B (en) Method and server for end-to-end message push in cluster architecture mode
CN112838935A (en) Electronic data exchange method and system
US9137331B2 (en) Adaptive replication
CN110324384B (en) Data pushing method and device
WO2017040604A1 (en) Systems and methods for remote network topology discovery
WO2019227473A1 (en) Method and apparatus for performing communication in internet of things

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant