CN113472727B - Data synchronization method and device, electronic equipment and storage medium - Google Patents

Data synchronization method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN113472727B
CN113472727B CN202010246629.XA CN202010246629A CN113472727B CN 113472727 B CN113472727 B CN 113472727B CN 202010246629 A CN202010246629 A CN 202010246629A CN 113472727 B CN113472727 B CN 113472727B
Authority
CN
China
Prior art keywords
data
message
cpu
synchronization
data synchronization
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
CN202010246629.XA
Other languages
Chinese (zh)
Other versions
CN113472727A (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.)
BEIJING ZHONGKE WANGWEI INFORMATION TECHNOLOGY CO LTD
Original Assignee
BEIJING ZHONGKE WANGWEI INFORMATION TECHNOLOGY 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 BEIJING ZHONGKE WANGWEI INFORMATION TECHNOLOGY CO LTD filed Critical BEIJING ZHONGKE WANGWEI INFORMATION TECHNOLOGY CO LTD
Priority to CN202010246629.XA priority Critical patent/CN113472727B/en
Publication of CN113472727A publication Critical patent/CN113472727A/en
Application granted granted Critical
Publication of CN113472727B publication Critical patent/CN113472727B/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
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
    • H04L69/161Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields
    • H04L69/162Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields involving adaptations of sockets based mechanisms

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The embodiment of the invention discloses a data synchronization method, a data synchronization device, electronic equipment and a storage medium, wherein the data synchronization method comprises the following steps: after receiving the data synchronization message, the internal network CPU generates a request data synchronization message based on the data synchronization message and sends the request data synchronization message to the external network CPU; after receiving a response message sent by an outer network CPU, the inner network CPU generates a synchronous data message and sends the synchronous data message to the outer network CPU, so that the outer network CPU carries out data synchronization based on the synchronous data message. The invention can effectively improve the data security.

Description

