Data synchronization method, device, electronic device and storage medium
Through distributed multi-service instances and data synchronization task sharding, combined with polling mechanism and remote dictionary service Redis, the high availability problem of enterprise card data acquisition in 5G customized network is solved, the data synchronization efficiency and success rate are improved, and the data synchronization efficiency and success rate are adapted to The large amount of data and interface restrictions of enterprise number cards.
Patent Information
- Application Number
- CN202211718618.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-29
- Publication Date
- 2024-12-24
- Estimated Expiration
- 2042-12-29
AI Technical Summary
In 5G customization network, the collection of enterprise card-related data has the problem of low fault tolerance and inability to achieve high availability. Especially due to the large number and complex interface conditions of enterprise card, data collection and synchronization fail or stagnant, affecting 5G customization The normal operation of the Internet-self service platform.
Distributed multi-service instances and data synchronization task sharding is adopted, data synchronization is combined with polling mechanism, enterprise list information is cached through remote dictionary service Redis, dynamically allocate task sharding in parallel processing, and supports distributed collaborative processing and load balancing.
It improves the efficiency and success rate of data synchronization, realizes high availability and load balancing, adapts to the large amount of data and interface restrictions of enterprise cards, and has strong dynamic expansion and capacity.
Smart Images

Figure CN116112509B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data synchronization technology, and in particular to a data synchronization method, a data synchronization device, an electronic device and a computer-readable storage medium. Background Art
[0002] 5G customized network is a communication network based on the fifth generation of mobile communication technology. It is also a comprehensive solution that integrates network, cloud computing, edge computing and application platform. 5G customized network can provide high-security services, application guarantee capabilities and service channel services with better network quality for industries with extremely high requirements for data security and reliability, such as industrial manufacturing, ports, mining and electricity, as well as industries with high requirements for network stability, such as tourism, education and venues. Among them, the collection of 5G customized network enterprise card data is an important part of the 5G customized network operation and management service process.
[0003] At present, the method of collecting data related to enterprise number cards is affected by factors such as the large number of enterprise number cards and the complex interface conditions. It has the defects of low fault tolerance and inability to achieve high availability.
[0004] Therefore, how to collect enterprise card related data has become a problem that technical personnel in this field need to overcome. Summary of the invention
[0005] The embodiments of the present invention provide a data synchronization method, device, electronic device and computer-readable storage medium to solve the problem of how to synchronize data.
[0006] The embodiment of the present invention discloses a data synchronization method, which is applied to a number card data synchronization system, wherein the number card data synchronization system has a plurality of corresponding task service instances, and the task service instance includes a remote dictionary service Redis, which may include:
[0007] Acquire number card list data, wherein the number card list data has a corresponding enterprise identifier and a paging identifier;
[0008] Generate enterprise list information for the number card list data;
[0009] Grouping the enterprise list information based on the enterprise identifier and the paging identifier to generate an enterprise card list group;
[0010] Determine a plurality of data synchronization task slices based on the enterprise card list grouping; the data synchronization task slices have corresponding polling cycles and interface status parameters;
[0011] The data synchronization task slice is sent to the task service instance; the task service instance is used to receive the data synchronization task slice; based on the enterprise list information, a target data synchronization task slice is determined from the data synchronization task slice; the data synchronization task slice is executed through the remote dictionary service Redis according to the polling cycle and the interface status parameters to generate target number card synchronization data; the remote dictionary service Redis is used to cache the enterprise list information.
[0012] Optionally, the step of sending the data synchronization task slice to the task service instance may include:
[0013] Obtaining an Internet Protocol address of the task service instance;
[0014] Determine a target task service instance corresponding to the data synchronization task slice based on the enterprise identifier, the paging identifier, and the Internet Protocol address;
[0015] The data synchronization task slice is sent to the target task service instance.
[0016] The embodiment of the present invention also discloses a data synchronization method, which is applied to a task service instance, wherein the task service instance has a corresponding number card data synchronization system and a remote dictionary service Redis, wherein the number card data synchronization system is used to obtain number card list data, wherein the number card list data has a corresponding enterprise identifier and a paging identifier, and enterprise list information is determined from the number card list data based on the enterprise identifier and the paging identifier, and the enterprise list information is grouped based on the enterprise identifier and the paging identifier to generate an enterprise number card list group, and multiple data synchronization task slices are determined based on the enterprise number card list group, wherein the data synchronization task slice has a corresponding polling cycle and interface status parameter, and the data synchronization task slice is sent to the task service instance, and the remote dictionary service Redis is used to cache the enterprise list information, which may include:
[0017] Receiving the data synchronization task slice;
[0018] Obtain the enterprise list information from the remote dictionary service Redis;
[0019] Determine a target data synchronization task slice from the data synchronization task slices based on the enterprise list information;
[0020] The data synchronization task slice is executed through the remote dictionary service Redis according to the polling cycle and the interface status parameter to generate target number card synchronization data.
[0021] Optionally, the remote dictionary service Redis is used to configure corresponding data validity period and dependent data for the data synchronization task slice, and the step of determining the target data synchronization task slice from the data synchronization task slice based on the enterprise list information may also include:
[0022] Based on the data validity period, determining a valid data synchronization task slice from the data synchronization task slices;
[0023] Obtain the historical synchronization task progress data and the dependency data corresponding to the valid data synchronization task slice from the remote dictionary service Redis;
[0024] The target data synchronization task slice is determined from the valid data synchronization task slices based on the historical synchronization task progress data and the dependency data.
[0025] Optionally, the step of executing the data synchronization task slices according to the polling cycle and the interface status parameters through the remote dictionary service Redis to generate target number card synchronization data may include:
[0026] Generate initial number card synchronization data based on the enterprise number card list grouping and the target data synchronization task slice;
[0027] When the interface status parameter meets the preset standard, the target number card synchronization data is generated based on the enterprise number card list grouping and the initial number card synchronization data.
[0028] Optionally, it may also include:
[0029] When the interface status parameter does not meet the preset standard, the initial number card synchronization data is used as the historical synchronization task progress data.
[0030] The embodiment of the present invention further discloses a data synchronization device, which is applied to a number card data synchronization system, wherein the number card data synchronization system has a plurality of corresponding task service instances, wherein the task service instance includes a remote dictionary service Redis, and may include:
[0031] A number card list data acquisition module, used to acquire number card list data, the number card list data having a corresponding enterprise identifier and a paging identifier;
[0032] An enterprise list information generating module, used to generate enterprise list information for the number card list data;
[0033] An enterprise card list grouping generation module, used to group the enterprise list information based on the enterprise identifier and the paging identifier to generate an enterprise card list grouping;
[0034] A data synchronization task slice determination module, used to determine a plurality of data synchronization task slices based on the enterprise card list grouping; the data synchronization task slices have corresponding polling cycles and interface status parameters;
[0035] A target number card synchronization data generation module is used to send the data synchronization task slice to the task service instance; the task service instance is used to receive the data synchronization task slice; based on the enterprise list information, the target data synchronization task slice is determined from the data synchronization task slice; the data synchronization task slice is executed through the remote dictionary service Redis according to the polling cycle and the interface status parameters to generate target number card synchronization data; the remote dictionary service Redis is used to cache the enterprise list information.
[0036] Optionally, the target number card synchronization data generation module may include:
[0037] An Internet Protocol address acquisition submodule, used to acquire the Internet Protocol address of the task service instance;
[0038] A target task service instance determination submodule, used to determine a target task service instance corresponding to the data synchronization task slice based on the enterprise identifier, the paging identifier and the Internet Protocol address;
[0039] The data synchronization task slice sending submodule is used to send the data synchronization task slice to the target task service instance.
[0040] The embodiment of the present invention further discloses a data synchronization device, which is applied to a task service instance, wherein the task service instance has a corresponding number card data synchronization system and a remote dictionary service Redis, wherein the number card data synchronization system is used to obtain number card list data, wherein the number card list data has a corresponding enterprise identifier and a paging identifier, and enterprise list information is determined from the number card list data based on the enterprise identifier and the paging identifier, and the enterprise list information is grouped based on the enterprise identifier and the paging identifier to generate an enterprise number card list group, and multiple data synchronization task slices are determined based on the enterprise number card list group, wherein the data synchronization task slice has a corresponding polling cycle and interface status parameter, and the data synchronization task slice is sent to the task service instance, and the remote dictionary service Redis is used to cache the enterprise list information, which may include:
[0041] A data synchronization task slice receiving module, used for receiving the data synchronization task slice;
[0042] An enterprise list information acquisition module, used to acquire the enterprise list information from the remote dictionary service Redis;
[0043] A target data synchronization task slice determination module, used to determine a target data synchronization task slice from the data synchronization task slices based on the enterprise list information;
[0044] The data synchronization task slice execution module is used to execute the data synchronization task slice according to the polling cycle and the interface status parameter through the remote dictionary service Redis to generate target number card synchronization data.
[0045] Optionally, the remote dictionary service Redis is used to configure corresponding data validity period and dependent data for the data synchronization task slice, and the target data synchronization task slice determination module may further include:
[0046] A valid data synchronization task slice determination submodule, used to determine a valid data synchronization task slice from the data synchronization task slices based on the data validity period;
[0047] A historical synchronization task progress data acquisition submodule is used to obtain the historical synchronization task progress data and the dependency data corresponding to the valid data synchronization task slice from the remote dictionary service Redis;
[0048] The target data synchronization task slice determination submodule is used to determine the target data synchronization task slice from the valid data synchronization task slices based on the historical synchronization task progress data and the dependency data.
[0049] Optionally, the data synchronization task slicing execution module may include:
[0050] An initial number card synchronization data generation submodule is used to generate initial number card synchronization data based on the enterprise number card list grouping and the target data synchronization task slice;
[0051] The data synchronization task slice execution submodule is used to generate target number card synchronization data based on the enterprise number card list group and the initial number card synchronization data when the interface status parameter meets the preset standard.
[0052] Optionally, it may also include:
[0053] The historical synchronization task progress data generating submodule is used to use the initial number card synchronization data as the historical synchronization task progress data when the interface status parameter does not meet the preset standard.
[0054] The embodiment of the present invention further discloses an electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
[0055] The memory is used to store computer programs;
[0056] The processor is used to implement the method described in the embodiment of the present invention when executing the program stored in the memory.
[0057] The embodiment of the present invention further discloses a computer-readable storage medium having instructions stored thereon, which, when executed by one or more processors, enables the processors to execute the method described in the embodiment of the present invention.
[0058] The embodiments of the present invention include the following advantages:
[0059] In an embodiment of the present invention, number card list data is acquired, and the number card list data has a corresponding enterprise identifier and a paging identifier; enterprise list information for the number card list data is generated; the enterprise list information is grouped based on the enterprise identifier and the paging identifier to generate an enterprise number card list group; multiple data synchronization task slices are determined based on the enterprise number card list group; the data synchronization task slice has a corresponding polling cycle and interface status parameter; the data synchronization task slice is sent to the task service instance; the task service instance is used to receive the data synchronization task slice; based on the enterprise list information, a target data synchronization task slice is determined from the data synchronization task slice; the data synchronization task slice is executed according to the polling cycle and the interface status parameter through the remote dictionary service Redis to generate a target number card synchronization data; the remote dictionary service Redis is used to cache the enterprise list information, thereby improving the efficiency of data synchronization. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] Figure 1 is a flowchart of the steps of a data synchronization method provided in Embodiment 1 of the present invention;
[0061] Figure 2 is a flowchart of a data synchronization method provided in Embodiment 2 of the present invention;
[0062] Figure 3 is a flow chart of a data synchronization method provided in an embodiment of the present invention;
[0063] Figure 4 is a structural block diagram of a data synchronization device provided in Embodiment 3 of the present invention;
[0064] Figure 5 is a structural block diagram of a data synchronization device provided in Embodiment 4 of the present invention;
[0065] Figure 6 It is a hardware structure block diagram of an electronic device provided in each embodiment of the present invention. DETAILED DESCRIPTION
[0066] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0067] In the 5G customized network self-service platform project, it is necessary to collect enterprise number card related data. In the collection process, there are many factors that affect the smooth collection. For example, due to the large number of enterprise number cards, the various types of interfaces involved in obtaining attributes and belonging to different platforms, interface call failures or interface call restrictions, etc., the above factors will cause the collection and synchronization of enterprise number card related data to fail or stagnate, affecting the normal operation of the 5G customized network self-service platform project. The existing collection of enterprise number card data adopts a timed one-time execution method. The disadvantage of this method is that the processing cycle is long, and once an exception occurs in the middle or access is restricted, the task is terminated, the synchronization data of the current cycle fails to be obtained and is permanently lost, and it cannot support distributed multi-instance parallel processing and load balancing, and cannot achieve high availability. The embodiment of the present invention combines distributed multi-service instances and data synchronization task sharding, and adopts a polling mechanism to synchronize data, thereby improving the efficiency and success rate of data synchronization.
[0068] Embodiment 1
[0069] Reference Figure 1 , shows a flow chart of the steps of a data synchronization method provided in an embodiment of the present invention, which may specifically include the following steps:
[0070] Step 101, obtaining number card list data, wherein the number card list data has a corresponding enterprise identifier and a paging identifier;
[0071] Step 102, generating enterprise list information for the number card list data;
[0072] Step 103, grouping the enterprise list information based on the enterprise identifier and the paging identifier to generate an enterprise number card list group;
[0073] Step 104, determining a plurality of data synchronization task slices based on the enterprise card list grouping; the data synchronization task slices have corresponding polling cycles and interface status parameters;
[0074] Step 105, sending the data synchronization task slice to the task service instance; the task service instance is used to receive the data synchronization task slice; determining the target data synchronization task slice from the data synchronization task slice based on the enterprise list information; executing the data synchronization task slice according to the polling cycle and the interface status parameters through the remote dictionary service Redis to generate target number card synchronization data; the remote dictionary service Redis is used to cache the enterprise list information.
[0075] In practical applications, the embodiments of the present invention can be applied to a number card data synchronization system, and the number card data synchronization system can have multiple corresponding task service instances, and the task service instance has a remote dictionary service Redis. Among them, Redis (Remote Dictionary Server), that is, remote dictionary service, is a high-performance key-value database, and Redis supports master-slave synchronization. Data can be synchronized from the master server to any number of slave servers. The slave server can be a master server associated with other slave servers, which enables Redis to perform single-layer tree replication, and data can be written to the disk. Since the publish / subscribe mechanism is fully implemented, when the slave database synchronizes the tree anywhere, it can subscribe to a channel and receive the complete message publishing record of the master server. Synchronization is very helpful for the scalability and data redundancy of read operations. In addition, the task service instance can be a server that runs a distributed scheduled task service, and multiple task service instances work together to complete the same task.
[0076] In a specific implementation, an embodiment of the present invention can obtain number card list data, which can be composed of information such as telephone number, number validity, number user information, etc. The number card list data has corresponding enterprise identification and paging identification, such as enterprise name and current page number; generate enterprise list information for the number card list data; group the enterprise list information based on the enterprise identification and paging identification to generate enterprise number card list groups. Exemplarily, number card list data corresponding to multiple enterprises can be obtained as number card list data according to the enterprise identification, and the number card list data of each enterprise can be sorted according to the paging identification of the number card list data to obtain the updated enterprise's number card list data as the enterprise list information. The enterprise list information can be grouped according to the standard of "having the same enterprise identification and paging identification" to generate multiple enterprise number card list groups with "the same enterprise identification and paging identification".
[0077] Of course, the above is only an example, and those skilled in the art may use other types of data as the content of the number card list data, and the embodiment of the present invention does not limit this.
[0078] In an embodiment of the present invention, by acquiring number card list data, the number card list data may have corresponding enterprise identification and paging identification, and enterprise list information for the number card list data is generated. The enterprise list information is grouped based on the enterprise identification and paging identification, and an enterprise number card list group is generated, thereby preliminarily sorting out the number card list data, laying the foundation for subsequent data processing, and at the same time, preparing for subsequent task slicing by grouping the enterprise list information.
[0079] In a specific implementation, an embodiment of the present invention can determine multiple data synchronization task slices based on the enterprise card list grouping; the data synchronization task slices have corresponding polling cycles and interface status parameters; an embodiment of the present invention can send the data synchronization task slices to the target task service instance after determining the target task service instance; the task service instance is used to receive the data synchronization task slices; determine the target data synchronization task slice from the data synchronization task slices based on the enterprise list information; execute the data synchronization task slices according to the polling cycle and interface status parameters through the remote dictionary service Redis to generate the target card synchronization data; the remote dictionary service Redis is used to cache the enterprise list information.
[0080] In practical applications, task slicing means that the same task is divided into different slicings and completed by different task service instances. The task service instance will obtain the task slicing that needs to be processed according to the algorithm. Each slicing will contain the number card data synchronization tasks of several enterprises. In addition, the task polling cycle can be the time interval between two pollings. 5 minutes can be set as a polling cycle, and the polling cycle can be adjusted using the configuration file.
[0081] Exemplarily, when the enterprise card list is grouped into multiple enterprise card list groups with "the same enterprise ID and paging ID", a data synchronization task slice can be determined based on an enterprise card list group, and the polling period of each data synchronization task slice is 5 minutes. The interface status parameter of each data synchronization task slice can be "normal / abnormal", and then the data synchronization task slice is sent to the task service instance. Multiple task service instances can process the task slices in parallel, so that when the task service instance is dynamically expanded or reduced, only a small number of task slices will be affected, wherein the task service instance can be a distributed operation. The server of the scheduled task service, after the task service instance receives multiple data synchronization task slices, can obtain the enterprise list information, such as enterprise ID and paging ID, from the remote dictionary service Redis, and determine the data synchronization task slice corresponding to the specific enterprise ID and paging ID from multiple data synchronization task slices as the target data synchronization task slice according to the enterprise ID and paging ID, and then execute the target data synchronization task slice according to the polling cycle of 5 minutes and the interface status parameter "normal" corresponding to the target data synchronization task slice, and generate the target synchronization data composed of the number card list data and the number card attribute data after synchronization;
[0082] In an embodiment of the present invention, number card list data is acquired, and the number card list data has a corresponding enterprise identifier and a paging identifier; enterprise list information for the number card list data is generated; the enterprise list information is grouped based on the enterprise identifier and the paging identifier to generate an enterprise number card list group; multiple data synchronization task slices are determined based on the enterprise number card list group; the data synchronization task slice has a corresponding polling cycle and interface status parameter; the data synchronization task slice is sent to the task service instance; the task service instance is used to receive the data synchronization task slice; based on the enterprise list information, a target data synchronization task slice is determined from the data synchronization task slice; the data synchronization task slice is executed according to the polling cycle and the interface status parameter through the remote dictionary service Redis to generate a target number card synchronization data; the remote dictionary service Redis is used to cache the enterprise list information, thereby improving the efficiency of data synchronization.
[0083] Based on the above embodiment, a variant embodiment of the above embodiment is proposed. It should be noted that in order to make the description concise, only the differences from the above embodiment are described in the variant embodiment.
[0084] In an optional embodiment of the present invention, the step of sending the data synchronization task slice to the task service instance includes:
[0085] Obtaining an Internet Protocol address of the task service instance;
[0086] Determine a target task service instance corresponding to the data synchronization task slice based on the enterprise identifier, the paging identifier, and the Internet Protocol address;
[0087] The data synchronization task slice is sent to the target task service instance.
[0088] In practical applications, the Internet Protocol address, also known as the IP address (Internet Protocol Address), is a unified address format. It assigns a logical address to each network and each host on the Internet to shield the difference in physical addresses. The Internet Protocol address can be used to accurately locate the location of the task service instance. In the embodiment of the present invention, the Hash algorithm can be used in the calculation. The Hash algorithm is also called a hash function. It can convert input of any length into output of fixed length through the Hash algorithm. The process is irreversible and the original value cannot be calculated from the result value. At the same time, the result can be obtained quickly, and the final result has few conflicts. Therefore, the use of the Hash algorithm in the embodiment of the present invention can effectively improve the speed of obtaining the target task service instance and reduce the calculation errors caused by the result conflicts.
[0089] In a specific implementation, the embodiment of the present invention can obtain the Internet Protocol address of the task service instance. For example, the Internet Protocol address of the task service instance is obtained as "task service instance IP", and the hash algorithm is used to calculate the "task service instance IP" to generate the task service instance location value for the "task service instance IP". The calculation formula is as follows:
[0090] Formula 1:
[0091] Task service instance location value = Hash (task service instance IP) % 2^32
[0092] Next, you can use the enterprise ID and page ID corresponding to the data synchronization task slice to calculate according to the following formula to obtain the task slice position value:
[0093] Formula 2:
[0094] Task slice position value = Hash (enterprise ID + paging ID) % 2^32
[0095] After obtaining the task service instance position value and the task slice position value, the difference between the task service instance position value and the task slice position value can be calculated to determine the task service instance and data synchronization task slice with the smallest absolute value of the difference, and the task service instance is used as the target task service instance of the data synchronization task slice, and the data synchronization task slice is sent to the target task service instance. If the absolute values of the two differences are the same, the task service instance with a positive difference is selected as the target task service instance.
[0096] Of course, the above is only an example, and those skilled in the art may use other algorithms or substitute other parameters into the algorithm for calculation, which is not limited in the embodiment of the present invention.
[0097] The embodiment of the present invention obtains the Internet Protocol address of the task service instance; determines the target task service instance corresponding to the data synchronization task slice based on the enterprise identifier, the paging identifier and the Internet Protocol address; sends the data synchronization task slice to the target task service instance, and uses a hash algorithm to change the mapping relationship between the existing service request and the request processing server as little as possible in the process of adding the server to the data synchronization task slice, thereby improving the task's adaptability to dynamic scaling of the server, and by allocating the data synchronization task slices, it can support distributed multi-service instances to collaboratively process tasks in parallel, thereby improving the efficiency of data synchronization.
[0098] Embodiment 2
[0099] Reference Figure 2, shows a flow chart of the steps of a data synchronization method provided in Embodiment 2 of the present invention, which may specifically include the following steps:
[0100] Step 201, receiving the data synchronization task slice;
[0101] Step 202, obtaining the enterprise list information from the remote dictionary service Redis;
[0102] Step 203, determining a target data synchronization task slice from the data synchronization task slices based on the enterprise list information;
[0103] Step 204: Execute the data synchronization task slice according to the polling cycle and the interface status parameter through the remote dictionary service Redis to generate target number card synchronization data.
[0104] In a specific implementation, an embodiment of the present invention can be applied to a task service instance. The task service instance can have a corresponding number card data synchronization system. The task service instance can include a remote dictionary service Redis. The number card data synchronization system is used to obtain number card list data. The number card list data has a corresponding enterprise identifier and a paging identifier. Based on the enterprise identifier and the paging identifier, the enterprise list information is determined from the number card list data. The enterprise list information is grouped based on the enterprise identifier and the paging identifier to generate an enterprise number card list group. Based on the enterprise number card list group, multiple data synchronization task slices are determined. The data synchronization task slices have corresponding polling cycles and interface status parameters. The data synchronization task slices are sent to the task service instance. The remote dictionary service Redis is used to cache the enterprise list information.
[0105] Exemplarily, when the number card list data may be composed of information such as telephone number, number validity, number user information, etc., the number card list data has corresponding enterprise identification and paging identification, such as enterprise name and current page number; generate enterprise list information for the number card list data; group the enterprise list information based on the enterprise identification and paging identification to generate enterprise number card list groups. Exemplarily, the number card list data corresponding to multiple enterprises can be obtained as number card list data according to the enterprise identification, and the number card list data of each enterprise can be sorted according to the paging identification of the number card list data to obtain the updated enterprise number card list data as the enterprise list information, which can be sorted according to "number card list data with the same enterprise identification and The enterprise list information is grouped according to the standard of "paging identifier". After generating multiple enterprise card list groups with "the same enterprise identifier and paging identifier", a data synchronization task slice can be determined based on the enterprise card list group. The polling period of each data synchronization task slice is 5 minutes, and the interface status parameter of each data synchronization task slice can be "normal / abnormal". Then, the task slice position value for the data synchronization task slice and the task service instance position value for the task service instance are calculated respectively, and the target task service instance is determined based on the task service instance position value and the task slice position value, and the data synchronization task slice is sent to the target task service instance.
[0106] After the task service instance receives the data synchronization task shard assigned by the number card data synchronization system, it can obtain the enterprise list information cached in the remote dictionary service Redis from the remote dictionary service Redis. For example, the enterprise list information corresponding to "data synchronization task shard 1" is obtained as "enterprise ID 1". "Enterprise ID 1" is used to determine whether the "data synchronization task shard 1" corresponding to the enterprise ID is being processed in other task service instances. If no other task service instance is processing "data synchronization task shard 1", "data synchronization task shard 1" can be used as the target data synchronization task shard.
[0107] Then, based on the polling period corresponding to the "data synchronization task shard 1", for example, "5 minutes", and the interface status parameter corresponding to the "data synchronization task shard 1", for example, "interface status is normal", the "data synchronization task shard 1" can be processed, and the relevant data of the remote dictionary service Redis can be associated to finally generate the target number card synchronization data.
[0108] In an embodiment of the present invention, the data synchronization task slice is received; the enterprise list information is obtained from the remote dictionary service Redis; a target data synchronization task slice is determined from the data synchronization task slice based on the enterprise list information; the data synchronization task slice is executed by the remote dictionary service Redis according to the polling cycle and the interface status parameter to generate target number card synchronization data, wherein the method is applied to a task service instance, the task service instance has a corresponding number card data synchronization system and a remote dictionary service Redis, the number card data synchronization system is used to obtain number card list data, the number card list data has a corresponding enterprise identifier and a paging identifier, based on the enterprise identifier and the paging identifier, the enterprise list information is determined from the number card list data, based on the enterprise identifier and the paging identifier, the enterprise list information is grouped to generate an enterprise number card list group, multiple data synchronization task slices are determined based on the enterprise number card list group, the data synchronization task slice has a corresponding polling cycle and interface status parameter, and the data synchronization task slice is sent to the task service instance, and the remote dictionary service Redis is used to cache the enterprise list information, thereby improving the efficiency of data synchronization.
[0109] Based on the above embodiment, a variant embodiment of the above embodiment is proposed. It should be noted that in order to make the description concise, only the differences from the above embodiment are described in the variant embodiment.
[0110] In an optional embodiment of the present invention, the step of determining a target data synchronization task slice from the data synchronization task slices based on the enterprise list information further includes:
[0111] Based on the data validity period, determining a valid data synchronization task slice from the data synchronization task slices;
[0112] Obtain the historical synchronization task progress data and the dependency data corresponding to the valid data synchronization task slice from the remote dictionary service Redis;
[0113] The target data synchronization task slice is determined from the valid data synchronization task slices based on the historical synchronization task progress data and the dependency data.
[0114] In actual applications, the remote dictionary service Redis can be used to configure the corresponding data validity period and dependent data for the data synchronization task shard, where the data validity period means that if the data is within the validity period, the scheduled task does not need to perform a new synchronization cycle; the dependent data is data that has a dependency relationship with the data in the data synchronization task shard. For example, when the data in the data synchronization task shard is a telephone number, the telephone number user name that has a dependency relationship with the telephone number is the dependent data.
[0115] Of course, the above is only an example, and those skilled in the art may use other types of data as dependent data, which is not limited in this embodiment of the present invention.
[0116] In the specific implementation, when the enterprise list information corresponding to "data synchronization task shard 1" is obtained as "enterprise identification 1", it is judged through "enterprise identification 1" whether the "data synchronization task shard 1" corresponding to the enterprise identification is being processed in other task service instances. After judging that no other task service instances are processing "data synchronization task shard 1", the data validity period for "data synchronization task shard 1" is obtained from the remote dictionary service Redis, and it is judged whether the data of "data synchronization task shard 1" is within the data validity period to determine whether "data synchronization task shard 1" needs to be synchronized. If "data synchronization task shard 1" is within the data validity period, it means that "data synchronization task shard 1" is not completed, and "data synchronization task shard 1" is used as a valid data synchronization task shard. If "data synchronization task shard 1" has exceeded the data validity period, it means that "data synchronization task shard 1" has been completed, and you can jump to query other "data synchronization task shard n" to be processed. If "data synchronization task shard n" does not exist, the synchronization task can be ended.
[0117] After "Data Synchronization Task Slice 1" is determined as a valid data synchronization task slice, the historical synchronization task progress data and dependent data for "Data Synchronization Task Slice 1" can be obtained from the remote dictionary service Redis based on the "Enterprise Identifier 1" corresponding to "Data Synchronization Task Slice 1". If there is historical synchronization task progress data for "Data Synchronization Task Slice 1" generated in the previous round of synchronization tasks, "Data Synchronization Task Slice 1" can be synchronized directly according to the historical synchronization task progress data of the previous round. If the historical synchronization task progress data is displayed as "empty" or "Current Page Identification data has been synchronized", etc., then the synchronization process can be started for the "Data synchronization task slice 1*" of the "Enterprise identification 1". At the same time, check whether the dependent data corresponding to the "Data synchronization task slice 1*" has met the conditions. For example, if there is no update to the dependent data, it is determined to be unqualified. Otherwise, it means that the dependent data has met the conditions, and / or, if the dependent data can be obtained, it is determined to be qualified. Otherwise, it is determined to be unqualified. When the dependent data is determined to meet the conditions, the "Data synchronization task slice 1*" can be used as the new target data synchronization task slice.
[0118] Of course, the above is only an example, and those skilled in the art may adopt other preset rules to set the dependent data judgment criteria to determine whether the data meets the synchronization conditions, and the embodiment of the present invention is not limited to this.
[0119] The embodiment of the present invention determines the valid data synchronization task slice from the data synchronization task slice based on the data validity period; obtains the historical synchronization task progress data and the dependency data corresponding to the valid data synchronization task slice from the remote dictionary service Redis; and determines the target data synchronization task slice from the valid data synchronization task slice based on the historical synchronization task progress data and the dependency data. In this way, invalid task slices are eliminated, and the target data synchronization task slice is determined from the valid task slice through the historical progress data and the dependency data, which reduces data redundancy and repeated operations, and further ensures the improvement of data synchronization efficiency.
[0120] In an optional embodiment of the present invention, the step of executing the data synchronization task slice according to the polling cycle and the interface status parameter through the remote dictionary service Redis to generate target number card synchronization data includes:
[0121] Generate initial number card synchronization data based on the enterprise number card list grouping and the target data synchronization task slice;
[0122] When the interface status parameter meets the preset standard, the target number card synchronization data is generated based on the enterprise number card list grouping and the initial number card synchronization data.
[0123] In actual applications, there are many types of interfaces involved in obtaining attributes and they belong to different platforms. In some cases, the interfaces may fail to be called and there are call restrictions on the interfaces. These factors will affect data synchronization.
[0124] In a specific implementation, an embodiment of the present invention can generate initial number card synchronization data based on the enterprise number card list grouping and the target data synchronization task shard; when the interface status parameter meets the preset standard, the target number card synchronization data is generated based on the enterprise number card list grouping and the initial number card synchronization data. Exemplarily, when "data synchronization task shard 1" starts synchronization processing as the target data synchronization task shard, "data synchronization task shard 1" can perform preliminary data synchronization based on the enterprise number card list grouping in the remote dictionary service Redis. For example, the enterprise number card list grouping and the data corresponding to "number 1" in "data synchronization task shard 1" are associated to generate "data synchronization task shard 1_1", and then "data synchronization task shard 1_1" can be used as the initial number card synchronization data. At this time, the "interface status 1" of the interface adaptation layer interface required to obtain data from the enterprise number card list group corresponding to "number 1" and "data synchronization task shard 1_1" can be used as the interface status parameter. When the preset standard When the interface is judged as "interface call successful", determine whether the "interface status 1" meets the preset standard. If it does, continue to determine whether the current "data synchronization task slice 1_1" has been synchronized. If the synchronization is not completed, continue to determine the "interface status n" of other interfaces that need to be called, and then sort them out based on the preset standard. If the synchronization is completed, the initial card synchronization data "data synchronization task slice 1_1" can continue to determine "whether there are other data synchronization task slices that need to be synchronized". If not, use "data synchronization task slice 1_1" as the target card synchronization data. If yes, repeat the step of determining the target data synchronization task slice from the data synchronization task slice based on the enterprise list information. If it is determined that the "interface status 1" does not meet the preset standard, the call can be considered to have failed, and the number of failures can be recorded. Choose whether to skip the failed data. If you choose to skip, continue to determine the "interface status n" of other interfaces that need to be called, and then sort them out based on the preset standard. If you choose not to skip, you can end the synchronization.
[0125] Of course, the above is only an example, and technicians in this field can use other rules and logics to formulate preset rules to perform data combing and process direction standards, and the embodiments of the present invention are not limited to this.
[0126] In the embodiment of the present invention, initial card number synchronization data is generated based on the enterprise card number list grouping and the target data synchronization task slice; when the interface status parameter meets the preset standard, the target card number synchronization data is generated based on the enterprise card number list grouping and the initial card number synchronization data. Under the influence of factors such as a large number of interface types involved and belonging to different platforms, interface calls failing in certain situations, and interface call restrictions, the interface status parameters are judged based on preset standards, thereby avoiding abnormal termination of the synchronization process or the synchronization process falling into a loop due to abnormal interface conditions, and further improving the efficiency of data synchronization.
[0127] In an optional embodiment of the present invention, it also includes:
[0128] When the interface status parameter does not meet the preset standard, the initial number card synchronization data is used as the historical synchronization task progress data.
[0129] In practical applications, since the existing data synchronization method is executed once at a scheduled time, the task will be terminated if an exception or access is restricted in the middle, and the data acquisition in the current cycle fails, the data will be lost permanently. On the one hand, it causes data loss, and on the other hand, it causes duplicate synchronization items and synchronization data to be generated every time the task is restarted, thus reducing the efficiency of data synchronization.
[0130] In a specific implementation, an embodiment of the present invention can use the initial number card synchronization data as the historical synchronization task progress data when the interface status parameters do not meet the preset standards. For example, if the initial number card synchronization data is the "data synchronization task slice 1_1" corresponding to the "enterprise identification 1" and the "number 1", and the "data synchronization task slice 1_1" uses the "interface status 1" of the interface adaptation layer interface required to obtain data from the enterprise number card list group as the interface status parameter, then the "interface status 1" is judged based on the preset standard. When the preset standard is "interface call successful", it is judged whether the "interface status 1" meets the preset standard. If the "interface status 1" does not meet the standard of "interface call successful", the "data synchronization task slice 1_1" is used as The historical synchronization task progress data is recorded as "historical synchronization task progress data 1_1". The "data synchronization task shard 1_1" can be stored in the remote dictionary service Redis, so that when the next synchronization task starts, it can be used as the historical synchronization task progress data of the "data synchronization task shard 1_1*" corresponding to the "enterprise identification 1" and the "number 1", and the "data synchronization task shard 1_1*" can be synchronized based on the "historical synchronization task progress data 1_1", wherein the "historical synchronization task progress data 1_1" can include the data content updated by the "data synchronization task shard 1_1" during this synchronization process, and at the same time, the data content can be retrieved and used by the "data synchronization task shard 1_1*" during the synchronization process.
[0131] In the embodiment of the present invention, when the interface status parameters do not meet the preset standards, the initial number card synchronization data is used as the historical synchronization task progress data, thereby avoiding the permanent loss of data caused by the task termination due to abnormal path or restricted access, and the failure to obtain the current cycle data, and at the same time eliminating the problem of repeated synchronization items and synchronization data each time the task is restarted, thereby further improving the efficiency of data synchronization.
[0132] The number card data synchronization system in the second embodiment can implement each process of the above-mentioned first embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0133] In order to enable those skilled in the art to better understand the embodiments of the present invention, the embodiments of the present invention are described below using a complete example.
[0134] refer to Figure 3 , Figure 3 It is a flowchart of a data synchronization method provided in an embodiment of the present invention.
[0135] In order to enable those skilled in the art to better understand the embodiments of the present invention, the technical terms involved in the embodiments of the present invention are explained below.
[0136] Task service instance: A server that runs a scheduled task service in a distributed manner is called a task service instance. Multiple task service instances work together to complete the same task.
[0137] Task sharding: A synchronization task will be divided into different task shards, which will be completed by different task service instances. The task service instance will obtain the task shards that need to be processed according to the algorithm. Each shard will contain the card data synchronization tasks of several enterprises.
[0138] Task polling cycle: Scheduled tasks will use polling to process synchronization tasks. If task processing is interrupted due to interface restrictions or other abnormalities, it can be continued at the next polling. The time interval between two polling is called the task polling cycle. The initial default value of the polling cycle is currently set to 5 minutes and can be adjusted through the configuration file.
[0139] Data synchronization cycle: The data obtained by each scheduled task has a different validity period. If the data is within the validity period, the scheduled task does not need to be synchronized again. The time interval between two new synchronizations is called the data synchronization cycle. The data synchronization cycle of the task can be configured through the database.
[0140] There are dependencies between the data synchronized with the number card. Before synchronizing the enterprise number card data, the number card list data needs to be updated first. Therefore, we adopt a timed polling processing mechanism and a segmented number card data synchronization method.
[0141] For the above problems, we can first update the number card list by enterprise group, then dynamically group the enterprise number card list, and group and slice the number card attribute data synchronization tasks. Different task instances handle different task slices, supporting distributed collaborative processing of number card data synchronization tasks. And use the polling processing mechanism instead of the timing processing mechanism. When the task cannot be completed in a short time, the task can be segmented to gradually advance the task progress, effectively solving the problem of large task data volume and southbound interface restrictions.
[0142] The specific process for data synchronization is as follows:
[0143] First, the card list task is used to update the card list synchronously according to the enterprise ID. The card list of each enterprise is obtained in pages. After the update of the card list data of one (or part of) page is completed, its data is cached in Redis.
[0144] Secondly, the number cards are grouped according to the enterprise identification and paging information, and the number card data synchronization tasks are divided into different task slices, which are completed by different task service instances. The task service instance will obtain the task slices that need to be processed according to the algorithm. Each slice will contain the number card data synchronization tasks of several enterprises.
[0145] The shard acquisition algorithm adopts the following algorithm:
[0146] (1) Calculate the location value of the task service instance:
[0147] The task instance location value is calculated using the formula hash(task service instance IP)%2^32
[0148] (2) Calculate the fragment position value
[0149] The task shard position value is calculated using the formula hash(enterprise ID + paging ID)%2^32
[0150] (3) Calculate the service instance used by the selected shard
[0151] Calculate the difference between the task slice position and the task instance position, and select the instance with the smallest absolute value of the difference as the task instance to process the slice. If the absolute values of the difference between two task instances are the same, the task instance with a positive difference is selected first.
[0152] Task sharding allows task instances to collaboratively process tasks in parallel. Allocating task shards using the above allocation algorithm can ensure that only a small number of task shards will be affected when the task service instance is dynamically scaled up or down.
[0153] Then, the task instance reads the enterprise card list information corresponding to the shard in the Redis cache. After determining that no other instance is processing the task shard, it serially and synchronously processes the data synchronization task of each shard.
[0154] When processing the company's card data synchronization task, it is necessary to check the data validity period and determine whether the task of the current data cycle has been completed. If not, start a new task or continue the previous task.
[0155] Among them, when starting a new task, it is necessary to first determine whether the dependent data meets the conditions. If not, exit the current polling process; if the conditions are met, it is necessary to obtain the dependent data first, determine whether the dependent data has been updated, and update the data content related to the task data according to the changes. Then synchronize the card data.
[0156] To continue the previous task, you need to read the previous task progress. Then continue the original progress and synchronize the card data.
[0157] Then, the number card data is synchronized. The task will call several southbound interfaces to obtain data. When the southbound interface call fails or is restricted, the current processing progress data information needs to be saved and the current polling process must be exited.
[0158] The present invention, through the above-mentioned method, has significant improvements over the scheduled one-time execution of the traditional scheduled data acquisition method. In the traditional method, if an exception occurs midway or the task is terminated due to access restrictions, the current cycle data acquisition will fail, the data will be permanently lost, and it cannot support distributed multi-instance parallel processing and load balancing, and cannot achieve high availability. The present invention has significant advantages and effects: (1) It adopts task slicing according to the enterprise, supports distributed multi-service instance parallel collaborative processing of tasks, can achieve high availability and load balancing, and support dynamic expansion and contraction of service instances. (2) The scheduled polling mechanism can be used to realize task segmentation and gradually advance the task progress. When the task is abnormal or restricted, it has strong fault tolerance and can be more suitable for synchronous tasks that need to call a large number of different interfaces to obtain number card attributes. (3) The task data cycle can be dynamically adjusted without restarting the service instance, and supports dynamic configuration effectiveness.
[0159] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0160] Embodiment 3
[0161] Reference Figure 4 , shows a structural block diagram of a data synchronization device provided in Embodiment 3 of the present invention; specifically, it may include the following modules:
[0162] A number card list data acquisition module 401 is used to acquire number card list data, wherein the number card list data has a corresponding enterprise identifier and a paging identifier;
[0163] The enterprise list information generating module 402 is used to generate the enterprise list information for the number card list data;
[0164] An enterprise card list grouping generation module 403 is used to group the enterprise list information based on the enterprise identifier and the paging identifier to generate an enterprise card list grouping;
[0165] A data synchronization task slice determination module 404 is used to determine a plurality of data synchronization task slices based on the enterprise card list grouping; the data synchronization task slices have corresponding polling cycles and interface status parameters;
[0166] The target number card synchronization data generation module 405 is used to send the data synchronization task slice to the task service instance; the task service instance is used to receive the data synchronization task slice; based on the enterprise list information, the target data synchronization task slice is determined from the data synchronization task slice; through the remote dictionary service Redis, the data synchronization task slice is executed according to the polling cycle and the interface status parameters to generate the target number card synchronization data; the remote dictionary service Redis is used to cache the enterprise list information.
[0167] Optionally, the target number card synchronization data generation module may include:
[0168] An Internet Protocol address acquisition submodule, used to acquire the Internet Protocol address of the task service instance;
[0169] A target task service instance determination submodule, used to determine a target task service instance corresponding to the data synchronization task slice based on the enterprise identifier, the paging identifier and the Internet Protocol address;
[0170] The data synchronization task slice sending submodule is used to send the data synchronization task slice to the target task service instance.
[0171] Embodiment 4
[0172] Reference Figure 5 , shows a structural block diagram of a data synchronization device provided in Embodiment 4 of the present invention; specifically, it may include the following modules:
[0173] The data synchronization task slice receiving module 501 is used to receive the data synchronization task slice;
[0174] An enterprise list information acquisition module 502 is used to acquire the enterprise list information from the remote dictionary service Redis;
[0175] A target data synchronization task slice determination module 503 is used to determine a target data synchronization task slice from the data synchronization task slices based on the enterprise list information;
[0176] The data synchronization task slice execution module 504 is used to execute the data synchronization task slice according to the polling cycle and the interface status parameter through the remote dictionary service Redis to generate target number card synchronization data.
[0177] Optionally, the remote dictionary service Redis is used to configure corresponding data validity period and dependent data for the data synchronization task slice, and the target data synchronization task slice determination module may further include:
[0178] A valid data synchronization task slice determination submodule, used to determine a valid data synchronization task slice from the data synchronization task slices based on the data validity period;
[0179] A historical synchronization task progress data acquisition submodule is used to obtain the historical synchronization task progress data and the dependency data corresponding to the valid data synchronization task slice from the remote dictionary service Redis;
[0180] The target data synchronization task slice determination submodule is used to determine the target data synchronization task slice from the valid data synchronization task slices based on the historical synchronization task progress data and the dependency data.
[0181] Optionally, the data synchronization task slicing execution module may include:
[0182] An initial number card synchronization data generation submodule is used to generate initial number card synchronization data based on the enterprise number card list grouping and the target data synchronization task slice;
[0183] The data synchronization task slice execution submodule is used to generate target number card synchronization data based on the enterprise number card list group and the initial number card synchronization data when the interface status parameter meets the preset standard.
[0184] Optionally, it may also include:
[0185] The historical synchronization task progress data generating submodule is used to use the initial number card synchronization data as the historical synchronization task progress data when the interface status parameter does not meet the preset standard.
[0186] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0187] In addition, an embodiment of the present invention further provides an electronic device, including: a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, the various processes of the above-mentioned data synchronization method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.
[0188] The embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, each process of the above-mentioned data synchronization method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. The computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0189] Figure 6 A schematic diagram of the hardware structure of an electronic device for implementing various embodiments of the present invention.
[0190] The electronic device 600 includes but is not limited to: a radio frequency unit 601, a network module 602, an audio output unit 603, an input unit 604, a sensor 605, a display unit 606, a user input unit 607, an interface unit 608, a memory 609, a processor 610, and a power supply 611. Those skilled in the art will appreciate that Figure 6 The electronic device structure shown in the figure does not constitute a limitation on the electronic device, and the electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. In the embodiments of the present invention, the electronic device includes but is not limited to a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted terminal, a wearable device, and a pedometer.
[0191] It should be understood that in the embodiment of the present invention, the radio frequency unit 601 can be used for receiving and sending signals during information transmission or communication. Specifically, after receiving downlink data from the base station, it is sent to the processor 610 for processing; in addition, uplink data is sent to the base station. Generally, the radio frequency unit 601 includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer, etc. In addition, the radio frequency unit 601 can also communicate with the network and other devices through a wireless communication system.
[0192] The electronic device provides users with wireless broadband Internet access through the network module 602, such as helping users to send and receive emails, browse web pages, and access streaming media.
[0193] The audio output unit 603 can convert the audio data received by the RF unit 601 or the network module 602 or stored in the memory 609 into an audio signal and output it as sound. Moreover, the audio output unit 603 can also provide audio output related to a specific function performed by the electronic device 600 (for example, a call signal reception sound, a message reception sound, etc.). The audio output unit 603 includes a speaker, a buzzer, a receiver, etc.
[0194] The input unit 604 is used to receive audio or video signals. The input unit 604 may include a graphics processor (GPU) 6041 and a microphone 6042, and the graphics processor 6041 processes the image data of a static picture or video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The processed image frame can be displayed on the display unit 606. The image frame processed by the graphics processor 6041 can be stored in the memory 609 (or other storage medium) or sent via the radio frequency unit 601 or the network module 602. The microphone 6042 can receive sound and can process such sound into audio data. The processed audio data can be converted into a format output that can be sent to a mobile communication base station via the radio frequency unit 601 in the case of a telephone call mode.
[0195] The electronic device 600 also includes at least one sensor 605, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor includes an ambient light sensor and a proximity sensor, wherein the ambient light sensor can adjust the brightness of the display panel 6061 according to the brightness of the ambient light, and the proximity sensor can turn off the display panel 6061 and / or the backlight when the electronic device 600 is moved to the ear. As a type of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in each direction (generally three axes), and can detect the magnitude and direction of gravity when stationary, which can be used to identify the posture of the electronic device (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; the sensor 605 can also include a fingerprint sensor, a pressure sensor, an iris sensor, a molecular sensor, a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, etc., which will not be repeated here.
[0196] The display unit 606 is used to display information input by the user or information provided to the user. The display unit 606 may include a display panel 6061, which may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like.
[0197] The user input unit 607 can be used to receive input digital or character information, and to generate key signal input related to user settings and function control of the electronic device. Specifically, the user input unit 607 includes a touch panel 6071 and other input devices 6072. The touch panel 6071, also known as a touch screen, can collect the user's touch operation on or near it (such as the user's operation on the touch panel 6071 or near the touch panel 6071 using any suitable object or accessory such as a finger, stylus, etc.). The touch panel 6071 may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into contact coordinates, and then sends it to the processor 610, receives the command sent by the processor 610 and executes it. In addition, the touch panel 6071 can be implemented in various types such as resistive, capacitive, infrared and surface acoustic waves. In addition to the touch panel 6071, the user input unit 607 may also include other input devices 6072. Specifically, other input devices 6072 may include but are not limited to a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be described in detail here.
[0198] Furthermore, the touch panel 6071 may be overlaid on the display panel 6061. When the touch panel 6071 detects a touch operation on or near it, it is transmitted to the processor 610 to determine the type of touch event. Then, the processor 610 provides corresponding visual output on the display panel 6061 according to the type of touch event. Figure 6 In the figure, the touch panel 6071 and the display panel 6061 are used as two independent components to realize the input and output functions of the electronic device. However, in some embodiments, the touch panel 6071 and the display panel 6061 can be integrated to realize the input and output functions of the electronic device, which is not limited here.
[0199] The interface unit 608 is an interface for connecting an external device to the electronic device 600. For example, the external device may include a wired or wireless headset port, an external power supply (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device with an identification module, an audio input / output (I / O) port, a video I / O port, a headphone port, etc. The interface unit 608 may be used to receive input (e.g., data information, power, etc.) from an external device and transmit the received input to one or more elements within the electronic device 600 or may be used to transmit data between the electronic device 600 and an external device.
[0200] The memory 609 can be used to store software programs and various data. The memory 609 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory 609 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0201] The processor 610 is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire electronic device. By running or executing software programs and / or modules stored in the memory 609 and calling data stored in the memory 609, it performs various functions of the electronic device and processes data, thereby monitoring the electronic device as a whole. The processor 610 may include one or more processing units; preferably, the processor 610 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 610.
[0202] The electronic device 600 may also include a power supply 611 (such as a battery) for supplying power to each component. Preferably, the power supply 611 may be logically connected to the processor 610 through a power management system, thereby managing functions such as charging, discharging, and power consumption through the power management system.
[0203] In addition, the electronic device 600 includes some functional modules not shown, which will not be described in detail here.
[0204] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0205] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0206] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation modes, which are merely illustrative rather than restrictive. Under the guidance of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims, all of which are within the protection of the present invention.
[0207] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in the embodiments of the present invention can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0208] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0209] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0210] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0211] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0212] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, ROM, RAM, magnetic disks, or optical disks.
[0213] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A data synchronization method, characterized in that: The method is applied to a number card data synchronization system, the number card data synchronization system has a plurality of corresponding task service instances, and the task service instance has a remote dictionary service Redis, including: Acquire number card list data, wherein the number card list data has a corresponding enterprise identifier and a paging identifier; Generate enterprise list information for the number card list data; Grouping the enterprise list information based on the enterprise identifier and the paging identifier to generate an enterprise card list group; Determine a plurality of data synchronization task slices based on the enterprise card list grouping; the data synchronization task slices have corresponding polling cycles and interface status parameters; The data synchronization task slice is sent to the task service instance; the task service instance is used to receive the data synchronization task slice; based on the enterprise list information, a target data synchronization task slice is determined from the data synchronization task slice; the data synchronization task slice is executed through the remote dictionary service Redis according to the polling cycle and the interface status parameters to generate target number card synchronization data; the remote dictionary service Redis is used to cache the enterprise list information.
2. The method according to claim 1, characterized in that: The step of sending the data synchronization task slice to the task service instance includes: Obtaining an Internet Protocol address of the task service instance; Determine a target task service instance corresponding to the data synchronization task slice based on the enterprise identifier, the paging identifier, and the Internet Protocol address; The data synchronization task slice is sent to the target task service instance.
3. A data synchronization method, characterized in that: The method is applied to a task service instance, the task service instance has a corresponding number card data synchronization system, the task service instance includes a remote dictionary service Redis, the number card data synchronization system is used to obtain number card list data, the number card list data has a corresponding enterprise identifier and a paging identifier, enterprise list information is determined from the number card list data based on the enterprise identifier and the paging identifier, the enterprise list information is grouped based on the enterprise identifier and the paging identifier to generate an enterprise number card list group, multiple data synchronization task slices are determined based on the enterprise number card list group, the data synchronization task slices have corresponding polling cycles and interface status parameters, and the data synchronization task slices are sent to the task service instance, and the remote dictionary service Redis is used to cache the enterprise list information, including: Receiving the data synchronization task slice; Obtain the enterprise list information from the remote dictionary service Redis; Determine a target data synchronization task slice from the data synchronization task slices based on the enterprise list information; The data synchronization task slice is executed through the remote dictionary service Redis according to the polling cycle and the interface status parameter to generate target number card synchronization data.
4. The method according to claim 3, characterized in that: The remote dictionary service Redis is used to configure corresponding data validity period and dependent data for the data synchronization task slice, and the step of determining the target data synchronization task slice from the data synchronization task slice based on the enterprise list information also includes: Based on the data validity period, determining a valid data synchronization task slice from the data synchronization task slices; Obtain the historical synchronization task progress data and the dependency data corresponding to the valid data synchronization task slice from the remote dictionary service Redis; The target data synchronization task slice is determined from the valid data synchronization task slices based on the historical synchronization task progress data and the dependency data.
5. The method according to claim 4, characterized in that The step of executing the data synchronization task slice according to the polling cycle and the interface status parameter through the remote dictionary service Redis to generate target number card synchronization data includes: Generate initial number card synchronization data based on the enterprise number card list grouping and the target data synchronization task slice; When the interface status parameter meets the preset standard, the target number card synchronization data is generated based on the enterprise number card list grouping and the initial number card synchronization data.
6. The method according to claim 5, characterized in that Also includes: When the interface status parameter does not meet the preset standard, the initial number card synchronization data is used as the historical synchronization task progress data.
7. A data synchronization device, characterized in that: The device is applied to a number card data synchronization system, and the number card data synchronization system has a plurality of corresponding task service instances, and the task service instance has a remote dictionary service Redis, including: A number card list data acquisition module, used to acquire number card list data, the number card list data having a corresponding enterprise identifier and a paging identifier; An enterprise list information generating module, used to generate enterprise list information for the number card list data; An enterprise card list grouping generation module, used to group the enterprise list information based on the enterprise identifier and the paging identifier to generate an enterprise card list grouping; A data synchronization task slice determination module, used to determine a plurality of data synchronization task slices based on the enterprise card list grouping; the data synchronization task slices have corresponding polling cycles and interface status parameters; A target number card synchronization data generation module is used to send the data synchronization task slice to the task service instance; the task service instance is used to receive the data synchronization task slice; based on the enterprise list information, the target data synchronization task slice is determined from the data synchronization task slice; the data synchronization task slice is executed through the remote dictionary service Redis according to the polling cycle and the interface status parameters to generate target number card synchronization data; the remote dictionary service Redis is used to cache the enterprise list information.
8. The device according to claim 7, characterized in that The target number card synchronization data generation module includes: An Internet Protocol address acquisition submodule, used to acquire the Internet Protocol address of the task service instance; A target task service instance determination submodule, used to determine a target task service instance corresponding to the data synchronization task slice based on the enterprise identifier, the paging identifier and the Internet Protocol address; The data synchronization task slice sending submodule is used to send the data synchronization task slice to the target task service instance.
9. A data synchronization device, characterized in that: The device is applied to a task service instance, the task service instance has a corresponding number card data synchronization system and a remote dictionary service Redis, the number card data synchronization system is used to obtain number card list data, the number card list data has a corresponding enterprise identifier and a paging identifier, enterprise list information is determined from the number card list data based on the enterprise identifier and the paging identifier, the enterprise list information is grouped based on the enterprise identifier and the paging identifier, an enterprise number card list group is generated, a plurality of data synchronization task slices are determined based on the enterprise number card list group, the data synchronization task slices have corresponding polling cycles and interface status parameters, and the data synchronization task slices are sent to the task service instance, the remote dictionary service Redis is used to cache the enterprise list information, including: A data synchronization task slice receiving module, used for receiving the data synchronization task slice; An enterprise list information acquisition module, used to acquire the enterprise list information from the remote dictionary service Redis; A target data synchronization task slice determination module, used to determine a target data synchronization task slice from the data synchronization task slices based on the enterprise list information; The data synchronization task slice execution module is used to execute the data synchronization task slice according to the polling cycle and the interface status parameter through the remote dictionary service Redis to generate target number card synchronization data.
10. The device according to claim 9, characterized in that The remote dictionary service Redis is used to configure the corresponding data validity period and dependent data for the data synchronization task slice, and the target data synchronization task slice determination module also includes: A valid data synchronization task slice determination submodule, used to determine a valid data synchronization task slice from the data synchronization task slices based on the data validity period; A historical synchronization task progress data acquisition submodule is used to obtain the historical synchronization task progress data and the dependency data corresponding to the valid data synchronization task slice from the remote dictionary service Redis; The target data synchronization task slice determination submodule is used to determine the target data synchronization task slice from the valid data synchronization task slices based on the historical synchronization task progress data and the dependency data.
11. The device according to claim 10, characterized in that The data synchronization task slicing execution module includes: An initial number card synchronization data generation submodule is used to generate initial number card synchronization data based on the enterprise number card list grouping and the target data synchronization task slice; The data synchronization task slice execution submodule is used to generate target number card synchronization data based on the enterprise number card list group and the initial number card synchronization data when the interface status parameter meets the preset standard.
12. The device according to claim 11, characterized in that Also includes: The historical synchronization task progress data generating submodule is used to use the initial number card synchronization data as the historical synchronization task progress data when the interface status parameter does not meet the preset standard.
13. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; The memory is used to store computer programs; The processor, when used to execute a program stored in the memory, implements the method described in any one of claims 1-2 or 3-6.
14. A computer-readable storage medium having instructions stored thereon, which, when executed by one or more processors, cause the processors to perform the method according to any one of claims 1-2 or 3-6.
Citation Information
Patent Citations
Data synchronization method and device based on distributed cluster
CN110866062A
Data synchronization method and device, server and storage medium
CN114077499A
Cache data synchronization method and device, equipment and storage medium
CN114328618A
Redis-based database data aggregation and synchronization method
US20180260435A1
