CN114553943B - A cloud platform business layer unified information rollback method, device, terminal and medium - Google Patents
A cloud platform business layer unified information rollback method, device, terminal and medium Download PDFInfo
- Publication number
- CN114553943B CN114553943B CN202210094593.7A CN202210094593A CN114553943B CN 114553943 B CN114553943 B CN 114553943B CN 202210094593 A CN202210094593 A CN 202210094593A CN 114553943 B CN114553943 B CN 114553943B
- Authority
- CN
- China
- Prior art keywords
- target
- rollback
- resource
- interface
- resource information
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L41/00—Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
- H04L41/08—Configuration management of networks or network elements
- H04L41/0803—Configuration setting
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L65/00—Network arrangements, protocols or services for supporting real-time applications in data packet communication
- H04L65/1066—Session management
- H04L65/1073—Registration or de-registration
-
- 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/02—Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
-
- 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)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Business, Economics & Management (AREA)
- General Business, Economics & Management (AREA)
- Multimedia (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Debugging And Monitoring (AREA)
Abstract
本发明涉及云平台业务层统一信息回滚方法、装置、终端及介质。本发明中服务调用方发起目标业务操作后,逐层调用目标业务操作所依赖的微服务的外部接口以准备相应的目标资源;若调用外部接口准备目标资源成功,则将准备好的目标资源的资源信息进行存档;若调用外部接口准备目标资源失败,则根据目标业务操作查询对应的目标资源的资源信息;根据资源信息的内容从微服务的服务注册中心查询执行回滚操作的回滚接口;利用回滚接口对从相应的资源信息中获取相应内容进行回滚。本发明利用存档的标业务操作的资源信息获取实现回滚的回滚接口,并通过各个回滚接口对目标业务操作所依赖的各个微服务的回滚统一,代码实现简单便于维护与扩展。
The invention relates to a unified information rollback method, device, terminal and medium of a cloud platform business layer. In the present invention, after the service caller initiates the target business operation, it calls the external interface of the microservice that the target business operation depends on layer by layer to prepare the corresponding target resource; if the call to the external interface succeeds in preparing the target resource, the prepared target resource The resource information is archived; if the call to the external interface fails to prepare the target resource, the resource information of the corresponding target resource is queried according to the target business operation; the rollback interface for performing the rollback operation is queried from the service registration center of the microservice according to the content of the resource information; Use the rollback interface to roll back the acquisition of the corresponding content from the corresponding resource information. The present invention utilizes the resource information of the archived target business operation to obtain the rollback interface for realizing the rollback, and unifies the rollback of each microservice that the target business operation depends on through each rollback interface, and the code implementation is simple and convenient for maintenance and expansion.
Description
技术领域technical field
本发明涉及微服务业务层统一信息回滚技术领域,尤其涉及一种云平台业务层统一信息回滚方法、装置、终端及介质。The present invention relates to the technical field of unified information rollback of microservice business layer, in particular to a method, device, terminal and medium of unified information rollback of cloud platform business layer.
背景技术Background technique
随着互联网的发展,网站应用的规模不断扩大、需求激增,系统架构也因此不断的演进、升级、迭代。目前,已由之前的单体架构发展成为微服务架构,随着云原生热潮的兴起,作为云原生应用的软件架构,一般都是微服务架构。With the development of the Internet, the scale of website applications continues to expand and demand surges, and the system architecture is therefore constantly evolving, upgrading, and iterating. At present, the previous monolithic architecture has developed into a microservice architecture. With the rise of the cloud native boom, the software architecture of cloud native applications is generally a microservice architecture.
微服务架构是使用一套小服务来开发单个应用的方式或途径,每个服务基于单一业务能力构建,运行在自己的进程中,并使用轻量级机制通信,通常是HTTP API,并能够通过自动化部署机制来独立部署。这些服务由一个统一的服务注册中心来进行管理和维护。The microservice architecture is a way or approach to develop a single application using a set of small services. Each service is built based on a single business capability, runs in its own process, and communicates using a lightweight mechanism, usually HTTP API, and can pass Automated deployment mechanism to deploy independently. These services are managed and maintained by a unified service registry.
虽然各服务有自己单一的业务能力,但是并不意味着服务间不需要业务逻辑交互。而一旦存在业务逻辑交互,必然会存在交互失败的场景,而失败后,在某些场景下,就会面临之前成功的操作需要回滚取消的问题。对于云平台来说,这种场景发生的尤为多。比如,在云平台中创建一个云主机,需要先准备网络资源、存储资源,之后才能创建出来;在云主机管理服务中,需要调用网络资源管理服务和存储资源管理服务的HTTP接口中去事先准备网络资源和存储资源。而如果网络资源和存储资源都准备成功的情况下,创建云主机反倒失败了,这时,就需要把之前准备成功的网络和存储资源都进行回滚取消,以确保系统信息的一致性,避免在系统中产生垃圾数据。Although each service has its own single business capability, it does not mean that there is no need for business logic interaction between services. Once there is business logic interaction, there will inevitably be a scenario where the interaction fails, and after the failure, in some scenarios, it will face the problem that the previous successful operation needs to be rolled back and canceled. For cloud platforms, this scenario occurs especially frequently. For example, to create a cloud host on the cloud platform, you need to prepare network resources and storage resources before creating it; in the cloud host management service, you need to call the HTTP interface of the network resource management service and storage resource management service to prepare in advance network resources and storage resources. However, if the network resources and storage resources are prepared successfully, the creation of the cloud host fails. At this time, it is necessary to roll back and cancel the previously prepared network and storage resources to ensure the consistency of system information and avoid Generate garbage data in the system.
在不采用分布式事务控制的情况下,一般涉及各依赖微服务间交互操作的回滚设计,都是由调用方在自己的业务层编写业务代码调用相关依赖微服务的资源回滚接口进行回滚控制的,这样在每次发生错误的地方,都需要单独写业务代码进行额外处理,无疑会造成代码冗余和重复,不利于后期的维护和扩展。In the case of not using distributed transaction control, the rollback design generally involves the interaction between various dependent microservices, and the caller writes business code in its own business layer to call the resource rollback interface of related dependent microservices to perform the rollback. Roll control, so that every time an error occurs, business code needs to be written separately for additional processing, which will undoubtedly cause code redundancy and duplication, which is not conducive to later maintenance and expansion.
发明内容Contents of the invention
为了解决上述技术问题或者至少部分地解决上述技术问题,本发明提供一种云平台业务层统一信息回滚方法、装置、终端及介质。In order to solve the above-mentioned technical problems or at least partly solve the above-mentioned technical problems, the present invention provides a unified information rollback method, device, terminal and medium of a cloud platform business layer.
第一方面,本发明提供一种云平台业务层统一信息回滚方法,包括:In the first aspect, the present invention provides a unified information rollback method for the business layer of the cloud platform, including:
服务调用方发起目标业务操作后,逐层调用目标业务操作所依赖的微服务的外部接口以准备相应的目标资源;After the service caller initiates the target business operation, it calls the external interface of the microservice that the target business operation depends on layer by layer to prepare the corresponding target resources;
若调用外部接口准备目标资源成功,则将准备好的目标资源的资源信息进行存档,所述资源信息的数据结构包括:资源ID、服务调用方IP、资源所属微服务IP、操作类型和操作参数;If the external interface is called to prepare the target resource successfully, the resource information of the prepared target resource will be archived. The data structure of the resource information includes: resource ID, service caller IP, microservice IP to which the resource belongs, operation type and operation parameters ;
若调用外部接口准备目标资源失败,则根据目标业务操作查询对应的目标资源的资源信息;根据资源信息的内容从微服务的服务注册中心查询执行回滚操作的回滚接口;利用回滚接口对从相应的资源信息中获取相应内容进行回滚。If it fails to call the external interface to prepare the target resource, query the resource information of the corresponding target resource according to the target business operation; query the rollback interface for performing the rollback operation from the service registration center of the microservice according to the content of the resource information; use the rollback interface to Get the corresponding content from the corresponding resource information to roll back.
更进一步地,在定义各个微服务的接口时,为接口配置相应的接口类型,接口类型包括:内部接口和外部接口;进一步对于外部接口配置外部接口所实现的操作类型,其中操作类型包括:创建、删除、修改和查询。Furthermore, when defining the interface of each microservice, configure the corresponding interface type for the interface. The interface type includes: internal interface and external interface; further configure the operation type implemented by the external interface for the external interface, where the operation type includes: create , Delete, Modify and Query.
更进一步地,发起目标业务操作时,为目标业务操作配置相应的操作ID;将准备好的目标资源的资源信息进行存档时,将目标业务操作所对应的资源信息映射到目标业务操作的操作ID。Furthermore, when initiating a target business operation, configure the corresponding operation ID for the target business operation; when archiving the prepared resource information of the target resource, map the resource information corresponding to the target business operation to the operation ID of the target business operation .
更进一步地,根据目标业务操作查询对应的目标资源的资源信息时,获取目标业务操作的操作ID,并根据操作ID查询对应的资源信息。Furthermore, when querying the resource information of the corresponding target resource according to the target business operation, the operation ID of the target business operation is obtained, and the corresponding resource information is queried according to the operation ID.
更进一步地,所述根据资源信息的内容从微服务的服务注册中心查询执行回滚操作的回滚接口包括:Further, the rollback interface for querying and executing the rollback operation from the service registration center of the microservice according to the content of the resource information includes:
解析目标业务操作的各个存档的资源信息的数据结构获取各个目标操作类型和相应的目标资源所属微服务IP;Analyze the data structure of each archived resource information of the target business operation to obtain each target operation type and the microservice IP to which the corresponding target resource belongs;
利用预先配置的操作类型和反向操作类型的对应关系表来根据资源信息中的目标操作类型确定对应的目标反向操作类型;Determine the corresponding target reverse operation type according to the target operation type in the resource information by using the pre-configured correspondence table between the operation type and the reverse operation type;
利用各个目标反向操作类型和相应的目标资源所属微服务IP,从服务注册中心查询出各个相应的回滚接口。Use each target reverse operation type and the microservice IP to which the corresponding target resource belongs, and query each corresponding rollback interface from the service registry.
更进一步地,将各个微服务注册到服务注册中心时,将外部接口信息上报到服务注册中心,其中,外部接口信息包括:接口名称、接口类型、操作类型和操作参数。Furthermore, when each microservice is registered to the service registration center, the external interface information is reported to the service registration center, wherein the external interface information includes: interface name, interface type, operation type and operation parameters.
更进一步地,利用回滚接口对从相应的资源信息中获取相应内容进行回滚时,根据回滚接口的操作类型从资源信息中获取对应的内容。Furthermore, when using the rollback interface to roll back the acquisition of the corresponding content from the corresponding resource information, the corresponding content is acquired from the resource information according to the operation type of the rollback interface.
第二方面,本发明提供一种实现云平台业务层统一信息回滚方法的装置,包括:失败检测模块,所述失败检测模块检测调用目标业务操作所依赖微服务外部接口准备目标资源是否成功;In a second aspect, the present invention provides a device for implementing a unified information rollback method of the cloud platform business layer, including: a failure detection module, the failure detection module detects whether the call target business operation relies on the microservice external interface to prepare the target resource successfully;
资源信息存档模块,所述资源信息存档模块在准备目标资源成功时将准备好的目标资源的资源信息按预设的数据结构存档;A resource information archiving module, the resource information archiving module archives the resource information of the prepared target resource according to a preset data structure when the target resource is successfully prepared;
资源信息匹配模块,所述资源信息匹配模块在目标业务操作所需的目标资源失败时,根据目标业务匹配查询对应的资源信息;A resource information matching module, the resource information matching module queries corresponding resource information according to the target business matching when the target resource required for the target business operation fails;
资源信息解析模块,所述资源信息解析模块对资源信息进行解析,获取资源信息的内容;A resource information analysis module, the resource information analysis module analyzes the resource information to obtain the content of the resource information;
回滚接口匹配模块,所述回滚接口匹配模块利用资源信息的内容从配置各个微服务的服务注册中心查询对应的回滚接口;A rollback interface matching module, the rollback interface matching module queries the corresponding rollback interface from the service registration center that configures each microservice by using the content of the resource information;
回滚执行模块,所述回滚执行模块利用回滚接口和相应资源信息中的相应内容进行回滚。A rollback execution module, the rollback execution module uses the rollback interface and the corresponding content in the corresponding resource information to perform rollback.
第三方面,本发明提供一种实现云平台业务层统一信息回滚方法的终端,包括:处理单元、总线单元、存储单元、显示单元以及输入单元,所述总线单元连接所述处理单元、存储单元、显示单元以及输入单元,所述存储单元存储至少一条指令,所述处理单元读取并执行所述指令实现所述的云平台业务层统一信息回滚方法。In the third aspect, the present invention provides a terminal for realizing the unified information rollback method of the business layer of the cloud platform, including: a processing unit, a bus unit, a storage unit, a display unit, and an input unit, the bus unit is connected to the processing unit, storage unit, a display unit, and an input unit, the storage unit stores at least one instruction, and the processing unit reads and executes the instruction to implement the method for rolling back unified information of the cloud platform business layer.
第四方面,本发明提供一种实现云平台业务层统一信息回滚方法的存储介质,所述实现云平台业务层统一信息回滚方法的存储介质存储至少一条指令,读取并执行所述指令实现所述的云平台业务层统一信息回滚方法。In a fourth aspect, the present invention provides a storage medium for implementing a unified information rollback method for the cloud platform business layer, wherein the storage medium for implementing the unified information rollback method for the cloud platform business layer stores at least one instruction, and reads and executes the instruction Realize the unified information rollback method of the cloud platform business layer.
本发明实施例提供的上述技术方案与现有技术相比具有如下优点:Compared with the prior art, the technical solution provided by the embodiments of the present invention has the following advantages:
本发明在为目标业务操作准备目标资源成功时,将准备成功的目标资源的资源信息进行存档,资源信息中包含了目标资源的资源ID、服务调用方IP、目标资源所属微服务IP、操作类型和操作参数。一旦遇到目标资源准备失败的情况,则根据目标业务操作查询到相应的资源信息的存档,资源信息存档包含了发生错误失败前已经准备好的全部目标资源的资源信息,是回滚的对象。本发明利用资源信息中的操作类型确定相应的反向操作类型,反向操作类型为实现针对该资源信息所记载资源回滚的回滚接口的操作类型。通过资源信息中的目标资源所属微服务IP和反向操作类型从服务注册中心查询执行回滚的回滚接口,利用回滚接口对资源信息中所记载目标资源进行回滚。从而实现利用统一的手段将目标业务操作所依赖的各个微服务的回滚操作的统一,代码实现简单,且利于后期维护和扩展。In the present invention, when the target resource is successfully prepared for the target business operation, the resource information of the successfully prepared target resource is archived, and the resource information includes the resource ID of the target resource, the service caller IP, the microservice IP to which the target resource belongs, and the operation type and operating parameters. Once the preparation of the target resource fails, query the corresponding resource information archive according to the target business operation. The resource information archive contains the resource information of all target resources that have been prepared before the failure occurs, and is the object of rollback. In the present invention, the operation type in the resource information is used to determine the corresponding reverse operation type, and the reverse operation type is the operation type for realizing the rollback interface for resource rollback recorded in the resource information. Query the rollback interface for performing rollback from the service registry through the microservice IP to which the target resource belongs and the reverse operation type in the resource information, and use the rollback interface to roll back the target resource recorded in the resource information. In this way, the rollback operation of each microservice that the target business operation depends on can be unified by using a unified method, the code is simple to implement, and it is convenient for later maintenance and expansion.
本申请中在定义微服务的操作接口时,配置外部接口的操作类型,定义外部接口的操作类型,并在向服务注册中心注册时提供包含操作类型的接口信息,为后续根据资源信息中的操作类型与对应的反向操作类型提供基础,为后续根据操作类型从服务注册中心查询外部接口获取相应的回滚接口提供基础。In this application, when defining the operation interface of the microservice, configure the operation type of the external interface, define the operation type of the external interface, and provide the interface information including the operation type when registering with the service registration center, for subsequent operations based on the resource information The type and the corresponding reverse operation type provide the basis for the subsequent query of the external interface from the service registry to obtain the corresponding rollback interface based on the operation type.
附图说明Description of drawings
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本发明的实施例,并与说明书一起用于解释本发明的原理。The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description serve to explain the principles of the invention.
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,对于本领域普通技术人员而言,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, In other words, other drawings can also be obtained from these drawings without paying creative labor.
图1为本发明实施例提供的一种云平台业务层统一信息回滚方法的流程图;Fig. 1 is the flow chart of a kind of cloud platform business layer unified information rollback method provided by the embodiment of the present invention;
图2为本发明实施例提供的根据资源信息的内容从微服务的服务注册中心查询执行回滚操作的回滚接口的流程图;2 is a flow chart of a rollback interface for querying and performing a rollback operation from a service registration center of a microservice according to the content of resource information provided by an embodiment of the present invention;
图3为本发明实施例提供的一种实现云平台业务层统一信息回滚方法的装置的示意图;FIG. 3 is a schematic diagram of a device for implementing a method for rolling back unified information of a cloud platform business layer provided by an embodiment of the present invention;
图4为本发明实施例提供的一种实现云平台业务层统一信息回滚方法的终端的示意图。FIG. 4 is a schematic diagram of a terminal implementing a method for rolling back unified information of a service layer of a cloud platform provided by an embodiment of the present invention.
具体实施方式Detailed ways
为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明的一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动的前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments It is a part of embodiments of the present invention, but not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should be noted that, in this document, the terms "comprising", "comprising" or any other variation thereof are intended to cover a non-exclusive inclusion such that a process, method, article or apparatus comprising a set of elements includes not only those elements, It also includes other elements not expressly listed, or elements inherent in the process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article or apparatus comprising said element.
实施例1Example 1
本发明实施例提供一种云平台业务层统一信息回滚方法,为了实现本方法,在定义各个微服务的接口时,为接口配置相应的接口类型,接口类型包括:内部接口和外部接口;进一步对于外部接口配置外部接口所实现的操作类型,其中操作类型包括:创建、删除、修改和查询。将各个微服务注册到服务注册中心时,将外部接口信息上报到服务注册中心,其中,外部接口信息包括:接口名称、接口类型、操作类型和操作参数;通过外部接口的操作类型和微服务IP能够从微服务的服务注册中心查到相应的外部接口。The embodiment of the present invention provides a cloud platform business layer unified information rollback method. In order to implement this method, when defining the interface of each micro service, configure the corresponding interface type for the interface. The interface type includes: internal interface and external interface; further For the external interface, configure the operation type implemented by the external interface, where the operation type includes: create, delete, modify, and query. When registering each microservice to the service registration center, report the external interface information to the service registration center, where the external interface information includes: interface name, interface type, operation type and operation parameters; the operation type and microservice IP through the external interface The corresponding external interface can be found from the service registry of the microservice.
参阅图1所示,所述云平台业务层统一信息回滚方法包括:Referring to shown in Figure 1, the unified information rollback method of the cloud platform business layer includes:
S100,服务调用方发起目标业务操作后,逐层调用目标业务操作所依赖的微服务的外部接口以准备相应的目标资源;具体实施过程中,服务调用方发起目标业务操作时,为目标业务操作配置相应的操作ID。S100, after the service caller initiates the target business operation, call the external interface of the microservice that the target business operation depends on layer by layer to prepare the corresponding target resources; in the specific implementation process, when the service caller initiates the target business operation, the target business operation Configure the corresponding operation ID.
S200,检测调用目标业务操作所依赖的微服务的外部接口准备目标资源是否成功,是则执行S300,否则执行S400。S200. Detect whether calling the external interface of the microservice on which the target business operation depends is successful in preparing the target resource. If yes, execute S300; otherwise, execute S400.
S300,若调用外部接口准备目标资源成功,则将准备好的目标资源的资源信息进行存档,所述资源信息的数据结构包括:资源ID、服务调用方IP、资源所属微服务IP、操作类型和操作参数;具体实施过程中,为各个微服务回滚构建统一的回滚控制器,利用所述回滚控制器将准备好的目标资源的资源信息进行存档,且在存档时,将目标业务操作所对应的资源信息映射到目标业务操作的操作ID。S300, if calling the external interface to prepare the target resource is successful, then archive the resource information of the prepared target resource, the data structure of the resource information includes: resource ID, service caller IP, microservice IP to which the resource belongs, operation type and Operating parameters; in the specific implementation process, build a unified rollback controller for each microservice rollback, use the rollback controller to archive the resource information of the prepared target resource, and when archiving, target business operation The corresponding resource information is mapped to the operation ID of the target business operation.
S400,若调用外部接口准备目标资源失败,则根据目标业务操作查询对应的目标资源的资源信息;根据目标业务操作查询对应的目标资源的资源信息时,获取目标业务操作的操作ID,并根据操作ID查询对应的资源信息。具体实施过程中,目标业务操作准备目标资源失败时,通知回滚控制器对目标业务操作进行回滚,通知中包含目标业务操作的操作ID,回滚控制器利用目标业务操作的操作ID查询对应的目标资源的资源信息。利用操作ID所查询的资源信息为发生错误失败前已经准备好的全部目标资源的资源信息。S400, if calling the external interface to prepare the target resource fails, query the resource information of the corresponding target resource according to the target business operation; when querying the resource information of the corresponding target resource according to the target business operation, obtain the operation ID of the target business operation, and ID query corresponding resource information. In the specific implementation process, when the target business operation fails to prepare the target resource, the rollback controller is notified to roll back the target business operation. The notification includes the operation ID of the target business operation, and the rollback controller uses the operation ID of the target business operation to query the corresponding Resource information for the target resource for . The resource information queried by using the operation ID is the resource information of all target resources that have been prepared before the failure occurs.
S500,根据资源信息的内容从微服务的服务注册中心查询执行回滚操作的回滚接口;具体实施过程中,参阅图2所示,所述根据资源信息的内容从微服务的服务注册中心查询执行回滚操作的回滚接口包括:S500. Query the rollback interface for executing the rollback operation from the service registration center of the microservice according to the content of the resource information; in the specific implementation process, refer to FIG. 2 , query from the service registration center of the microservice according to the content of the resource information The rollback interfaces for performing rollback operations include:
S501,解析目标业务操作的各个存档的资源信息的数据结构获取各个目标操作类型和相应的目标资源所属微服务IP。具体的,回滚控制器解析目标业务操作的各个存档的资源信息的数据结构获取各个目标操作类型和相应的目标资源所属微服务IP。S501. Analyze the data structure of each archived resource information of the target business operation to obtain each target operation type and the microservice IP to which the corresponding target resource belongs. Specifically, the rollback controller parses the data structure of each archived resource information of the target business operation to obtain each target operation type and the microservice IP to which the corresponding target resource belongs.
S502,利用预先配置的操作类型和反向操作类型的对应关系表来根据资源信息中的目标操作类型确定对应的目标反向操作类型。具体的,回滚控制器利用预先配置的操作类型和反向操作类型的对应关系表来根据资源信息中的目标操作类型确定对应的目标反向操作类型。S502. Using a pre-configured correspondence table between operation types and reverse operation types to determine a corresponding target reverse operation type according to the target operation type in the resource information. Specifically, the rollback controller determines the corresponding target reverse operation type according to the target operation type in the resource information by using the pre-configured correspondence table between the operation type and the reverse operation type.
具体的,对应关系表中记录操作类型为创建时,对应的反向操作类型为删除;操作类型为修改时,对应的反向操作类型为修改。而操作类型为删除时,若对应的反向操作类型为创建时,利用创建类型对外部接口所创建的资源与被删除的资源相比,其实属于新资源,因此本申请对于删除操作不进行回滚目,即不在对应关系表中将创建设为删除的反向操作类型。Specifically, when the record operation type in the correspondence table is creation, the corresponding reverse operation type is delete; when the operation type is modification, the corresponding reverse operation type is modification. When the operation type is delete, if the corresponding reverse operation type is create, the resource created by using the create type to the external interface is actually a new resource compared with the deleted resource, so this application does not respond to the delete operation. Scrolling, that is, the reverse operation type that does not set create as delete in the corresponding relationship table.
S503,利用各个目标反向操作类型和相应的目标资源所属微服务IP,从服务注册中心查询出各个相应的回滚接口。由于将各个微服务注册到服务注册中心时,将外部接口信息上报到服务注册中心,其中,外部接口信息包括:接口名称、接口类型、操作类型和操作参数;因此,回滚控制器通过外部接口的操作类型和微服务IP能够从微服务的服务注册中心查到相应的外部接口。S503. Using each target reverse operation type and the microservice IP to which the corresponding target resource belongs, query each corresponding rollback interface from the service registration center. When each microservice is registered to the service registration center, the external interface information is reported to the service registration center, wherein the external interface information includes: interface name, interface type, operation type and operation parameters; therefore, the rollback controller passes the external interface The operation type and microservice IP can find the corresponding external interface from the service registration center of the microservice.
S600,利用回滚接口对从相应的资源信息中获取相应内容进行回滚。具体实施过程中,回滚控制器利用回滚接口对从相应的资源信息中获取相应内容进行回滚时,根据回滚接口的操作类型从资源信息中获取对应的内容。如:回滚接口的操作类型为删除(对应的资源信息中操作类型为创建)时,则从对应的资源信息中获取资源ID,将资源ID所映射的资源删除即完成资源信息中所对应资源的回滚取消。回滚接口的操作类型为修改(对应的资源信息中操作类型为修改)时,则从对应的资源信息中获取资源ID和操作参数,将资源ID所映射的资源中的操作参数反向修改即完成资源信息中所对应资源的回滚取消。S600. Use a rollback interface to roll back the acquisition of corresponding content from corresponding resource information. During the specific implementation process, when the rollback controller uses the rollback interface to roll back the corresponding content obtained from the corresponding resource information, it obtains the corresponding content from the resource information according to the operation type of the rollback interface. For example: when the operation type of the rollback interface is delete (the operation type in the corresponding resource information is create), obtain the resource ID from the corresponding resource information, and delete the resource mapped to the resource ID to complete the corresponding resource in the resource information rollback cancellation. When the operation type of the rollback interface is modification (the operation type in the corresponding resource information is modification), obtain the resource ID and operation parameters from the corresponding resource information, and reversely modify the operation parameters in the resource mapped by the resource ID. Complete the rollback cancellation of the resource corresponding to the resource information.
具体实施过程中,本发明在对目标业务操作回滚成功后,记录相应的操作日志。In the specific implementation process, the present invention records the corresponding operation log after the target business operation is rolled back successfully.
实施例2Example 2
参阅图3所示,本发明实施例提供一种实现云平台业务层统一信息回滚方法的装置,包括:失败检测模块,所述失败检测模块检测调用目标业务操作所依赖微服务外部接口准备目标资源是否成功;Referring to FIG. 3 , an embodiment of the present invention provides a device for implementing a unified information rollback method of the cloud platform business layer, including: a failure detection module, the failure detection module detects that the calling target business operation depends on the microservice external interface preparation target whether the resource was successful;
资源信息存档模块,所述资源信息存档模块在准备目标资源成功时将准备好的目标资源的资源信息按预设的数据结构存档;A resource information archiving module, the resource information archiving module archives the resource information of the prepared target resource according to a preset data structure when the target resource is successfully prepared;
资源信息匹配模块,所述资源信息匹配模块在目标业务操作所需的目标资源失败时,根据目标业务匹配查询对应的资源信息;A resource information matching module, the resource information matching module queries corresponding resource information according to the target business matching when the target resource required for the target business operation fails;
资源信息解析模块,所述资源信息解析模块对资源信息进行解析,获取资源信息的内容;A resource information analysis module, the resource information analysis module analyzes the resource information to obtain the content of the resource information;
回滚接口匹配模块,所述回滚接口匹配模块利用资源信息的内容从配置各个微服务的服务注册中心查询对应的回滚接口;A rollback interface matching module, the rollback interface matching module queries the corresponding rollback interface from the service registration center that configures each microservice by using the content of the resource information;
回滚执行模块,所述回滚执行模块利用回滚接口和相应资源信息中的相应内容进行回滚;A rollback execution module, the rollback execution module uses the rollback interface and the corresponding content in the corresponding resource information to perform rollback;
日志模块,所述日志模块记录各个目标业务操作的回滚过程日志。A log module, the log module records the log of the rollback process of each target business operation.
实施例3Example 3
参阅图4所示,本发明实施例提供一种实现云平台业务层统一信息回滚方法的终端,包括:处理单元、总线单元、存储单元、显示单元以及输入单元,所述总线单元连接所述处理单元、存储单元、显示单元以及输入单元,所述存储单元存储至少一条指令,所述处理单元读取并执行所述指令实现所述的云平台业务层统一信息回滚方法。As shown in FIG. 4 , an embodiment of the present invention provides a terminal for implementing a unified information rollback method of a cloud platform business layer, including: a processing unit, a bus unit, a storage unit, a display unit, and an input unit, and the bus unit is connected to the A processing unit, a storage unit, a display unit, and an input unit, the storage unit stores at least one instruction, and the processing unit reads and executes the instruction to implement the method for rolling back unified information of the cloud platform business layer.
实施例4Example 4
本发明实施例提供一种实现云平台业务层统一信息回滚方法的存储介质,所述实现云平台业务层统一信息回滚方法的存储介质存储至少一条指令,读取并执行所述指令实现所述的云平台业务层统一信息回滚方法。The embodiment of the present invention provides a storage medium for realizing the unified information rollback method of the cloud platform business layer. The storage medium for realizing the unified information rollback method of the cloud platform business layer stores at least one instruction, reads and executes the instruction to realize the The unified information rollback method of the cloud platform business layer described above.
本发明在为目标业务操作准备目标资源成功时,将准备成功的目标资源的资源信息进行存档,资源信息中包含了目标资源的资源ID、服务调用方IP、目标资源所属微服务IP、操作类型和操作参数。一旦遇到目标资源准备失败的情况,则根据目标业务操作查询到相应的资源信息的存档,资源信息存档包含了发生错误失败前已经准备好的全部目标资源的资源信息,是回滚的对象。本发明利用资源信息中的操作类型确定相应的反向操作类型,反向操作类型为实现针对该资源信息所记载资源回滚的回滚接口的操作类型。通过资源信息中的目标资源所属微服务IP和反向操作类型从服务注册中心查询执行回滚的回滚接口,利用回滚接口对资源信息中所记载目标资源进行回滚。从而实现利用统一的回滚控制器将目标业务操作所依赖的各个微服务的回滚操作的统一,代码实现简单,且利于后期维护和扩展。In the present invention, when the target resource is successfully prepared for the target business operation, the resource information of the successfully prepared target resource is archived, and the resource information includes the resource ID of the target resource, the service caller IP, the microservice IP to which the target resource belongs, and the operation type and operating parameters. Once the preparation of the target resource fails, query the corresponding resource information archive according to the target business operation. The resource information archive contains the resource information of all target resources that have been prepared before the failure occurs, and is the object of rollback. In the present invention, the operation type in the resource information is used to determine the corresponding reverse operation type, and the reverse operation type is the operation type for realizing the rollback interface for resource rollback recorded in the resource information. Query the rollback interface for performing rollback from the service registry through the microservice IP to which the target resource belongs and the reverse operation type in the resource information, and use the rollback interface to roll back the target resource recorded in the resource information. In this way, a unified rollback controller is used to unify the rollback operations of various microservices that the target business operation depends on, the code is simple to implement, and it is convenient for later maintenance and expansion.
本申请中在定义微服务的操作接口时,配置外部接口的操作类型,定义外部接口的操作类型,并在向服务注册中心注册时提供包含操作类型的接口信息,为后续根据资源信息中的操作类型与对应的反向操作类型提供基础,为后续根据操作类型从服务注册中心查询外部接口获取相应的回滚接口提供基础。In this application, when defining the operation interface of the microservice, configure the operation type of the external interface, define the operation type of the external interface, and provide the interface information including the operation type when registering with the service registration center, for subsequent operations based on the resource information The type and the corresponding reverse operation type provide the basis for the subsequent query of the external interface from the service registry to obtain the corresponding rollback interface based on the operation type.
在本发明所提供的实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the embodiments provided in the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or May be integrated into another system, or some features may be ignored, or not implemented. In another point, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.
以上所述仅是本发明的具体实施方式,使本领域技术人员能够理解或实现本发明。对这些实施例的多种修改对本领域的技术人员来说将是显而易见的,本文中所定义的一般原理可以在不脱离本发明的精神或范围的情况下,在其它实施例中实现。因此,本发明将不会被限制于本文所示的这些实施例,而是要符合与本文所申请的原理和新颖特点相一致的最宽的范围。The above descriptions are only specific embodiments of the present invention, so that those skilled in the art can understand or implement the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Accordingly, the present invention will not be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.
Claims (9)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202210094593.7A CN114553943B (en) | 2022-01-26 | 2022-01-26 | A cloud platform business layer unified information rollback method, device, terminal and medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202210094593.7A CN114553943B (en) | 2022-01-26 | 2022-01-26 | A cloud platform business layer unified information rollback method, device, terminal and medium |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN114553943A CN114553943A (en) | 2022-05-27 |
| CN114553943B true CN114553943B (en) | 2023-08-08 |
Family
ID=81673942
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202210094593.7A Active CN114553943B (en) | 2022-01-26 | 2022-01-26 | A cloud platform business layer unified information rollback method, device, terminal and medium |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN114553943B (en) |
Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN109800083A (en) * | 2018-12-18 | 2019-05-24 | 平安科技(深圳)有限公司 | A kind of method, apparatus, system and storage medium that micro services collaboration is called |
| CN112269677A (en) * | 2020-10-10 | 2021-01-26 | 北京浪潮数据技术有限公司 | Rollback operation device, method, equipment and medium under heterogeneous cloud platform |
Family Cites Families (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US8997088B2 (en) * | 2012-11-02 | 2015-03-31 | Wipro Limited | Methods and systems for automated deployment of software applications on heterogeneous cloud environments |
| US10719414B2 (en) * | 2018-05-11 | 2020-07-21 | Cisco Technology, Inc. | Rollback for cloud native workflows |
-
2022
- 2022-01-26 CN CN202210094593.7A patent/CN114553943B/en active Active
Patent Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN109800083A (en) * | 2018-12-18 | 2019-05-24 | 平安科技(深圳)有限公司 | A kind of method, apparatus, system and storage medium that micro services collaboration is called |
| CN112269677A (en) * | 2020-10-10 | 2021-01-26 | 北京浪潮数据技术有限公司 | Rollback operation device, method, equipment and medium under heterogeneous cloud platform |
Also Published As
| Publication number | Publication date |
|---|---|
| CN114553943A (en) | 2022-05-27 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| WO2024077885A1 (en) | Management method, apparatus and device for container cluster, and non-volatile readable storage medium | |
| CN101788917A (en) | Deployment method of utility software and the system thereof | |
| CN114024853B (en) | A method, system and related components for collecting hardware information of bare metal nodes | |
| WO2018090290A1 (en) | Mirror image file conversion method and apparatus | |
| CN114416434B (en) | A bare metal disk backup method, device and computer-readable storage medium | |
| JP6393612B2 (en) | System backup device and backup method | |
| WO2019223181A1 (en) | Etl task data source switching method and system, computer device and storage medium | |
| CN113687907B (en) | Application processing method, device, electronic device and storage medium | |
| CN106330546A (en) | System and method for deploying application cluster in private cloud environment | |
| CN113672334A (en) | Container management method and device | |
| CN114443294A (en) | Big data service component deployment method, system, terminal and storage medium | |
| CN117591106A (en) | Calling method and device of native function component, electronic equipment and storage medium | |
| CN111488163B (en) | Firmware updating method and device, electronic equipment and storage medium | |
| CN110096226B (en) | Disk array deployment method and device | |
| CN110716811B (en) | Database calling method, device and computer equipment | |
| CN114553943B (en) | A cloud platform business layer unified information rollback method, device, terminal and medium | |
| CN114640709B (en) | A processing method, device and medium for an edge node | |
| CN116962185A (en) | Gateway management and control method, device, electronic equipment and computer program product | |
| WO2020015751A1 (en) | Container service snapshot management method and apparatus | |
| CN106998259A (en) | A kind of collecting method and device | |
| CN116795548A (en) | Interface processing method, device, system and storage medium based on multi-cloud management | |
| CN116501552A (en) | Method, device, system and storage medium for data backup | |
| CN115514633A (en) | API gateway dynamic configuration method, device, and electronic equipment | |
| US10824598B2 (en) | Handling file commit and commit-delete operations in an overlay optimizer | |
| CN114047933A (en) | Method, device, device and medium for opening multiple Android applications |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant | ||
| CP03 | Change of name, title or address |
Address after: Building 9, No.1, guanpu Road, Guoxiang street, Wuzhong Economic Development Zone, Wuzhong District, Suzhou City, Jiangsu Province Patentee after: Suzhou Yuannao Intelligent Technology Co.,Ltd. Country or region after: China Address before: Building 9, No.1, guanpu Road, Guoxiang street, Wuzhong Economic Development Zone, Wuzhong District, Suzhou City, Jiangsu Province Patentee before: SUZHOU LANGCHAO INTELLIGENT TECHNOLOGY Co.,Ltd. Country or region before: China |