Data synchronization method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a data synchronization method and apparatus, an electronic device, and a storage medium.
Background
In a mobile communication system, data synchronization between an intranet and an extranet is usually required to be realized through data communication between the intranet and the extranet, so as to ensure that data of the intranet and the extranet are consistent in real time.
At present, data synchronization between the intranet and the extranet is usually realized by realizing data communication between the intranet management device and the extranet management device, that is, the intranet management device operates an intranet system, the extranet management device operates an extranet system, and the intranet system and the extranet system have no correlation therebetween, and respectively manage the intranet or the extranet. Meanwhile, data communication between the intranet management device and the extranet management device is usually realized through a switch in a way of IP (Internet Protocol) route lookup, so as to perform data synchronization between the intranet and the extranet.
In the prior art, when data synchronization between an intranet and an extranet is realized, network connection is needed, so that the possibility of message interception and decryption exists, and the data security is low.
Disclosure of Invention
Due to the technical problems, embodiments of the present invention provide a data synchronization method and apparatus, an electronic device, and a storage medium.
In a first aspect, an embodiment of the present invention provides a data synchronization method, including:
after receiving the data synchronization message, the internal network CPU generates a request data synchronization message based on the data synchronization message and sends the request data synchronization message to the external network CPU;
and after receiving a response message sent by the outer network CPU, the inner network CPU generates a synchronous data message and sends the synchronous data message to the outer network CPU, so that the outer network CPU carries out data synchronization based on the synchronous data message.
Optionally, the method further includes:
the method comprises the steps that an intranet CPU monitors connection of a client through a socket, after a target process of the client and the intranet CPU establish socket connection successfully, the target process sends data synchronization information to the intranet CPU through the socket connection, and the data synchronization information comprises data to be synchronized.
Optionally, the generating a request data synchronization packet based on the data synchronization message includes:
determining the data length of the data to be synchronized based on the data synchronization message, and generating a request data synchronization message based on the data length of the data to be synchronized;
before receiving the response message sent by the outer network CPU, the inner network CPU further comprises:
the external network CPU acquires the data length of the data to be synchronized based on the request data synchronization message, and determines a target memory space based on the data length of the data to be synchronized; the target memory space is used for storing the data to be synchronized;
and the outer network CPU generates a response message corresponding to the request data synchronization message and sends the response message to the inner network CPU through an outer right interface of the outer network CPU.
Optionally, the sending the request data synchronization packet to an external network CPU includes:
and the intranet CPU sends the request data synchronous message to an outer left interface of the outer network CPU through an inner left interface, so that the outer network CPU receives the request data synchronous message through the outer left interface.
Optionally, the generating the synchronous data packet includes:
the intranet CPU obtains data to be synchronized in the data synchronization message, and divides the data to be synchronized according to a preset division unit to generate a plurality of sub data packets corresponding to the data to be synchronized;
distributing a sequence number for each sub-data packet according to the sequence of the division, wherein the distribution of the sequence numbers is distributed according to the sequence of the sequence numbers from small to large;
and generating a synchronous data message based on each sub data packet of the data to be synchronized and the corresponding sequence number of each sub data packet.
Optionally, the data synchronization performed by the external network CPU based on the synchronous data packet includes:
and the external network CPU acquires each sub data packet in the synchronous data message and a sequence number corresponding to each sub data packet, and stores each sub data packet in the target memory space according to the sequence number corresponding to each sub data packet.
Optionally, after sending the synchronous data packet to the external network CPU, the method further includes:
the intranet CPU generates a synchronization end message, sends the synchronization end message to the extranet CPU and deletes the data to be synchronized;
the data synchronization is carried out by the external network CPU based on the synchronous data message, and the data synchronization comprises the following steps:
and after receiving the synchronization ending message, the external network CPU writes the data to be synchronized into a temporary file, and establishes socket connection with the target process, so that the target process reads the data to be synchronized from the temporary file through the socket connection.
In a second aspect, an embodiment of the present invention further provides a data synchronization apparatus, including an intranet CPU and an extranet CPU, where:
the intranet CPU is used for generating a request data synchronization message based on the data synchronization message after receiving the data synchronization message and sending the request data synchronization message to the extranet CPU; the synchronous data message is generated after a response message sent by an external network CPU is received, and the synchronous data message is sent to the external network CPU so that the external network CPU can carry out data synchronization based on the synchronous data message;
the external network CPU is used for receiving the request data synchronization message; receiving a synchronous data message; and for data synchronization based on the synchronization data message.
In a third aspect, an embodiment of the present invention further provides an electronic device, including:
at least one processor; and
at least one memory communicatively coupled to the processor, wherein:
the memory stores program instructions executable by the processor, which when called by the processor are capable of performing the above method.
In a fourth aspect, an embodiment of the present invention further provides a non-transitory computer-readable storage medium storing a computer program, which causes the computer to execute the above method.
According to the technical scheme, the synchronous data message is generated by the internal network CPU and sent to the external network CPU, so that the external network CPU carries out data synchronization based on the synchronous data message. In this way, since the intranet CPU and the extranet CPU are located on the same network device, the intranet CPU performs processing related to the intranet, and the extranet CPU performs processing related to the extranet. Compared with data synchronization through network connection, the embodiment of the invention can realize data communication between the internal network and the external network based on two basic hardware CPUs (central processing units) without a network, and realize data synchronization between the internal network and the external network, so that a data message cannot be sent out of a firewall and cannot be sent to the network in the data synchronization process, thereby effectively reducing the possibility of interception and decryption of the message and further effectively improving the data security.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the embodiments or the prior art descriptions will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is also possible for those skilled in the art to obtain other drawings based on the drawings without creative efforts.
Fig. 1 is a schematic flowchart of a data synchronization method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a data flow according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a data synchronization apparatus according to an embodiment of the present invention;
fig. 4 is a logic block diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The following further describes embodiments of the present invention with reference to the accompanying drawings. The following examples are only for illustrating the technical solutions of the present invention more clearly, and the protection scope of the present invention is not limited thereby.
The execution main body of the data synchronization method provided by the embodiment of the invention can be a network device, the network device is based on a firewall of a Shenwei encryptor, and two Central Processing Units (CPUs) are deployed in the firewall of the Shenwei encryptor. One CPU independently runs an intranet system and performs related processing of an intranet, namely the intranet CPU; and the other CPU independently operates an external network system to perform related processing of the external network, namely, the network CPU. It can be understood that the method embodiment provided by the embodiment of the present invention may be executed by the foregoing network device through a Data Plane (DP) of an intranet CPU and a DP of an extranet CPU.
Fig. 1 shows a schematic flowchart of a data synchronization method provided in this embodiment, including:
s101, after receiving the data synchronization message, the internal network CPU generates a request data synchronization message based on the data synchronization message and sends the request data synchronization message to the external network CPU.
The intranet CPU refers to a CPU used for operating an intranet system and performing related processing of the intranet.
The outer network CPU is used for operating an outer network system and carrying out relevant processing of the outer network.
The data synchronization message is used for indicating an intranet CPU to start data synchronization, and the data synchronization message comprises data to be synchronized.
The request data synchronization message is a message which is generated by an intranet CPU and used for requesting the extranet CPU to start configuration data synchronization.
In implementation, the request synchronization message can be generated by the internal network CPU and sent to the external network CPU, and after receiving the response message of the external network CPU, the synchronization data message can be sent to the external network CPU, and then data synchronization is performed by the external network CPU. Specifically, first, the data synchronization message may be received through a DP corresponding to the intranet CPU (may be referred to as an intranet DP). Then, a request data synchronization message may be generated based on the data synchronization message through the intranet DP of the intranet CPU, for example, a message with an ethernet header protocol of 0x9999 and a content of 0x1111 may be assembled through the intranet DP of the intranet CPU (i.e., request configuration data synchronization), and a data length of configuration synchronization (i.e., a data length with synchronization data) is put behind to generate the request data synchronization message. And then, the request data synchronization message is sent to an external network CPU through an internal network DP of the internal network CPU.
S102, after receiving the response message sent by the outer network CPU, the inner network CPU generates a synchronous data message and sends the synchronous data message to the outer network CPU, so that the outer network CPU performs data synchronization based on the synchronous data message.
The synchronous data message is a message which is generated by an intranet CPU and contains data to be synchronized.
In implementation, after the intranet CPU sends the request data synchronization message to the extranet CPU, the intranet CPU detects whether a response message (for example, a message with ethernet header protocol of 0x9999 and content of 0x2222 later) for the request data synchronization message sent by the extranet CPU is received within a preset response time (for example, 5 seconds). If the response message is received within the preset response time through the intranet CPU, the synchronous data message can be generated. Then, the synchronization data packet may be sent to the extranet CPU through the intranet DP of the intranet CPU, so that the extranet CPU may perform data synchronization based on the synchronization data packet. It can be understood that, if the response message is not received within the preset response time through the intranet CPU, the synchronous data message may be sent to the extranet CPU again through the intranet DP of the intranet CPU.
According to the technical scheme, the synchronous data message is generated by the internal network CPU and sent to the external network CPU, so that the external network CPU carries out data synchronization based on the synchronous data message. In this way, since the intranet CPU and the extranet CPU are located on the same network device, the intranet CPU performs related processing of the intranet, and the extranet CPU performs related processing of the extranet. Compared with data synchronization through network connection, the embodiment of the invention can realize data communication between the internal network and the external network based on two basic hardware CPUs (central processing units) without a network, and realize data synchronization between the internal network and the external network, so that a data message cannot be sent out of a firewall and cannot be sent to the network in the data synchronization process, thereby effectively reducing the possibility of interception and decryption of the message and further effectively improving the data security.
Further, on the basis of the above method embodiment, the data synchronization message may be sent by the target process to the CPU in the intranet, and the corresponding processing may be as follows: the internal network CPU monitors the connection of the client through the socket, and after the target process of the client successfully establishes the socket connection with the internal network CPU, the target process sends a data synchronization message to the internal network CPU through the socket connection.
Wherein, the data synchronization message comprises data to be synchronized.
The target process refers to any third-party process needing data synchronization on the client.
In an implementation, the data synchronization message may be received in a socket connection. Specifically, the socket can be started to monitor the client connection through the intranet DP of the intranet CPU. When a target process needs to perform data synchronization, a socket connection can be requested to be established from an intranet CPU. When the target process and the intranet CPU successfully establish socket connection, the target process can generate data synchronization messages, if the target process can call a configured synchronous writing function (such as ssp _ sync _ write), data (namely data to be synchronized) needing to be synchronized is written into a temporary file (such as/tmp/sync _ data), the size of the temporary file can be specified to be maximum 3M, the synchronous writing function (ssp _ sync _ write) can be locked before the data to be synchronized is written, and the synchronous writing function (ssp _ sync _ write) can be unlocked after the data to be synchronized is written, so that the data synchronization messages are generated. Then, the target process may send a data synchronization message to the intranet CPU through the socket connection, so that the intranet DP through the intranet CPU may receive the data synchronization message.
Further, on the basis of the above method embodiment, the request data synchronization message may carry a data length of data to be synchronized, and the corresponding partial processing of step S101 may be as follows: determining the data length of the data to be synchronized based on the data synchronization message, and generating a request data synchronization message based on the data length of the data to be synchronized; accordingly, before the step S102, the following process is further included: the external network CPU acquires the data length of the data to be synchronized based on the request data synchronization message, and determines a target memory space based on the data length of the data to be synchronized; and the outer network CPU generates a response message corresponding to the request data synchronization message and sends the response message to the inner network CPU through an outer right interface of the outer network CPU.
The target memory space is a memory space for storing data to be synchronized.
The outer right interface refers to an interface which is arranged on the outer network CPU and used for sending data messages to the inner network CPU.
In implementation, the data to be synchronized in the data synchronization message (i.e. the data to be synchronized in the temporary file) may be read by the intranet CPU, and the data length of the data to be synchronized may be determined. Then, a request data synchronization message can be generated by the intranet CPU based on the data length of the data to be synchronized, that is, the request data synchronization message carries the data length of the data to be synchronized. Correspondingly, after the request data synchronization message is sent to the outer network CPU by the inner network CPU, if the request data synchronization message is received by the outer network CPU, the data length of the data to be synchronized can be acquired from the request data synchronization message by the outer network CPU, and the target memory space can be determined by the outer network CPU based on the data length of the data to be synchronized. Then, a response message corresponding to the request data synchronization message can be generated through the outer network CPU, and the response message can be sent to the inner network CPU through the outer right interface of the outer network CPU.
Further, on the basis of the above method embodiment, the message may be sent to the outer left interface of the outer network CPU through the inner left interface, and the corresponding part of the processing in step S101 may be as follows: and the internal network CPU sends the request data synchronization message to the external left interface of the external network CPU through the internal left interface, so that the external network CPU receives the request data synchronization message through the external left interface.
The inner left interface refers to an interface through which the inner network CPU sends data messages to the outer network CPU.
The outer left interface refers to an interface on the outer network CPU for receiving the data message sent by the inner network CPU.
Further, on the basis of the method embodiment, the data to be synchronized may be divided into a plurality of sub packets, and then a synchronization data packet is generated based on all the sub packets, and the corresponding partial processing in step S101 may be as follows: the method comprises the steps that an intranet CPU obtains data to be synchronized in a data synchronization message, the data to be synchronized are segmented according to preset segmentation units, and a plurality of sub data packets corresponding to the data to be synchronized are generated; distributing a sequence number for each sub-data packet according to the sequence of the division; and generating a synchronous data message based on each sub data packet of the data to be synchronized and the corresponding sequence number of each sub data packet.
The sequence numbers are distributed in the order from small to large.
The preset segmentation unit refers to a unit for segmenting data to be synchronized, and may be understood as a segmentation granularity, for example, may be 1K.
In implementation, the data to be synchronized in the data synchronization message may be obtained through an intranet CPU, and then the data to be synchronized may be segmented according to a preset segmentation unit to obtain a plurality of sub data packets corresponding to the data to be synchronized, for example, for a 1M data to be synchronized, the data to be synchronized may be segmented into 1024 sub data packets according to a 1K preset segmentation unit. Then, a sequence number may be assigned to each sub-packet according to the segmentation order of each sub-packet, and when assigning a sequence number, the sequence numbers are assigned according to the sequence from small to large, for example, for a first sub-packet and a second sub-packet obtained by successively segmenting, a sequence number of 1 may be assigned to the first sub-packet, and a sequence number of 2 may be assigned to the second sub-packet. Then, a synchronous data packet may be generated based on each sub-packet of the data to be synchronized and the sequence number corresponding to each sub-packet. For example, the content of a temporary file (e.g.,/tmp/sync _ data) in the data synchronization message, i.e., the data to be synchronized, is read, an ethernet header protocol of 0x9999 and the content of the latter 0x3333 are assembled by applying for pkb (packet buffers) in a loop, the data to be synchronized is divided into a plurality of sub-packets of 1K, a sequence number is allocated to each sub-packet, and a message is encapsulated from 1 to 3072 (maximum 3M), so as to generate a synchronization data message. It can be understood that each sub-packet and the corresponding sequence number thereof may be encapsulated as a synchronous data packet and sent out according to the sequence of the sequence numbers from small to large, or each sub-packet and the corresponding sequence number thereof may be encapsulated as a sub-synchronous data packet and then all the sub-synchronous data packets are encapsulated as a synchronous data packet and sent out.
Further, on the basis of the above method embodiment, each sub-packet may be stored in a target memory space, and the corresponding processing in step S102 may be as follows: and the outer network CPU acquires each sub data packet in the synchronous data message and the corresponding sequence number of each sub data packet, and stores each sub data packet in a target memory space according to the corresponding sequence number of each sub data packet.
In implementation, after receiving a synchronous data packet (such as the ethernet header protocol is 0x9999, and the content of the packet is 0x3333 later) through the external network CPU, each sub-packet in the synchronous data packet and a sequence number corresponding to each sub-packet may be obtained through the external network CPU. Then, each sub data packet can be stored in the target memory space through the external network CPU according to the corresponding sequence number of each sub data packet, for example, each sub data packet can be sequentially stored in the target memory space according to the sequence number of the purchased sub data packet and the offset of a preset segmentation unit (for example, 1K), so that the sub data packets are stored according to the sequence numbers, the order preservation of the message can be realized, and the synchronous data content is ensured not to change.
Further, on the basis of the above method embodiment, after the synchronous data message is sent to the external network CPU by the internal network CPU, the following processing may be performed: and the intranet CPU generates a synchronization end message, sends the synchronization end message to the extranet CPU and deletes the data to be synchronized. Accordingly, part of the processing of step S102 may be as follows: and after receiving the synchronization ending message, the external network CPU writes the data to be synchronized into the temporary file and establishes socket connection with the target process so that the target process reads the data to be synchronized from the temporary file through the socket connection.
In implementation, after the data synchronization message is sent to the external network CPU by the internal network CPU, a synchronization end message may also be generated, for example, the assembled ethernet header protocol is 0x9999, and the message with the content of 0x4444 later is a synchronization end message. Then, the synchronization end message may be sent to the extranet CPU through the intranet CPU, and the obtained data to be synchronized may be deleted.
Correspondingly, after receiving the synchronization end message (for example, the ethernet header protocol is 0x9999, and the message of the following content is 0x 4444), the external network CPU may write the data to be synchronized into the temporary file, and establish a socket connection with the target process, so that the target process may read the data to be synchronized from the temporary file through the socket connection, for example, may call a configured synchronization read function (ssp _ sync _ read), and read the data to be synchronized from the temporary file (for example,/tmp/sync _ data). It can be understood that after the target process reads the data to be synchronized from the temporary file, the data to be synchronized in the temporary file can be deleted by the extranet CPU.
In order to make the method provided by the embodiment of the present invention clearer, the method provided by the embodiment of the present invention is completely explained by using a Data flow diagram shown in fig. 2 (in fig. 2, DDR represents Double Data Rate of a Double-Rate synchronous dynamic random Access memory, IP-MAC (Media Access Control Address, MAC Address) represents binding between an IP Address and a MAC Address, and FPGA is a Field Programmable Gate Array). Specifically, the processing procedure of the intranet CPU side (i.e. the intranet side in fig. 2) may be:
step 1, starting a socket to monitor client connection by an intranet DP (namely an intranet data plane); step 2, the target process requests socket connection; and step 3, after the socket request of the target process is successfully connected, calling a configured synchronous writing function (such as ssp _ sync _ write), writing data to be synchronized into a temporary file (such as/tmp/sync _ data), wherein the file size specifies the maximum 3M, locking the synchronous writing function (ssp _ sync _ write) before processing the written file, and unlocking the written file. After the synchronous writing function is called successfully, the data synchronization message is connected to the intranet DP through the socket so as to inform the intranet DP that the data synchronization can be started. And 4, after the data synchronization message is received by the internal network DP. A message (request configuration data synchronization) with an ethernet header protocol of 0x9999 and a content of 0x1111 behind can be assembled, and meanwhile, the data length of the configuration synchronization is put behind to generate a request data synchronization message and the message is sent out through the inner left interface. And detecting whether a response message (such as a message with an Ethernet header protocol of 0x9999 and the content of the following message of 0x 2222) is received within a preset response time (such as 5 seconds), and if the response message is not received, retransmitting the request data synchronization message. Step 5, according to fig. 2, the FPGA (Field Programmable Gate Array) in the internal CPU automatically sends the message received by the internal right interface out from the internal left interface, and waits for the response of the external CPU. And step 6, after receiving a response message (such as an Ethernet header protocol of 0x9999 and the content behind the Ethernet header protocol is 0x 2222) of the external network CPU, the internal network CPU reads out data to be synchronized in a temporary file (such as/tmp/sync _ data) stored in the request data synchronization message, assembles a message with the Ethernet header protocol of 0x9999 and the content behind the Ethernet header protocol of 0x3333 by applying for pkb circularly, divides the data to be synchronized into a plurality of sub-packets according to a preset division unit (such as 1K), stores 1K in each sub-packet, adds a corresponding sequence number in front of each sub-packet, such as from 1 to the maximum 3072 (maximum 3M), encapsulates the message to generate a synchronization data message, and sends out the synchronization data message through an internal left interface until the sending is finished. And 7, after the synchronous data message is sent, sending a message for configuring the synchronous end, namely a synchronous end message, such as a message with an assembled Ethernet header protocol of 0x9999 and the content of 0x4444 later. Sending out through the inner left interface; and meanwhile, the temporary file (such as the/tmp/sync _ data) is cleared. It should be noted that during the sending of the sync data message, the profile is not allowed to be rewritten.
The processing procedure of the external network CPU side (i.e. the external network side in fig. 2) may be:
step 1, a target process starts a socket to monitor client connection. Step 2, after receiving a request data synchronization message, namely the ethernet header protocol is 0x9999 and the following message with content of 0x1111, the external network DP (i.e. the external network data plane) reads the data length of the data to be synchronized behind 0x1111 in the message, and applies for a block of memory, namely the target memory space, according to the length. And then sends a response message (e.g. ethernet header protocol is 0x9999, and the content is 0x 2222) through the outer right interface. And 3, the FPGA of the outer network CPU automatically sends the message received by the outer left interface out from the outer right interface, and then waits for the response of the inner network CPU. And 4, the external network DP receives a synchronous data message, wherein the Ethernet header protocol is 0x9999, and the message with the content of 0x3333 later stores the data to be synchronized into the target memory space applied in the step 2 according to the sequence number and the offset of a preset segmentation unit (such as 1K) (the data to be synchronized is stored according to the sequence number, so that the order of the message can be preserved, and the synchronized content is ensured not to change). And 5, when the external network DP receives a synchronization ending message, wherein the Ethernet header protocol is 0x9999, and the message of the following content 0x4444, ending the data storage into the target memory space, and simultaneously writing the content of the target memory space into a temporary file (such as/tmp/sync _ data). And 6, requesting socket connection from the external network DP to the target process. And 7, after the socket request of the external network DP is successfully connected, sending a message to the target process through the socket connection, and informing the target process that data synchronization can be started. And step 8, after receiving the message that the data synchronization can be started, the target process calls a configuration synchronization reading function (such as ssp _ sync _ read) and reads the data to be synchronized from a temporary file (such as/tmp/sync _ data). And 9, after reading the data to be synchronized, clearing the data to be synchronized in the temporary file (such as/tmp/sync _ data). It should be noted that, during reading the temporary file, the file is not allowed to be rewritten.
Fig. 3 shows a data synchronization apparatus provided in this embodiment, which includes an intranet CPU 301 and an extranet CPU 302, where:
the intranet CPU 301 is configured to generate a request data synchronization message based on the data synchronization message after receiving the data synchronization message, and send the request data synchronization message to the extranet CPU; the synchronous data message is generated after a response message sent by the external network CPU is received, and the synchronous data message is sent to the external network CPU so that the external network CPU can carry out data synchronization based on the synchronous data message;
the external network CPU 302 is configured to receive the request data synchronization packet; receiving a synchronous data message; and for data synchronization based on the synchronization data message.
Further, the intranet CPU 301 is configured to:
monitoring client connection through a socket, wherein after a target process of the client successfully establishes socket connection with the intranet CPU, the target process sends a data synchronization message to the intranet CPU through the socket connection, and the data synchronization message comprises data to be synchronized.
Further, the intranet CPU 301 is configured to:
determining the data length of the data to be synchronized based on the data synchronization message, and generating a request data synchronization message based on the data length of the data to be synchronized;
the extranet CPU 302 is configured to:
acquiring the data length of data to be synchronized based on the request data synchronization message, and determining a target memory space based on the data length of the data to be synchronized; the target memory space is used for storing the data to be synchronized;
and generating a response message corresponding to the request data synchronous message, and sending the response message to the intranet CPU through an outer right interface of the extranet CPU.
Further, the intranet CPU 301 is configured to:
and sending the request data synchronization message to an outer left interface of the outer network CPU through an inner left interface so that the outer network CPU receives the request data synchronization message through the outer left interface.
Further, the intranet CPU 301 is configured to:
acquiring data to be synchronized in the data synchronization message, segmenting the data to be synchronized according to preset segmentation units, and generating a plurality of sub data packets corresponding to the data to be synchronized;
distributing a sequence number for each sub-data packet according to the sequence of the division, wherein the distribution of the sequence numbers is distributed according to the sequence of the sequence numbers from small to large;
and generating a synchronous data message based on each sub data packet of the data to be synchronized and the corresponding sequence number of each sub data packet.
Further, the extranet CPU 302 is configured to:
and acquiring each sub data packet in the synchronous data message and a sequence number corresponding to each sub data packet, and storing each sub data packet in the target memory space according to the sequence number corresponding to each sub data packet.
Further, the intranet CPU 301 is configured to:
generating a synchronization end message, sending the synchronization end message to the external network CPU, and deleting the data to be synchronized;
the extranet CPU 302 is configured to:
and after receiving the synchronization ending message, writing the data to be synchronized into a temporary file, and establishing socket connection with the target process so that the target process reads the data to be synchronized from the temporary file through the socket connection.
The data synchronization apparatus described in this embodiment may be used to implement the method embodiments, and the principle and technical effect are similar, which are not described herein again.
Referring to fig. 4, the electronic device includes: a processor (processor) 401, a memory (memory) 402, and a bus 403;
wherein,
the processor 401 and the memory 402 complete communication with each other through the bus 403;
the processor 401 is configured to call program instructions in the memory 402 to perform the methods provided by the above-described method embodiments.
The present embodiment discloses a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions which, when executed by a computer, enable the computer to perform the method provided by the above-described method embodiments.
The present embodiments provide a non-transitory computer-readable storage medium storing computer instructions that cause the computer to perform the methods provided by the method embodiments described above.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. Based on the understanding, the above technical solutions substantially or otherwise contributing to the prior art may be embodied in the form of a software product, which may be stored in a computer-readable storage medium, such as ROM/RAM, magnetic disk, optical disk, etc., and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the various embodiments or some parts of the embodiments.
It should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (9)

