Lightweight data management method and device, equipment, storage medium and product
Through the lightweight data management method, directed clusters are built and data synchronization is achieved, which solves the availability problem of the existing technology in abnormal scenarios and ensures the stable operation and data integrity of the system in various situations.
Patent Information
- Application Number
- CN202411167048.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-23
- Publication Date
- 2024-12-17
AI Technical Summary
The prior art cannot ensure the availability of the system in a variety of abnormal scenarios, especially in database downtime or abnormal situations, resulting in unreliable data management.
Using lightweight data management methods, by determining the current application scenario, obtaining the local cache instance list refreshed by the service center, building a directed cluster, and determining the target instance based on the preset rectangle graph and instance list, obtaining and managing target lightweight data , realize data synchronization and three-level data storage mechanism under the Leader-Follower idea.
Ensure system availability in a variety of abnormal scenarios, reduce data management costs, improve data synchronization efficiency, and maintain data integrity when the target database is down or the application restarts.
Smart Images

Figure CN119149637A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to lightweight data management methods, devices, equipment, storage media and products. Background Art
[0002] Microservice architecture is a commonly used design pattern for distributed systems. Specifically, large applications are decomposed into a group of small, independent services. Each service focuses on completing specific business functions. For a single service, multiple instances are used to jointly undertake business functions to achieve load balancing and high availability. Databases are often used between instances to implement distributed scheduled task scheduling, lightweight data storage and synchronization. However, in abnormal scenarios, the parameter configuration in the database or the jobs that rely on the database are unavailable for a short time. That is, the above method cannot guarantee the availability of the system in various abnormal scenarios.
[0003] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. Summary of the invention
[0004] The main purpose of this application is to provide a lightweight data management method, device, equipment, storage medium and product, aiming to solve the technical problem that the existing technology cannot guarantee the availability of the system in various abnormal scenarios.
[0005] To achieve the above objectives, the present application proposes a lightweight data management method, the method comprising:
[0006] Determine the current application scenario;
[0007] When the current application scenario is a preset downtime scenario, obtaining a list of instances of the local cache refreshed by the service center;
[0008] Constructing a directed cluster according to a preset rectangular graph and the instance list, and determining a target instance according to the directed cluster;
[0009] Target lightweight data is acquired according to the target instance and the external system, and data management is performed according to the target lightweight data.
[0010] In one embodiment, the step of constructing a directed cluster according to the preset rectangular graph and the instance list, and determining the target instance according to the directed cluster includes:
[0011] Obtaining the serial number of each instance in the instance list;
[0012] Sorting the instances according to the sequence numbers according to a preset relationship;
[0013] Determine respective adjacent instances according to the sorted instances, and construct directed clusters according to the respective adjacent instances and a preset rectangular graph;
[0014] Determining the sequence number of each instance in the directed cluster;
[0015] The smallest sequence number among the sequence numbers of the instances is obtained, and the target instance is determined according to the smallest sequence number.
[0016] In one embodiment, the step of acquiring target lightweight data according to the target instance and the external system, and performing data management according to the target lightweight data includes:
[0017] Accessing an external system according to the target instance to obtain target lightweight data;
[0018] Updating the disk and cache of the target instance according to the target lightweight data;
[0019] Determine, according to the directed cluster, an instance adjacent to the target instance;
[0020] Obtaining a data version of the instance adjacent to the target instance;
[0021] When the data version of the adjacent instance is smaller than the data version of the target instance, data synchronization is performed on the instance adjacent to the target instance according to the target lightweight data.
[0022] In one embodiment, after the step of determining the current application scenario, the method further includes:
[0023] When the current application scenario is a preset normal scenario, determining a current scheduled task preempted by the instance;
[0024] Calling an external system to obtain target lightweight data by executing the current scheduled task;
[0025] updating the disk and cache of the instance according to the target lightweight data, and updating the target database at the same time;
[0026] The other instance queries the updated first data stored in the target database and obtains the data version of the first data;
[0027] When the data version of the first data is smaller than the data version of the cached data, the disks and caches of other instances are updated.
[0028] In one embodiment, after the step of determining the current application scenario, the method further includes:
[0029] When the current application scenario is a preset reply scenario, the control instance periodically accesses the target database to obtain second data stored in the target database;
[0030] Get the current data of the instance cache;
[0031] When the data version of the second data is greater than the data version of the current data, updating the instance according to the second data;
[0032] When the data version of the second data is smaller than the data version of the current data, the target database is updated according to the current data.
[0033] In one embodiment, after the step of determining the current application scenario, the method further includes:
[0034] When the current application scenario is a preset reply scenario, the control instance periodically accesses the target database to obtain second data stored in the target database;
[0035] Get the current data of the instance cache;
[0036] When the data version of the second data is greater than the data version of the current data, updating the instance according to the second data;
[0037] When the data version of the second data is smaller than the data version of the current data, the target database is updated according to the current data.
[0038] In addition, to achieve the above purpose, the present application also proposes a lightweight data management device, the lightweight data management device comprising:
[0039] A determination module is used to determine the current application scenario;
[0040] An acquisition module, used for acquiring a list of instances of refreshing a local cache by a service center when the current application scenario is a preset downtime scenario;
[0041] A construction module, used to construct a directed cluster according to a preset rectangular diagram and the instance list, and determine a target instance according to the directed cluster;
[0042] The management module is used to obtain target lightweight data according to the target instance and the external system, and perform data management according to the target lightweight data.
[0043] In addition, to achieve the above objectives, the present application also proposes a lightweight data management device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the lightweight data management method as described above.
[0044] In addition, to achieve the above objectives, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the lightweight data management method described above are implemented.
[0045] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the lightweight data management method described above are implemented.
[0046] One or more technical solutions proposed in the present application have at least the following technical effects: determining the current application scenario; when the current application scenario is a preset downtime scenario, obtaining a list of instances of the local cache refreshed by the service center; building a directed cluster according to the preset rectangular diagram and the instance list, and determining the target instance according to the directed cluster; obtaining target lightweight data according to the target instance and the external system, and performing data management according to the target lightweight data; through the above method, when it is determined that the current application scenario is a preset downtime scenario, the Leader-Follower idea is adopted to build a directed cluster to realize the acquisition, update and synchronization between instances of the target lightweight data within the cluster, and at the same time establish a three-level data storage mechanism for instances, namely database, cache and disk, to ensure the availability of the system in various abnormal scenarios and reduce the cost of data management. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] The accompanying drawings herein are incorporated in and constitute a part of the specification, illustrate embodiments consistent with the present application, and together with the description, are used to explain the principles of the present application.
[0048] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0049] Figure 1 A flowchart of the first embodiment of the lightweight data management method of the present application is provided;
[0050] Figure 2 A rectangular schematic diagram of the lightweight data management method provided in Embodiment 1 of the present application;
[0051] Figure 3 A directed cluster diagram of the lightweight data management method provided in Example 1 of the present application;
[0052] Figure 4A flowchart of the second embodiment of the lightweight data management method of the present application is provided;
[0053] Figure 5 A schematic diagram of data propagation of a lightweight data management method provided in Example 2 of the present application;
[0054] Figure 6 A system architecture diagram provided for the lightweight data management method of this application;
[0055] Figure 7 This is a schematic diagram of the module structure of the lightweight data management device according to an embodiment of the present application;
[0056] Figure 8 This is a schematic diagram of the device structure of the hardware operating environment involved in the lightweight data management method in the embodiment of the present application.
[0057] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0058] It should be noted that the execution subject of this embodiment may be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, a data management device, etc. The following takes a data management device as an example to illustrate this embodiment and the following embodiments.
[0059] Based on this, the embodiment of the present application provides a lightweight data management method, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the lightweight data management method of the present application.
[0060] In this embodiment, the lightweight data management method includes steps S10 to S40:
[0061] Step S10, determining the current application scenario.
[0062] It should be noted that the current application scenario refers to the application scenario of the target distributed system at the current moment, which includes but is not limited to a preset normal scenario, a preset response scenario, a preset abnormal scenario, and a preset downtime scenario.
[0063] Furthermore, after step S10, it also includes: when the current application scenario is a preset normal scenario, determining the current scheduled task preempted by the instance; calling an external system to obtain target lightweight data by executing the current scheduled task; updating the disk and cache of the instance according to the target lightweight data, and updating the target database at the same time; other instances query the first data stored in the updated target database and obtain the data version of the first data; when the data version of the first data is smaller than the data version of its own cached data, updating the disk and cache of other instances.
[0064] It should be understood that the preset normal scenario can be a normal database scenario. The current scheduled task indicates the execution of a data update operation. It relies on the database to implement only one instance at the same time. Most of them are implemented using a target database or other single point. They have a strong dependence on the target database or single point and cannot be executed in the preset downtime scenario. When it is determined that the instance preempts the current scheduled task (depends on the target database), the target lightweight data is obtained by calling the external system through the execution of the current scheduled task. The target lightweight data is characterized as the latest data. For the instance, after obtaining the target lightweight data, the disk and cache will be updated, and the target database will be updated at the same time. There is a one-to-one correspondence between the instance, the cache and the disk.
[0065] It is understandable that after the target database is updated, the latest data will be stored in the target database. At this time, for other instances, the target database will be queried to obtain the first data. The self-cached data refers to the data cached by other instances themselves. Then, it is determined whether the data version of the first data is smaller than the data version of the self-cached data. If so, it indicates that other instances need to update the disk and cache. At this time, the disk and cache of other instances are updated to the latest data to realize data update.
[0066] Furthermore, after step S10, it also includes: when the current application scenario is a preset reply scenario, controlling the instance to periodically access the target database to obtain second data stored in the target database; obtaining the current data cached by the instance; when the data version of the second data is greater than the data version of the current data, updating the instance according to the second data; when the data version of the second data is less than the data version of the current data, updating the target database according to the current data.
[0067] It should be understood that the preset reply scenario can be a database reply scenario. When it is determined that the current application scenario is the preset reply scenario, it indicates that the target database has replied. At this time, the control instance accesses the target database periodically. The instance can be all instances in the target distributed system. In the process of accessing the target database, the second data will be obtained in real time, and then it is determined whether the data version of the second data is greater than the data version of the current data. If so, the data cached by the instance is updated. If less than, the data stored in the target database is updated. If equal, they will not update each other, so that the target database obtains the latest data.
[0068] Furthermore, after step S10, it also includes: when the current application scenario is a preset abnormal scenario, determining the scenario where the target database is located; when the scenario where the target database is located is a preset normal scenario, controlling the instance to load parameter configuration from the target database; when the scenario where the target data is located is not a preset normal scenario, controlling the instance to load parameter configuration from the disk; adding the instance after the parameter configuration is loaded to a directed cluster, and determining the instance adjacent to the instance after the parameter configuration is loaded according to the directed cluster; and updating and synchronizing data according to the instance adjacent to the instance after the parameter configuration is loaded.
[0069] It can be understood that the preset exception scenario can be an instance exception scenario. When determining that the current application scenario is the preset exception scenario, it is necessary to further determine the scenario in which the target database is located. If it is the preset normal scenario, it indicates that the instance exception causes a restart in the database normal scenario. At this time, the control instance loads the parameter configuration from the target database. If it is not the preset normal scenario, it indicates that the instance exception causes a restart in the database exception scenario. At this time, the control instance loads the parameter configuration from the disk. After the loading is completed, the instance with the loaded parameter configuration is added to the directed cluster, and then the data is updated and synchronized in a manner that determines adjacent instances.
[0070] Step S20, when the current application scenario is a preset downtime scenario, obtain a list of instances of the local cache refreshed by the service center.
[0071] It can be understood that the preset downtime scenario can be a database downtime scenario. Determining that the current application scenario is the preset downtime scenario can be obtained by the instance by detecting the status of the target database, and the detection interval of the instance can be 5 seconds. The service center is used to manage and coordinate instances, and instance startup needs to register with the service center. In this embodiment, the instance will access the service center to refresh the local village at intervals, and the interval can be 10 seconds, that is, the instance will read the locally cached instance list.
[0072] Step S30: construct a directed cluster according to the preset rectangular diagram and the instance list, and determine the target instance according to the directed cluster.
[0073] It should be understood that the preset rectangular diagram may be a rectangular diagram in which the maximum in-degree and out-degree of each instance is set to a preset value. The preset value may be 3, that is, each instance is connected to at most three other instances. Figure 2 , Figure 2 It is a rectangular schematic diagram, specifically: taking 16 instances as an example to illustrate, the preset rectangular diagram is divided into two horizontal and vertical columns, the numbers filled in the central rectangular box from the upper left to the lower right are all 0, and the numbers filled in the rectangular boxes on both sides are all 1.
[0074] Further, step S30 includes: obtaining the serial number of each instance in the instance list; sorting each instance according to the serial number according to a preset relationship; determining the respective adjacent instances based on the sorted instances, and constructing a directed cluster based on the respective adjacent instances and a preset rectangular diagram; determining the serial number of each instance in the directed cluster; obtaining the minimum serial number among the serial numbers of the instances, and determining the target instance based on the minimum serial number.
[0075] It can be understood that in this embodiment, each instance has a sequence number. At this time, the instances are sorted according to the sequence number according to the preset relationship. The preset relationship can be a relationship from large to small. After the sorting is completed, there are adjacent instances between the instances. For example, instance 1 and instance 2, instance 3 and instance 4 are adjacent instances. At this time, a connection is established with the adjacent instance in combination with its own sequence number to realize the construction of a directed cluster using the Leader-Follower idea. Figure 3 , Figure 3 The diagram is a directed cluster diagram, specifically: 16 instances are used as an example, where instance 9, instance 12, instance 13, instance 15 and instance 16 have only one adjacent instance, instance 8, instance 10, instance 11 and instance 14 have two adjacent instances, and instance 3, instance 4, instance 7, instance 1, instance 2, instance 5 and instance 6 have three adjacent instances. In addition, after the directed cluster is constructed, the instance with the smallest sequence number in the directed cluster is set as the Leader, and the target instance determined at this time is instance 1.
[0076] Step S40: acquiring target lightweight data according to the target instance and the external system, and performing data management according to the target lightweight data.
[0077] It can be understood that after determining the target instance, the target instance is used to complete the function of the scheduled task that cannot be executed due to the target database crash, that is, the target instance accesses the external system to obtain the target lightweight data, that is, obtains the latest data, and then performs data management based on the target lightweight data. The data management includes but is not limited to data updates and data synchronization of the three-level storage mechanism, thereby realizing lightweight data synchronization. Different from the conventional one-master and multiple-slave structure, the directed cluster in this embodiment is a mesh structure, which makes the synchronization between instances have strong scalability and robustness, and is suitable for consistency scenarios of lightweight data in large-scale clusters. The three-level storage mechanism is a target database-cache-disk mechanism. Without relying on middleware such as Redis, it saves software and hardware resources, and ensures that data will not be lost when the target database crashes or the application is restarted.
[0078] This embodiment determines the current application scenario; when the current application scenario is a preset downtime scenario, obtains a list of instances of the local cache refreshed by the service center; builds a directed cluster according to the preset rectangular diagram and the instance list, and determines the target instance according to the directed cluster; obtains target lightweight data according to the target instance and the external system, and performs data management according to the target lightweight data; through the above method, when it is determined that the current application scenario is a preset downtime scenario, the Leader-Follower idea is adopted to build a directed cluster, realize the acquisition, update and synchronization between instances of the target lightweight data within the cluster, and establish a three-level data storage mechanism for the instance, namely, database, cache and disk, to ensure the availability of the system in various abnormal scenarios and reduce the cost of data management.
[0079] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can be referred to the above introduction, and will not be repeated in the following. Figure 4 , step S10 includes steps S401 to S405:
[0080] Step S401: access an external system according to the target instance to obtain target lightweight data.
[0081] It should be noted that the external system refers to a system that stores the latest data. After the target instance is determined, the target instance accesses the external system to obtain the target lightweight data.
[0082] Step S402: updating the disk and cache of the target instance according to the target lightweight data.
[0083] It is understandable that after obtaining the target lightweight data, the disk and cache corresponding to the target instance are determined, and the data of the disk and cache are updated. For example, the target instance is 1, the corresponding disk is disk 1, and the corresponding cache is cache 1.
[0084] Step S403: determining instances adjacent to the target instance according to the directed cluster.
[0085] It should be understood that after a directed cluster is constructed, the directed cluster can be used to determine instances adjacent to the target instance. For example, when the target instance is instance 1, the adjacent instances are determined to be instance 2, instance 3, and instance 4.
[0086] Step S404: Acquire the data version of the instance adjacent to the target instance.
[0087] It can be understood that the data version of the adjacent instance refers to the version of the cached data of the instance adjacent to the target instance. The larger the value of the data version is, the newer the data is.
[0088] Step S405 : when the data version of the adjacent instance is smaller than the data version of the target instance, data synchronization is performed on the instance adjacent to the target instance according to the target lightweight data.
[0089] It should be understood that in this embodiment, the data of the adjacent instance is obtained by periodically accessing the adjacent instance between instances. That is, after accessing the data of the target instance, the adjacent instance determines whether its own data version is smaller than the data version of the target instance. If so, it is necessary to use the target lightweight data to synchronize the data of the instance adjacent to the target instance to achieve data propagation.
[0090] Understandably, reference Figure 5 , Figure 5 The figure is a schematic diagram of data propagation, specifically: the upper left is the initial data, the upper right is the data after one propagation, the lower right is the data after three propagations, and the lower right is the data after five propagations, that is, after several timed propagations, the data consistency in the cluster is achieved, so that the data between instances can be consistent within a limited time. Among them, the instances selected in the dotted box are the instances that have been updated and synchronized. If 16 instances are taken as an example, data consistency can be achieved after three propagations, and the propagation time can be 6 seconds.
[0091] This embodiment accesses an external system to obtain target lightweight data according to the target instance; updates the disk and cache of the target instance according to the target lightweight data; determines the instance adjacent to the target instance according to the directed cluster; obtains the data version of the instance adjacent to the target instance; when the data version of the adjacent instance is smaller than the data version of the target instance, synchronizes the data of the instance adjacent to the target instance according to the target lightweight data; through the above method, after determining the target instance, the target lightweight data is obtained by accessing the external system, and then the disk and cache data of the target instance are updated. In addition, it is also determined whether the data version of the adjacent instance is smaller than the data version of the target instance. If so, it is necessary to update the data of the adjacent instance to achieve the purpose of data synchronization, thereby effectively improving the efficiency of data synchronization.
[0092] For example, to help understand the implementation process of the lightweight data management method obtained by combining this embodiment with the above-mentioned embodiment 1, please refer to Figure 6 , Figure 6 A system architecture diagram of a lightweight data management method is provided, specifically:
[0093] Multiple instances are used for illustration, and each instance corresponds to a cache and a disk. For example, the disk corresponding to instance 1 is disk 1, and the corresponding cache is cache 1; the disk corresponding to instance 2 is disk 2, and the corresponding cache is cache 2; the disk corresponding to target instance n is disk n, and the corresponding cache is cache n; and instance 1, instance 2...instance n need to be registered with the service center when they are started, and each instance is connected to the target database to update the data stored in the target database. In addition, the instance will also preempt the current scheduled task, and then call the external system to obtain the target lightweight data by executing the current scheduled task. Then use the constructed mesh-structured directed cluster to update and synchronize the data.
[0094] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the lightweight data management method of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.
[0095] This application also provides a lightweight data management device, please refer to Figure 7 , the lightweight data management device comprises:
[0096] The determination module 10 is used to determine the current application scenario.
[0097] The acquisition module 20 is used to acquire a list of instances of refreshing the local cache of the service center when the current application scenario is a preset downtime scenario.
[0098] The construction module 30 is used to construct a directed cluster according to the preset rectangular diagram and the instance list, and determine the target instance according to the directed cluster.
[0099] The management module 40 is used to obtain target lightweight data according to the target instance and the external system, and perform data management according to the target lightweight data.
[0100] This embodiment determines the current application scenario; when the current application scenario is a preset downtime scenario, obtains a list of instances of the local cache refreshed by the service center; builds a directed cluster according to the preset rectangular diagram and the instance list, and determines the target instance according to the directed cluster; obtains target lightweight data according to the target instance and the external system, and performs data management according to the target lightweight data; through the above method, when it is determined that the current application scenario is a preset downtime scenario, the Leader-Follower idea is adopted to build a directed cluster, realize the acquisition, update and synchronization between instances of the target lightweight data within the cluster, and establish a three-level data storage mechanism for the instance, namely, database, cache and disk, to ensure the availability of the system in various abnormal scenarios and reduce the cost of data management.
[0101] The lightweight data management device provided by the present application adopts the lightweight data management method in the above embodiment, which can solve the technical problem that the prior art cannot guarantee the availability of the system in various abnormal scenarios. Compared with the prior art, the beneficial effects of the lightweight data management device provided by the present application are the same as the beneficial effects of the lightweight data management method provided by the above embodiment, and the other technical features in the lightweight data management device are the same as the features disclosed in the above embodiment method, which will not be repeated here.
[0102] In one embodiment, the determination module 10 is also used to determine the current scheduled task preempted by the instance when the current application scenario is a preset normal scenario; call an external system to obtain target lightweight data by executing the current scheduled task; update the disk and cache of the instance according to the target lightweight data, and update the target database at the same time; query the first data stored in the updated target database by other instances, and obtain the data version of the first data; when the data version of the first data is smaller than the data version of its own cached data, update the disk and cache of other instances.
[0103] In one embodiment, the determination module 10 is also used to control the instance to periodically access the target database when the current application scenario is a preset reply scenario to obtain the second data stored in the target database; obtain the current data cached by the instance; when the data version of the second data is greater than the data version of the current data, update the instance according to the second data; when the data version of the second data is less than the data version of the current data, update the target database according to the current data.
[0104] In one embodiment, the determination module 10 is also used to determine the scenario where the target database is located when the current application scenario is a preset abnormal scenario; when the scenario where the target database is located is a preset normal scenario, control the instance to load parameter configuration from the target database; when the scenario where the target database is located is not a preset normal scenario, control the instance to load parameter configuration from the disk; add the instance after the parameter configuration is loaded to a directed cluster, and determine the instance adjacent to the instance after the parameter configuration is loaded according to the directed cluster; and update and synchronize data according to the instance adjacent to the instance after the parameter configuration is loaded.
[0105] In one embodiment, the construction module 30 is also used to obtain the serial number of each instance in the instance list; sort the instances according to the serial number according to a preset relationship; determine the respective adjacent instances based on the sorted instances, and construct a directed cluster based on the respective adjacent instances and a preset rectangular diagram; determine the serial number of each instance in the directed cluster; obtain the minimum serial number among the serial numbers of the instances, and determine the target instance based on the minimum serial number.
[0106] In one embodiment, the management module 40 is also used to access an external system to obtain target lightweight data according to the target instance; update the disk and cache of the target instance according to the target lightweight data; determine the instance adjacent to the target instance according to the directed cluster; obtain the data version of the instance adjacent to the target instance; and when the data version of the adjacent instance is smaller than the data version of the target instance, synchronize the data of the instance adjacent to the target instance according to the target lightweight data.
[0107] The present application provides a lightweight data management device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the lightweight data management method in the above-mentioned embodiment one.
[0108] Reference below Figure 8, which shows a schematic diagram of the structure of a lightweight data management device suitable for implementing the embodiment of the present application. The lightweight data management device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 8 The lightweight data management device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0109] like Figure 8 As shown, the lightweight data management device may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the lightweight data management device are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 1003 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 1009. The communication device 1009 can allow the lightweight data management device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows a lightweight data management device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems may be implemented or have alternatively.
[0110] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0111] The lightweight data management device provided by the present application adopts the lightweight data management method in the above embodiment, which can solve the technical problem that the prior art cannot guarantee the availability of the system in various abnormal scenarios. Compared with the prior art, the beneficial effects of the lightweight data management device provided by the present application are the same as the beneficial effects of the lightweight data management method provided by the above embodiment, and the other technical features in the lightweight data management device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0112] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0113] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0114] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, wherein the computer-readable program instructions are used to execute the lightweight data management method in the above-mentioned embodiment.
[0115] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM: Erasable Programable Read Only Memory or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM: CD-Read Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.
[0116] The computer-readable storage medium may be included in the lightweight data management device; or may exist independently without being assembled into the lightweight data management device.
[0117] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0118] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0119] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0120] The readable storage medium provided by the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned lightweight data management method, and can solve the technical problem that the prior art cannot guarantee the availability of the system in various abnormal scenarios. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as the beneficial effects of the lightweight data management method provided by the above-mentioned embodiment, and will not be repeated here.
[0121] The present application also provides a computer program product, including a computer program, which implements the steps of the lightweight data management method as described above when executed by a processor.
[0122] The computer program product provided by this application can solve the technical problem that the prior art cannot guarantee the availability of the system in various abnormal scenarios. Compared with the prior art, the beneficial effects of the computer program product provided by this application are the same as the beneficial effects of the lightweight data management method provided by the above embodiment, which will not be repeated here.
[0123] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A lightweight data management method, characterized in that: The method comprises: Determine the current application scenario; When the current application scenario is a preset downtime scenario, obtaining a list of instances of the local cache refreshed by the service center; Constructing a directed cluster according to a preset rectangular graph and the instance list, and determining a target instance according to the directed cluster; Target lightweight data is acquired according to the target instance and the external system, and data management is performed according to the target lightweight data.
2. The method according to claim 1, characterized in that The step of constructing a directed cluster according to the preset rectangular graph and the instance list, and determining a target instance according to the directed cluster includes: Obtaining the serial number of each instance in the instance list; Sorting the instances according to the sequence numbers according to a preset relationship; Determine respective adjacent instances according to the sorted instances, and construct directed clusters according to the respective adjacent instances and a preset rectangular graph; Determining the sequence number of each instance in the directed cluster; The smallest sequence number among the sequence numbers of the instances is obtained, and the target instance is determined according to the smallest sequence number.
3. The method according to any one of claims 1 or 2, characterized in that The step of acquiring target lightweight data according to the target instance and the external system, and performing data management according to the target lightweight data includes: Accessing an external system according to the target instance to obtain target lightweight data; Updating the disk and cache of the target instance according to the target lightweight data; Determine, according to the directed cluster, an instance adjacent to the target instance; Obtaining a data version of the instance adjacent to the target instance; When the data version of the adjacent instance is smaller than the data version of the target instance, data synchronization is performed on the instance adjacent to the target instance according to the target lightweight data.
4. The method according to claim 1, characterized in that After the step of determining the current application scenario, the method further includes: When the current application scenario is a preset normal scenario, determining a current scheduled task preempted by the instance; Calling an external system to obtain target lightweight data by executing the current scheduled task; updating the disk and cache of the instance according to the target lightweight data, and updating the target database at the same time; The other instance queries the updated first data stored in the target database and obtains the data version of the first data; When the data version of the first data is smaller than the data version of the cached data, the disks and caches of other instances are updated.
5. The method according to claim 1, characterized in that After the step of determining the current application scenario, the method further includes: When the current application scenario is a preset reply scenario, the control instance periodically accesses the target database to obtain second data stored in the target database; Get the current data of the instance cache; When the data version of the second data is greater than the data version of the current data, updating the instance according to the second data; When the data version of the second data is smaller than the data version of the current data, the target database is updated according to the current data.
6. The method according to claim 1, characterized in that After the step of determining the current application scenario, the method further includes: When the current application scenario is a preset abnormal scenario, determining the scenario where the target database is located; When the scenario where the target database is located is a preset normal scenario, the control instance loads parameter configuration from the target database; When the scene where the target data is located is not a preset normal scene, the control instance loads parameter configuration from the disk; Adding the instance after the parameter configuration is loaded to the directed cluster, and determining the instance adjacent to the instance after the parameter configuration is loaded according to the directed cluster; Data is updated and synchronized according to the instance adjacent to the instance configured with the loading parameters.
7. A lightweight data management device, characterized in that: The device comprises: A determination module is used to determine the current application scenario; An acquisition module, used for acquiring a list of instances of refreshing a local cache by a service center when the current application scenario is a preset downtime scenario; A construction module, used to construct a directed cluster according to a preset rectangular diagram and the instance list, and determine a target instance according to the directed cluster; The management module is used to obtain target lightweight data according to the target instance and the external system, and perform data management according to the target lightweight data.
8. A lightweight data management device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the lightweight data management method according to any one of claims 1 to 6.
9. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the lightweight data management method according to any one of claims 1 to 6 are implemented.
10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the lightweight data management method according to any one of claims 1 to 6 are implemented.
