CN114827171B - Information synchronization method, apparatus, computer device and storage medium - Google Patents

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

Info

Publication number
CN114827171B
CN114827171B CN202210287295.XA CN202210287295A CN114827171B CN 114827171 B CN114827171 B CN 114827171B CN 202210287295 A CN202210287295 A CN 202210287295A CN 114827171 B CN114827171 B CN 114827171B
Authority
CN
China
Prior art keywords
database instance
state information
client
service node
database
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.)
Active
Application number
CN202210287295.XA
Other languages
Chinese (zh)
Other versions
CN114827171A (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

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 present application relates to an information synchronization method, apparatus, computer device, storage medium and 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 target service node issues the database instance state information to a remote dictionary database redis; the database instance state information is changed database instance state information monitored by the service layer; based on a preset subscription relation between each service node of the service layer and the redis, publishing the database instance state information stored in the redis to each service node; and transmitting 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 efficient synchronization of the database instance state information between the service layer and the client is realized.

Description

Information synchronization method, apparatus, computer device and storage medium
Technical Field
The present application relates to the field of internet technology, and in particular, to an information synchronization method, an apparatus, a computer device, a storage medium, and a computer program product.
Background
In the service system, when the service layer creates a database instance, information synchronization needs to be performed between state information generated by creating the database instance and the client so as to ensure that a user knows the running state of the current service layer.
The current information synchronization method between the service layer and the client is mainly implemented in a service system deployed by a single node, namely, a unique long connection relationship is established between the service layer and the single node service layer as well as between the service layer and the single client, and then, based on the unique long connection relationship, the service layer pushes state information generated by creating a database instance to a corresponding unique client through the single service node (service layer) to complete data message transmission of the long connection.
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 to perform 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 foregoing, it is desirable to provide an information synchronization method, apparatus, computer device, computer readable storage medium, and computer program product.
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 target service node issues the database instance state information to a remote dictionary database redis; the database instance state information is changed database instance state information monitored by the service layer;
based on a preset subscription relation between each service node of the service layer and the redis, publishing the database instance state information stored in the redis to each service node;
and transmitting 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 message queue as a transmission middleware, the stability of message transmission is enhanced, and furthermore, the database instance state information consumed by a certain service node is synchronized to other service nodes of the service layer according to the subscription and release mechanism of redis, and the high-efficiency 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, when the target service node in the service layer consumes the database instance state information in the message queue, before the target service node issues the database instance state information to the remote dictionary database redis, the method further includes:
responding to a long connection creation request sent by a client, and reversely acting through an acting server to send the long connection creation request to each service node of a service layer; the long connection creation request carries client identification information corresponding to the client;
and establishing a long connection relation between each service node and the client side, so as to be used for pushing database instance state information to the client side.
In this embodiment, a long connection relationship 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, and further, 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, when the target service node in the service layer consumes the database instance state information in the message queue, before the target service node issues the database instance state information to the remote dictionary database redis, the method further includes:
Monitoring the running state of each database instance in the business layer database through the service layer;
if the running state of the target database instance in the service layer database is changed, 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, timely update and push the state information of the changed database instance to the middleware (message queue) for asynchronous processing, and the timeliness of transmitting the state information of the database instance is improved.
In one embodiment, before the monitoring, by the service layer, the running state of each database instance in the service layer database, the method further includes:
responding to a creation request of a database instance sent by a client, and creating the database instance according to configuration parameter information carried in the creation request of the database instance;
And storing the created database instance to a business layer database.
In this embodiment, the client sends a database instance creation request to the service node of the 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 of a pre-subscribed target transmission channel in the redis;
and according to the client identifier, releasing database instance state information to the client corresponding to the client identifier through the target transmission channel.
In the embodiment of the application, through the subscription and release mechanism of the redis database, the database instance state information consumed by a certain service node is subjected to the subscription and release processing of the redis and is synchronously transmitted to other service nodes in the service layer, so that the problem that the database instance state information can be received after different clients are connected with corresponding different service nodes in the service layer for a long time is solved, and the information synchronization between the service layer and multiple clients is realized under the cluster deployment condition.
In a second aspect, the application further provides an information synchronization device. The device comprises:
the consumption transmission module is used for publishing 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 a message queue; the database instance state information is changed database instance state information monitored by the 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 relation 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, the asynchronous transmission processing of the database instance state information is realized through the message queue as a transmission middleware, the stability of message transmission is enhanced, and furthermore, according to the subscription and release mechanism of redis, the database instance state information consumed by a certain service node is synchronized to other service nodes of the service layer, and the high-efficiency 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 third aspect, the 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 or not; if the running state of the target database instance changes, sending the changed state information of the target database instance to a pre-created message queue;
the service layer is configured to issue, when a target service node in the service layer consumes the database instance state information in the message queue, the database instance state information to a remote dictionary database redis through the target service node; based on a preset subscription relation between each service node of the service layer and the redis, 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, the database instance state information is sent to the corresponding client;
the client is used for creating a database instance and receiving the state information of the database instance pushed by each service node in the service layer.
By adopting the system, asynchronous transmission processing of the database instance state information is realized through the message queue as a transmission middleware, the stability of message transmission is enhanced, further, according to a subscription and release mechanism of redis, the database instance state information consumed by a certain service node is synchronized to other service nodes of the service layer, and through a long connection relationship between each service node and a client, the efficient synchronization of the database instance state information between the service layer and the client is realized.
In a fourth aspect, the present application also provides a computer device. The computer device comprises a memory storing a computer program and a processor which when executing the computer program performs the steps of:
when a target service node in a service layer consumes database instance state information in a message queue, the target service node issues the database instance state information to a remote dictionary database redis; the database instance state information is changed database instance state information monitored by the service layer;
based on a preset subscription relation between each service node of the service layer and the redis, publishing the database instance state information stored in the redis to each service node;
and transmitting 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 also 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 target service node issues the database instance state information to a remote dictionary database redis; the database instance state information is changed database instance state information monitored by the service layer;
based on a preset subscription relation between each service node of the service layer and the redis, publishing the database instance state information stored in the redis to each service node;
and transmitting 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 also provides a computer program product. The computer program product comprises a computer program which, when executed by a processor, implements the steps of:
when a target service node in a service layer consumes database instance state information in a message queue, the target service node issues the database instance state information to a remote dictionary database redis; the database instance state information is changed database instance state information monitored by the service layer;
Based on a preset subscription relation between each service node of the service layer and the redis, publishing the database instance state information stored in the redis to each service node;
and transmitting the database instance state information to the corresponding client based on the long connection relation between each service node and the client.
The information synchronization method, the information synchronization device, the computer equipment, the storage medium and the computer program product are used for publishing 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 the service layer; based on a preset subscription relation between each service node of the service layer and the redis, publishing the database instance state information stored in the redis to each service node; and transmitting 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 message queue as a transmission middleware, the stability of message transmission is enhanced, and furthermore, the database instance state information consumed by a certain service node is synchronized to other service nodes of the service layer according to the subscription and release mechanism of redis, and the high-efficiency 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.
Drawings
FIG. 1 is a diagram of an application environment for a method of information synchronization in one embodiment;
FIG. 2 is a flow diagram of a method of information synchronization in one embodiment;
FIG. 3 is a flow chart of a long connection creation step in one embodiment;
FIG. 4 is a flowchart illustrating steps performed by a service layer to monitor database instance state information in one embodiment;
FIG. 5 is a flow diagram of database instance creation steps in one embodiment;
FIG. 6 is a flowchart illustrating a database instance status information pushing step between a business layer and a client in one embodiment;
FIG. 7 is a block diagram of an information synchronization device in one embodiment;
fig. 8 is an internal structural diagram of a computer device in one embodiment.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
The information synchronization method provided by the embodiment of the application can be applied to the information synchronization system 100 shown in fig. 1. Wherein the client 106 communicates with the business layer 104 via a network. The data storage system (i.e., business layer database) may store data required by business 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 the 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 by the target service node. The database instance state information is database instance state information monitored by the service layer 102 and changed. Then, based on the preset subscription relationship between each service node of the service layer 104 and the redis, 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, and the method is applied to the service system in fig. 1 for illustration, 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 target service node issues the database instance state information to the remote dictionary database redis.
The database instance state information is changed database instance state information monitored by the service layer;
in implementation, a service layer of the 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, namely, each service node is set to be kept at the same topic with a message queue. When data consumption transmission is performed, based on a priority principle, each database instance state information contained in the message queue can only be consumed by the first service node each time, and other service nodes can not acquire the database instance state information, so when a certain target service node in the service layer (namely, the service node which consumes the database instance state information first) consumes the database instance state information in the message queue, the service system issues the database instance state information to the remote dictionary database redis (Remote Dictionary Server).
Step 204, based on the preset subscription relation between each service node and redis of the service layer, publishing the database instance state information stored in redis to each service node.
In implementation, each service node and redis in the service layer are preconfigured with a subscription relationship, that is, each service node and redis in the service layer are kept in rdsRedis Topic channel, and further, when the redis receives the database instance state information transmitted by the message queue, the redis reissues the information to all service nodes in the service layer, so that each service node in the service layer can obtain the database instance state information.
And step 206, based on the long connection relation between each service node and the client, transmitting the database instance state information to the corresponding 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 of each client configured with the long connection relationship is not fixed, and the reverse proxy can be performed through the proxy server, so that a plurality of clients can allocate and determine the long connection relationship with different service nodes according to the load balancing standard. After each client establishes a long connection relation with the service node, the received database instance state information is sent to the client which establishes the long connection based on the synchronized database instance state information among the service nodes.
In the above information synchronization method, in the service system, when a target service node in the service layer consumes the database instance state information in the message queue, the target service node issues the database instance state information to a remote dictionary database redis; then, based on the preset subscription relation between each service node and redis of 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 database instance state information to the corresponding client. By adopting the method, the asynchronous transmission processing of the database instance state information is realized through the message queue as a transmission middleware, the stability of message transmission is enhanced, and furthermore, the database instance state information consumed by a certain service node is synchronized to other service nodes of the service layer according to the subscription and release mechanism of redis, and the high-efficiency 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:
In step 302, in response to the long connection creation request sent by the client, the long connection creation request is sent to each service node of the service layer by the proxy server reverse proxy.
The long connection creation request carries client identification information corresponding to the client.
In implementation, in a service system, in order to realize synchronization of data information between a client and a service layer, information transmission is realized in a websocket mode, and the client firstly 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 sends the long connection creation request to the target service node of the service layer through the proxy server reverse proxy. The proxy server may be an nginx server, an Squid server, a varish server, an Apache TS server, a HAProxy server, etc., which is not limited in the embodiment of the present application.
Specifically, webSocket transmission format allows a server to actively push data to a client. In the WebSocket API, the browser and the server only need to complete one handshake, and can directly create a persistent connection (i.e., a long connection) between the two and perform bidirectional data transmission, so in the WebSocket method, the client side establishes a long connection relationship with each service node in a service layer in the service system in advance, and a long connection relationship is established between the service node and the service layer, thereby realizing a transmission path of information between the service layer and the client side. When the multi-client synchronously initiates the long connection creation request, the reverse proxy is performed on the long connection creation requests based on the pre-deployed proxy server, and the long connection creation requests are distributed to the service nodes of the service layer according to the standard of load balancing, so that the service nodes respond to the long connection creation request to perform long connection relation creation.
Step 304, a long connection relationship between each service node and the client is established, so as to be used for pushing database instance state information to the client.
In implementation, after receiving a long connection creation request sent by a client, each service node responds to the long connection creation request, and establishes a long connection relationship between the service node and a corresponding client based on a client identifier, so as to be used for pushing database instance state information to the client.
In this embodiment, a long connection relationship 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, and further, 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 running state of each database instance in the business layer database through the service layer.
In an implementation, in a service system, configuration information, running state information and the like of a database instance are stored in a database of a service layer, the service system monitors running states of all database instances stored in the database of the service layer through a service layer, and detects whether the running states are updated, for example, running state information of a certain database instance is changed from stop to running.
Step 404, if the running state of the target database instance is changed in the service layer database, the changed database instance state information of the target database instance is sent to the pre-created message queue through the service layer.
In an implementation, if the service layer monitors that the running state of the target database instance in the service layer database is changed, the service layer sends the changed database instance state information of the target database instance to a pre-created message queue (for example, rabbitMQ).
The message queue is a pre-deployed middleware between a service layer and a service layer of the service system, and the database instance state information between the service layer and the service layer is transmitted asynchronously through the message queue.
Step 406, receiving and storing database instance state information via the message queue.
In implementation, the service system sends the database instance state information after the change of the target database instance (i.e. the database instance with the running state change) to a pre-created message queue through the service layer. The message queue may be a rabitmq message queue, which is open source message proxy software (also referred to as message oriented middleware) implementing Advanced Message Queue Protocol (AMQP), through which asynchronous transmission of service layer and service layer messages is implemented.
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, timely update and push the state information of the changed database instance to the middleware (message queue) for asynchronous processing, and the timeliness of transmitting 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 creation request of a database instance sent by a client, and creating the database instance according to configuration parameter information carried in the creation request of the database instance.
The database instance creation request carries configuration parameter information.
In implementation, a user sends a creation request of a database instance to a service layer through a client based on actual service requirements, wherein the creation request of the database instance carries configuration parameter information required for creating the database instance to be created. Then, the service node in the service layer receives the creation request, and creates a corresponding database instance according to the configuration parameter information carried in the creation request.
Optionally, because the client establishes a long connection relationship with a service node in the service layer, the long connection relationship is not fixed as a one-to-one correspondence relationship, but can be a many-to-one correspondence relationship, that is, a plurality of clients can all establish a long connection relationship with the same service node. Therefore, when the client sends a creation request of the database instance to the corresponding service node, the creation request also carries the client identifier of the client.
Step 504, the created database instance is stored to the business layer database.
In an implementation, the service node stores the created database instance to the service layer database. The service layer database can record the client identifier, the database instance, the current running state of the database instance, and the like.
Optionally, the user may delete, start and stop each database instance based on the display page provided by the service system to the client, and the embodiment of the present application does not limit the configuration processing of the database instance.
In this embodiment, the client sends a database instance creation request to the service node of the 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 redis to each service node in step 106 includes the following steps:
step 602, querying and determining a client identifier of a pre-subscribed target transmission channel in redis.
In implementation, there is a subscription publishing mechanism in the redis database, which is a messaging 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 the present application, in order to maintain the subscription transmission relationship between the redis database and each service node, a rdsRedis Topic channel (target transmission channel) may be set between the redis database and each service node, and the pushing of the database instance state information is implemented through the channel, which is not limited to the embodiment of the present application.
Step 604, according to the client identifier, the database instance state information is issued to the client corresponding to the client identifier through the target transmission channel.
In the implementation, redis issues database instance state information to a client corresponding to the client identifier through a target transmission channel according to the client identifier determined by the query.
In the embodiment of the application, through the subscription and release mechanism of the redis database, the database instance state information consumed by a certain service node is subjected to the subscription and release processing of the redis and is synchronously transmitted to other service nodes in the service layer, so that the problem that the database instance state information can be received after different clients are connected with corresponding different service nodes in the service layer for a long time is solved, and the information synchronization between the service layer and multiple clients is realized under the cluster deployment condition.
In one embodiment, the specific process of step 108 includes the steps of:
and pushing the database instance state information to the corresponding client through each service node of the service layer according to the pre-established long connection relation between the service node and the client.
In the implementation, each service node in the service layer pushes the database instance state information issued by redis to the corresponding client according to the long connection relation pre-established with the client, so that the client timely feeds back the updated database instance state information to the user.
It should be understood that, although the steps in the flowcharts related to the embodiments described above are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Based on the same inventive concept, the embodiment of the application also provides an information synchronization device for realizing the above related information synchronization method. The implementation of the solution provided by the device is similar to the implementation described in the above method, so the specific limitation in one or more embodiments of the information synchronization device provided below may refer to the limitation of the information synchronization method hereinabove, and will not be repeated herein.
In one embodiment, as shown in fig. 7, there is provided an information synchronization apparatus 700 including: a consumption transmission module 710, a publication module 720, and a sending module 730, wherein:
the consumption transmission module 710 is configured to issue, when a target service node in the service layer consumes the database instance state information in the message queue, 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, to each service node, database instance state information stored in a redis based on a subscription relationship preset between each service node and the redis of the service layer;
and the sending module 730 is configured to send the database instance status information to the corresponding client based on the long connection relationship between each service node and the client.
By adopting the device, the asynchronous transmission processing of the database instance state information is realized through the message queue as a transmission middleware, the stability of message transmission is enhanced, and furthermore, according to the subscription and release mechanism of redis, the database instance state information consumed by a certain service node is synchronized to other service nodes of the service layer, and the high-efficiency 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, the apparatus 700 further comprises:
the request module is used for responding to a long connection creation request sent by the client and sending the long connection creation request to each service node of the service layer through a proxy server reverse proxy; the long connection creation request carries client identification information corresponding to the client;
the creation module is used for creating a long connection relation between each service node and the client and pushing 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 business 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 is changed in the service layer database;
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 creation module is used for responding to a creation request of the database instance sent by the client and creating the database instance according to the configuration parameter information carried in the creation 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 target transmission channel subscribed in advance in the redis;
and the publishing module is used for publishing the database instance state information to the client corresponding to the client identifier through the target transmission channel according to the client identifier.
The modules in the information synchronization device may be implemented in whole or in part by software, hardware, or a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, as shown in FIG. 1, an information synchronization system 100 is provided, 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 is changed, sending the state information of the changed target database instance to a pre-created message queue;
A service layer 104, configured to issue, when a target service node in the service layer consumes the database instance state information in the message queue, the database instance state information to a remote dictionary database redis through the target service node; based on a preset subscription relation between each service node and 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 database instance state information to the corresponding client;
and the client 106 is used for creating a database instance and receiving the state information of the database instance pushed by each service node in the service layer.
In one embodiment, a computer device is provided, which may be a server, and the internal structure of which 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, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer device is 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.
It will be appreciated by those skilled in the art that the structure shown in FIG. 8 is merely a block diagram of some of the structures associated with the present inventive arrangements and is not limiting of the computer device to which the present inventive arrangements may be applied, and that a particular computer device may include more or fewer components than shown, or may combine some of the 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 stored therein a computer program, the processor when executing the computer program performing the steps of:
when a target service node in the service layer consumes the database instance state information in the message queue, the target service node issues the database instance state information to a remote dictionary database redis; the database instance state information is the changed database instance state information monitored by the service layer;
based on a preset subscription relation between each service node and 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 each service node and the client, the database instance state information is sent to the corresponding client.
In one embodiment, the processor when executing the computer program further performs the steps of:
responding to a long connection creation request sent by a client, and reversely acting through an agent server to send the long connection creation request to each service node of a service layer; the long connection creation request carries client identification information corresponding to the client;
and establishing a long connection relation between each service node and the client for pushing the 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 business layer database through the service layer;
if the running state of the target database instance in the service layer database is changed, the changed database instance state information of the target database instance is sent to a pre-established message queue through the 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 creation request of a database instance sent by a client, and creating the database instance according to configuration parameter information carried in the creation request of the database instance;
And storing the created database instance to a business 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 redis;
and according to the client identifier, releasing database instance state information to the client corresponding to the client identifier through the target transmission channel.
In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored which, when executed by a processor, carries out the steps of the method embodiments described above.
In an embodiment, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the steps of the method embodiments described above.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in 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 (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (Ferroelectric Random Access Memory, FRAM), phase change Memory (Phase Change Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like. The databases referred to in the embodiments provided herein may include at least one of a relational database and a non-relational database. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processor referred to in the embodiments provided in the present application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, or the like, but is not limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The foregoing examples illustrate only a few embodiments of the application and are described in detail herein without thereby limiting the scope of the application. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of the application should be assessed as that of the appended claims.

Claims (10)

1. An information synchronization method, characterized in that the method comprises:
the method comprises the steps of sending database instance state information of a changed target database instance to a pre-established message queue through a service layer, and receiving and storing the database instance state information through the message queue;
when a target service node in a service layer consumes database instance state information in a message queue, the target service node issues the database instance state information to a remote dictionary database redis; the database instance state information is changed database instance state information monitored by the service layer;
Based on a preset subscription relation between each service node of the service layer and the redis, publishing the database instance state information stored in the redis to each service node;
and transmitting 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, before publishing the database instance state information to a remote dictionary database redis by the target service node, the method further comprises:
responding to a long connection creation request sent by a client, and reversely acting through an acting server to send the long connection creation request to each service node of a service layer; the long connection creation request carries client identification information corresponding to the client;
and establishing a long connection relation between each service node and the client side, so as to be used for pushing database instance state information to the client side.
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, before publishing the database instance state information to a remote dictionary database redis by the target service node, the method further comprises:
Monitoring the running state of each database instance in the business layer database through the service layer;
and if the running state of the target database instance in the service layer database is changed, executing the step of sending the changed database instance state information of the target database instance to a pre-created message queue through a service layer.
4. A method according to claim 3, wherein before monitoring the running state of each database instance in the service layer database by the service layer, the method further comprises:
responding to a creation request of a database instance sent by a client, and creating the database instance according to configuration parameter information carried in the creation request of the database instance;
and storing the created database instance to a business layer database.
5. The method of claim 1, wherein said publishing said database instance state information stored in said redis to said service nodes comprises:
inquiring and determining a client identifier of a pre-subscribed target transmission channel in the redis;
and according to the client identifier, releasing database instance state information to the client corresponding to the client identifier through the target transmission channel.
6. An information synchronization device, the device comprising:
the storage module is used for sending the database instance state information of the changed target database instance to a pre-established message queue through a service layer, and receiving and storing the database instance state information through the message queue;
the consumption transmission module is used for publishing 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 a message queue; the database instance state information is changed database instance state information monitored by the 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 relation 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. The apparatus of claim 6, wherein the apparatus further comprises:
The request module is used for responding to a long connection creation request sent by the client and sending the long connection creation request to each service node of the service layer through a proxy server reverse proxy; the long connection creation request carries client identification information corresponding to the client;
the creation module is used for creating a long connection relation between each service node and the client and pushing database instance state information to the client.
8. 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 or not; if the running state of the target database instance changes, the changed database instance state information of the target database instance is sent to a pre-established message queue, so that the database instance state information is received and stored through the message queue;
the service layer is configured to issue, when a target service node in the service layer consumes the database instance state information in the message queue, the database instance state information to a remote dictionary database redis through the target service node; based on a preset subscription relation between each service node of the service layer and the redis, 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, the database instance state information is sent to the corresponding client;
The client is used for creating a database instance and receiving the state information of the database instance pushed by each service node in the service layer.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any one of claims 1 to 5 when the computer program is executed.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 5.
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 CN114827171A (en) 2022-07-29
CN114827171B true 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)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115292097B (en) * 2022-08-22 2023-05-23 广州鼎甲计算机科技有限公司 Database instance creation method, apparatus, device, storage medium, and program product
CN117271152A (en) * 2023-09-04 2023-12-22 中电金信软件有限公司 Registration and query method for application instance information

Citations (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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
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

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8700759B2 (en) * 2007-01-19 2014-04-15 International Business Machines Corporation Autonomic optimization of presence server performance
WO2018017602A1 (en) * 2016-07-18 2018-01-25 Fugue, Inc. Distributed key/value store system using asynchronous messaging systems
US10601915B2 (en) * 2016-12-20 2020-03-24 Striim, Inc. Data stream processor with both in memory and persisted messaging

Patent Citations (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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
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
基于分布式架构的光伏电站远程监测系统设计;王苗苗;;西安航空学院学报(第05期);全文 *
基于消息队列遥测传输协议的智能家居消息中间件设计;李洋;;计算机应用(S1);全文 *

Also Published As

Publication number Publication date
CN114827171A (en) 2022-07-29

Similar Documents

Publication Publication Date Title
CN114827171B (en) Information synchronization method, apparatus, computer device and storage medium
RU2471227C2 (en) Peer-to-peer synchronisation assisted with service unit
US9277030B2 (en) Stream processing using a client-server architecture
US9722862B2 (en) Computer system to support failover in an event stream processing system
US20100100626A1 (en) Methods and apparatus related to inter-widget interactions managed by a client-side master
US10579595B2 (en) Method and device for calling a distributed file system
JP2017037666A (en) Sending category information
CA3131954C (en) Information synchronization method, system, apparatus, computer device and storage medium
CA2923896C (en) Email webclient notification queuing
CN110837423A (en) Method and device for automatically acquiring data of guided transport vehicle
WO2019227473A1 (en) Method and apparatus for performing communication in internet of things
CN106899605B (en) Communication method and device based on STOMP protocol
US10545667B1 (en) Dynamic data partitioning for stateless request routing
CN111460038A (en) Quasi-real-time data synchronization method and device
JP6621075B2 (en) Resource acquisition method and apparatus
CN112865927B (en) Message delivery verification method, device, computer equipment and storage medium
CN117176796A (en) Message pushing method, device, computer equipment and storage medium
CN110380967B (en) SSE technology-based server message pushing method
CN112052104A (en) Message queue management method based on multi-computer-room realization and electronic equipment
CN116192927A (en) Data transmission method and device based on SaaS service, computer equipment and medium
CN115695532A (en) Method, device and computer equipment for processing message by message middleware
CN103067419A (en) Distributed type file system and method of controlling file storage in distributed type file system
US20200364009A1 (en) Distributing statuses
CN114979162B (en) Node deployment method and network system
CN115529288B (en) Message pushing method, device and computer equipment

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