1. A method of data synchronization, comprising:
after receiving the data synchronization message, the internal network CPU generates a request data synchronization message based on the data synchronization message and sends the request data synchronization message to the external network CPU;
determining the data length of the data to be synchronized based on the data synchronization message, and generating a request data synchronization message based on the data length of the data to be synchronized;
the external network CPU obtains the data length of the data to be synchronized based on the request data synchronization message, and determines a target memory space based on the data length of the data to be synchronized; the target memory space is used for storing the data to be synchronized;
the outer network CPU generates a response message corresponding to the request data synchronization message, and sends the response message to the inner network CPU through an outer right interface of the outer network CPU;
and after receiving a response message sent by the outer network CPU, the inner network CPU generates a synchronous data message and sends the synchronous data message to the outer network CPU, so that the outer network CPU carries out data synchronization based on the synchronous data message.
2. The data synchronization method of claim 1, further comprising:
the method comprises the steps that an intranet CPU monitors connection of a client through a socket, after a target process of the client and the intranet CPU establish socket connection successfully, the target process sends data synchronization information to the intranet CPU through the socket connection, and the data synchronization information comprises data to be synchronized.
3. The data synchronization method according to claim 1, wherein the sending the request data synchronization packet to an external network CPU comprises:
and the intranet CPU sends the request data synchronization message to an outer left interface of the outer network CPU through an inner left interface, so that the outer network CPU receives the request data synchronization message through the outer left interface.
4. The data synchronization method of claim 1, wherein the generating the synchronization data packet comprises:
the intranet CPU acquires data to be synchronized in the data synchronization message, and divides the data to be synchronized according to preset division units to generate a plurality of sub data packets corresponding to the data to be synchronized;
distributing a sequence number for each sub-data packet according to the sequence of the division, wherein the distribution of the sequence numbers is distributed according to the sequence of the sequence numbers from small to large;
and generating a synchronous data message based on each sub data packet of the data to be synchronized and the corresponding sequence number of each sub data packet.
5. The data synchronization method according to claim 4, wherein the external network CPU performs data synchronization based on the synchronization data message, and comprises:
and the outer network CPU acquires each sub data packet in the synchronous data message and a sequence number corresponding to each sub data packet, and stores each sub data packet in the target memory space according to the sequence number corresponding to each sub data packet.
6. The data synchronization method according to claim 2, wherein after sending the synchronization data packet to the external network CPU, the method further comprises:
the intranet CPU generates a synchronization end message, sends the synchronization end message to the extranet CPU and deletes the data to be synchronized;
the external network CPU carries out data synchronization based on the synchronous data message, and the data synchronization comprises the following steps:
and after receiving the synchronization ending message, the external network CPU writes the data to be synchronized into a temporary file, and establishes socket connection with the target process, so that the target process reads the data to be synchronized from the temporary file through the socket connection.
7. The utility model provides a data synchronizer, its characterized in that includes intranet CPU and extranet CPU, wherein:
the intranet CPU is used for generating a request data synchronization message based on the data synchronization message after receiving the data synchronization message and sending the request data synchronization message to the extranet CPU; the synchronous data message is generated after a response message sent by the external network CPU is received, and the synchronous data message is sent to the external network CPU so that the external network CPU can carry out data synchronization based on the synchronous data message; determining the data length of the data to be synchronized based on the data synchronization message, and generating a request data synchronization message based on the data length of the data to be synchronized;
the external network CPU is used for receiving the request data synchronization message; receiving a synchronous data message; and for data synchronization based on the synchronization data message; acquiring the data length of data to be synchronized based on the request data synchronization message, and determining a target memory space based on the data length of the data to be synchronized; the target memory space is used for storing the data to be synchronized; and generating a response message corresponding to the request data synchronous message, and sending the response message to the intranet CPU through an outer right interface of the extranet CPU.
8. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the data synchronization method of any of claims 1 to 6 when executing the program.
9. A non-transitory computer-readable storage medium on which a computer program is stored, the computer program, when being executed by a processor, implementing the data synchronization method according to any one of claims 1 to 6.
CN202010246629.XA 2020-03-31 2020-03-31 Data synchronization method and device, electronic equipment and storage medium Active CN113472727B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010246629.XA CN113472727B (en) 2020-03-31 2020-03-31 Data synchronization method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010246629.XA CN113472727B (en) 2020-03-31 2020-03-31 Data synchronization method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113472727A CN113472727A (en) 2021-10-01
CN113472727B true CN113472727B (en) 2023-02-17

