CN117435604A - Data updating method and device, electronic equipment and storage medium - Google Patents
Data updating method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN117435604A CN117435604A CN202311434655.5A CN202311434655A CN117435604A CN 117435604 A CN117435604 A CN 117435604A CN 202311434655 A CN202311434655 A CN 202311434655A CN 117435604 A CN117435604 A CN 117435604A
- Authority
- CN
- China
- Prior art keywords
- resource object
- derivative
- original
- data
- preset
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 42
- 238000012544 monitoring process Methods 0.000 claims abstract description 13
- 238000004590 computer program Methods 0.000 claims description 8
- 238000005096 rolling process Methods 0.000 claims description 6
- 230000001360 synchronised effect Effects 0.000 abstract description 12
- 238000010586 diagram Methods 0.000 description 11
- 238000004891 communication Methods 0.000 description 5
- 230000008859 change Effects 0.000 description 4
- 238000012986 modification Methods 0.000 description 4
- 230000004048 modification Effects 0.000 description 4
- 230000006978 adaptation Effects 0.000 description 2
- 230000010076 replication Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000012790 confirmation Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000008520 organization Effects 0.000 description 1
- 230000008569 process Effects 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/23—Updating
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/23—Updating
- G06F16/2358—Change logging, detection, and notification
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/27—Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
- G06F16/275—Synchronous replication
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/1095—Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Databases & Information Systems (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computing Systems (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention provides a data updating method, a device, electronic equipment and a storage medium, and relates to the field of cluster business service, wherein the method comprises the following steps: acquiring preset derivative information corresponding to the derivative resource object, and determining an original resource object for derivative creation of the derivative resource object according to the preset derivative information; monitoring the data updating conditions of the original resource object and the derivative resource object; when any one data object in the original resource object and the derivative resource object is determined to be subjected to data updating, the updated data is synchronized to other data objects which are not updated according to preset derivative information; the derivative relation between the derivative resource object and the original resource object can be recorded in advance, and the data update condition of the derivative resource object and the original resource object can be monitored, so long as any one of the original resource object and the derivative resource object is subjected to data update, the updated data can be synchronized to all the resource objects according to preset derivative information, and repeated configuration can be further effectively reduced.
Description
Technical Field
The present invention relates to the field of cluster service, and in particular, to a data updating method, apparatus, electronic device, and storage medium.
Background
Business services deployed in clusters (e.g., K8S clusters, kubernetes, open source container orchestration platform) are typically loaded with resource objects, such as ConfigMap, secret, for managing the configuration data of the business services. As business content of business services becomes more and more complex, configuration items in resource objects are increased, and cost brought by updating the resource objects is increased gradually. Especially, for the original resource object mounted by the original business service and the derivative resource object mounted by the derivative business service which is created by derivative based on the original business service, a great amount of repeated configuration exists for updating the original resource object and the derivative resource object, and the maintainability of the business service is reduced.
Disclosure of Invention
The invention aims to provide a data updating method, a device, electronic equipment and a storage medium, which can record the derivative relation between a derivative resource object and an original resource object in advance, and further synchronize updated data to all resource objects according to the derivative relation as long as any one of the original resource object and the derivative resource object is determined to be updated, so that repeated configuration can be effectively reduced.
In order to solve the above technical problems, the present invention provides a data updating method, including:
Acquiring preset derivative information corresponding to a derivative resource object, and determining an original resource object for derivative creation of the derivative resource object according to the preset derivative information;
monitoring the data updating conditions of the original resource object and the derivative resource object;
and when determining that any one of the original resource object and the derivative resource object is subjected to data updating, synchronizing the updating data to other resource objects which are not updated according to the preset derivative information.
Optionally, when determining that any one of the original resource object and the derivative resource object is updated, synchronizing update data to other resource objects that are not updated according to the preset derivative information includes:
and when the original resource object is determined to be updated, synchronizing the updated data from the original resource object to the derivative resource object according to the preset derivative information.
Optionally, when determining that any one of the original resource object and the derivative resource object is updated, synchronizing update data to other resource objects that are not updated according to the preset derivative information includes:
When the derivative resource object is determined to be subjected to data updating, synchronizing the updating data from the derivative resource object to the original resource object according to preset derivative information of the derivative resource object;
and synchronizing the update data from the original resource object to other derivative resource objects according to preset derivative information between the original resource object and the other derivative resource objects.
Optionally, the synchronizing the update data to other resource objects not updated according to the preset derivative information includes:
and synchronizing the updated data to other resource objects which are not updated across the naming space according to the preset derivative information, wherein the original resource object and the derivative resource object are located in different naming spaces.
Optionally, before obtaining the preset derivative information corresponding to the derivative resource object, the method further includes:
receiving a micro-service creation request, and determining an original business micro-service corresponding to the micro-service creation request, an original naming space where the original business micro-service is located and the original resource object mounted in the original business micro-service;
copying and creating derivative business micro-services in a new naming space by utilizing the original business micro-services;
Copying and creating the derivative resource object in the new naming space by utilizing the original resource object, recording preset derivative information between the derivative resource object and the original resource object, and mounting the derivative resource object to the derivative business micro-service; the preset derivative information comprises the name of the original name space and the name of the original resource object.
Optionally, the copying and creating the derivative resource object in the new namespace by using the original resource object, and recording preset derivative information between the derivative resource object and the original resource object, including:
creating an initial resource object in the new name space, and writing the name of the original name space and the name of the original resource object into the initial resource object as the preset derivative information;
and synchronizing data in the original resource object to the initial resource object across a name space according to preset derivative information in the initial resource object to obtain the derivative resource object.
Optionally, after synchronizing the update data to other resource objects that are not updated according to the preset derived information, the method further includes:
And rolling and updating the derivative business micro-service by utilizing the updated derivative resource object based on the deployment mode of the derivative business micro-service.
The invention also provides a data updating device, which comprises:
the original resource object confirming module is used for acquiring preset derivative information corresponding to the derivative resource object and determining an original resource object for creating the derivative resource object in a derivative mode according to the preset derivative information;
the monitoring module is used for monitoring the data updating conditions of the original resource object and the derivative resource object;
and the updating module is used for synchronizing the updating data to other resource objects which are not updated according to the preset derivative information when determining that any one of the original resource object and the derivative resource object is subjected to data updating.
The present invention also provides an electronic device including:
a memory for storing a computer program;
and a processor for implementing the data updating method as described above when executing the computer program.
The present invention also provides a computer-readable storage medium having stored therein computer-executable instructions that, when loaded and executed by a processor, implement a data updating method as described above.
The invention provides a data updating method, which comprises the following steps: acquiring preset derivative information corresponding to a derivative resource object, and determining an original resource object for derivative creation of the derivative resource object according to the preset derivative information; monitoring the data updating conditions of the original resource object and the derivative resource object; and when determining that any one of the original resource object and the derivative resource object is subjected to data updating, synchronizing updating data to other data objects which are not updated according to the preset derivative information.
Therefore, the invention can firstly obtain the preset derivative information corresponding to the derivative resource object, and determine the original resource object for derivative creation of the derivative resource object according to the preset derivative information, i.e. the invention can record the derivative relation between the derivative resource object and the original resource object in advance. The invention can monitor the data update condition of the original resource object and the derivative resource object, and can synchronize the update data to other data objects which are not updated according to the preset derivative information when determining that any one of the original resource object and the derivative resource object is updated, namely, as long as any one of the original resource object and the derivative resource object is updated, the update data is synchronized to all the resource objects according to the preset derivative information, thereby effectively reducing repeated configuration and effectively guaranteeing the maintainability of business service. The invention also provides a data updating device, electronic equipment and a computer readable storage medium, which have the beneficial effects.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only embodiments of the present invention, and that other drawings can be obtained according to the provided drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic diagram of a service micro-service system according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of another business micro service system according to an embodiment of the present invention;
FIG. 3 is a flowchart of a data update method according to an embodiment of the present invention;
FIG. 4 is a diagram of a micro-server system architecture according to an embodiment of the present invention;
FIG. 5 is a block diagram of a data update apparatus according to an embodiment of the present invention;
fig. 6 is a block diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Business services deployed in clusters (e.g., K8S clusters, kubernetes, open source container orchestration platform) are typically loaded with resource objects, such as ConfigMap, secret, for managing the configuration data of the business services. As business content of business services becomes more and more complex, configuration items in resource objects are increased, and cost brought by updating the resource objects is increased gradually. Especially, for the original resource object mounted by the original business service and the derivative resource object mounted by the derivative business service which is created by derivative based on the original business service, a great amount of repeated configuration exists for updating the original resource object and the derivative resource object, and the maintainability of the business service is reduced. In view of this, the present invention can provide a data update method, which can record the derivative relationship between the derivative resource object and the original resource object in advance, and further synchronize the update data to all resource objects according to the derivative relationship as long as any one of the original resource object and the derivative resource object is determined to be updated, so as to effectively reduce the repeated configuration.
For easy understanding, the business micro service system to which the embodiments of the present invention are applied will be first described briefly. Referring to fig. 1, fig. 1 is a schematic diagram of a business micro service system according to an embodiment of the present invention. Business micro-services are an organization of business services in clusters that are typically configured with individual resource objects, e.g., each business micro-service in fig. 1 (i.e., original business micro-service and derivative business micro-service 1-n, n.gtoreq.1) is configured with a corresponding resource object (i.e., original resource object and derivative resource object 1-n). The resource objects typically contain a ConfigMap object that is typically used to manage non-sensitive configuration data for the business micro-services and a Secret object that is used to manage sensitive configuration data for the business micro-services. To facilitate creation of a service microservice, clusters are typically provided with a derivative creation function, i.e. a copy creation of an original service microservice is performed on the basis of the original service microservice to obtain a new derivative service microservice. Similarly, the original resource object of the original business micro-service can be copied to obtain the derivative resource object to be mounted in the derivative business micro-service. For example, in FIG. 1, derivative business micro-services 1-n may each be created based on the original business micro-service derivative, and the derivative resource object in each derivative business micro-service is also created by replication of the original resource object. Further, to keep the business micro-services separate, each business micro-service may also be in a separate namespace (namespace). Referring to fig. 2, fig. 2 is a schematic diagram of another business micro service system according to an embodiment of the invention. It can be seen that each business micro-service is in an independent namespace and isolated from each other.
In the related art, since the derived resource object is the same as the original resource object, in order to ensure that each derived service micro-service is consistent with the original service micro-service, after the data update of the original resource object, the same update needs to be performed on each derived resource object. However, updating of each derived resource object needs to be performed separately, especially when each business micro-service is in an independent namespace, and the derived resource object needs to be modified separately in each namespace, which easily brings about more repeated configuration operations, and further reduces maintainability of the business micro-service. Therefore, the embodiment of the invention can record the derivative relation information between the original resource object and each derivative resource object in advance, and further can synchronously update all the resource objects with the derivative relation according to the prerecorded derivative relation information when updating the original resource object or the derivative resource object, especially can synchronously update the resource objects in different namespaces, thereby effectively improving the maintainability of the business micro-service.
It should be noted that, the embodiment of the present invention is not limited to a hardware device for specifically executing the method, and may be any electronic device capable of deploying a cluster, for example, may be a personal computer, a server, etc., and may be set according to actual application requirements.
Based on the above system structure description, the data updating method provided by the embodiment of the present invention will be described in detail below. Referring to fig. 3, fig. 3 is a flowchart of a data updating method according to an embodiment of the present invention, where the method may include:
s301, acquiring preset derivative information corresponding to the derivative resource object, and determining an original resource object for derivative creation of the derivative resource object according to the preset derivative information.
In the embodiment of the invention, the preset derivative information is used for recording the derivative relation between the derivative resource object and the original resource object. The derivative relation is specifically as follows: the derived resource object is derived from replication of the original resource object. Therefore, when modifying the original resource object, in order to maintain consistency between business micro services, the same modification needs to be performed on the derivative resource object. In order to improve maintainability, the embodiment of the invention can generate the preset derivative relation in advance, and then can synchronize the update data from the original resource object to the derivative resource object according to the preset derivative information when the data update of the original resource object is determined. Similarly, when the derivative resource object is modified, the update data can be synchronized from the derivative resource object to the original resource object according to the preset derivative information, so that the update data can be further synchronized from the original resource object to other derivative resource objects derived from the original resource object.
It should be noted that, the embodiment of the present invention is not limited to a specific form of the preset derived information, as long as the corresponding relationship between the derived resource object and the original resource object can be determined according to the information. The embodiment of the invention is also not limited to the position where the preset derivative information is stored, for example, the preset derivative information can be arranged in each derivative resource object, can be stored by a special management module, and can be set according to the actual application requirements. In one possible scenario, preset derived information may be provided as metadata in each derived resource object, which may first contain identification information (e.g., a name) of the original resource object, so as to find the original resource object according to the identification information. In addition, when the original resource object and the derivative resource object are set in different namespaces, the preset derivative information may further include a namespace name where the original resource object is located, so that the original resource object is searched in the corresponding namespace according to the namespace name. Because the preset derived information is stored in the derived resource objects, the preset derived information can be obtained from each derived resource object, and the corresponding original resource object is determined according to the information, so that the data change condition of the original resource object can be conveniently monitored.
S302, monitoring the data updating conditions of the original resource object and the derivative resource object.
In the embodiment of the invention, since the derivative resource object is created by copying the original resource object, and the data of the derivative resource object is required to be consistent with the original resource object, the data update condition of the original resource object needs to be monitored first to synchronize the update data to the derivative resource object when the data update of the original resource object is determined. Similarly, the changed data in the derived resource object also needs to be synchronized to the original resource object, so that the embodiment of the invention can monitor the data update condition of the derived resource object. Thus, regardless of which of the original resource object and the derivative resource object is updated, the update data is updated to all resource objects in time.
It should be noted that, the embodiment of the present invention is not limited to the implementation manner of the monitoring operation, for example, the monitoring may be implemented, and the monitoring may be periodically performed. For example, each resource object may be periodically polled to determine whether a data update has occurred for each resource object.
And S303, when any one of the original resource object and the derivative resource object is determined to be updated, synchronizing the updated data to other resource objects which are not updated according to the preset derivative information.
As described above, the embodiment of the present invention has recorded the derivative relationship between the original resource object and each derivative resource object in advance, and can monitor the data update conditions of the original resource object and each derivative resource object, so that the embodiment of the present invention can discover the data update conditions in time, and synchronize the update data to all resource objects rapidly according to the preset derivative information. For example, when it is determined that data update occurs in an original resource object, the embodiment of the present invention may go to the original resource object to obtain update data according to preset derivative information corresponding to each derivative resource object, and synchronize the update data from the original resource object to each derivative resource object.
Based on this, when determining that any one of the original resource object and the derivative resource object is updated, synchronizing the update data to other resource objects that are not updated according to the preset derivative information may include:
step 11: and when the original resource object is determined to be updated, synchronizing the updated data from the original resource object to the derivative resource object according to the preset derivative information.
For example, in the system shown in fig. 1, when it is determined that the original resource object is updated, the system may go to the original resource object according to the preset derivative information in the derivative resource objects 1 to n to obtain the update data, and synchronize the update data to the derivative resource objects 1 to n, so as to quickly synchronize the update data to all the derivative resource objects derived from the original resource object.
For another example, when it is determined that data update occurs in a derivative resource object, the embodiment of the present invention may first synchronize update data to an original resource object according to preset derivative information in the derivative resource object.
Based on the above, when determining that any one of the original resource object and the derivative resource object is updated, synchronizing the update data to other resource objects which are not updated according to the preset derivative information includes:
step 21: and when determining that the derivative resource object generates data update, synchronizing the update data from the derivative resource object to the original resource object according to preset derivative information of the derivative resource object.
It should be noted that, if the original resource object derives only one derived resource object, when determining that the derived resource object is updated with data, the update data only needs to be synchronized with the original resource object. If the original resource object derives a plurality of derived resource objects, when determining that the data update occurs to the certain derived resource object, after synchronizing the update data to the original resource object, the update data between the original resource objects can be further diffused to other unmodified derived resource objects. Specifically, after the data update of the original resource object is completed, since the data update of the original resource object can be monitored at other non-updated derivative resource objects, the update data can be further synchronized from the original resource object to other derivative resource objects according to the preset derivative information between the original resource object and the other derivative resource objects, so as to diffuse the update data into all derivative resource objects derived based on the original resource object.
Based on this, after synchronizing the update data from the derivative resource object to the original resource object according to the preset derivative information of the derivative resource object, it may further include: step 31: and synchronizing the update data from the original resource object to other derivative resource objects according to preset derivative information between the original resource object and the other derivative resource objects.
For example, in the system shown in fig. 1, when it is determined that the derivative resource object 1 is updated with data, the update data may be synchronized to the original resource object according to preset derivative information inside the derivative resource object. And then, after the derivative resource objects 2-n determine that the original resource object is updated with data, the data can be synchronously updated from the original resource object according to preset derivative information in the derivative resource objects. Therefore, the embodiment of the invention can ensure that even the modification of the derived resource object can be synchronized to all the resource objects, thereby effectively ensuring the consistency of the original resource object and the derived resource object.
Particularly, when each resource object is located in different namespaces, because the embodiment of the invention can increase the namespace information of the original resource object in the preset derivative information, the embodiment of the invention can also realize the data synchronization across namespaces.
Based on this, the synchronizing the update data to other resource objects that are not updated according to the preset derived information may include:
step 41: and synchronizing the updated data to other resource objects which are not updated across the naming space according to the preset derivative information, wherein the original resource object and the derivative resource object are located in different naming spaces.
For example, in the system shown in fig. 2, for the derived resource object 1, since the name of the namespace where the original resource object is located may be recorded, when determining that the data update occurs for the original resource object, the embodiment of the present invention may synchronize the update data of the original resource object to the derived resource object 1 located in the namespace 1 according to the record of the derived resource object 1. As are the derivative resource objects 2-n. Therefore, the invention can still realize the data synchronization between the original resource object and the derivative resource object under the condition that the business micro-services are in different namespaces and are isolated from each other, thereby further ensuring the consistency among the resource objects.
Based on the above embodiment, the present invention may first obtain preset derived information corresponding to the derived resource object, and determine the original resource object for deriving and creating the derived resource object according to the preset derived information, that is, the present invention may record in advance a derived relationship between the derived resource object and the original resource object. The invention can monitor the data update condition of the original resource object and the derivative resource object, and can synchronize the update data to other data objects which are not updated according to the preset derivative information when determining that any one of the original resource object and the derivative resource object is updated, namely, as long as any one of the original resource object and the derivative resource object is updated, the update data is synchronized to all the resource objects according to the preset derivative information, thereby effectively reducing repeated configuration and effectively guaranteeing the maintainability of business service.
Based on the above embodiments, the following describes in detail the creation manner of the derivative business micro service and the derivative resource object. In one possible case, before acquiring the preset derivative information corresponding to the derivative resource object, the method may further include:
s401, receiving a micro-service creation request, and determining an original business micro-service corresponding to the micro-service creation request, an original naming space where the original business micro-service is located, and the original resource object mounted in the original business micro-service.
S402, copying and creating derivative business micro-services in a new naming space by utilizing the original business micro-services.
It should be noted that, the embodiments of the present invention are not limited to how to create a new namespace and how to copy the creation of a derivative business micro-service, and reference may be made to the related art of clusters (e.g., K8S).
S403, copying and creating the derivative resource object in the new naming space by utilizing the original resource object, recording preset derivative information between the derivative resource object and the original resource object, and mounting the derivative resource object to the derivative business micro-service; the preset derivative information comprises the name of the original name space and the name of the original resource object.
Therefore, the invention can record the preset derivative information between the derivative resource object and the original resource object in the derivative resource object when the derivative resource object is created. In order to ensure that the original resource object can be found according to the preset derived information, the preset derived information in the embodiment of the present invention includes the name of the original namespace where the original resource object is located and the name of the original resource object.
Further, as described above, since each business micro-service needs to configure an independent resource object, after the creation of the derived resource object is completed, the embodiment of the present invention needs to install it into the derived business micro-service to validate the configuration data in the derived resource object.
The manner in which the derived resource object is created will be described. In one possible scenario, the copying the original resource object in the new namespace to create the derivative resource object, and recording preset derivative information between the derivative resource object and the original resource object may include:
step 51: creating an initial resource object in the new name space, and writing the name of the original name space and the name of the original resource object into the initial resource object as the preset derivative information.
It should be noted that, after the initial resource object is created, the embodiment of the present invention only needs to write the preset derivative information into the object, and does not need to write data (data). The data may be synchronized directly from the original resource object to ensure that the derived resource object remains consistent with the original resource object.
Step 52: and synchronizing data in the original resource object to the initial resource object across a name space according to preset derivative information in the initial resource object to obtain the derivative resource object.
Based on the above embodiment, in the embodiment of the present invention, after the data synchronization of the original resource object and the derivative resource object is completed, in order to ensure that the update data can act on the derivative business micro-service, the derivative business micro-service may be updated in a rolling manner by using the updated derivative resource object based on the deployment mode of the derivative business micro-service. The embodiment of the invention is not limited to a specific deployment mode, for example, a deployment mode such as Deployment, service, deamonSet can be used, and reference can be made to the related technology of the cluster.
Based on this, after synchronizing the update data into other resource objects that are not updated according to the preset derived information, it may further include:
Step 51: and rolling and updating the derivative business micro-service by utilizing the updated derivative resource object based on the deployment mode of the derivative business micro-service.
The above data updating method will be fully described based on a specific schematic diagram. Referring to fig. 4, fig. 4 is a schematic diagram of a micro service system according to an embodiment of the invention. The architecture from front-end to back-end is shown in fig. 4. The interface receives the business micro-service creation or update request and forwards the business micro-service creation or update request to the business generation service through the gateway. The service generation service is responsible for creating and updating derivative service micro-services, acquiring resource object configuration of the service micro-services and forwarding the resource object configuration to the resource object service. The resource object service copies or updates the resource object of the original business micro-service across namespaces to finish the configuration change of the resource object across namespaces.
The resource object maintenance method across namespaces comprises the following steps:
first, a user creates a resource object 1 using a template of the resource object 1, and creates a business micro service 1, and the business micro service 1 mounts the resource object 1. The resource object data of the resource object 1 is as follows:
apiVersion v1// API interface version;
kind, configMap// resource object name;
metadata:// metadata;
name cm// name of resource object 1;
a namespace is a namespace where default// resource object 1 is located;
data:// data of resource object 1;
special.how: ver// data special.how in resource object 1;
specific.type: char// data specific.type in resource object 1.
It can be seen that the resource object service creates a resource object cm with data (i.e., resource object 1) in the default namespace.
In a second step, the user replicates the new business micro-service based on resource object 1. When the service creation service creates the derivative service micro service 1 across the namespaces and the resource object service creates the derivative resource object 1 across the namespaces, the source of the resource object is recorded by configuring the Label (Label) of the scene of the source of the resource object and the two information of the resource name, and the data of the specific derivative resource object is not required to be configured. The initial resource object data of the derived resource object 1 is:
apiVersion v1// API interface version;
kind, configMap// resource object name;
metadata:// metadata;
name cm// name of derivative resource object 1;
namespace, name space where new 1// derivative resource object 1 is located;
labels:// tags;
from-ns, default// namespace where resource object 1 is located;
from-cm-name cm// namespace where resource object 1 is located;
it can be seen that the resource object service creates a derived resource object cm (i.e., derived resource object 1) in namespace news 1 from the value defaults of the namespace from-ns from which the resource object originates and the value cm of the name from-cm-name from which the resource object originates. The resource object service also needs to synchronize the data of resource object 1 to the derived resource object 1. The resource object data of the derivative resource object 1 after data synchronization is:
apiVersion v1// API interface version;
kind, configMap// resource object name;
metadata:// metadata;
name cm// name of derivative resource object 1;
namespace, name space where new 1// derivative resource object 1 is located;
labels:// tags;
from-ns, default// namespace where resource object 1 is located;
from-cm-name cm// namespace where resource object 1 is located;
data:// data of the derived resource object 1;
special.how: the data in the y// derivative resource object 1 special.how;
specific.type: char// data specific.type in the derivative resource object 1.
It can be seen that the resource object service copies the data of resource object 1 to derivative resource object 1.
Third, and so on, the user copies new business micro-service based on the resource object 1, the business generation service creates a derivative business micro-service n across the name space, when the resource object service creates a derivative resource object n across the name space, the resource object service completes the data creation of the resource object according to the scene and the resource name of the resource object source by configuring the labels of the scene and the resource name of the resource object source without configuring the data of the specific derivative resource object, and the configuration of the derivative resource object n is completed.
Fourth, when the data of the resource object 1 changes, the resource object service searches for the resource object according to two labels of from-ns and from-cm-name, and synchronously updates the corresponding resource object across the namespaces. The updated resource object 1 resource object is as follows:
apiVersion v1// API interface version;
kind, configMap// resource object name;
metadata:// metadata;
name cm// name of resource object 1;
a namespace is a namespace where default// resource object 1 is located;
data:// data of resource object 1;
specific.how: verynew// data specific.how in resource object 1;
specific.type: char new// data specific.type in resource object 1.
The updated data of the derivative resource object 1 is as follows:
apiVersion v1// API interface version;
kind, configMap// resource object name;
metadata:// metadata;
name cm// name of derivative resource object 1;
namespace, name space where new 1// derivative resource object 1 is located;
labels:// tags;
from-ns, default// namespace where resource object 1 is located;
from-cm-name cm// namespace where resource object 1 is located;
data:// data of the derived resource object 1;
specific.how: verynew// derived resource object 1;
specific.type: logical// data specific.type in the derivative resource object 1.
It can be seen that modifying the data of resource object cm of namespace defaults, the data of derived resource objects (specific. How and specific. Type also change) is also updated synchronously
And fifthly, the resource service object monitors ConfigMap, secret the change of the resource object, and can perform rolling upgrade on the service micro-service by using DeploymentConfig, deployment, daemonSet, statefulSet deployment modes associated with the service micro-service, and synchronize the resource object data of all derivative service micro-service mounts.
The data updating apparatus, the electronic device, and the computer-readable storage medium provided in the embodiments of the present invention are described below, and the data updating apparatus, the electronic device, and the computer-readable storage medium described below and the data updating method described above may be referred to correspondingly.
Referring to fig. 5, fig. 5 is a block diagram of a data updating apparatus according to an embodiment of the present invention, where the apparatus may include:
the original resource object confirmation module 501 is configured to obtain preset derivative information corresponding to a derivative resource object, and determine an original resource object for creating the derivative resource object in a derivative manner according to the preset derivative information;
The monitoring module 502 is configured to monitor a data update condition of the original resource object and the derivative resource object;
and an updating module 503, configured to synchronize the updated data to other resource objects that are not updated according to the preset derivative information when it is determined that any one of the original resource object and the derivative resource object is updated with data.
Optionally, the updating module 503 may include:
and the first updating sub-module is used for synchronizing the updating data from the original resource object to the derivative resource object according to the preset derivative information when the original resource object is determined to be updated.
Optionally, the updating module 503 may include:
the second updating sub-module is used for synchronizing the updating data from the derivative resource object to the original resource object according to preset derivative information of the derivative resource object when the derivative resource object is determined to be subjected to data updating;
and the third updating sub-module is used for synchronizing the updating data from the original resource object to other derivative resource objects according to preset derivative information between the original resource object and the other derivative resource objects.
Optionally, the updating module 503 is specifically configured to:
and synchronizing the updated data to other resource objects which are not updated across the naming space according to the preset derivative information, wherein the original resource object and the derivative resource object are located in different naming spaces.
Optionally, the apparatus may further include:
the request processing module is used for receiving a micro-service creation request and determining an original business micro-service corresponding to the micro-service creation request, an original naming space where the original business micro-service is located and the original resource object mounted in the original business micro-service;
the derivative business micro-service creation module is used for copying and creating the derivative business micro-service in a new naming space by utilizing the original business micro-service;
the derivative resource object creation module is used for copying and creating the derivative resource object in the new name space by utilizing the original resource object, recording preset derivative information between the derivative resource object and the original resource object, and mounting the derivative resource object to the derivative business micro-service; the preset derivative information comprises the name of the original name space and the name of the original resource object.
Optionally, the derivative resource object creation module may include:
the creation sub-module is used for creating an initial resource object in the new naming space and writing the name of the original naming space and the name of the original resource object into the initial resource object as the preset derivative information;
and the data synchronization sub-module is used for synchronizing the data in the original resource object to the initial resource object across the name space according to the preset derivative information in the initial resource object to obtain the derivative resource object.
Optionally, the apparatus may further include:
and the service micro-service updating module is used for rolling and updating the derivative service micro-service by utilizing the updated derivative resource object based on the deployment mode of the derivative service micro-service.
Referring to fig. 6, fig. 6 is a block diagram of an electronic device according to an embodiment of the present invention, and an electronic device 60 according to an embodiment of the present invention includes a processor 61 and a memory 62; wherein the memory 62 is used for storing a computer program; the processor 61 is configured to execute the data updating method provided in the foregoing embodiment when executing the computer program.
For the specific process of the data updating method, reference may be made to the corresponding content provided in the foregoing embodiment, and no further description is given here.
The memory 62 may be a carrier for storing resources, such as a read-only memory, a random access memory, a magnetic disk, or an optical disk, and the storage mode may be temporary storage or permanent storage.
In addition, the electronic device 60 further includes a power supply 63, a communication interface 64, an input-output interface 65, and a communication bus 66; wherein the power supply 63 is configured to provide an operating voltage for each hardware device on the electronic device 60; the communication interface 64 can create a data transmission channel between the electronic device 60 and an external device, and the communication protocol to be followed is any communication protocol applicable to the technical solution of the present invention, which is not specifically limited herein; the input/output interface 65 is used for obtaining external input data or outputting external output data, and the specific interface type thereof may be selected according to the specific application requirement, which is not limited herein.
The embodiment of the invention also provides a computer readable storage medium, and a computer program is stored on the computer readable storage medium, and when the computer program is executed by a processor, the steps of the data updating method of any embodiment are realized.
Since the embodiments of the computer readable storage medium portion and the embodiments of the data updating method portion correspond to each other, the embodiments of the storage medium portion are referred to the description of the embodiments of the data updating method portion, and are not repeated here.
In the description, each embodiment is described in a progressive manner, and each embodiment is mainly described by the differences from other embodiments, so that the same similar parts among the embodiments are mutually referred. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant points refer to the description of the method section.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative elements and steps are described above generally in terms of functionality in order to clearly illustrate the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. The software modules may be disposed in Random Access Memory (RAM), memory, read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The data updating method, the device, the electronic equipment and the storage medium provided by the invention are described in detail. The principles and embodiments of the present invention have been described herein with reference to specific examples, the description of which is intended only to facilitate an understanding of the method of the present invention and its core ideas. It should be noted that it will be apparent to those skilled in the art that various modifications and adaptations of the invention can be made without departing from the principles of the invention and these modifications and adaptations are intended to be within the scope of the invention as defined in the following claims.
Claims (10)
1. A method of updating data, comprising:
acquiring preset derivative information corresponding to a derivative resource object, and determining an original resource object for derivative creation of the derivative resource object according to the preset derivative information;
Monitoring the data updating conditions of the original resource object and the derivative resource object;
and when determining that any one of the original resource object and the derivative resource object is subjected to data updating, synchronizing the updating data to other resource objects which are not updated according to the preset derivative information.
2. The method for updating data according to claim 1, wherein when it is determined that any one of the original resource object and the derivative resource object is updated with data, synchronizing the updated data to other resource objects that are not updated according to the preset derivative information comprises:
and when the original resource object is determined to be updated, synchronizing the updated data from the original resource object to the derivative resource object according to the preset derivative information.
3. The method for updating data according to claim 1, wherein when it is determined that any one of the original resource object and the derivative resource object is updated with data, synchronizing the updated data to other resource objects that are not updated according to the preset derivative information comprises:
and when determining that the derivative resource object generates data update, synchronizing the update data from the derivative resource object to the original resource object according to preset derivative information of the derivative resource object.
4. A method of updating data according to any of claims 1 to 3, wherein said synchronizing updated data into other resource objects not updated according to said preset derived information comprises:
and synchronizing the updated data to other resource objects which are not updated across the naming space according to the preset derivative information, wherein the original resource object and the derivative resource object are located in different naming spaces.
5. The method for updating data according to claim 4, further comprising, before acquiring the preset derivative information corresponding to the derivative resource object:
receiving a micro-service creation request, and determining an original business micro-service corresponding to the micro-service creation request, an original naming space where the original business micro-service is located and the original resource object mounted in the original business micro-service;
copying and creating derivative business micro-services in a new naming space by utilizing the original business micro-services;
copying and creating the derivative resource object in the new naming space by utilizing the original resource object, recording preset derivative information between the derivative resource object and the original resource object, and mounting the derivative resource object to the derivative business micro-service; the preset derivative information comprises the name of the original name space and the name of the original resource object.
6. The method for updating data according to claim 5, wherein the creating the derivative resource object by copying the original resource object in the new namespace, recording preset derivative information between the derivative resource object and the original resource object, includes:
creating an initial resource object in the new name space, and writing the name of the original name space and the name of the original resource object into the initial resource object as the preset derivative information;
and synchronizing data in the original resource object to the initial resource object across a name space according to preset derivative information in the initial resource object to obtain the derivative resource object.
7. The data updating method according to claim 5, further comprising, after synchronizing the update data into other resource objects that are not updated according to the preset derivative information:
and rolling and updating the derivative business micro-service by utilizing the updated derivative resource object based on the deployment mode of the derivative business micro-service.
8. A data updating apparatus, comprising:
the original resource object confirming module is used for acquiring preset derivative information corresponding to the derivative resource object and determining an original resource object for creating the derivative resource object in a derivative mode according to the preset derivative information;
The monitoring module is used for monitoring the data updating conditions of the original resource object and the derivative resource object;
and the updating module is used for synchronizing the updating data to other resource objects which are not updated according to the preset derivative information when determining that any one of the original resource object and the derivative resource object is subjected to data updating.
9. An electronic device, comprising:
a memory for storing a computer program;
processor for implementing the data updating method according to any of claims 1 to 7 when executing the computer program.
10. A computer readable storage medium having stored therein computer executable instructions which when loaded and executed by a processor implement a data updating method according to any of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311434655.5A CN117435604A (en) | 2023-10-31 | 2023-10-31 | Data updating method and device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311434655.5A CN117435604A (en) | 2023-10-31 | 2023-10-31 | Data updating method and device, electronic equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117435604A true CN117435604A (en) | 2024-01-23 |
Family
ID=89547693
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311434655.5A Pending CN117435604A (en) | 2023-10-31 | 2023-10-31 | Data updating method and device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117435604A (en) |
-
2023
- 2023-10-31 CN CN202311434655.5A patent/CN117435604A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
TWI472934B (en) | Method, article, and apparatus for cross-synchronization of data | |
CN104199666B (en) | A kind of application program Dynamic Configuration and device | |
KR101076851B1 (en) | A method for managing multiple file states for replicated files | |
US9361309B2 (en) | File synchronization method, electronic device and synchronization system | |
CN113778623B (en) | Resource processing method and device, electronic equipment and storage medium | |
CN109032796B (en) | Data processing method and device | |
JP2012520504A (en) | A programming model for synchronizing the browser cache across devices and web services | |
CN115517009B (en) | Cluster management method, cluster management device, storage medium and electronic equipment | |
CN109804361A (en) | File synchronization in computing system | |
US20150227605A1 (en) | Information processing terminal, synchronization control method, and computer-readable recording medium | |
CN102227720A (en) | Supporting media content revert functionality across multiple devices | |
CN110099084B (en) | Method, system and computer readable medium for ensuring storage service availability | |
WO2016082594A1 (en) | Data update processing method and apparatus | |
CN103064717A (en) | Device and method for parallel installation of software for cluster system | |
CN114610509A (en) | Calling parameter processing method, system, device, storage medium and product | |
CN114077518B (en) | Data snapshot method, device, equipment and storage medium | |
CN106850724B (en) | Data pushing method and device | |
CN115309827A (en) | Data differentiation synchronization method, system, device and medium | |
CN112181049B (en) | Cluster time synchronization method, device, system, equipment and readable storage medium | |
CN117435604A (en) | Data updating method and device, electronic equipment and storage medium | |
CN115687503A (en) | Method, device and equipment for synchronizing data among databases and storage medium | |
CN112738550B (en) | Content data processing method and device, electronic equipment and medium | |
CN114398208B (en) | A cross-cluster backup method, system, medium and device for stateless application | |
CN113985961B (en) | Clock synchronization device, clock synchronization method, electronic equipment and storage medium | |
CN110515907B (en) | Data synchronization method and related device for distributed storage nodes |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |