CN114764379A - Access switching method and device for application software and computer readable storage medium - Google Patents
Access switching method and device for application software and computer readable storage medium Download PDFInfo
- Publication number
- CN114764379A CN114764379A CN202110040628.4A CN202110040628A CN114764379A CN 114764379 A CN114764379 A CN 114764379A CN 202110040628 A CN202110040628 A CN 202110040628A CN 114764379 A CN114764379 A CN 114764379A
- Authority
- CN
- China
- Prior art keywords
- deployment unit
- disaster recovery
- target
- application software
- deployment
- 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 63
- 238000011084 recovery Methods 0.000 claims abstract description 340
- 230000002159 abnormal effect Effects 0.000 claims abstract description 27
- 230000036541 health Effects 0.000 claims description 22
- 239000000523 sample Substances 0.000 claims description 8
- 238000004590 computer program Methods 0.000 claims description 7
- 238000004519 manufacturing process Methods 0.000 description 45
- 230000006870 function Effects 0.000 description 8
- 238000010586 diagram Methods 0.000 description 5
- 230000008569 process Effects 0.000 description 4
- 238000004891 communication Methods 0.000 description 3
- 230000003862 health status Effects 0.000 description 2
- 238000009434 installation Methods 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- 230000004044 response Effects 0.000 description 2
- 238000012546 transfer Methods 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 1
- 230000001419 dependent effect Effects 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000007599 discharging Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 230000006855 networking Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000011002 quantification Methods 0.000 description 1
- 230000008439 repair process Effects 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/16—Error detection or correction of the data by redundancy in hardware
- G06F11/20—Error detection or correction of the data by redundancy in hardware using active fault-masking, e.g. by switching out faulty elements or by switching in spare elements
- G06F11/2053—Error detection or correction of the data by redundancy in hardware using active fault-masking, e.g. by switching out faulty elements or by switching in spare elements where persistent mass storage functionality or persistent mass storage control functionality is redundant
- G06F11/2056—Error detection or correction of the data by redundancy in hardware using active fault-masking, e.g. by switching out faulty elements or by switching in spare elements where persistent mass storage functionality or persistent mass storage control functionality is redundant by mirroring
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/16—Error detection or correction of the data by redundancy in hardware
- G06F11/20—Error detection or correction of the data by redundancy in hardware using active fault-masking, e.g. by switching out faulty elements or by switching in spare elements
- G06F11/202—Error detection or correction of the data by redundancy in hardware using active fault-masking, e.g. by switching out faulty elements or by switching in spare elements where processing functionality is redundant
- G06F11/2023—Failover techniques
- G06F11/2033—Failover techniques switching over of hardware resources
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
- G06F11/3003—Monitoring arrangements specially adapted to the computing system or computing system component being monitored
- G06F11/302—Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Quality & Reliability (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computing Systems (AREA)
- Mathematical Physics (AREA)
- Stored Programmes (AREA)
Abstract
本发明实施例公开了一种应用软件的访问切换方法、设备和计算机可读存储介质,以解决现有技术访问切换耗时多造成异常时间增加的问题;本申请中若目标部署单元异常,则查询目标部署单元对应的容灾部署单元的运行状态;若容灾部署单元的运行状态正常,则将访问请求切换至容灾部署单元对应的目标网络地址;本申请通过查询容灾部署单元的运行状态以确定是否执行应用软件的访问切换,简化切换操作,减少异常时间,并保障切换操作能恢复应用正常访问;并且通过判断目标部署单元是否已部署对应的容灾部署单元,只对已部署对应的容灾部署单元的目标部署单元提供应用软件的访问切换服务,为应用软件的访问切换提供保障。
Embodiments of the present invention disclose an access switching method, device, and computer-readable storage medium for application software, so as to solve the problem of excessive time-consuming access switching in the prior art, resulting in an increase in abnormal time; in this application, if the target deployment unit is abnormal, the Query the running status of the disaster recovery deployment unit corresponding to the target deployment unit; if the running status of the disaster recovery deployment unit is normal, switch the access request to the target network address corresponding to the disaster recovery deployment unit; this application queries the operation status of the disaster recovery deployment unit by querying the operation status of the disaster recovery deployment unit. Status to determine whether to perform access switching of application software, simplify switching operations, reduce abnormal time, and ensure that switching operations can restore normal application access; and by judging whether the target deployment unit has deployed the corresponding disaster recovery deployment unit, only the corresponding The target deployment unit of the disaster recovery deployment unit provides the access switching service of the application software, and provides guarantee for the access switching of the application software.
Description
技术领域technical field
本发明涉及服务集群容器技术领域,具体涉及一种应用软件的访问切换方法、设备和计算机可读存储介质。The present invention relates to the technical field of service cluster containers, in particular to an access switching method, device and computer-readable storage medium for application software.
背景技术Background technique
在大规模的互联网应用中,应用存放在服务器集群中,用户通过访问服务器集群中的应用获得应用服务。In large-scale Internet applications, applications are stored in server clusters, and users obtain application services by accessing applications in the server clusters.
服务器集群中的服务器出现故障时,会导致应用不可访问,如果故障时间比较长,会导致应用不可以提供相应的应用服务,使得应用相关的业务异常,给公司带来巨大的损失,因此需要建立容灾系统来保证应用的正常访问;现有的容灾建立技术通常通过kubernetes容器编排框架来部署云平台组件容器进行数据备份,在服务器集群崩溃后,启动新的kubernetes容器后读取备份数据,然后就地重建应用程序,在应用程序重建完成之后,会将用户的访问请求切换至重建的应用程序,这样由于应用程序重建时间较长,使得应用响应时间较长。When a server in the server cluster fails, the application will be inaccessible. If the failure time is relatively long, the application will not be able to provide the corresponding application service, which will make the application-related business abnormal and bring huge losses to the company. Therefore, it is necessary to establish Disaster recovery system to ensure the normal access of applications; the existing disaster recovery establishment technology usually deploys cloud platform component containers for data backup through the kubernetes container orchestration framework. After the server cluster crashes, start a new kubernetes container to read the backup data, Then, the application is rebuilt on the spot, and after the application is rebuilt, the user's access request is switched to the rebuilt application, so that the application response time is longer due to the longer application rebuilding time.
发明内容SUMMARY OF THE INVENTION
本发明实施例提供一种应用软件的访问切换方法、设备和计算机可读存储介质,已解决现有技术服务集群故障时,应用恢复时间长,访问请求响应速度慢的技术问题。Embodiments of the present invention provide an access switching method, device, and computer-readable storage medium for application software, which solve the technical problems of long application recovery time and slow access request response speed when a service cluster fails in the prior art.
一方面,本申请提供一种应用软件的访问切换方法,所述方法包括:On the one hand, the present application provides an access switching method for application software, the method comprising:
接收访问请求,获取所述访问请求关联的初始访问地址;Receive an access request, and obtain the initial access address associated with the access request;
若所述初始访问地址对应的目标部署单元异常,则判断所述目标部署单元是否已部署对应的容灾部署单元;If the target deployment unit corresponding to the initial access address is abnormal, determine whether the target deployment unit has deployed the corresponding disaster recovery deployment unit;
若所述目标部署单元已部署对应的容灾部署单元,则查询所述容灾部署单元的运行状态;If the target deployment unit has deployed the corresponding disaster recovery deployment unit, query the running status of the disaster recovery deployment unit;
若所述容灾部署单元的运行状态正常,则将所述访问请求切换至所述容灾部署单元对应的目标网络地址。If the running state of the disaster recovery deployment unit is normal, the access request is switched to the target network address corresponding to the disaster recovery deployment unit.
在本申请一些实施例中,所述接收访问请求,获取所述访问请求关联的初始访问地址之前,所述方法包括:In some embodiments of the present application, before the receiving an access request and acquiring the initial access address associated with the access request, the method includes:
接收容灾部署请求,确定所述容灾部署请求对应的应用软件,及所述应用软件关联的部署单元集合;receiving a disaster recovery deployment request, and determining application software corresponding to the disaster recovery deployment request, and a set of deployment units associated with the application software;
获取所述部署单元集合中待部署的部署单元标识,及各所述部署单元标识对应部署单元的运行信息;Obtaining the deployment unit identifiers to be deployed in the deployment unit set, and the operation information of the deployment units corresponding to the deployment unit identifiers;
根据各所述部署单元的运行信息,部署各所述部署单元的容灾部署单元,将各所述容灾部署单元对应的设备作为所述应用软件对应的容灾集群。According to the operation information of each deployment unit, the disaster recovery deployment unit of each deployment unit is deployed, and the device corresponding to each disaster recovery deployment unit is used as the disaster recovery cluster corresponding to the application software.
在本申请一些实施例中,所述根据各所述部署单元的运行信息,部署各所述部署单元的容灾部署单元,将各所述容灾部署单元对应的设备作为所述应用软件对应的容灾集群,包括:In some embodiments of the present application, according to the operation information of each deployment unit, the disaster recovery deployment unit of each deployment unit is deployed, and the device corresponding to each disaster recovery deployment unit is used as the corresponding device of the application software. Disaster recovery cluster, including:
根据各所述部署单元的运行信息,获取各所述部署单元关联的配置信息;Obtain configuration information associated with each deployment unit according to the operation information of each deployment unit;
从各所述部署单元关联的所述配置信息中提取各所述部署单元对应的依赖项和环境变量,判断各所述部署单元对应的所述依赖项中是否包含容灾依赖项;Extracting dependencies and environment variables corresponding to each deployment unit from the configuration information associated with each deployment unit, and determining whether the dependencies corresponding to each deployment unit include disaster tolerance dependencies;
若各所述部署单元对应的所述依赖项中包含容灾依赖项,则根据各所述部署单元对应的所述容灾依赖项,创建各所述部署单元的容灾部署单元,将各所述容灾部署单元对应的设备作为所述应用软件对应的容灾集群;If the dependencies corresponding to each deployment unit include disaster tolerance dependencies, create a disaster tolerance deployment unit of each deployment unit according to the disaster tolerance dependencies corresponding to each deployment unit, The device corresponding to the disaster recovery deployment unit is used as the disaster recovery cluster corresponding to the application software;
若各所述部署单元对应的所述依赖项中不包含容灾依赖项,则通过各所述部署单元对应的所述环境变量配置所述依赖项对应的容灾依赖项,并根据各所述容灾依赖项创建各所述部署单元的容灾部署单元,将各所述容灾部署单元对应的设备作为所述应用软件对应的容灾集群。If the dependencies corresponding to the deployment units do not include disaster tolerance dependencies, configure the disaster tolerance dependencies corresponding to the dependencies through the environment variables corresponding to the deployment units, and configure the disaster tolerance dependencies according to the environment variables corresponding to the deployment units. The disaster recovery dependency creates a disaster recovery deployment unit of each of the deployment units, and uses the device corresponding to each of the disaster recovery deployment units as a disaster recovery cluster corresponding to the application software.
在本申请一些实施例中,所述根据各所述部署单元的运行信息,部署各所述部署单元的容灾部署单元,将各所述容灾部署单元对应的设备作为所述应用软件对应的容灾集群之后,所述方法包括:In some embodiments of the present application, according to the operation information of each deployment unit, the disaster recovery deployment unit of each deployment unit is deployed, and the device corresponding to each disaster recovery deployment unit is used as the corresponding device of the application software. After the disaster recovery cluster, the method includes:
检测各所述部署单元的运行信息,确定运行信息更新的目标部署单元;Detecting the operation information of each of the deployment units, and determining the target deployment unit whose operation information is updated;
根据所述目标部署单元的运行信息,更新所述目标部署单元对应容灾部署单元的运行信息。According to the operation information of the target deployment unit, the operation information of the disaster recovery deployment unit corresponding to the target deployment unit is updated.
在本申请一些实施例中,所述若所述初始访问地址对应的目标部署单元异常,则判断所述目标部署单元是否已部署对应的容灾部署单元,包括:In some embodiments of the present application, if the target deployment unit corresponding to the initial access address is abnormal, determining whether the target deployment unit has deployed the corresponding disaster recovery deployment unit includes:
若所述初始访问地址对应的目标部署单元异常,则判断所述目标部署单元是否存在对应的容灾部署单元;If the target deployment unit corresponding to the initial access address is abnormal, determine whether the target deployment unit has a corresponding disaster recovery deployment unit;
若所述目标部署单元存在对应的容灾部署单元,则将所述目标部署单元的依赖项与所述容灾部署单元的容灾依赖项进行比对;If the target deployment unit has a corresponding disaster recovery deployment unit, comparing the dependency of the target deployment unit with the disaster recovery dependency of the disaster recovery deployment unit;
若所述目标部署单元的依赖项与所述容灾部署单元的容灾依赖项匹配,则判定所述目标部署单元已部署对应的容灾部署单元;If the dependency of the target deployment unit matches the disaster recovery dependency of the disaster recovery deployment unit, it is determined that the target deployment unit has deployed the corresponding disaster recovery deployment unit;
若所述目标部署单元不存在对应的容灾部署单元,和/或所述目标部署单元的依赖项与所述容灾部署单元的容灾依赖项不匹配,则判定所述目标部署单元未部署对应的容灾部署单元。If the target deployment unit does not have a corresponding disaster recovery deployment unit, and/or the dependency of the target deployment unit does not match the disaster recovery dependency of the disaster recovery deployment unit, it is determined that the target deployment unit is not deployed The corresponding disaster recovery deployment unit.
在本申请一些实施例中,所述若所述目标部署单元已部署对应的容灾部署单元,则查询所述容灾部署单元的运行状态包括:In some embodiments of the present application, if the target deployment unit has deployed a corresponding disaster recovery deployment unit, querying the running status of the disaster recovery deployment unit includes:
若所述目标部署单元已部署对应的容灾部署单元,则查询所述目标部署单元对应容灾部署单元的状态;If the target deployment unit has deployed the corresponding disaster recovery deployment unit, query the status of the disaster recovery deployment unit corresponding to the target deployment unit;
若所述容灾部署单元的状态为已启动,则根据所述容灾部署单元的运行信息查询所述容灾部署单元的运行状态;If the status of the disaster recovery deployment unit is activated, query the running status of the disaster recovery deployment unit according to the operation information of the disaster recovery deployment unit;
若所述容灾部署单元的状态为未启动,则启动所述容灾部署单元,更新所述容灾部署单元的运行信息。If the status of the disaster recovery deployment unit is not started, the disaster recovery deployment unit is started, and the running information of the disaster recovery deployment unit is updated.
在本申请一些实施例中,所述若所述目标部署单元已部署对应的容灾部署单元,则查询所述目标部署单元对应容灾部署单元的启动状态包括:In some embodiments of the present application, if the target deployment unit has deployed the corresponding disaster recovery deployment unit, querying the startup status of the disaster recovery deployment unit corresponding to the target deployment unit includes:
若所述目标部署单元已部署对应的容灾部署单元,则查询所述目标部署单元对应容灾部署单元是否完成调度确定所述容灾部署单元的启动状态;If the target deployment unit has deployed the corresponding disaster recovery deployment unit, query whether the disaster recovery deployment unit corresponding to the target deployment unit has completed scheduling to determine the startup state of the disaster recovery deployment unit;
若所述目标部署单元对应容灾部署单元完成调度,则判定所述容灾部署单元的启动状态为已启动;If the target deployment unit corresponding to the disaster recovery deployment unit completes the scheduling, it is determined that the startup status of the disaster recovery deployment unit is started;
若所述目标部署单元对应容灾部署单元没有完成调度,则判定所述容灾部署单元的启动状态为未启动;If the disaster recovery deployment unit corresponding to the target deployment unit has not completed the scheduling, it is determined that the startup state of the disaster recovery deployment unit is not started;
所述若所述容灾部署单元的启动状态为已启动,则根据所述容灾部署单元的运行信息查询所述容灾部署单元的运行状态包括:If the startup status of the disaster recovery deployment unit is started, querying the running status of the disaster recovery deployment unit according to the operation information of the disaster recovery deployment unit includes:
若所述容灾部署单元的状态为已启动,则获取所述容灾部署单元的运行信息;If the status of the disaster recovery deployment unit is activated, acquiring the operation information of the disaster recovery deployment unit;
通过探针对所述运行信息进行健康检查,查询所述容灾部署单元的运行状态;Perform a health check on the running information through a probe, and query the running status of the disaster recovery deployment unit;
若所述运行信息的健康检查通过,则判定所述容灾部署单元的运行状态为正常;If the health check of the operation information is passed, it is determined that the operation state of the disaster recovery deployment unit is normal;
若所述运行信息的健康检查不通过,则判定所述容灾部署单元的运行状态为异常。If the health check of the operation information fails, it is determined that the operation state of the disaster recovery deployment unit is abnormal.
在本申请一些实施例中,所述接收访问请求,获取所述访问请求关联的初始访问地址之前,所述方法包括;In some embodiments of the present application, before the receiving an access request and acquiring the initial access address associated with the access request, the method includes:
接收应用程序部署请求,根据所述部署请求定义所述应用程序的环境变量,基于所述环境变量制作镜像;Receive an application deployment request, define an environment variable of the application according to the deployment request, and create an image based on the environment variable;
基于所述镜像制作依赖项,根据所述依赖项部署所述应用程序的部署单元。A dependency is made based on the image, and a deployment unit of the application is deployed according to the dependency.
另一方面,本申请提供一种应用软件的访问切换设备,所述应用软件的访问切换设备包括:On the other hand, the present application provides an access switching device for application software, and the access switching device for application software includes:
一个或多个处理器;one or more processors;
存储器;以及memory; and
一个或多个应用程序,其中所述一个或多个应用程序被存储于所述存储器中,并配置为由所述处理器执行以实现应用软件的访问切换方法。One or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the processor to implement an access switching method of application software.
另一方面,本申请提供一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器进行加载,以执行所述的应用软件的访问切换方法中的步骤。On the other hand, the present application provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and the computer program is loaded by a processor to execute the access switching method of the application software. A step of.
本申请技术方案中接收访问请求,获取访问请求关联的初始访问地址;若初始访问地址对应的目标部署单元异常,判断目标部署单元是否已部署对应的容灾部署单元,若所述目标部署单元已部署对应的容灾部署单元,通过查询容灾部署单元的运行状态,若容灾部署单元的运行状态正常,则将所述访问请求切换至容灾部署单元对应的目标网络地址,实现应用软件的访问请求从目标部署单元快速切换到容灾部署单元,简化切换操作,减少异常时间,并保障切换操作后能恢复应用正常访问,使得访问请求快速地响应。In the technical solution of the present application, an access request is received, and an initial access address associated with the access request is obtained; if the target deployment unit corresponding to the initial access address is abnormal, it is determined whether the target deployment unit has deployed the corresponding disaster recovery deployment unit, and if the target deployment unit has Deploy the corresponding disaster recovery deployment unit, by querying the running status of the disaster recovery deployment unit, if the running status of the disaster recovery deployment unit is normal, then switch the access request to the target network address corresponding to the disaster recovery deployment unit, so as to realize the application software. The access request is quickly switched from the target deployment unit to the disaster recovery deployment unit, which simplifies the switching operation, reduces the abnormal time, and ensures that the normal access of the application can be restored after the switching operation, so that the access request can be responded quickly.
附图说明Description of drawings
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to illustrate the technical solutions in the embodiments of the present invention more clearly, the following briefly introduces the accompanying drawings used in the description of the embodiments. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For those skilled in the art, other drawings can also be obtained from these drawings without creative effort.
图1是本发明实施例提供的应用软件的访问切换的场景示意图;1 is a schematic diagram of a scenario of access switching of application software provided by an embodiment of the present invention;
图2是本发明实施例提供的应用软件的访问切换方法的一个实施例流程示意图;2 is a schematic flowchart of an embodiment of an access switching method for application software provided by an embodiment of the present invention;
图3是本发明实施例提供的应用软件的切换访问方法中容灾集群的建立的一个实施例流程示意图;3 is a schematic flowchart of an embodiment of the establishment of a disaster tolerance cluster in the switching access method for application software provided by an embodiment of the present invention;
图4是本发明实施例提供的应用软件的访问切换中部署容灾部署单元的一个实施例流程示意图;4 is a schematic flowchart of an embodiment of deploying a disaster tolerance deployment unit in access switching of application software provided by an embodiment of the present invention;
图5是本发明实施例提供的应用软件的访问切换方法中确定对应的容灾部署单元是否已部署的一个实施例流程示意图;5 is a schematic flowchart of an embodiment of determining whether a corresponding disaster tolerance deployment unit has been deployed in an access switching method for application software provided by an embodiment of the present invention;
图6是本发明实施例提供的应用软件的访问切换方法中查询所述容灾部署单元的运行状态的一个实施例流程示意图;6 is a schematic flowchart of an embodiment of querying the running state of the disaster tolerance deployment unit in the access switching method for application software provided by the embodiment of the present invention;
图7是本发明实施例提供的应用软件的访问切换方法中部署单元部署的一个实施例流程示意图;7 is a schematic flowchart of an embodiment of deployment unit deployment in an access switching method for application software provided by an embodiment of the present invention;
图8是本发明实施例提供的应用软件的访问切换设备的一个实施例结构示意图。FIG. 8 is a schematic structural diagram of an embodiment of an access switching device for application software provided by an embodiment of the present invention.
具体实施方式Detailed ways
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in 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. Obviously, the described embodiments are only a part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative efforts shall fall within the protection scope of the present invention.
在本申请的描述中,需要理解的是,术语“中心”、“纵向”、“横向”、“长度”、“宽度”、“厚度”、“上”、“下”、“前”、“后”、“左”、“右”、“竖直”、“水平”、“顶”、“底”、“内”、“外”等指示的方位或位置关系为基于附图所示的方位或位置关系,仅是为了便于描述本申请和简化描述,而不是指示或暗示所指的装置或元件必须具有特定的方位、以特定的方位构造和操作,因此不能理解为对本申请的限制。此外,术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括一个或者更多个特征。在本申请的描述中,“多个”的含义是两个或两个以上,除非另有明确具体的限定。In the description of this application, it should be understood that the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "upper", "lower", "front", " The orientation or positional relationship indicated by "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", etc. is based on the orientation shown in the drawings Or the positional relationship is only for the convenience of describing the present application and simplifying the description, rather than indicating or implying that the indicated device or element must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be construed as a limitation on the present application. In addition, the terms "first" and "second" are only used for descriptive purposes, and should not be construed as indicating or implying relative importance or implying the number of indicated technical features. Thus, features defined as "first", "second" may expressly or implicitly include one or more features. In the description of the present application, "plurality" means two or more, unless otherwise expressly and specifically defined.
在本申请中,“示例性”一词用来表示“用作例子、例证或说明”。本申请中被描述为“示例性”的任何实施例不一定被解释为比其它实施例更优选或更具优势。为了使本领域任何技术人员能够实现和使用本申请,给出了以下描述。在以下描述中,为了解释的目的而列出了细节。应当明白的是,本领域普通技术人员可以认识到,在不使用这些特定细节的情况下也可以实现本申请。在其它实例中,不会对公知的结构和过程进行详细阐述,以避免不必要的细节使本申请的描述变得晦涩。因此,本申请并非旨在限于所示的实施例,而是与符合本申请所公开的原理和特征的最广范围相一致。In this application, the word "exemplary" is used to mean "serving as an example, illustration, or illustration." Any embodiment described in this application as "exemplary" is not necessarily to be construed as preferred or advantageous over other embodiments. The following description is presented to enable any person skilled in the art to make and use the present application. In the following description, details are set forth for the purpose of explanation. It is to be understood that one of ordinary skill in the art can realize that the present application may be practiced without the use of these specific details. In other instances, well-known structures and procedures have not been described in detail so as not to obscure the description of the present application with unnecessary detail. Therefore, this application is not intended to be limited to the embodiments shown but is to be accorded the widest scope consistent with the principles and features disclosed herein.
本发明实施例提供一种应用软件的访问切换方法、设备和计算机可读存储介质。Embodiments of the present invention provide an access switching method, device, and computer-readable storage medium for application software.
本申请实施例中的应用软件的访问切换方法应用于应用软件的访问切换设备,应用软件的访问切换设备设置有存储器和处理器,存储器上存储有应用程序,处理器用于运行存储器内存储的应用程序,以实现应用软件的访问切换;应用软件的访问切换设备可以是服务器,例如单个服务器或多个服务器组成的服务器集群。The application software access switching method in the embodiment of the present application is applied to an application software access switching device. The application software access switching device is provided with a memory and a processor, the memory stores an application program, and the processor is used for running the application stored in the memory. A program is used to implement the access switching of the application software; the access switching device of the application software can be a server, such as a single server or a server cluster composed of multiple servers.
如图1所示,图1为本申请实施例提供的应用软件的访问切换的场景示意图,本申请实施例中应用软件的访问切换场景包括应用软件的访问切换设备,应用软件的访问切换设备运行应用软件的访问切换对应的计算机可读存储介质,以执行应用软件的访问切换的步骤。As shown in FIG. 1 , FIG. 1 is a schematic diagram of a scenario of access switching of application software provided by an embodiment of the present application. In the embodiment of the present application, the access switching scenario of application software includes an access switching device of application software, and the access switching device of application software runs The computer-readable storage medium corresponding to the access switching of the application software is used to perform the steps of the access switching of the application software.
可以理解的是,图1所示应用软件的访问切换中的应用软件的访问切换设备,或者应用软件的访问切换设备中包含的装置并不构成对本申请实施例的限制,即应用软件的访问切换的场景中包含的设备数量、设备类型,或者各个设备中包含的装置数量、装置类型不影响本申请实施例技术方案整体实现,均可以算作本申请实施例要求保护技术方案的等效替换或衍生。It can be understood that the access switching device of the application software in the access switching of the application software shown in FIG. 1, or the device included in the access switching device of the application software does not constitute a restriction to the embodiment of the present application, that is, the access switching of the application software. The number of devices and types of devices included in the scene, or the number and types of devices included in each device do not affect the overall implementation of the technical solutions of the embodiments of the present application, and can be regarded as equivalent replacements of the technical solutions claimed in the embodiments of the present application or derivative.
本申请实施例应用软件的访问切换设备主要用于:The access switching device of the application software in the embodiment of the present application is mainly used for:
接收访问请求,获取所述访问请求关联的初始访问地址;Receive an access request, and obtain the initial access address associated with the access request;
若所述初始访问地址对应的目标部署单元异常,则判断所述目标部署单元是否已部署对应的容灾部署单元;If the target deployment unit corresponding to the initial access address is abnormal, determine whether the target deployment unit has deployed the corresponding disaster recovery deployment unit;
若所述目标部署单元已部署对应的容灾部署单元,则查询所述容灾部署单元的运行状态;If the target deployment unit has deployed the corresponding disaster recovery deployment unit, query the running status of the disaster recovery deployment unit;
若所述容灾部署单元的运行状态正常,则将所述访问请求切换至所述容灾部署单元对应的目标网络地址。If the running state of the disaster recovery deployment unit is normal, the access request is switched to the target network address corresponding to the disaster recovery deployment unit.
本申请实施例中该应用软件的访问切换设备可以是单独的应用软件的访问切换设备,也可以是应用软件的访问切换设备组成的应用软件的访问切换设备网络或者应用软件的访问切换设备集群,例如本申请实施例中描述的应用软件的访问切换设备包括但不限于计算机、服务器、多个服务器组成的服务器集群、单个网络应用软件的访问切换设备、多个应用软件的访问切换设备集或多个应用软件的访问切换设备构成的云应用软件的访问切换设备。其中云应用软件的访问切换设备由基于云计算的大量计算机、服务器或网络应用软件的访问切换设备构成。In the embodiment of the present application, the access switching device of the application software may be an independent application software access switching device, or may be an application software access switching device network composed of application software access switching devices, or an application software access switching device cluster, For example, the access switching device for application software described in the embodiments of this application includes, but is not limited to, a computer, a server, a server cluster composed of multiple servers, an access switching device for a single network application software, a set of access switching devices for multiple application software, or multiple Access switching devices for cloud application software composed of access switching devices for each application software. The access switching device for cloud application software is composed of a large number of cloud computing-based computers, servers or access switching devices for network application software.
本领域技术人员可以理解,图1中示出的应用场景,仅仅是本申请方案一种应用场景,并不构成对本申请方案应用场景的限定,其他的应用场景还可以包括比图1所示更多或者更少的应用软件的访问切换设备,或者应用软件的访问切换设备网络连接关系,例如图1中仅仅示出了1个应用软件的访问切换设备,可以理解的,该应用软件的访问切换的场景还可以包括一个或多个应用软件的访问切换设备,具体此处不做限定;该应用软件的访问切换设备中还可以包括存储器,用于存储数据,例如目标部署单元的运行信息等。Those skilled in the art can understand that the application scenario shown in FIG. 1 is only one application scenario of the solution of the present application, and does not constitute a limitation on the application scenario of the solution of the present application. Other application scenarios may also include more than that shown in FIG. 1 . There are more or less application software access switching devices, or the network connection relationship of application software access switching devices. For example, only one application software access switching device is shown in FIG. 1. It can be understood that the application software access switching device The scenario may also include one or more access switching devices for application software, which is not specifically limited here; the application software access switching device may also include a memory for storing data, such as running information of the target deployment unit.
此外,本申请应用软件的访问切换的场景应用软件的访问切换设备可以设置显示装置200,或者应用软件的访问切换设备100中不设置显示装置200与外接的显示装置通讯连接,显示装置200用于输出应用软件的访问切换设备100中应用软件的访问切换方法执行的结果。应用软件的访问切换设备100可以访问后台数据库300(后台数据库300可以是应用软件的访问切换设备100的本地存储器),后台数据库300中保存有应用软件的访问切换相关的信息,例如,后台数据库中保存目标部署单元的运行信息、容灾部署单元的运行状态和目标部署单元的依赖项等。In addition, the access switching device of the application software of the present application may be provided with the
需要说明的是,图1所示出的应用软件的访问切换的场景示意图仅仅是一个施例,本申请实施例描述的应用软件的访问切换的场景为了更加清楚的说明本申请实施例的技术方案,并不构成对本申请实施例提供的技术方案的限定。It should be noted that the schematic diagram of the access switching scenario of the application software shown in FIG. 1 is only an example, and the scenario of the access switching of the application software described in the embodiments of the present application is for the purpose of illustrating the technical solutions of the embodiments of the present application more clearly. , which does not constitute a limitation on the technical solutions provided in the embodiments of the present application.
如图2所示,图2是本申请实施例提供的应用软件的访问切换方法的一个实施例流程示意图,该应用软件的访问切换方法包括:As shown in FIG. 2, FIG. 2 is a schematic flowchart of an embodiment of an access switching method for application software provided by an embodiment of the present application. The access switching method for application software includes:
101,接收访问请求,获取所述访问请求关联的初始访问地址。101. Receive an access request, and obtain an initial access address associated with the access request.
本申请实施例中的应用软件的访问切换方法应用在应用软件的访问切换设备中,应用软件的访问切换设备中的设备种类和设备数量不做限定。本实施例应用软件的访问切换设备以生产可用区为例进行说明(其中,生产可用区是一个或多个物理数据中心的集合,具有冗余电源、联网和连接,包含用户日常访问的应用软件)。生产可用区通过端口接收客户端的访问请求,获取访问请求中请求访问的域名,利用负载均衡器解析域名获得访问请求关联的初始访问地址,通过初始访问地址查询初始访问地址对应的目标部署单元(其中目标部署单元是生产可用区中生产应用的最小应用单元),并基于初始访问地址建立目标部署单元与客户端通信连接,如果通信连接建立失败,则说明目标部署单元访问超时,并判定初始访问地址对应的目标部署单元异常。The access switching method for application software in the embodiment of the present application is applied to an access switching device for application software, and the type and number of devices in the access switching device for application software are not limited. The access switching device of the application software in this embodiment is described by taking the production availability zone as an example (wherein, the production availability zone is a collection of one or more physical data centers with redundant power supplies, networking and connections, including application software accessed by users daily ). The production availability zone receives the client's access request through the port, obtains the domain name requested in the access request, uses the load balancer to resolve the domain name to obtain the initial access address associated with the access request, and queries the target deployment unit corresponding to the initial access address through the initial access address (wherein The target deployment unit is the smallest application unit of the production application in the production availability zone), and establishes a communication connection between the target deployment unit and the client based on the initial access address. If the communication connection fails to be established, it means that the target deployment unit access times out, and the initial access address is determined. The corresponding target deployment unit is abnormal.
在本实施例中,可以基于Kubernetes(中文:开源的一个容器编排引擎)容器管理平台建立生产可用区,可以通过设置NodePort服务(中文:节点端口)、LoadBalancer(中文:负载均衡器)或部署Kubernetes Ingress(中文:从kubernetes集群外访问集群的入口)容器以使客户端能够通过端口或Ingress方式来访问应用软件,可以通过DNS(全称:DomainName Server,中文:域名系统)解析域名获得访问请求关联的初始访问地址。基于Kubernetes容器管理平台将容器组合成一个个的互相存在依赖关系的部署单元,相关容器被组合成部署单元后被共同部署和调度,形成服务,简化部署和调度部署单元的复杂性。In this embodiment, a production availability zone can be established based on the Kubernetes (Chinese: open source container orchestration engine) container management platform, and the NodePort service (Chinese: node port), LoadBalancer (Chinese: load balancer) or Kubernetes can be deployed by setting Ingress (Chinese: access to the cluster from outside the kubernetes cluster) container so that the client can access the application software through the port or Ingress mode, you can use DNS (full name: DomainName Server, Chinese: Domain Name System) to resolve the domain name to obtain the associated access request Initial access address. Based on the Kubernetes container management platform, containers are combined into deployment units that are mutually dependent. Related containers are combined into deployment units and then deployed and scheduled together to form services, simplifying the complexity of deployment and scheduling deployment units.
102,若所述初始访问地址对应的目标部署单元异常,则判断所述目标部署单元是否已部署对应的容灾部署单元。102. If the target deployment unit corresponding to the initial access address is abnormal, determine whether the target deployment unit has deployed the corresponding disaster recovery deployment unit.
在本申请实施例中,若初始访问地址对应的目标部署单元异常,则查询生产可用区对应的容灾可用区,判断目标部署单元是否已部署对应的容灾部署单元(其中容灾部署单元是容灾可用区容灾应用的最小应用单元,容灾可用区是基于Kubernetes容器管理平台建立的生产可用区的备用区),如果目标部署单元未部署对应的容灾部署单元,则输出不可进行应用软件的访问切换的提示消息;如果目标部署单元已部署对应的容灾部署单元,则执行若目标部署单元已部署对应的容灾部署单元,则查询容灾部署单元的运行状态操作。In the embodiment of the present application, if the target deployment unit corresponding to the initial access address is abnormal, the disaster recovery availability zone corresponding to the production availability zone is queried to determine whether the target deployment unit has deployed the corresponding disaster recovery deployment unit (where the disaster recovery deployment unit is Disaster Recovery Availability Zone is the smallest application unit of disaster recovery application. Disaster recovery availability zone is the spare area of production availability zone established based on Kubernetes container management platform). If the target deployment unit does not deploy the corresponding disaster recovery deployment unit, the output cannot be applied. The prompt message of the access switching of the software; if the target deployment unit has deployed the corresponding disaster recovery deployment unit, execute the operation of querying the running status of the disaster recovery deployment unit if the target deployment unit has deployed the corresponding disaster recovery deployment unit.
103,若所述目标部署单元已部署对应的容灾部署单元,则查询所述容灾部署单元的运行状态。103. If the target deployment unit has deployed the corresponding disaster recovery deployment unit, query the running status of the disaster recovery deployment unit.
本申请实施例中,若目标部署单元已部署对应的容灾部署单元,生产可用区查询容灾可用区中目标部署单元对应容灾部署单元的运行信息(其中运行信息包括容灾部署单元的配置信息和运行状态等),通过运行信息获取容灾部署单元的运行状态,分析运行状态判断运行状态是否正常;如果容灾部署单元的运行状态异常,则说明不能进行容灾部署单元的切换,生产可用区输出应用软件的访问切换失败的提示消息;如果容灾部署单元的运行状态正常,则说明可以进行容灾部署单元的切换,生产可用区执行将所述访问请求切换至所述容灾部署单元对应的目标网络地址操作。In the embodiment of the present application, if the target deployment unit has already deployed the corresponding disaster recovery deployment unit, the production availability zone queries the operation information of the disaster recovery deployment unit corresponding to the target deployment unit in the disaster recovery availability zone (the operation information includes the configuration of the disaster recovery deployment unit) information and running status, etc.), obtain the running status of the disaster recovery deployment unit through the running information, and analyze the running status to determine whether the running status is normal; if the running status of the disaster recovery deployment unit is abnormal, it means that the disaster recovery deployment unit cannot be switched and the production The availability zone outputs a message indicating that the access switching of the application software fails; if the running state of the disaster recovery deployment unit is normal, it means that the switching of the disaster recovery deployment unit can be performed, and the production availability zone executes the switch of the access request to the disaster recovery deployment. The target network address operation corresponding to the unit.
104,若所述容灾部署单元的运行状态正常,则将所述访问请求切换至所述容灾部署单元对应的目标网络地址。104. If the running state of the disaster recovery deployment unit is normal, switch the access request to a target network address corresponding to the disaster recovery deployment unit.
本申请实施例中,若容灾部署单元的运行状态正常,生产可用区将停止目标部署单元的运行,访问请求切换至容灾部署单元对应的目标网络地址,并将生产可用区中应用软件的数据迁移到容灾可用区,由容灾可用区中对应容灾应用提供应用服务,实现应用软件的访问切换。In the embodiment of the present application, if the running state of the disaster recovery deployment unit is normal, the production availability zone will stop the operation of the target deployment unit, switch the access request to the target network address corresponding to the disaster recovery deployment unit, and transfer the application software in the production availability zone to the target network address. Data is migrated to the disaster recovery availability zone, and the corresponding disaster recovery application in the disaster recovery availability zone provides application services to realize the access switching of application software.
在本实施例中,生产可用区停止目标部署单元的运行包括:查询目标部署单元的运行信息,根据运行信息分析目标部署单元是否处于启动状态,如果目标部署单元处于未启动状态,则查询目标部署单元的状态(其中目标部署单元的状态包括挂起、成功终止、失败终止和未知等),如果目标部署单元为成功终止,则说明目标部署单元停止状态正常,并输出停止成功的提示信息;如果目标部署单元为失败终止,则说明目标部署单元的停止状态异常,输出停止目标部署单元的运行失败的提示信息,并提示应用软件的访问切换失败;如果目标部署单元处于已启动状态,则将目标部署单元标记为“terminating(中文:终止)”,并将访问请求切换至容灾部署单元对应的目标网络地址,停止目标部署单元运行的进程,并通过查询目标部署单元的状态检查目标部署单元的停止状态是否正常。In this embodiment, stopping the operation of the target deployment unit in the production availability zone includes: querying the operation information of the target deployment unit, analyzing whether the target deployment unit is in the activated state according to the operational information, and querying the target deployment unit if the target deployment unit is in the inactive state The status of the unit (where the status of the target deployment unit includes suspended, successfully terminated, failed to terminate, and unknown, etc.), if the target deployment unit is successfully terminated, it means that the target deployment unit is in a normal stop state, and outputs a message indicating that the stop is successful; if If the target deployment unit fails to terminate, it means that the stop state of the target deployment unit is abnormal, and outputs a prompt message that the operation of the target deployment unit fails to stop, and indicates that the access switching of the application software fails; if the target deployment unit is in the started state, the target deployment unit The deployment unit is marked as "terminating", and the access request is switched to the target network address corresponding to the disaster recovery deployment unit, the running process of the target deployment unit is stopped, and the status of the target deployment unit is checked by querying the status of the target deployment unit. Whether the stop state is normal.
本实施例中,生产可用区在停止目标部署单元的的运行后,检查生产可用区中生产应用的异常原因,进行生产可用区故障修护,在检测到生产应用的运行恢复后,生产可用区将查询容灾可用区获得生产应用对应容灾应用的容灾部署单元,根据容灾部署单元查询生产可用区中对应的目标部署单元的状态是否为失败终止,如果目标部署单元的状态是失败终止,生产可用区将重启目标部署单元;如果目标部署单元的状态不是失败终止,生产可用区将根据容灾部署单元创建目标部署单元,并启动目标部署单元;在目标部署单元重启/启动后,查询目标部署单元的运行状态,如果运行状态正常,生产可用区将发送应用软件的访问切换请求到容灾可用区,接收客户端的访问请求,将访问请求切换至目标部署单元的对应的网络地址,完成应用软件的访问切换。In this embodiment, after the production availability zone stops the running of the target deployment unit, the abnormal cause of the production application in the production availability zone is checked, and the fault repair of the production availability zone is performed. Query the DR availability zone to obtain the DR deployment unit of the production application corresponding to the DR application, and query whether the status of the corresponding target deployment unit in the production availability zone is terminated according to the DR deployment unit. If the status of the target deployment unit is terminated by failure , the production availability zone will restart the target deployment unit; if the status of the target deployment unit is not terminated, the production availability zone will create the target deployment unit according to the disaster recovery deployment unit, and start the target deployment unit; after the target deployment unit is restarted/started, query The running status of the target deployment unit. If the running status is normal, the production availability zone will send the access switching request of the application software to the disaster recovery zone, receive the access request from the client, and switch the access request to the corresponding network address of the target deployment unit. Access switching of application software.
在本实施例中,生产可用区在停止目标部署单元的的运行后,查询容灾可用区获得对应容灾部署单元的运行信息,根据容灾部署单元的运行信息更新目标部署单元的运行信息,利用更新后的目标部署单元的运行信息重启/启动目标部署单元。In this embodiment, after stopping the operation of the target deployment unit, the production availability zone queries the disaster recovery availability zone to obtain the operation information of the corresponding disaster recovery deployment unit, and updates the operation information of the target deployment unit according to the operation information of the disaster recovery deployment unit. Restart/start the target deployment unit using the updated running information of the target deployment unit.
本申请实施例中,通过查询容灾部署单元的运行状态,若容灾部署单元的运行状态正常,则将访问请求切换至容灾部署单元对应的目标网络地址,实现应用软件的访问切换,从目标部署单元快速切换到容灾部署单元,简化切换操作,减少异常时间,并保障切换操作能恢复应用正常访问;并且接收访问切换请求后,通过判断目标部署单元是否已部署对应的容灾部署单元,只对已部署对应的容灾部署单元的目标部署单元提供应用软件的访问切换服务,为应用软件的访问切换提供保障。In the embodiment of the present application, by querying the running status of the disaster recovery deployment unit, if the running status of the disaster recovery deployment unit is normal, the access request is switched to the target network address corresponding to the disaster recovery deployment unit, so as to realize the access switching of the application software, from The target deployment unit is quickly switched to the disaster recovery deployment unit, which simplifies the switching operation, reduces abnormal time, and ensures that the switching operation can restore the normal access of the application; and after receiving the access switching request, it determines whether the target deployment unit has deployed the corresponding disaster recovery deployment unit , the access switching service of the application software is only provided to the target deployment unit of the corresponding disaster recovery deployment unit that has been deployed, so as to provide guarantee for the access switching of the application software.
如图3所示,图3是本申请实施例提供的应用软件的切换访问方法中容灾集群的建立的一个实施例流程示意图。As shown in FIG. 3 , FIG. 3 is a schematic flowchart of an embodiment of establishing a disaster tolerance cluster in the switching access method for application software provided by the embodiment of the present application.
在本申请一些实施例中,详细说明了应用软件的切换访问方法中容灾集群的建立方法,包括:In some embodiments of the present application, a method for establishing a disaster recovery cluster in a switching access method for application software is described in detail, including:
201,接收容灾部署请求,确定所述容灾部署请求对应的应用软件,及所述应用软件关联的部署单元集合。201. Receive a disaster recovery deployment request, and determine application software corresponding to the disaster recovery deployment request and a set of deployment units associated with the application software.
本申请实施例,生产可用区在接收客户端访问请求之前,生产可用区需要在部署的对应容灾可用区中,部署为应用软件提供运行服务的容灾部署单元,以建立容灾集群。具体地,生产可用区接收容灾可用区的容灾部署请求,根据容灾部署请求获取容灾部署请求中包含的应用软件标识,根据应用软件标识查询获得应用软件的详细信息(应用软件的详细信息包含运行应用软件需要的服务信息),根据应用软件详细信息获取为应用软件运行提供服务的多个部署单元,根据多个部署单元组成部署单元集合。In the embodiment of the present application, before the production availability zone receives a client access request, the production availability zone needs to deploy a disaster recovery deployment unit that provides running services for application software in the corresponding disaster recovery availability zone to establish a disaster recovery cluster. Specifically, the production availability zone receives the disaster recovery deployment request of the disaster recovery availability zone, obtains the application software identifier included in the disaster recovery deployment request according to the disaster recovery deployment request, and obtains the detailed information of the application software (the detailed information of the application software) according to the application software identification query. The information includes service information required for running the application software), and according to the detailed information of the application software, a plurality of deployment units that provide services for the operation of the application software are acquired, and a deployment unit set is formed according to the plurality of deployment units.
202,获取所述部署单元集合中待部署的部署单元标识,及各所述部署单元标识对应部署单元的运行信息。202: Acquire an identifier of a deployment unit to be deployed in the set of deployment units, and operation information of a deployment unit corresponding to each of the deployment unit identifiers.
本申请实施例中,生产可用区从部署单元集合中获取待部署的部署单元标识(其中部署单元标识包括部署单元的名称和IP地址(全称:Internet Protocol,中文:网际互连协议)),根据待部署的部署单元标识获得部署单元的运行信息,遍历整个部署单元集合,逐一获取部署单元集合中各部署单元标识对应部署单元的运行信息(其中运行信息包括配置信息、健康信息、镜像信息等)。In the embodiment of the present application, the production availability zone obtains the deployment unit identifier to be deployed from the deployment unit set (wherein the deployment unit identifier includes the name and IP address of the deployment unit (full name: Internet Protocol, Chinese: Internet Interconnection Protocol)), according to The deployment unit identifier to be deployed obtains the operation information of the deployment unit, traverses the entire deployment unit set, and obtains the operation information of the deployment unit corresponding to each deployment unit identifier in the deployment unit collection one by one (the operation information includes configuration information, health information, image information, etc.) .
203,根据各所述部署单元的运行信息,部署各所述部署单元的容灾部署单元,将各所述容灾部署单元对应的设备作为所述应用软件对应的容灾集群。203. Deploy a disaster recovery deployment unit of each deployment unit according to the operation information of each deployment unit, and use a device corresponding to each disaster recovery deployment unit as a disaster recovery cluster corresponding to the application software.
在逐一获取部署单元集合中各部署单元标识对应部署单元的运行信息之后,根据各部署单元的运行信息,在容灾可用区逐一部署各个部署单元对应的容灾部署单元,在部署单元集合中各部署单元对应的容灾部署单元部署完成后,生产可用区根据应用软件的详细信息,确定部署单元集合中各个待部署单元之间的关联关系,基于关联关系联立各个容灾部署单元建立容灾部署单元集合,并将容灾可用区中容灾部署单元集合对应的设备作为容灾集群,通过容灾集群为应用软件的运行提供服务。After acquiring the operation information of the deployment units corresponding to the deployment unit identifiers in the deployment unit set one by one, according to the operation information of each deployment unit, deploy the disaster recovery deployment units corresponding to each deployment unit in the disaster recovery availability zone one by one. After the deployment of the disaster recovery deployment unit corresponding to the deployment unit is completed, the production availability zone determines the association relationship between each to-be-deployed unit in the deployment unit set according to the detailed information of the application software, and establishes a disaster recovery by synchronizing each disaster recovery deployment unit based on the association relationship. A set of deployment units is used, and the devices corresponding to the set of disaster recovery deployment units in the disaster recovery availability zone are used as a disaster recovery cluster, and the operation of the application software is provided through the disaster recovery cluster.
在本申请实施例中,生产可用区在接收容灾部署请求之前,利用应用软件的详细信息获得部署单元集合,通过部署容灾单元集合对应的容灾部署单元集合获得支持应用软件运行的容灾集群,为应用软件的访问切换提供数据保障。In the embodiment of the present application, before receiving the disaster tolerance deployment request, the production availability zone obtains the set of deployment units by using the detailed information of the application software, and obtains the set of disaster tolerance units supporting the operation of the application software by deploying the set of disaster tolerance deployment units corresponding to the set of disaster tolerance units The cluster provides data protection for the access switching of application software.
如图4所示,图4是本申请实施例提供的应用软件的访问切换中部署容灾部署单元的一个实施例流程示意图。As shown in FIG. 4 , FIG. 4 is a schematic flowchart of an embodiment of deploying a disaster tolerance deployment unit in access switching of application software provided by an embodiment of the present application.
在本申请一些实施例中,详细说明了应用软件的访问切换中部署容灾部署单元的方法,包括:In some embodiments of the present application, a method for deploying a disaster tolerance deployment unit in access switching of application software is described in detail, including:
301,根据各所述部署单元的运行信息,获取各所述部署单元关联的配置信息。301. Acquire configuration information associated with each deployment unit according to the operation information of each deployment unit.
302,从各所述部署单元关联的所述配置信息中提取各所述部署单元对应的依赖项和环境变量,判断各所述部署单元对应的所述依赖项中是否包含容灾依赖项。302. Extract dependencies and environment variables corresponding to each deployment unit from the configuration information associated with each deployment unit, and determine whether the dependencies corresponding to each deployment unit include disaster tolerance dependencies.
本申请实施例中,生产可用区根据各部署单元的运行信息,获取与部署单元标识关联的配置信息(其中配置信息可以是创建部署单元时所使用的配置数据,包括配置文件和环境变量等),从配置信息中提取与部署单元标识关联的配置文件,根据配置文件确定部署单元的依赖项(其中配置文件是创建部署单元依赖项产生的数据文件,依赖项为部署单元的启动和运行提供支持,包括配置项、存储卷和服务项等),获得部署单元的依赖项后通过判断容灾可用区中是否存在配置文件来确定部署单元对应的依赖项是否包含容灾依赖项;如果容灾可用区中存在配置文件,则说明配置文件对应的依赖项存在容灾依赖项,容灾可用区中已经建立对应容灾依赖项,即部署单元对应的依赖项包含容灾依赖项;如果容灾可用区中不存在配置文件,则说明配置文件对应的依赖项不存在容灾依赖项,容灾可用区中没有建立对应容灾依赖项,即部署单元对应的依赖项不包含容灾依赖项。In this embodiment of the present application, the production availability zone acquires configuration information associated with the deployment unit identifier according to the operation information of each deployment unit (wherein the configuration information may be configuration data used when the deployment unit is created, including configuration files and environment variables, etc.) , extract the configuration file associated with the deployment unit identifier from the configuration information, and determine the dependencies of the deployment unit according to the configuration file (where the configuration file is the data file generated by creating the dependencies of the deployment unit, and the dependencies provide support for the startup and operation of the deployment unit , including configuration items, storage volumes and service items, etc.), after obtaining the dependencies of the deployment unit, determine whether the dependencies corresponding to the deployment unit include disaster tolerance dependencies by judging whether there is a configuration file in the disaster tolerance availability zone; if disaster tolerance is available If there is a configuration file in the zone, it means that the dependency corresponding to the configuration file has a DR dependency, and the corresponding DR dependency has been established in the DR availability zone, that is, the dependency corresponding to the deployment unit includes the DR dependency; if the DR is available If there is no configuration file in the zone, it means that the dependency corresponding to the configuration file does not have a DR dependency, and there is no corresponding DR dependency established in the DR availability zone, that is, the dependency corresponding to the deployment unit does not contain the DR dependency.
303,若各所述部署单元对应的所述依赖项中包含容灾依赖项,则根据各所述部署单元对应的所述容灾依赖项,创建各所述部署单元的容灾部署单元,将各所述容灾部署单元对应的设备作为所述应用软件对应的容灾集群。303. If the dependencies corresponding to each deployment unit include disaster tolerance dependencies, create a disaster tolerance deployment unit of each deployment unit according to the disaster tolerance dependencies corresponding to each deployment unit, and store the The equipment corresponding to each of the disaster recovery deployment units is used as a disaster recovery cluster corresponding to the application software.
如果部署单元对应的依赖项包含容灾依赖项,则根据容灾依赖项,并结合部署单元的运行信息通过Kubernetes容器管理平台创建容灾部署单元,在完成部署单元集合中各部署单元对应容灾部署单元的创建后,将各容灾部署单元的设备作为支持应用软件运行服务的容灾集群。If the dependencies corresponding to the deployment unit include disaster tolerance dependencies, create a disaster tolerance deployment unit through the Kubernetes container management platform according to the disaster tolerance dependencies and combined with the operation information of the deployment unit. In the completed deployment unit set, each deployment unit corresponds to the disaster tolerance After the deployment unit is created, the equipment of each disaster recovery deployment unit is used as a disaster recovery cluster that supports application software running services.
304,若各所述部署单元对应的所述依赖项中不包含容灾依赖项,则通过各所述部署单元对应的所述环境变量配置所述依赖项对应的容灾依赖项,并根据各所述容灾依赖项创建各所述部署单元的容灾部署单元,将各所述容灾部署单元对应的设备作为所述应用软件对应的容灾集群。304. If the dependencies corresponding to the deployment units do not include disaster tolerance dependencies, configure the disaster tolerance dependencies corresponding to the dependencies through the environment variables corresponding to the deployment units, and configure the disaster tolerance dependencies according to the environment variables corresponding to the deployment units. The disaster recovery dependency creates a disaster recovery deployment unit of each of the deployment units, and uses the device corresponding to each of the disaster recovery deployment units as a disaster recovery cluster corresponding to the application software.
如果部署单元对应的依赖项不包含容灾依赖项,则根据环境变量(其中环境变量包括部署单元名字、命名空间、IP地址以及容器的计算资源限制等基本信息以及部署单元运行之前创建的服务的信息)配置依赖项对应的容灾依赖项,并根据容灾依赖项创建容灾部署单元,从而获得容灾集群,具体地,包括:If the dependencies corresponding to the deployment unit do not contain disaster tolerance dependencies, based on the environment variables (where the environment variables include basic information such as the name of the deployment unit, namespace, IP address, and computing resource limits of the container, and the service created before the deployment unit runs) Information) configure the disaster recovery dependencies corresponding to the dependencies, and create a disaster recovery deployment unit according to the disaster recovery dependencies, so as to obtain a disaster recovery cluster, specifically, including:
根据配置文件将依赖项分为前置依赖项和后置依赖项,其中前置依赖项包括配置项(ConfigMap,中文:应用配置管理)和存储卷(Volume,中文:挂卷)(其中配置项用于部署应用软件运行所需要的配置信息,存储卷用于存储部署单元创建、运行过程中产生的数据)后置依赖项包括服务项(service,中文:服务,其中服务项主要用于部署单元集合的对外访问接口);According to the configuration file, the dependencies are divided into pre-dependencies and post-dependencies. The pre-dependencies include configuration items (ConfigMap, Chinese: application configuration management) and storage volumes (Volume, Chinese: hanging volumes) (where the configuration items It is used to deploy the configuration information required for the operation of the application software, and the storage volume is used to store the data generated during the creation and operation of the deployment unit. The post-dependency includes the service item (service, Chinese: service, where the service item is mainly used for the deployment unit The external access interface of the collection);
如果容灾可用区不存在部署单元对应的ConfigMap前置依赖项的数据文件,即部署单元对应的依赖项不包含容灾ConfigMap前置依赖项,则通过环境变量配置创建ConfigMap依赖项需要的配置文件,根据配置文件在容灾可用区中创建ConfigMap,并通过容灾环境变量记录容灾可用区部署ConfigMap依赖项产生的数据文件;如果容灾可用区不存在部署单元对应的Volume前置依赖项的数据文件;如果容灾可用区不存在部署单元对应的Volume前置依赖项的数据文件,即部署单元对应的依赖项不包含容灾Volume前置依赖项,则通过环境变量配置创建Volume前置依赖项需要的配置文件,根据配置文件在容灾可用区中创建Volume,在Volume前置依赖项创建完成后,将容灾环境变量存储到Volume中;If the data file of the ConfigMap pre-dependencies corresponding to the deployment unit does not exist in the DR availability zone, that is, the dependencies corresponding to the deployment unit do not contain the DR ConfigMap pre-dependencies, configure the configuration files required to create the ConfigMap dependencies through environment variables , create a ConfigMap in the DR availability zone according to the configuration file, and record the data files generated by deploying ConfigMap dependencies in the DR availability zone through the DR environment variable; Data file; if the data file of the volume pre-dependency corresponding to the deployment unit does not exist in the disaster-tolerant availability zone, that is, the dependency corresponding to the deployment unit does not contain the disaster-tolerant Volume pre-dependency, the Volume pre-dependency is created through the environment variable configuration The configuration file required by the item, create a Volume in the DR availability zone according to the configuration file, and store the DR environment variables in the Volume after the Volume pre-dependencies are created;
如果容灾可用区存在部署单元对应的前置依赖项的数据文件,则通过Kubernetes容器管理平台创建容灾部署单元,当部署单元集合中各部署单元对应的容灾部署单元创建完成后,通过环境变量和service后置依赖项,创建容灾service后置依赖项,并判断通过容灾service后置依赖项能否访问容灾部署单元,确定容灾service后置依赖项是否构建成功;如果通过容灾后置依赖项能访问容灾部署单元,则说明容灾后置依赖项创建成功;如果通过容灾后置依赖项不能访问容灾部署单元,则说明容灾后置依赖项创建失败。本实施例中,如果容灾后置依赖项创建失败,则删除已创建的容灾部署单元。If the data file of the pre-dependencies corresponding to the deployment unit exists in the DR availability zone, the DR deployment unit is created through the Kubernetes container management platform. After the DR deployment unit corresponding to each deployment unit in the deployment unit set is created, the Variables and service post-dependencies, create disaster-tolerant service post-dependencies, and determine whether the disaster-tolerant service post-dependencies can access the disaster-tolerant deployment unit, and determine whether the disaster-tolerant service post-dependencies are successfully constructed; If the post-disaster dependency can access the DR deployment unit, it means that the post-disaster dependency is created successfully; if the post-disaster dependency cannot access the DR deployment unit, it means that the post-disaster dependency creation fails. In this embodiment, if the creation of the post-disaster tolerance dependency fails, the created disaster tolerance deployment unit is deleted.
在本实施例中,可以通过YAML(中文:表达数据序列化的格式)编写配置文件或者直接使用kubectl create configmap(中文:创建应用配置管理,kubectl,中文:命令行接口,用于对Kubernetes集群运行命令)命令行的方式来创建ConfigMap;可以以共享存储的方式建立容灾Volume前置依赖项,将Volume前置依赖项中的数据同步到容灾Volume前置依赖项中,并确保容灾Volume前置依赖项与Volume前置依赖项的命名相同;可以通过expose命令(Kubernetes中的基础命令,用于将一个资源公开为一个新的Kubernetes服务)或通过YAML文件创建service创建。In this embodiment, the configuration file can be written through YAML (Chinese: format for expressing data serialization) or directly using kubectl create configmap (Chinese: create application configuration management, kubectl, Chinese: command line interface, for running the Kubernetes cluster Command) command line method to create a ConfigMap; you can create a disaster recovery Volume pre-dependency in the way of shared storage, synchronize the data in the Volume pre-dependency to the disaster-tolerant Volume pre-dependency, and ensure that the disaster recovery Volume Pre-dependencies are named the same as Volume pre-dependencies; they can be created via the expose command (a fundamental command in Kubernetes, used to expose a resource as a new Kubernetes service) or by creating a service from a YAML file.
在本实施例中,在执行根据各部署单元的运行信息,获取各部署单元关联的配置信息操作之前,生产可用区可以根据各部署单元的部署单元标识查询对应容灾可用区中是否存在相同名称的容灾部署单元,如果存在相同名称的容灾部署单元,则输出重试的提示信息,提示删除原先部署的相同名称的容灾部署单元的提示信息,再重新部署容灾部署单元;如果不存在相同名称的容灾部署单元,则执行根据各部署单元的运行信息,获取各部署单元关联的配置信息操作,完成容灾部署单元的创建。本实施例中,在根据各部署单元的运行信息创建对应容灾部署单元之前,生产可用区需要查询对应容灾可用区中是否存在同名的容灾部署单元,以保证创建的容灾部署单元是根据部署单元的运行信息来创建的,保障容灾部署单元与部署单元之间的一致性。In this embodiment, before performing the operation of obtaining the configuration information associated with each deployment unit according to the operation information of each deployment unit, the production availability zone can query whether the corresponding disaster recovery availability zone has the same name according to the deployment unit identifier of each deployment unit If there is a disaster recovery deployment unit with the same name, it will output a prompt message for retry, prompting to delete the previously deployed disaster recovery deployment unit with the same name, and then redeploy the disaster recovery deployment unit; if not If a disaster recovery deployment unit with the same name exists, the operation of obtaining the configuration information associated with each deployment unit according to the operation information of each deployment unit is performed to complete the creation of the disaster recovery deployment unit. In this embodiment, before creating a corresponding disaster recovery deployment unit according to the operation information of each deployment unit, the production availability zone needs to query whether there is a disaster recovery deployment unit with the same name in the corresponding disaster recovery availability zone, so as to ensure that the created disaster recovery deployment unit is It is created according to the operation information of the deployment unit, and ensures the consistency between the disaster recovery deployment unit and the deployment unit.
本申请实施例在根据各部署单元的运行信息,部署各部署单元的容灾部署单元,将各容灾部署单元对应的设备作为应用软件对应的容灾集群之后,生产可用区检测部署单元集合中各部署单元的运行信息,确定运行信息更新的目标部署单元,并根据目标部署单元的运行信息,更新目标部署单元对应容灾部署单元的运行信息。In this embodiment of the present application, after the disaster recovery deployment units of each deployment unit are deployed according to the operation information of each deployment unit, and the equipment corresponding to each disaster recovery deployment unit is used as the disaster recovery cluster corresponding to the application software, the production availability zone detects the set of deployment units in the production availability zone. The operation information of each deployment unit determines the target deployment unit whose operation information is updated, and updates the operation information of the disaster recovery deployment unit corresponding to the target deployment unit according to the operation information of the target deployment unit.
本申请实施例中,生产可用区根据各部署单元的运行信息,获取与部署单元标识关联的配置信息,根据配置信息创建容灾部署单元,保证部署单元与对应容灾部署单元的一致性,并在容灾集群建立完成后,根据目标容灾部署单元的运行信息更新对应容灾部署单元的运行信息,进一步确保部署单元与对应容灾部署单元的一致性。In the embodiment of the present application, the production availability zone obtains configuration information associated with the identifier of the deployment unit according to the operation information of each deployment unit, and creates a disaster recovery deployment unit according to the configuration information, so as to ensure the consistency of the deployment unit and the corresponding disaster recovery deployment unit, and After the establishment of the disaster recovery cluster is completed, the operation information of the corresponding disaster recovery deployment unit is updated according to the operation information of the target disaster recovery deployment unit, so as to further ensure the consistency of the deployment unit and the corresponding disaster recovery deployment unit.
如图5所示,图5是本申请实施例提供的应用软件的访问切换方法中确定对应的容灾部署单元是否已部署的一个实施例流程示意图。As shown in FIG. 5 , FIG. 5 is a schematic flowchart of an embodiment of determining whether a corresponding disaster tolerance deployment unit has been deployed in the access switching method for application software provided by an embodiment of the present application.
在本申请一些实施例中,具体说明了应用软件的访问切换方法中确定对应的容灾部署单元是否已部署的方法,具体地包括:In some embodiments of the present application, the method for determining whether the corresponding disaster recovery deployment unit has been deployed in the access switching method of the application software is specifically described, which specifically includes:
401,若所述初始访问地址对应的目标部署单元异常,则判断所述目标部署单元是否存在对应的容灾部署单元。401. If the target deployment unit corresponding to the initial access address is abnormal, determine whether the target deployment unit has a corresponding disaster recovery deployment unit.
在本申请实施例中,若所述初始访问地址对应的目标部署单元异常,生产可用区将根据目标部署单元的部署单元标识查询容灾可用区中是否存在相同部署单元标识的容灾部署单元,判断目标部署单元是否存在对应的容灾部署单元;如果容灾可用区中存在相同部署单元标识的容灾部署单元,做说明目标部署单元存在对应的容灾部署单元;如果容灾可用区中不存在相同部署单元标识的容灾部署单元,则说明目标部署单元不存在对应的容灾部署单元。In the embodiment of the present application, if the target deployment unit corresponding to the initial access address is abnormal, the production availability zone will query whether there is a disaster recovery deployment unit with the same deployment unit ID in the disaster recovery availability zone according to the deployment unit ID of the target deployment unit, Determine whether the target deployment unit has a corresponding disaster recovery deployment unit; if there is a disaster recovery deployment unit with the same deployment unit ID in the disaster recovery availability zone, explain that the target deployment unit has a corresponding disaster recovery deployment unit; if there is no disaster recovery deployment unit in the disaster recovery availability zone If there are DR deployment units with the same deployment unit ID, it means that there is no corresponding DR deployment unit in the target deployment unit.
402,若所述目标部署单元存在对应的容灾部署单元,则将所述目标部署单元的依赖项与所述容灾部署单元的容灾依赖项进行比对。402. If the target deployment unit has a corresponding disaster recovery deployment unit, compare the dependency of the target deployment unit with the disaster recovery dependency of the disaster recovery deployment unit.
若目标部署单元存在对应的容灾部署单元,生产可用区将根据部署单元标识获得目标部署单元的配置信息,根据配置信息获得与目标部署单元关联的依赖项;以相同方式获得容灾部署单元的容灾依赖项,将目标部署单元的依赖项与容灾部署单元的容灾依赖项进行匹配;如果目标部署单元的依赖项的配置文件与容灾部署单元的容灾依赖项的配置文件中的数据信息不相同,则说明目标部署单元的依赖项与容灾部署单元的容灾依赖项配置不一致,目标部署单元的依赖项与所述容灾部署单元的容灾依赖项不匹配;如果目标部署单元的依赖项的配置文件与容灾部署单元的容灾依赖项的配置文件中的数据信息相同,则说明目标部署单元的依赖项与容灾部署单元的容灾依赖项配置一致,目标部署单元的依赖项与所述容灾部署单元的容灾依赖项匹配。If the target deployment unit has a corresponding disaster recovery deployment unit, the production availability zone will obtain the configuration information of the target deployment unit according to the deployment unit identifier, and obtain the dependencies associated with the target deployment unit according to the configuration information; obtain the disaster recovery deployment unit in the same way. Disaster tolerance dependencies, match the dependencies of the target deployment unit with the disaster tolerance dependencies of the disaster tolerance deployment unit; if the configuration file of the dependencies of the target deployment unit and the configuration file of the disaster tolerance dependencies of the If the data information is not the same, it means that the dependency of the target deployment unit is inconsistent with the configuration of the disaster recovery dependency of the disaster recovery deployment unit, and the dependency of the target deployment unit does not match the disaster recovery dependency of the disaster recovery deployment unit; if the target deployment If the data information in the configuration file of the dependency of the unit is the same as the configuration file of the configuration file of the DR dependency of the DR deployment unit, it means that the dependency of the target deployment unit is configured in the same way as the DR dependency configuration of the DR deployment unit. The dependencies of the DR match the DR dependencies of the DR deployment unit.
403,若所述目标部署单元的依赖项与所述容灾部署单元的容灾依赖项匹配,则判定所述目标部署单元已部署对应的容灾部署单元。403. If the dependency of the target deployment unit matches the disaster recovery dependency of the disaster recovery deployment unit, determine that the target deployment unit has deployed the corresponding disaster recovery deployment unit.
如果目标部署单元的依赖项与所述容灾部署单元的容灾依赖项匹配,生产可用区则判定目标部署单元已部署对应的容灾部署单元,并执行查询容灾部署单元的运行状态操作。If the dependency of the target deployment unit matches the disaster tolerance dependency of the disaster recovery deployment unit, the production availability zone determines that the target deployment unit has deployed the corresponding disaster recovery deployment unit, and performs an operation of querying the running status of the disaster recovery deployment unit.
404,若所述目标部署单元不存在对应的容灾部署单元,或所述目标部署单元的依赖项与所述容灾部署单元的容灾依赖项不匹配,则判定所述目标部署单元未部署对应的容灾部署单元。404. If the target deployment unit does not have a corresponding disaster recovery deployment unit, or the dependency of the target deployment unit does not match the disaster recovery dependency of the disaster recovery deployment unit, determine that the target deployment unit is not deployed The corresponding disaster recovery deployment unit.
在本申请实施例中,如果目标部署单元不存在对应的容灾部署单元,或者目标部署单元的依赖项与容灾部署单元的容灾依赖项不匹配,生产可用区将判定目标部署单元未部署对应的容灾部署单元,并输出不可进行应用软件的访问切换的提示信息。In this embodiment of the present application, if the target deployment unit does not have a corresponding disaster recovery deployment unit, or the dependencies of the target deployment unit do not match the disaster recovery dependencies of the disaster recovery deployment unit, the production availability zone will determine that the target deployment unit is not deployed The corresponding disaster recovery deployment unit, and output the prompt information that the access switching of the application software cannot be performed.
本申请实施例中,生产可用区利用部署单元标识的唯一性确定目标部署单元是否存在对应的容灾部署单元,并判断目标部署单元与对应的容灾部署单元的依赖项配置是否一致,通过两轮判断确定目标部署单元是否已部署对应的容灾部署单元,为应用软件的访问切换提供数据保障。In the embodiment of the present application, the production availability zone uses the uniqueness of the deployment unit identifier to determine whether the target deployment unit has a corresponding disaster recovery deployment unit, and to determine whether the dependency configurations of the target deployment unit and the corresponding disaster recovery deployment unit are consistent. The round judgment determines whether the target deployment unit has deployed the corresponding disaster recovery deployment unit, so as to provide data guarantee for the access switching of the application software.
如图6所示,图6是本申请实施例提供的应用软件的访问切换方法中查询所述容灾部署单元的运行状态的一个实施例流程示意图。As shown in FIG. 6 , FIG. 6 is a schematic flowchart of an embodiment of querying the running state of the disaster tolerance deployment unit in the access switching method of the application software provided by the embodiment of the present application.
在本申请一些实施例中,详细说明了应用软件的访问切换方法中查询所述容灾部署单元的运行状态的方法,具体地包括:In some embodiments of the present application, the method for querying the running state of the disaster tolerance deployment unit in the access switching method of the application software is described in detail, which specifically includes:
501,若所述目标部署单元已部署对应的容灾部署单元,则查询所述目标部署单元对应容灾部署单元的状态。501. If the target deployment unit has deployed the corresponding disaster recovery deployment unit, query the status of the disaster recovery deployment unit corresponding to the target deployment unit.
本申请实施例中,如果目标部署单元已部署对应的容灾部署单元,生产可用区则查询对应容灾可用区中容灾部署单元的状态,根据容灾部署单元的状态判断对应容灾部署单元是否已启动;如果容灾部署单元的状态为挂起,则说明容灾部署单元还没有启动,判定容灾部署单元的状态为未启动;如果容灾部署单元的状态为运行中,则说明容灾部署单元已经启动,判定容灾部署单元的状态为已启动。In the embodiment of the present application, if the target deployment unit has already deployed the corresponding disaster recovery deployment unit, the production availability zone will query the status of the disaster recovery deployment unit in the corresponding disaster recovery availability zone, and determine the corresponding disaster recovery deployment unit according to the status of the disaster recovery deployment unit Whether it has been started; if the status of the disaster recovery deployment unit is suspended, it indicates that the disaster recovery deployment unit has not been started, and the status of the disaster recovery deployment unit is determined to be not started; if the status of the disaster recovery deployment unit is running, it indicates that the The disaster recovery deployment unit has been started, and the status of the disaster recovery deployment unit is determined to be started.
502,若所述容灾部署单元的状态为已启动,则根据所述容灾部署单元的运行信息查询所述容灾部署单元的运行状态。502. If the status of the disaster recovery deployment unit is activated, query the running status of the disaster recovery deployment unit according to the operation information of the disaster recovery deployment unit.
如果容灾部署单元的状态为已启动,生产可用区将获取对应容灾部署单元的运行信息,对运行信息进行健康检查,根据健康检查的结果查看容灾部署单元的运行状态,确定容灾部署单元的运行状态是否正常;如果健康检查的结果显示容灾部署单元通过健康检查,则说明容灾部署单元的运行状态正常;如果健康检查的结果显示容灾部署单元不通过健康检查或健康检查的结果未知,则说明容灾部署单元的运行状态异常。If the status of the disaster recovery deployment unit is Started, the production availability zone will obtain the operation information of the corresponding disaster recovery deployment unit, perform a health check on the operation information, and check the running status of the disaster recovery deployment unit according to the result of the health check to determine the disaster recovery deployment. Whether the running state of the unit is normal; if the result of the health check shows that the DR deployment unit passes the health check, it means that the running state of the DR deployment unit is normal; if the result of the health check shows that the DR deployment unit fails the health check or the health check If the result is unknown, it means that the running state of the disaster recovery deployment unit is abnormal.
503,若所述容灾部署单元的状态为未启动,则启动所述容灾部署单元,更新所述容灾部署单元的运行信息。503. If the status of the disaster recovery deployment unit is not started, start the disaster recovery deployment unit, and update the operation information of the disaster recovery deployment unit.
如果容灾部署单元的状态为未启动,生产可用区将发送启动容灾部署单元的请求到对应容灾可用区,以使容灾可用区启动容灾部署单元,完成容灾部署单元调度,并更新容灾部署单元的运行信息,执行根据容灾部署单元的运行信息查询容灾部署单元的运行状态操作。If the status of the DR deployment unit is not started, the production AZ will send a request to start the DR deployment unit to the corresponding DR AZ, so that the DR AZ starts the DR deployment unit, completes the DR deployment unit scheduling, and The operation information of the disaster recovery deployment unit is updated, and the operation of querying the operation status of the disaster recovery deployment unit is performed according to the operation information of the disaster recovery deployment unit.
在本申请实施例中,可以通过查询目标部署单元对应容灾部署单元是否完成调度确定容灾部署单元的状态,具体地通过查看对应容灾部署单元的相位(其中相位是对部署单元生命周期的简单宏观概述,相位的值包括挂起(Pending,中文:挂起)、运行中(Running,中文:运行中)、成功(Succeeded,中文:成功终止)、失败(Failed,中文:失败终止)和未知(Unknown,中文:未知)),根据相位的值判断对应容灾部署单元是否完成调度;如果相位的值为挂起,则说明对应容灾部署单元没有完成调度,并判定容灾部署单元的状态为未启动;如果相位的值为运行中,则说明应容灾部署单元完成调度,并判定容灾部署单元的状态为已启动。In the embodiment of the present application, the status of the disaster recovery deployment unit can be determined by querying whether the corresponding disaster recovery deployment unit of the target deployment unit has completed the scheduling, and specifically by checking the phase of the corresponding disaster recovery deployment unit (where the phase is related to the life cycle of the deployment unit) A simple macro overview, the values of the phase include Pending (Chinese: Suspended), Running (Chinese: Running), Success (Succeeded, Chinese: Successfully terminated), Failed (Failed, Chinese: Failed to terminate) and Unknown (Unknown, Chinese: Unknown), according to the value of the phase to determine whether the corresponding disaster recovery deployment unit has completed the scheduling; if the value of the phase is suspended, it means that the corresponding disaster recovery deployment unit has not completed the scheduling, and determine whether the disaster recovery deployment unit has completed the scheduling. The status is not started; if the phase value is running, it means that the disaster recovery deployment unit should complete the scheduling, and the status of the disaster recovery deployment unit is determined to be started.
在本申请实施例中可以通过容器探针对运行信息进行健康检查,获得健康状态,根据健康状态确定容灾部署单元的运行状态是否正常,具体地,可以通过容灾部署单元的IP地址和端口号进行TCP(全称:Transfer Control Protocol,中文:传输控制协议)检查;如果能够通过端口与容灾部署单元建立TCP连接,则输出健康检查通过的提示信息,说明容灾部署单元通过健康检查;如果不能建立TCP连接,则输出健康检查未通过的提示信息,说明容灾部署单元健康检查不通过;如果通过容灾部署单元的IP地址和端口号,不能查找到容灾部署单元,则输出健康检查失败的提示信息,说明容灾部署单元健康检查的结果未知。在本申请实施例中可以通过liveness probe(中文:存活性探测)和readness probe(中文:就绪性探测)容器探针对运行信息进行健康检查。In this embodiment of the present application, a container probe may be used to perform a health check on the running information to obtain a health status, and according to the health status, it may be determined whether the running status of the disaster recovery deployment unit is normal. Specifically, the IP address and port of the disaster recovery deployment unit may be used. TCP (full name: Transfer Control Protocol, Chinese: Transmission Control Protocol) check; if a TCP connection can be established with the disaster recovery deployment unit through the port, a prompt message indicating that the disaster recovery deployment unit has passed the health check will be output, indicating that the disaster recovery deployment unit has passed the health check; If the TCP connection cannot be established, a message indicating that the health check fails is output, indicating that the health check of the disaster recovery deployment unit fails; if the disaster recovery deployment unit cannot be found through the IP address and port number of the disaster recovery deployment unit, the health check is output. The message of failure indicates that the result of the health check of the disaster recovery deployment unit is unknown. In this embodiment of the present application, a liveness probe (Chinese: survivability probe) and a readness probe (Chinese: readiness probe) container probes may be used to perform health checks on the running information.
在本申请实施例中,若目标部署单元已部署对应的容灾部署单元,则利用容灾部署单元的运行信息查询容灾部署单元的运行状态,保障应用软件的访问切换到对应容灾可用区后能够正常访问应用软件。In the embodiment of the present application, if the target deployment unit has already deployed the corresponding disaster recovery deployment unit, the operation information of the disaster recovery deployment unit is used to query the running status of the disaster recovery deployment unit, so as to ensure that the access of the application software is switched to the corresponding disaster recovery availability zone After that, the application software can be accessed normally.
如图7所示,图7是本申请实施例提供的应用软件的访问切换方法中部署单元部署的一个实施例流程示意图。As shown in FIG. 7 , FIG. 7 is a schematic flowchart of an embodiment of deployment unit deployment in an access switching method for application software provided by an embodiment of the present application.
在本申请一些实施例中,详细说明了应用软件的访问切换方法中部署单元部署的方法,具体地包括:In some embodiments of the present application, the method for deploying the deployment unit in the access switching method of the application software is described in detail, which specifically includes:
601,接收应用程序部署请求,根据所述部署请求定义所述应用程序的环境变量,基于所述环境变量制作镜像。601. Receive an application deployment request, define an environment variable of the application according to the deployment request, and create an image based on the environment variable.
本申请实施例中,生产可用区接收应用程序部署请求,根据部署请求确定基础镜像、准备部署应用程序需要的安装包、配置文件和相关脚本文件,其中配置文件可将应用程序部署中需要定制的配置项量化;定义应用程序的环境变量,并将配置文件和相关脚本文件中需要修改的一个或多个配置项量化;基于环境变量、安装包、配置文件和相关脚本文件制作镜像。In the embodiment of the present application, the production availability zone receives the application deployment request, and determines the basic image, the installation package, configuration file and related script files required for preparing the deployment application according to the deployment request. Configuration item quantification; define the environment variables of the application, and quantify one or more configuration items that need to be modified in the configuration file and related script files; make images based on environment variables, installation packages, configuration files and related script files.
602,基于所述镜像制作依赖项,根据所述依赖项部署所述应用程序的部署单元。602. Create a dependency based on the image, and deploy a deployment unit of the application according to the dependency.
根据镜像中环境变量和配置文件开发仓库进行关联,根据应用程序制作支持应用程序运行服务的模板文件(其中模板文件包括前置依赖项模板文件和后置依赖项模板文件,)在Kubernetes容器管理平台上,通过环境变量基于应用程序修改模板文件中对应的配置项来制作依赖项,通过依赖项确定部署应用程序的部署单元所需要的数据文件,并通过环境变量配置数据文件完成应用程序的部署单元的部署。According to the environment variables in the image and the configuration file, the development warehouse is associated, and the template file that supports the application running service is created according to the application (the template file includes the pre-dependency template file and the post-dependency template file,) in the Kubernetes container management platform In the above, modify the corresponding configuration items in the template file based on the environment variables to make dependencies, determine the data files required for the deployment unit of the application deployment through the dependencies, and configure the data files through the environment variables to complete the deployment unit of the application. deployment.
本申请实施例中通过制作镜像和配置文件,可实现根据应用程序完成部署单元部署,并通过环境变量根据应用程序修改模板文件中对应的配置项来制作依赖项,提供高效便捷的部署单元部署。In the embodiment of the present application, by creating images and configuration files, deployment unit deployment can be completed according to the application program, and dependencies can be created by modifying corresponding configuration items in the template file according to the application program through environment variables, thereby providing efficient and convenient deployment unit deployment.
本申请实施例中还提供一种应用软件的访问切换设备,如图8所示,图8是本申请实施例提供的应用软件的访问切换设备的一个实施例结构示意图。An embodiment of the present application further provides an access switching device for application software. As shown in FIG. 8 , FIG. 8 is a schematic structural diagram of an embodiment of the access switching device for application software provided by an embodiment of the present application.
应用软件的访问切换设备运行应用软件的访问切换对应的计算机可读存储介质,以执行应用软件的访问切换的步骤,所述应用软件的访问切换设备包括:一个或多个处理器;存储器;以及一个或多个应用程序,其中所述一个或多个应用程序被存储于所述存储器中,并配置为由所述处理器执行上述应用软件的访问切换方法实施例中任一实施例中的应用软件的访问切换方法中的步骤。The access switching device of the application software runs the computer-readable storage medium corresponding to the access switching of the application software to perform the steps of the access switching of the application software, the access switching device of the application software includes: one or more processors; a memory; and One or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the processor as an application in any one of the embodiments of the access switching method for the above application software Steps in the software's access switching method.
具体来讲:应用软件的访问切换设备包括一个或者一个以上核心的处理器801、一个或一个以上计算机可读存储介质的存储器802、电源803和输入单元804等部件。本领域技术人员可以理解,图8所展示的应用软件的访问切换设备结构并不构成对应用软件的访问切换设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。其中:Specifically, the access switching device for application software includes one or
处理器801是该应用软件的访问切换设备的控制中心,利用各种接口和线路连接应用软件的访问切换设备的各个部分,通过运行或执行存储器802内的软件程序和/或模块,以调用存储在存储器802内的数据,执行应用软件的访问切换设备的各种功能和处理数据,从而对应用软件的访问切换设备进行整体监控。可选的,处理器801可包含一个或一个以上处理核心;优选的,处理器802可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等,调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到处理器801中。The
存储器802可用于存储软件程序以及模块,处理器801通过运行存储在存储器802的软件程序以及模块,从而执行各种功能应用以及数据处理。存储器802可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序(比如访问请求接收功能、容灾部署单元的运行状态查询功能、访问请求切换功能等)等;存储数据区可存储根据应用软件的访问切换设备的使用所创建的数据等。此外,存储器802可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。相应地,存储器802还可以包括存储器控制器,以提供处理器801对存储器802的访问。The
应用软件的访问切换设备还包括给各个部件供电的电源803,优选的,电源803可以通过电源管理系统与处理器801逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。电源802还可以包括一个或一个以上的直流或交流电源、再充电系统、电源故障检测电路、电源转换器或者逆变器、电源状态指示器等任意组件。The access switching device of the application software also includes a
该订应用软件的访问切换设备还可包括输入单元804,该输入单元804可用于接收输入的数字或字符信息,以及产生与用户设置以及功能控制有关的键盘、鼠标、操作杆、光学或者轨迹球信号输入。The access switching device of the subscription application software may also include an
尽管未示出,应用软件的访问切换设备还可以包括显示单元等,在此不再赘述。具体在本实施例中,应用软件的访问切换设备中的处理器801会按照如下的指令,将一个或一个以上的应用程序的进程对应的可执行文件加载到存储器802中,并由处理器801来运行存储在存储器1002中的应用程序,从而实现各种功能,如下:接收访问请求,获取所述访问请求关联的初始访问地址;若所述初始访问地址对应的目标部署单元异常,则判断所述目标部署单元是否已部署对应的容灾部署单元;若所述目标部署单元已部署对应的容灾部署单元,则查询所述容灾部署单元的运行状态;若所述容灾部署单元的运行状态正常,则将所述访问请求切换至所述容灾部署单元对应的目标网络地址。Although not shown, the access switching device of the application software may also include a display unit and the like, which will not be described herein again. Specifically in this embodiment, the
本领域普通技术人员可以理解,上述实施例中各种方法中的全部或部分步骤可以通过指令完成,或者通过指令控制相关的硬件来完成,该指令可以存储于一计算机可读存储介质中,并由处理器进行加载或执行。Those of ordinary skill in the art can understand that all or part of the steps in the various methods in the above embodiments can be completed by instructions, or by instructions that control relevant hardware, and the instructions can be stored in a computer-readable storage medium, and Loaded or executed by the processor.
为此,本发明实施例提供一种计算机可读存储介质,该计算机可读存储介质可以包括:只读存储器(ROM,全称:Read Only Memory,中文:只读存储器)、随机存取记忆体(RAM,全称:Random Access Memory,中文:随机存储器)、磁盘或光盘等。其上存储有计算机程序,所述计算机程序被处理器进行加载,以执行本发明实施例所提供的任一种应用软件的访问切换方法中的步骤。例如,所述计算机程序被处理器进行加载可以执行如下步骤:接收访问请求,获取所述访问请求关联的初始访问地址;若所述初始访问地址对应的目标部署单元异常,则判断所述目标部署单元是否已部署对应的容灾部署单元;若所述目标部署单元已部署对应的容灾部署单元,则查询所述容灾部署单元的运行状态;若所述容灾部署单元的运行状态正常,则将所述访问请求切换至所述容灾部署单元对应的目标网络地址。在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见上文针对其他实施例的详细描述,此处不再赘述。To this end, an embodiment of the present invention provides a computer-readable storage medium, where the computer-readable storage medium may include: read-only memory (ROM, full name: Read Only Memory, Chinese: read-only memory), random access memory ( RAM, full name: Random Access Memory, Chinese: random access memory), magnetic disk or CD, etc. A computer program is stored thereon, and the computer program is loaded by the processor to execute the steps in any of the application software access switching methods provided by the embodiments of the present invention. For example, when the computer program is loaded by the processor, the following steps may be performed: receiving an access request, and obtaining an initial access address associated with the access request; if the target deployment unit corresponding to the initial access address is abnormal, judging the target deployment Whether the unit has deployed the corresponding disaster recovery deployment unit; if the target deployment unit has deployed the corresponding disaster recovery deployment unit, query the running status of the disaster recovery deployment unit; if the running status of the disaster recovery deployment unit is normal, Then, the access request is switched to the target network address corresponding to the disaster recovery deployment unit. In the above-mentioned embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference may be made to the above detailed description of other embodiments, and details are not repeated here.
具体实施时,以上各个单元或结构可以作为独立的实体来实现,也可以进行任意组合,作为同一或若干个实体来实现,以上各个单元或结构的具体实施可参见前面的方法实施例,在此不再赘述。During specific implementation, the above units or structures can be implemented as independent entities, or can be arbitrarily combined to be implemented as the same or several entities. For the specific implementation of the above units or structures, reference may be made to the foregoing method embodiments. No longer.
以上对本发明实施例所提供的一种应用软件的访问切换方法、设备和计算机可读存储介质进行了详细介绍,本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想;同时,对于本领域的技术人员,依据本发明的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本发明的限制。The method, device, and computer-readable storage medium for accessing and switching application software provided by the embodiments of the present invention have been described above in detail. In this paper, specific examples are used to illustrate the principles and implementations of the present invention. The above embodiments The description is only used to help understand the method of the present invention and its core idea; at the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation and application scope. , the contents of this specification should not be construed as limiting the invention.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110040628.4A CN114764379A (en) | 2021-01-13 | 2021-01-13 | Access switching method and device for application software and computer readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110040628.4A CN114764379A (en) | 2021-01-13 | 2021-01-13 | Access switching method and device for application software and computer readable storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114764379A true CN114764379A (en) | 2022-07-19 |
Family
ID=82364274
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110040628.4A Pending CN114764379A (en) | 2021-01-13 | 2021-01-13 | Access switching method and device for application software and computer readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114764379A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115344327A (en) * | 2022-08-19 | 2022-11-15 | 中电金信软件有限公司 | Application module switching method and device, electronic equipment and readable storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107977287A (en) * | 2016-10-21 | 2018-05-01 | 中兴通讯股份有限公司 | One kind is using disaster tolerance implementation method, apparatus and system |
CN108958927A (en) * | 2018-05-31 | 2018-12-07 | 康键信息技术(深圳)有限公司 | Dispositions method, device, computer equipment and the storage medium of container application |
CN110413457A (en) * | 2019-08-01 | 2019-11-05 | 北京百度网讯科技有限公司 | Cloud service disaster recovery method and device |
CN111711542A (en) * | 2020-06-22 | 2020-09-25 | 北京思特奇信息技术股份有限公司 | Disaster recovery switching method and device based on DNS (Domain name System), electronic equipment and storage medium |
-
2021
- 2021-01-13 CN CN202110040628.4A patent/CN114764379A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107977287A (en) * | 2016-10-21 | 2018-05-01 | 中兴通讯股份有限公司 | One kind is using disaster tolerance implementation method, apparatus and system |
CN108958927A (en) * | 2018-05-31 | 2018-12-07 | 康键信息技术(深圳)有限公司 | Dispositions method, device, computer equipment and the storage medium of container application |
CN110413457A (en) * | 2019-08-01 | 2019-11-05 | 北京百度网讯科技有限公司 | Cloud service disaster recovery method and device |
CN111711542A (en) * | 2020-06-22 | 2020-09-25 | 北京思特奇信息技术股份有限公司 | Disaster recovery switching method and device based on DNS (Domain name System), electronic equipment and storage medium |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115344327A (en) * | 2022-08-19 | 2022-11-15 | 中电金信软件有限公司 | Application module switching method and device, electronic equipment and readable storage medium |
CN115344327B (en) * | 2022-08-19 | 2023-07-28 | 中电金信软件有限公司 | Application module switching method and device, electronic equipment and readable storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP4095678A1 (en) | Method and apparatus of deploying a cluster, device and storage medium | |
CN113315754B (en) | Container access firewall intelligent linkage method and device, equipment and medium | |
US10230567B2 (en) | Management of a plurality of system control networks | |
WO2018192478A1 (en) | Cloud management platform, virtual machine management method, system thereof | |
CN111897558A (en) | Container cluster management system Kubernetes upgrade method and device | |
CN112860282B (en) | Cluster plug-in upgrading method, device and server | |
CN113204353B (en) | Big data platform assembly deployment method and device | |
CN113805969A (en) | Parameter configuration acquisition method and device, storage medium and electronic equipment | |
CN117130730A (en) | Metadata management method for federal Kubernetes cluster | |
CN102055779B (en) | Method, device and system for generating HA (High Availability) group | |
WO2023185136A1 (en) | Method and apparatus for processing edge node, and medium | |
WO2023155591A1 (en) | Progress information management and control method, micro-service apparatus, electronic device, and storage medium | |
CN114764379A (en) | Access switching method and device for application software and computer readable storage medium | |
CN114567617A (en) | IP address allocation method, system, electronic device and storage medium | |
CN106850354A (en) | A kind of processing method and processing device of Single Point of Faliure | |
CN116010111B (en) | Cross-cluster resource scheduling method, system and terminal equipment | |
CN117851352A (en) | An environmental management system and method based on TiDB distributed cluster | |
CN110221868A (en) | Dispositions method, device, electronic equipment and the storage medium of host system | |
CN114116671A (en) | Database migration method, system, server and storage medium | |
CN117215717A (en) | MySQL database containerized cluster management platform and electronic equipment | |
CN113672346B (en) | A method for implementing multi-MGR service deployment based on rook | |
CN112351114B (en) | Information processing method and device and storage medium | |
CN116781692A (en) | An information update method, device, equipment and computer-readable storage medium | |
CN114428691A (en) | Application calling method and device, electronic equipment and computer-readable storage medium | |
CN111355775B (en) | CloudStack cluster sub-server state judgment method, device, equipment and storage medium |
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 |