Family

ID=77865694

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010246629.XA Active CN113472727B (en) 2020-03-31 2020-03-31 Data synchronization method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113472727B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2014114232A1 (en) * 2013-01-22 2014-07-31 横河电机株式会社 Isolation protection system and method thereof for performing bidirectional data packet filtration inspection
CN105208352A (en) * 2015-10-16 2015-12-30 杭州中威电子股份有限公司 Safe monitoring system and physical isolation method for network video
CN106203188A (en) * 2016-06-24 2016-12-07 天津光电聚能专用通信设备有限公司 A kind of Unilateral Data Transferring System and method thereof adding MAC based on dual processors
CN108173810A (en) * 2017-12-07 2018-06-15 新华三信息安全技术有限公司 A kind of method and device of transmitting network data
CN108306847A (en) * 2017-01-13 2018-07-20 北京国双科技有限公司 Communication system and method
CN109218229A (en) * 2017-06-30 2019-01-15 华为技术有限公司 A kind of message processing method, the network equipment and storage medium
CN110266713A (en) * 2019-06-28 2019-09-20 深圳市网心科技有限公司 Intranet and extranet communication means, device, system and proxy server and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2014114232A1 (en) * 2013-01-22 2014-07-31 横河电机株式会社 Isolation protection system and method thereof for performing bidirectional data packet filtration inspection
CN105208352A (en) * 2015-10-16 2015-12-30 杭州中威电子股份有限公司 Safe monitoring system and physical isolation method for network video
CN106203188A (en) * 2016-06-24 2016-12-07 天津光电聚能专用通信设备有限公司 A kind of Unilateral Data Transferring System and method thereof adding MAC based on dual processors
CN108306847A (en) * 2017-01-13 2018-07-20 北京国双科技有限公司 Communication system and method
CN109218229A (en) * 2017-06-30 2019-01-15 华为技术有限公司 A kind of message processing method, the network equipment and storage medium
CN108173810A (en) * 2017-12-07 2018-06-15 新华三信息安全技术有限公司 A kind of method and device of transmitting network data
CN110266713A (en) * 2019-06-28 2019-09-20 深圳市网心科技有限公司 Intranet and extranet communication means, device, system and proxy server and storage medium

Also Published As

Publication number Publication date
CN113472727A (en) 2021-10-01

Similar Documents

Publication Publication Date Title
US10069946B2 (en) Hardware-based packet editor
CN104519036B (en) A kind of method and device for sending business request information
CN102325202B (en) Method and equipment for managing customer address table
EP3493587B1 (en) Apparatus and method for data delivery in delay-tolerant network (dtn)
CN112751897B (en) Load balancing method, device, medium and equipment
CN111786867B (en) Data transmission method and server
US20160360013A1 (en) System and Method for Implementing Traffic Optimization for Overlay Networks
CN107995233B (en) Method for establishing connection and corresponding equipment
CN108881233A (en) anti-attack processing method, device, equipment and storage medium
CN107294830A (en) A kind of data transmission method and system
US20190036793A1 (en) Network service implementation method, service controller, and communications system
CN102427452B (en) Synchronize (SYN) message transmitting method and device and network equipment
CN113472727B (en) Data synchronization method and device, electronic equipment and storage medium
CN109450991A (en) Data transmission acceleration method, relevant device and acceleration system based on mobile application
CN104284383B (en) A kind of method and apparatus for keeping business continuance
JP6690959B2 (en) Device and method for reforming TCP handshake
CN106612307B (en) A kind of implementation method and device of always online business
CN115190167B (en) Proxy system and method based on shared memory communication
CN115412974A (en) Shunting communication method, device, equipment and readable storage medium
CN111107166B (en) Session synchronization method, device, electronic equipment and medium
CN111064673B (en) User plane data integrity protection method and device, electronic equipment and medium
CN109688085B (en) Transmission control protocol proxy method, storage medium and server
CN106095559A (en) Based on mobile terminal data proxy data acclerating section streaming system and method
CN106792664B (en) Method for generating dynamic GTP tunnel
CN113518032A (en) SRv 6-based user trusted identifier carrying method and system

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