CN107196987A - The switching method and server of a kind of pair of centring system - Google Patents
The switching method and server of a kind of pair of centring system Download PDFInfo
- Publication number
- CN107196987A CN107196987A CN201610157457.2A CN201610157457A CN107196987A CN 107196987 A CN107196987 A CN 107196987A CN 201610157457 A CN201610157457 A CN 201610157457A CN 107196987 A CN107196987 A CN 107196987A
- Authority
- CN
- China
- Prior art keywords
- application
- state
- switching
- server
- dual
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 42
- 230000008569 process Effects 0.000 claims abstract description 16
- 230000009977 dual effect Effects 0.000 claims description 5
- 238000004891 communication Methods 0.000 abstract description 5
- 238000005516 engineering process Methods 0.000 abstract description 2
- 238000010586 diagram Methods 0.000 description 8
- 238000004590 computer program Methods 0.000 description 5
- 230000006870 function Effects 0.000 description 5
- 238000012986 modification Methods 0.000 description 5
- 230000004048 modification Effects 0.000 description 5
- 230000008859 change Effects 0.000 description 2
- 230000002159 abnormal effect Effects 0.000 description 1
- 230000005856 abnormality Effects 0.000 description 1
- 238000007689 inspection Methods 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 230000001360 synchronised effect Effects 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/14—Session management
- H04L67/148—Migration or transfer of sessions
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L41/00—Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
- H04L41/06—Management of faults, events, alarms or notifications
- H04L41/0654—Management of faults, events, alarms or notifications using network fault recovery
- H04L41/0663—Performing the actions predefined by failover planning, e.g. switching to standby network elements
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
本发明涉及通信技术领域,公开了一种双中心系统的切换方法及服务器,包括:双中心切换服务器在接收到切换请求指令后,将双中心系统中各应用的状态标志位从正常状态设置为切换状态,以使各应用依据状态标志位停止处理数据;所述双中心切换服务器确定待切换的第二应用,并将与所述第二应用相连的第一应用与所述第二应用之间的连接切换为所述第一应用与所述第三应用之间的连接,所述第三应用为所述第二应用的备应用;所述双中心切换服务器在确定切换完成后,将各应用的状态标志位从切换状态设置为正常状态。本发明用以解决现有技术中系统切换过程耗时较长,数据库连接压力较大的问题。
The invention relates to the field of communication technology, and discloses a switching method and server of a dual-center system, including: after the dual-center switching server receives a switching request instruction, the status flag bits of each application in the dual-center system are set from the normal state to Switching the state, so that each application stops processing data according to the state flag; the dual-center switching server determines the second application to be switched, and connects the first application connected with the second application to the second application The connection switching between the first application and the third application is the connection between the first application and the third application, and the third application is the backup application of the second application; after the dual-center switching server determines that the switching is completed, each application The status flag bit is set from toggle state to normal state. The invention is used to solve the problems of long time-consuming system switching process and high database connection pressure in the prior art.
Description
技术领域technical field
本发明涉及通信技术领域,尤其涉及一种双中心系统的切换方法及服务器。The invention relates to the technical field of communication, in particular to a switching method and a server of a dual-center system.
背景技术Background technique
为了防止互联网服务发生中断,提高网络服务的稳定性,线上同时部署有双中心系统,包括主应用集群和备应用集群。一般情况下由主应用集群处理数据请求,当主应用出现故障时,如数据库宕机、APP(应用程序,Application)应用故障等情况,可以在双中心系统间进行切换,即将服务请求切换到备应用集群上,同时主应用集群不再处理数据请求,从而实现备应用集群提供网络服务。In order to prevent the interruption of Internet services and improve the stability of network services, a dual-center system is deployed online, including the main application cluster and the standby application cluster. Generally, the data request is processed by the main application cluster. When the main application fails, such as database downtime, APP (Application, Application) application failure, etc., it can be switched between the dual-center systems, that is, the service request is switched to the standby application. At the same time, the main application cluster no longer processes data requests, so that the standby application cluster can provide network services.
传统的双中心系统间切换,需要停止双中心系统中的各个应用,并进行相应配置修改,再重启。具体来说,如切换数据库时,为了防止前台有新的操作,切换时要禁止前端访问,关闭WEB(互联网)应用;为了保证主备数据库的数据静止,需关闭APP等所有后台应用;为了保证存储的数据一致,需关闭数据库同步应用;此外,当备数据库变更为主数据库后,还需修改APP即后台应用的数据库配置,重新发布应用,系统才可正常使用。To switch between traditional dual-center systems, it is necessary to stop each application in the dual-center system, make corresponding configuration changes, and then restart. Specifically, when switching databases, in order to prevent new operations in the foreground, front-end access should be prohibited and WEB (Internet) applications should be closed during switching; in order to ensure that the data in the primary and standby databases is still, all background applications such as APPs should be closed; in order to ensure The stored data is consistent, and the database synchronization application needs to be closed; in addition, when the standby database is changed to the primary database, the database configuration of the APP, that is, the background application, needs to be modified and the application republished, so that the system can be used normally.
上述切换方式,对于高并发的实时系统,存在一定问题。由于目前通信系统规模比较大,包含多个较大的应用系统,所以整个系统停止和启动加载过程需耗费的时间较长,应用配置数据的修改也需耗费较长时间。此外,系统启动过程中需初始化数据库连接,在应用较多的情况下,会对数据库造成较大的连接压力。The above switching method has certain problems for high-concurrency real-time systems. Since the current communication system is relatively large in scale and includes multiple large application systems, it takes a long time to stop and start the loading process of the entire system, and it also takes a long time to modify the application configuration data. In addition, the database connection needs to be initialized during the system startup process. In the case of many applications, it will cause a large connection pressure on the database.
发明内容Contents of the invention
本发明实施例提供一种双中心系统的切换方法及服务器,用以解决现有技术中系统切换过程耗时较长,数据库连接压力较大的问题。Embodiments of the present invention provide a dual-center system switching method and server to solve the problems in the prior art that the system switching process takes a long time and the database connection pressure is high.
本发明实施例提供的双中心系统的切换方法包括:The switching method of the dual-center system provided by the embodiment of the present invention includes:
双中心切换服务器在接收到切换请求指令后,将双中心系统中各应用的状态标志位从正常状态设置为切换状态,以使各应用依据状态标志位停止处理数据;After receiving the switching request instruction, the dual-center switching server sets the status flags of each application in the dual-center system from the normal state to the switching state, so that each application stops processing data according to the status flags;
所述双中心切换服务器确定待切换的第二应用,并将与所述第二应用相连的第一应用与所述第二应用之间的连接切换为所述第一应用与所述第三应用之间的连接,所述第三应用为所述第二应用的备应用;The dual-center switching server determines the second application to be switched, and switches the connection between the first application connected to the second application and the second application to the first application and the third application The connection between the third application is the backup application of the second application;
所述双中心切换服务器在确定切换完成后,将各应用的状态标志位从切换状态设置为正常状态。After determining that the switching is completed, the dual-center switching server sets the status flags of each application from the switched state to the normal state.
可选的,所述双中心系统包括依次相连的互联网WEB服务器、应用程序APP服务器和数据库服务器;Optionally, the dual-center system includes an Internet WEB server, an application program APP server and a database server connected in sequence;
所述双中心切换服务器将双中心系统中各应用的状态标志位从正常状态设置为切换状态,包括:The dual-center switching server sets the status flags of each application in the dual-center system from a normal state to a switching state, including:
所述双中心切换服务器将所述WEB服务器对应的WEB应用的状态标志位从正常状态设置为切换状态;The dual-center switching server sets the status flag of the WEB application corresponding to the WEB server from a normal state to a switching state;
第一预定时间后,所述双中心切换服务器将所述APP服务器对应的APP应用的状态标志位从正常状态设置为切换状态;After the first predetermined time, the dual-center switching server sets the status flag bit of the APP application corresponding to the APP server from the normal state to the switching state;
第二预定时间后,所述双中心切换服务器将所述数据库服务器对应的数据库同步应用的状态标志位从正常状态设置为切换状态;After the second predetermined time, the dual-center switching server sets the status flag bit of the database synchronization application corresponding to the database server from the normal state to the switching state;
所述将各应用的状态标志位从切换状态设置为正常状态,包括:Said setting the state flag bits of each application from the switching state to the normal state includes:
所述双中心切换服务器将所述数据库同步应用的状态标志位从切换状态设置为正常状态;The dual-center switching server sets the status flag of the database synchronization application from the switching state to the normal state;
第三预定时间后,所述双中心切换服务器将所述APP应用的状态标志位从切换状态设置为正常状态;After the third predetermined time, the dual-center switching server sets the status flag of the APP application from the switching state to the normal state;
第四预定时间后,所述双中心切换服务器将所述WEB应用的状态标志位从切换状态设置为正常状态。After the fourth predetermined time, the dual-center switching server sets the status flag bit of the WEB application from the switched state to the normal state.
可选的,所述第一应用为所述APP应用,所述第二应用为所述数据库同步应用,所述第一应用通过轻量目录访问协议LDAP连接所述第二应用;Optionally, the first application is the APP application, the second application is the database synchronization application, and the first application connects to the second application through the Lightweight Directory Access Protocol LDAP;
所述将与所述第二应用相连的第一应用与所述第二应用之间的连接切换为所述第一应用与所述第三应用之间的连接,包括:The switching the connection between the first application connected to the second application and the second application to the connection between the first application and the third application includes:
所述双中心切换服务器将所述第二应用由主应用状态切换为备应用状态,且将所述第三应用由备应用状态切换为主应用状态后,将所述第一应用的LDAP连接指向,由所述第二应用切换为所述第三应用。The dual-center switching server switches the second application from the main application state to the standby application state, and after switching the third application from the standby application state to the main application state, directs the LDAP connection of the first application to , switching from the second application to the third application.
可选的,所述第一应用为所述WEB应用,所述第二应用为所述APP应用,所述第一应用通过负载均衡服务器连接所述第二应用;Optionally, the first application is the WEB application, the second application is the APP application, and the first application is connected to the second application through a load balancing server;
所述将与所述第二应用相连的第一应用与所述第二应用之间的连接切换为所述第一应用与所述第三应用之间的连接,包括:The switching the connection between the first application connected to the second application and the second application to the connection between the first application and the third application includes:
所述双中心切换服务器将所述第二应用由主应用状态切换为备应用状态,且将所述第三应用由备应用状态切换为主应用状态后,将所述负载均衡服务器的连接指向,由所述第二应用切换为所述第三应用。The dual-center switching server switches the second application from the main application state to the standby application state, and after switching the third application from the standby application state to the main application state, directs the connection of the load balancing server to Switch from the second application to the third application.
一种双中心系统的切换方法,包括:A switching method for a dual-center system, comprising:
第一应用在确定双中心切换服务器将所述第一应用的状态标志位设置为切换状态后,停止处理数据;After the first application determines that the dual-center switching server sets the state flag of the first application to the switching state, stop processing data;
若待切换的应用为所述第一应用连接的第二应用,则所述第一应用与第三应用建立连接,所述第三应用为所述第二应用的备应用;If the application to be switched is a second application connected to the first application, the first application establishes a connection with a third application, and the third application is a backup application of the second application;
所述第一应用在确定所述双中心切换服务器将所述第一应用的状态标志位设置为正常状态后,开始处理数据,所述第一应用的状态标志位在所述双中心切换服务器确定切换完成后被设置为正常状态。The first application starts to process data after determining that the dual-center switching server sets the status flag of the first application to a normal state, and the status flag of the first application is determined by the dual-center switching server It is set to the normal state after the switching is completed.
可选的,第一应用在确定双中心切换服务器将所述第一应用的状态标志位设置为切换状态后,停止处理数据,包括:Optionally, after the first application determines that the dual-center switching server sets the status flag of the first application to the switching state, stop processing data, including:
所述第一应用周期性从所述双中心切换服务器获取所述状态标志位;The first application periodically obtains the status flag bit from the dual-center switching server;
所述第一应用接收到数据后,确定获取的所述状态标志位是否为切换状态;After the first application receives the data, determine whether the acquired state flag is in a switching state;
当确定获取的所述状态标志位为切换状态后,停止处理所述数据。Stop processing the data when it is determined that the acquired status flag bit is in a switching status.
可选的,所述若待切换的应用为所述第一应用连接的第二应用,则所述第一应用与第三应用建立连接,包括:Optionally, if the application to be switched is the second application connected to the first application, establishing a connection between the first application and the third application includes:
在所述第二应用由主应用状态切换为备应用状态,且所述第三应用由备应用状态切换为主应用状态后,将所述第一应用的连接指向,由所述第二应用切换为所述第三应用。After the second application is switched from the main application state to the standby application state, and the third application is switched from the standby application state to the main application state, direct the connection of the first application to be switched by the second application for the third application.
可选的,双中心系统包括依次相连的WEB服务器、APP服务器和数据库服务器;Optionally, the dual-center system includes a WEB server, an APP server and a database server connected in sequence;
所述第一应用为所述WEB服务器上的WEB应用或所述APP服务器上的APP应用;The first application is a WEB application on the WEB server or an APP application on the APP server;
所述第二应用为所述APP服务器上的APP应用或所述数据库服务器上的数据库同步应用;The second application is an APP application on the APP server or a database synchronization application on the database server;
且,当所述第一应用为所述WEB应用时,所述第二应用为所述APP应用;当所述第一应用为所述APP应用时,所述第二应用为所述数据库同步应用。And, when the first application is the WEB application, the second application is the APP application; when the first application is the APP application, the second application is the database synchronization application .
一种双中心系统的切换服务器,包括:A switching server of a dual-center system, comprising:
设置模块,用于在接收到切换请求指令后,将双中心系统中各应用的状态标志位从正常状态设置为切换状态,以使各应用依据状态标志位停止处理数据;在确定切换完成后,将各应用的状态标志位从切换状态设置为正常状态;The setting module is used to set the state flags of each application in the dual-center system from the normal state to the switching state after receiving the switching request instruction, so that each application stops processing data according to the state flags; after determining that the switching is completed, Set the state flag bit of each application from the switching state to the normal state;
连接模块,用于确定待切换的第二应用,并将与所述第二应用相连的第一应用与所述第二应用之间的连接切换为所述第一应用与所述第三应用之间的连接,所述第三应用为所述第二应用的备应用。A connection module, configured to determine the second application to be switched, and switch the connection between the first application connected to the second application and the second application to between the first application and the third application The connection between the third application is the backup application of the second application.
可选的,所述设置模块具体用于:Optionally, the setting module is specifically used for:
将所述WEB服务器对应的WEB应用的状态标志位从正常状态设置为切换状态;Setting the status flag bit of the WEB application corresponding to the WEB server from a normal state to a switching state;
第一预定时间后,将所述APP服务器对应的APP应用的状态标志位从正常状态设置为切换状态;After the first predetermined time, the status flag bit of the APP application corresponding to the APP server is set from the normal state to the switching state;
第二预定时间后,将所述数据库服务器对应的数据库同步应用的状态标志位从正常状态设置为切换状态;After the second predetermined time, the state flag bit of the database synchronization application corresponding to the database server is set to the switching state from the normal state;
将所述数据库同步应用的状态标志位从切换状态设置为正常状态;Setting the state flag bit of the database synchronization application from the switching state to the normal state;
第三预定时间后,将所述APP应用的状态标志位从切换状态设置为正常状态;After the third predetermined time, the state flag bit of the APP application is set to a normal state from the switching state;
第四预定时间后,将所述WEB应用的状态标志位从切换状态设置为正常状态。After the fourth predetermined time, set the status flag bit of the WEB application from the switched state to the normal state.
可选的,所述第一应用为所述APP应用,所述第二应用为所述数据库同步应用,所述第一应用通过LDAP连接所述第二应用;Optionally, the first application is the APP application, the second application is the database synchronization application, and the first application is connected to the second application through LDAP;
所述连接模块,具体用于:The connection module is specifically used for:
将所述第二应用由主应用状态切换为备应用状态,且将所述第三应用由备应用状态切换为主应用状态后,将所述第一应用的LDAP连接指向,由所述第二应用切换为所述第三应用。After the second application is switched from the main application state to the standby application state, and after the third application is switched from the standby application state to the main application state, the LDAP connection of the first application is pointed to by the second application The application is switched to the third application.
可选的,所述第一应用为所述WEB应用,所述第二应用为所述APP应用,所述第一应用通过负载均衡服务器连接所述第二应用;Optionally, the first application is the WEB application, the second application is the APP application, and the first application is connected to the second application through a load balancing server;
所述连接模块,具体用于:The connection module is specifically used for:
将所述第二应用由主应用状态切换为备应用状态,且将所述第三应用由备应用状态切换为主应用状态后,将所述负载均衡服务器的连接指向,由所述第二应用切换为所述第三应用。After the second application is switched from the main application state to the standby application state, and after the third application is switched from the standby application state to the main application state, the connection of the load balancing server is pointed to, and the second application Switch to the third application.
一种双中心系统的应用服务器,包括:An application server of a dual center system, comprising:
判断模块,用于在确定双中心切换服务器将所述第一应用的状态标志位设置为切换状态后,停止处理数据;在确定所述双中心切换服务器将所述第一应用的状态标志位设置为正常状态后,开始处理数据,所述第一应用的状态标志位在所述双中心切换服务器确定切换完成后被设置为正常状态;A judging module, configured to stop processing data after determining that the dual-center switching server sets the status flag of the first application to a switching state; after determining that the dual-center switching server sets the status flag of the first application After being in a normal state, start processing data, and the state flag bit of the first application is set to a normal state after the dual-center switching server determines that the switching is completed;
建立模块,用于若待切换的应用为所述第一应用连接的第二应用,则与第三应用建立连接,所述第三应用为所述第二应用的备应用。An establishing module, configured to establish a connection with a third application if the application to be switched is a second application connected to the first application, and the third application is a standby application of the second application.
可选的,所述判断模块,具体用于:Optionally, the judging module is specifically used for:
周期性从所述双中心切换服务器获取所述状态标志位;Periodically obtain the status flag bit from the dual-center switching server;
接收到数据后,确定获取的所述状态标志位是否为切换状态;After receiving the data, determine whether the acquired state flag is in a switching state;
当确定获取的所述状态标志位为切换状态后,停止处理所述数据。Stop processing the data when it is determined that the acquired status flag bit is in a switching status.
可选的,所述建立模块,具体用于:Optionally, the building module is specifically used for:
在所述第二应用由主应用状态切换为备应用状态,且所述第三应用由备应用状态切换为主应用状态后,将所述第一应用的连接指向,由所述第二应用切换为所述第三应用。After the second application is switched from the main application state to the standby application state, and the third application is switched from the standby application state to the main application state, direct the connection of the first application to be switched by the second application for the third application.
可选的,双中心系统包括依次相连的WEB服务器、APP服务器和数据库服务器;Optionally, the dual-center system includes a WEB server, an APP server and a database server connected in sequence;
所述第一应用为所述WEB服务器上的WEB应用或所述APP服务器上的APP应用;The first application is a WEB application on the WEB server or an APP application on the APP server;
所述第二应用为所述APP服务器上的APP应用或所述数据库服务器上的数据库同步应用;The second application is an APP application on the APP server or a database synchronization application on the database server;
且,当所述第一应用为所述WEB应用时,所述第二应用为所述APP应用;当所述第一应用为所述APP应用时,所述第二应用为所述数据库同步应用。And, when the first application is the WEB application, the second application is the APP application; when the first application is the APP application, the second application is the database synchronization application .
本发明实施例中,通过双中心切换服务器,引入状态标志位,为双中心系统中的各应用分配对应的状态标志位,以使各应用可依据对应的状态标志位的状态来处理数据。双中心切换服务器接收到切换请求指令,确定双中心系统需要进行切换,将各应用的状态标志为从正常状态设置为切换状态。各应用获知状态标志位被设置为切换状态,则开始停止处理数据。双中心系统中,第一应用连接第二应用,第二应用需要切换为第三应用,其中,第三应用为第二应用的备应用。双中心切换服务器确定需要切换的是第二应用,则将第一应用与第二应用的连接切换为第一应用与第三应用的连接。待第二应用切换为第三应用完成后,双中心切换服务器将各应用的状态标志位从切换状态重新设置为正常状态,则系统中的各应用可以根据正常状态的状态标志位,开始处理数据,恢复正常工作。本发明实施例中,通过读取状态标志位状态的变化,决定各应用是否正常工作,双中心系统间进行切换时,可以不关闭各相关应用,仅使各应用停止处理数据,待切换完成后继续正常工作即可,避免关闭各应用,节省了先关闭再启动加载而浪费的时间,同时由于避免了重启,则无需初始化连接,减轻了数据库的连接压力。In the embodiment of the present invention, the status flag is introduced through the dual-center switching server, and the corresponding status flag is assigned to each application in the dual-center system, so that each application can process data according to the state of the corresponding status flag. The dual-center switching server receives the switching request instruction, determines that the dual-center system needs to be switched, and sets the status flag of each application as switching from the normal state to the switching state. Each application learns that the status flag is set to the switching state, and then starts to stop processing data. In a dual-center system, the first application is connected to the second application, and the second application needs to be switched to a third application, wherein the third application is a backup application of the second application. The dual-center switching server determines that the second application needs to be switched, and switches the connection between the first application and the second application to the connection between the first application and the third application. After the second application is switched to the third application, the dual-center switching server resets the status flags of each application from the switching state to the normal state, and then each application in the system can start processing data according to the status flags in the normal state , to resume normal operation. In the embodiment of the present invention, by reading the state change of the status flag bit, it is determined whether each application is working normally. When switching between dual-center systems, it is not necessary to close each related application, but only stop each application from processing data. After the switch is completed, Just continue to work normally, avoid closing each application, save the time wasted by first closing and then starting loading, and because restarting is avoided, there is no need to initialize the connection, which reduces the connection pressure on the database.
附图说明Description of drawings
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简要介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域的普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings that need to be used in the description of the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For Those of ordinary skill in the art can also obtain other drawings based on these drawings without any creative effort.
图1为本发明实施例中一种双中心系统的切换方法的流程图;Fig. 1 is a flow chart of a switching method of a dual-center system in an embodiment of the present invention;
图2为本发明实施例中双中心系统的结构示意图;Fig. 2 is the structural representation of double center system in the embodiment of the present invention;
图3为本发明实施例中一种双中心系统的切换服务器的示意图;FIG. 3 is a schematic diagram of a switching server of a dual-center system in an embodiment of the present invention;
图4为本发明实施例中一种双中心系统的应用服务器的示意图。FIG. 4 is a schematic diagram of an application server of a dual-center system in an embodiment of the present invention.
具体实施方式detailed description
为了使本发明的目的、技术方案和优点更加清楚,下面将结合附图对本发明作进一步地详细描述,显然,所描述的实施例仅仅是本发明一部份实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施例,都属于本发明保护的范围。In order to make the object, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, rather than all embodiments . Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.
为了增加通信系统的稳定性,提高通信系统对于灾难状况的容错能力,一般会建立一套备用应用,其中包括前端WEB应用,APP等后台应用,数据库同步应用等。当某一环节如数据库出现故障时,可以将业务切换到备用数据库上,保证网络服务的稳定性。在切换之前,由于无法控制应用系统操作,必须把系统中所有应用都停止下来,避免出现失败交易,同时防止异常交易数据丢失。数据库切换完成后,重新启动所有相关的应用,应用需连接访问新的数据库,且需使得应用能够读取到新的数据库访问配置,从而能正常访问新的数据库。应用较多的情况下,停止和重新启动耗费的时间较长,且应用重新启动需重新加载配置文件以连接新的数据库,也同样会耗费较长时间。In order to increase the stability of the communication system and improve the fault tolerance of the communication system for disaster situations, a set of backup applications is generally established, including front-end WEB applications, background applications such as APP, and database synchronization applications. When a link such as the database fails, the business can be switched to the standby database to ensure the stability of network services. Before the switchover, since the operation of the application system cannot be controlled, all applications in the system must be stopped to avoid failed transactions and at the same time prevent the loss of abnormal transaction data. After the database switch is complete, restart all related applications. The application needs to connect to access the new database, and the application needs to be able to read the new database access configuration so that it can access the new database normally. In the case of many applications, it takes a long time to stop and restart, and the application restart needs to reload the configuration file to connect to the new database, which will also take a long time.
为了解决上述问题,本发明实施例提供了一种双中心系统的切换方法,该方法的流程如图1所示,方法可以包括如下步骤:In order to solve the above problems, an embodiment of the present invention provides a switching method for a dual-center system. The flow of the method is shown in FIG. 1 , and the method may include the following steps:
S101、双中心切换服务器在接收到切换请求指令后,将双中心系统中各应用的状态标志位从正常状态设置为切换状态,以使各应用依据状态标志位停止处理数据。S101. After receiving the switching request instruction, the dual-center switching server sets the status flags of each application in the dual-center system from the normal state to the switching state, so that each application stops processing data according to the status flags.
S102、所述双中心切换服务器确定待切换的第二应用,并将与所述第二应用相连的第一应用与所述第二应用之间的连接切换为所述第一应用与所述第三应用之间的连接,所述第三应用为所述第二应用的备应用;S102. The dual-center switching server determines the second application to be switched, and switches the connection between the first application connected to the second application and the second application to the first application and the second application A connection between three applications, the third application being a backup application of the second application;
S103、所述双中心切换服务器在确定切换完成后,将各应用的状态标志位从切换状态设置为正常状态。S103. After determining that the switching is completed, the dual-center switching server sets the status flags of each application from the switched state to the normal state.
本发明实施例在双中心切换系统之间增加了双中心切换服务器,用以监控整个切换过程。双中心切换服务器可以通过客户端实现与工作人员的交互,接收工作人员输入的指令,对切换方向、切换环境进行自检,并在服务器前台进行同步实时显示,使工作人员可以准确把握切换时和切换之后各应用的情况和状态,以及各切换步骤的执行情况,便于工作人员对各种状况进行及时恰当的处理。In the embodiment of the present invention, a dual-center switching server is added between the dual-center switching systems to monitor the entire switching process. The dual-center switching server can realize the interaction with the staff through the client, receive the instructions input by the staff, conduct self-inspection on the switching direction and switching environment, and perform synchronous real-time display on the front desk of the server, so that the staff can accurately grasp the switching time and The status and status of each application after switching, as well as the execution status of each switching step, facilitate the staff to deal with various situations in a timely and appropriate manner.
双中心系统包括依次相连的WEB服务器、APP服务器和数据库服务器,如图2所示。WEB服务器上设置有WEB应用,APP服务器上设置有APP应用,数据库服务器上设置有数据库同步应用。The dual-center system includes WEB server, APP server and database server connected in sequence, as shown in Figure 2. A WEB application is set on the WEB server, an APP application is set on the APP server, and a database synchronization application is set on the database server.
现有技术中,一个服务器上设置一个应用即主应用,设置备应用时,需另外设置一个服务器,如对于WEB应用,有两个WEB服务器,一个WEB服务器上设置有主WEB应用,另一个WEB服务器上设置有备WEB应用。切换APP应用或数据库时,需将两个WEB服务器均关机,切换完毕后再重启。同理,对于APP应用或数据库同步应用,也需分别设置两个服务器。In the prior art, one application is set up on one server, that is, the main application. When setting up the backup application, another server needs to be set up. For example, for WEB applications, there are two WEB servers. A standby WEB application is set on the server. When switching APP applications or databases, both WEB servers need to be shut down, and then restarted after switching. Similarly, for APP applications or database synchronization applications, two servers need to be set up respectively.
本发明实施例中,对于WEB应用和APP应用,将主备应用都设置在一个服务器上,即一个WEB服务器上设置有一个主WEB应用,一个备WEB应用;一个APP服务器上设置有一个主APP应用,一个备APP应用。切换时,只需使应用停止处理数据,切换完成后,应用开始继续处理数据,避免了关闭重启服务器,节省时间。In the embodiment of the present invention, for WEB applications and APP applications, both the main and backup applications are set on one server, that is, one main WEB application and one backup WEB application are set on one WEB server; one main APP is set on one APP server Application, a backup APP application. When switching, you only need to make the application stop processing data. After the switching is completed, the application continues to process data, avoiding shutting down and restarting the server, saving time.
所述第一应用为所述WEB服务器上的WEB应用或所述APP服务器上的APP应用;所述第二应用为所述APP服务器上的APP应用或所述数据库服务器上的数据库同步应用。The first application is a WEB application on the WEB server or an APP application on the APP server; the second application is an APP application on the APP server or a database synchronization application on the database server.
从应用侧来说,第一应用在确定双中心切换服务器将所述第一应用的状态标志位设置为切换状态后,停止处理数据;From the application side, after the first application determines that the dual-center switching server sets the status flag bit of the first application to the switching state, it stops processing data;
若待切换的应用为所述第一应用连接的第二应用,则所述第一应用与第三应用建立连接,所述第三应用为所述第二应用的备应用;If the application to be switched is a second application connected to the first application, the first application establishes a connection with a third application, and the third application is a backup application of the second application;
所述第一应用在确定所述双中心切换服务器将所述第一应用的状态标志位设置为正常状态后,开始处理数据。所述第一应用的状态标志位设置为正常状态是所述双中心切换服务器确定切换完成后设置的。The first application starts to process data after determining that the dual-center switching server sets the state flag of the first application to a normal state. The status flag of the first application is set to the normal state after the dual-center switching server determines that the switching is completed.
本发明实施例中,通过双中心切换服务器,引入状态标志位,为双中心系统中的各应用分配对应的状态标志位,以使各应用可依据对应的状态标志位的状态来处理数据。双中心切换服务器接收到切换请求指令,确定双中心系统需要进行切换,将各应用的状态标志为从正常状态设置为切换状态。各应用获知状态标志位被设置为切换状态,则开始停止处理数据。双中心系统中,第一应用连接第二应用,第二应用需要切换为第三应用,其中,第三应用为第二应用的备应用。双中心切换服务器确定需要切换的是第二应用,则将第一应用与第二应用的连接切换为第一应用与第三应用的连接。待第二应用切换为第三应用完成后,双中心切换服务器将各应用的状态标志位从切换状态重新设置为正常状态,则系统中的各应用可以根据正常状态的状态标志位,开始处理数据,恢复正常工作。本发明实施例中,通过读取状态标志位状态的变化,决定各应用是否正常工作,双中心系统间进行切换时,可以不关闭各相关应用,仅使各应用停止处理数据,待切换完成后继续正常工作即可,避免关闭各应用,节省了先关闭再启动加载而浪费的时间,同时由于避免了重启,则无需初始化连接,减轻了数据库的连接压力。In the embodiment of the present invention, the status flag is introduced through the dual-center switching server, and the corresponding status flag is assigned to each application in the dual-center system, so that each application can process data according to the state of the corresponding status flag. The dual-center switching server receives the switching request instruction, determines that the dual-center system needs to be switched, and sets the status flag of each application as switching from the normal state to the switching state. Each application learns that the status flag is set to the switching state, and then starts to stop processing data. In a dual-center system, the first application is connected to the second application, and the second application needs to be switched to a third application, wherein the third application is a backup application of the second application. The dual-center switching server determines that the second application needs to be switched, and switches the connection between the first application and the second application to the connection between the first application and the third application. After the second application is switched to the third application, the dual-center switching server resets the status flags of each application from the switching state to the normal state, and then each application in the system can start processing data according to the status flags in the normal state , to resume normal operation. In the embodiment of the present invention, by reading the state change of the status flag bit, it is determined whether each application is working normally. When switching between dual-center systems, it is not necessary to close each related application, but only stop each application from processing data. After the switch is completed, Just continue to work normally, avoid closing each application, save the time wasted by first closing and then starting loading, and because restarting is avoided, there is no need to initialize the connection, which reduces the connection pressure on the database.
双中心切换系统是通过状态标志位控制各应用的,分别提供相应于WEB层、APP层和数据库层的状态标志位,各层在双中心切换服务器的内存中缓存状态标志位。双中心切换服务器提供单独进程刷新状态标志位,以供WEB应用、APP应用和数据库同步应用实时访问。系统中各应用读取内存中缓存的状态标志位,并根据状态标志位的状态判断各应用是处于正常工作状态还是处于切换状态,以此判断各应用是否正常受理业务。这样,可减轻双中心切换服务器的工作量,避免双中心切换服务器不可用时引起整个系统异常。The dual-center switching system controls each application through the status flags, providing status flags corresponding to the WEB layer, APP layer and database layer respectively, and each layer caches the status flags in the memory of the dual-center switching server. The dual-center switching server provides a separate process refresh status flag for real-time access by WEB applications, APP applications, and database synchronization applications. Each application in the system reads the status flag bits cached in the memory, and judges whether each application is in a normal working state or in a switching state according to the state of the status flag bits, so as to judge whether each application is normally accepting business. In this way, the workload of the dual-center switching server can be reduced, and the abnormality of the entire system can be avoided when the dual-center switching server is unavailable.
每层应用在各自的服务器内存中也缓存有相应的状态标志位,各应用周期性读取双中心切换服务器中的状态标志位,并与自身服务器内存储的状态标志位的状态相对比,若两者状态相同,则不做处理;若两者状态不同,则将自身服务器内存中的状态标志位的状态做相应更改,将自身相应的状态标志位的状态设置为与双中心切换服务器中的状态标志位的状态一致。Each layer of applications also caches the corresponding status flags in their respective server memory. Each application periodically reads the status flags in the dual-center switching server and compares them with the state of the status flags stored in its own server. If If the two states are the same, then no processing is done; if the two states are different, the state of the state flag in the memory of the server is changed accordingly, and the state of the corresponding state flag is set to be the same as the state of the dual-center switching server. The state of the status flag bit is consistent.
如此,各应用即可直接根据自身存储的状态标志位判断是否正常工作。具体来说,第一应用在确定双中心切换服务器将所述第一应用的状态标志位设置为切换状态后,停止处理数据,包括:In this way, each application can directly judge whether it is working normally according to the status flag bits stored by itself. Specifically, after the first application determines that the dual-center switching server sets the state flag of the first application to the switching state, it stops processing data, including:
所述第一应用周期性从所述双中心切换服务器获取所述状态标志位,并存储在所述第一应用的内存中;The first application periodically obtains the status flag bit from the dual-center switching server, and stores it in the memory of the first application;
所述第一应用在接收到数据后,从所述第一应用的内存中读取所述状态标志位为切换状态,停止处理数据。After the first application receives the data, it reads the status flag bit from the memory of the first application to switch state, and stops processing data.
其中,第一应用周期性读取双中心切换服务器中相应的状态标志位,将状态标志位存储在内存中。第一应用接收业务数据后,从自身的内存中读取状态标志位的状态,若状态标志位为切换状态,则表明双中心切换系统需要进行切换,第一应用停止处理数据。切换完成后,双中心切换服务器会将状态标志位的状态切换回正常状态。第一应用周期性读取双中心切换服务器中相应的状态标志位,确定自身内存中存储的状态标志位的状态与双中心切换服务器中的状态标志位的状态不一致,则将自身内存中存储的状态标志位的状态也切换回正常状态。第一应用接收到业务数据后,读取第一应用内存中的状态标志位,获知已为正常状态,则第一应用开始处理业务数据。Wherein, the first application periodically reads the corresponding status flag bits in the dual-center switching server, and stores the status flag bits in the memory. After the first application receives the business data, it reads the state of the status flag from its own memory. If the status flag is in the switched state, it indicates that the dual-center switching system needs to be switched, and the first application stops processing data. After the switching is completed, the dual-center switching server will switch the state of the status flag back to the normal state. The first application periodically reads the corresponding status flag in the dual-center switching server, determines that the state of the status flag stored in the self-memory is inconsistent with the state of the status flag in the dual-center switching server, and then stores the status flag in the self-memory The state of the status flag bit is also switched back to the normal state. After the first application receives the service data, it reads the status flag in the memory of the first application and knows that it is in a normal state, then the first application starts to process the service data.
为了保证正在处理的业务正常处理完成,本发明实施例将状态标志位从正常状态设置为切换状态,是从WEB应用的状态标志位开始切换,然后切换APP应用的状态标志位,最后切换数据库同步应用的状态标志位。具体来说,步骤S101包括:In order to ensure that the normal processing of the business being processed is completed, the embodiment of the present invention sets the status flag from the normal state to the switching state, starting from the status flag of the WEB application, then switching the status flag of the APP application, and finally switching the database synchronization Application status flags. Specifically, step S101 includes:
所述双中心切换服务器将所述WEB服务器对应的WEB应用的状态标志位从正常状态设置为切换状态;The dual-center switching server sets the status flag of the WEB application corresponding to the WEB server from a normal state to a switching state;
第一预定时间后,所述双中心切换服务器将所述APP服务器对应的APP应用的状态标志位从正常状态设置为切换状态;After the first predetermined time, the dual-center switching server sets the status flag bit of the APP application corresponding to the APP server from the normal state to the switching state;
第二预定时间后,所述双中心切换服务器将所述数据库服务器对应的数据库同步应用的状态标志位从正常状态设置为切换状态。After a second predetermined time, the dual-center switching server sets the status flag of the database synchronization application corresponding to the database server from the normal state to the switched state.
需要说明的是,上述这种情况主要针对将主数据库服务器切换为备数据库服务器,数据库服务器进行切换时,WEB应用和APP应用等上层应用需要停止处理数据。It should be noted that the above situation is mainly for the switchover of the primary database server to the standby database server. When the database server is switched, upper-layer applications such as WEB applications and APP applications need to stop processing data.
首先,双中心切换服务器将WEB应用的状态标志位设置为切换状态,WEB应用读取后,停止处理接收到的数据。由于WEB应用可与前端用户直接交互,则WEB应用确定状态标志位处于切换状态时,可向前端访问的用户展示友好提醒界面,解释当前系统不能访问的原因。First, the dual-center switching server sets the status flag bit of the WEB application to the switching state, and after the WEB application reads it, it stops processing the received data. Since the WEB application can directly interact with the front-end users, when the WEB application determines that the status flag is in the switching state, it can display a friendly reminder interface to the front-end access users to explain why the current system cannot be accessed.
双中心切换服务器将WEB应用的状态标志位设置为切换状态之后第一预定时间后,将APP应用的状态标志位设置为切换状态。APP应用确定相应的状态标志位为切换状态,则不再访问后端数据库,并向前端应用反馈当前系统正在进行切换。The dual-center switching server sets the status flag of the WEB application to the switching state after a first predetermined time, and then sets the status flag of the APP application to the switching state. The APP application determines that the corresponding status flag is in the switching state, and then no longer accesses the back-end database, and feeds back to the front-end application that the current system is switching.
第二预定时间后,双中心切换服务器将数据库同步应用的状态标志位设置为切换状态。数据库同步软件读取状态标志位为切换状态,在确定一段时间内没有新增加的需归档日志文件后,则开始进行切换。After the second predetermined time, the dual-center switching server sets the status flag bit of the database synchronization application to the switching state. The database synchronization software reads the status flag as the switching state, and starts switching after it is determined that there is no newly added log file to be archived within a period of time.
较佳地,所述若待切换的应用为所述第一应用连接的第二应用,则所述第一应用与第三应用建立连接,包括:Preferably, if the application to be switched is the second application connected to the first application, establishing a connection between the first application and the third application includes:
在所述第二应用由主应用状态切换为备应用状态,且所述第三应用由备应用状态切换为主应用状态后,所述第一应用的连接指向由指向所述第二应用切换为指向所述第三应用从而实现所述第一应用与第三应用建立连接。After the second application is switched from the main application state to the standby application state, and the third application is switched from the standby application state to the main application state, the connection point of the first application is switched from pointing to the second application to pointing to the third application so as to establish a connection between the first application and the third application.
对于数据库服务器切换而言,具体为,主数据库服务器上的数据库同步应用停止,并将主数据库服务器上的数据库同步应用由主状态切换到从属状态。然后将备数据库服务器上的数据库同步应用停止,并将备数据库服务器上的数据库同步应用由从属状态切换为主状态。For database server switching, specifically, the database synchronization application on the master database server is stopped, and the database synchronization application on the master database server is switched from a master state to a slave state. Then stop the database synchronization application on the standby database server, and switch the database synchronization application on the standby database server from the slave state to the master state.
数据库服务器切换后,需将APP应用的指向进行相应改变。切换前,APP应用指向主数据库服务器,切换后,APP应用需指向备数据库服务器。本发明实施例中,APP应用通过LDAP连接所述数据库同步应用,则步骤S102包括:所述双中心切换服务器将所述第二应用由主应用状态切换为备应用状态,且所述第三应用由备应用状态切换为主应用状态后,将所述第一应用的LDAP(轻量目录访问协议,Lightweight Directory Access Protocol)连接指向由指向所述第二应用切换为指向所述第三应用;其中,所述第一应用为所述APP应用,所述第二应用为数据库同步应用。After the database server is switched, the orientation of the APP needs to be changed accordingly. Before the switchover, the APP application points to the primary database server. After the switchover, the APP application needs to point to the standby database server. In the embodiment of the present invention, the APP application connects to the database synchronization application through LDAP, then step S102 includes: the dual-center switching server switches the second application from the main application state to the standby application state, and the third application After switching from the standby application state to the main application state, the LDAP (Lightweight Directory Access Protocol, Lightweight Directory Access Protocol) connection point of the first application is switched from pointing to the second application to pointing to the third application; wherein , the first application is the APP application, and the second application is a database synchronization application.
切换完成后,双中心切换服务器将各应用的状态标志位从切换状态设置为正常状态,且设置的顺序从数据库同步应用的状态标志位开始,然后设置APP应用的状态标志位,最后设置WEB应用的状态标志位。即,步骤S103包括:所述双中心切换服务器将所述数据库同步应用的状态标志位从切换状态设置为正常状态;After the switching is completed, the dual-center switching server sets the status flags of each application from the switching state to the normal state, and the order of setting starts from the status flags of the database synchronization application, then sets the status flags of the APP application, and finally sets the WEB application status flags. That is, step S103 includes: the dual-center switching server sets the status flag of the database synchronization application from the switched state to the normal state;
第三预定时间后,所述双中心切换服务器将所述APP应用的状态标志位从切换状态设置为正常状态;After the third predetermined time, the dual-center switching server sets the status flag of the APP application from the switching state to the normal state;
第四预定时间后,所述双中心切换服务器将所述WEB应用的状态标志位从切换状态设置为正常状态。After the fourth predetermined time, the dual-center switching server sets the status flag bit of the WEB application from the switched state to the normal state.
本发明实施例中,所述第一应用为所述WEB服务器上的WEB应用或所述APP服务器上的APP应用;所述第二应用为所述APP服务器上的APP应用或所述数据库服务器上的数据库同步应用。In the embodiment of the present invention, the first application is a WEB application on the WEB server or an APP application on the APP server; the second application is an APP application on the APP server or an APP application on the database server database synchronization application.
上述主要描述了数据库服务器的切换,其中第一应用为APP服务器上的APP应用,第二应用为数据库服务器上的数据库同步应用。对于双中心系统而言,APP应用也可进行切换。此时,第一应用为WEB应用,第二应用为APP应用,具体的切换方式与数据库服务器的切换相似,双中心切换服务器将WEB应用和APP应用的状态标志位依次设置为切换状态,待APP应用切换完成,再将APP应用的状态标志位设置为正常状态,然后将WEB应用的状态标志位设置为正常状态。不同的是,APP应用切换时,数据库同步应用无需停止处理数据,因此,数据库同步应用的状态标志位可一直保持正常状态。The foregoing mainly describes the switching of the database server, wherein the first application is an APP application on the APP server, and the second application is a database synchronization application on the database server. For the dual-center system, the APP application can also be switched. At this time, the first application is a WEB application, and the second application is an APP application. The specific switching method is similar to the switching of the database server. After the application switching is completed, the status flag bit of the APP application is set to the normal state, and then the status flag bit of the WEB application is set to the normal state. The difference is that when the APP application is switched, the database synchronization application does not need to stop processing data, therefore, the status flag of the database synchronization application can always maintain a normal state.
APP应用切换时,WEB应用的指向也需进行改变。WEB应用通过负载均衡服务器连接所述APP应用。此时,步骤S102包括:所述双中心切换服务器将所述第二应用由主应用状态切换为备应用状态,且所述第三应用由备应用状态切换为主应用状态后,将所述负载均衡服务器的连接指向由指向所述第二应用切换为指向所述第三应用。切换前,WEB通过负载均衡服务器连接主APP应用,切换后,WEB通过负载均衡服务器连接备APP应用。When the APP application is switched, the orientation of the WEB application also needs to be changed. The WEB application is connected to the APP application through the load balancing server. At this time, step S102 includes: the dual-center switching server switches the second application from the main application state to the standby application state, and after the third application switches from the standby application state to the main application state, the load The connection point of the balancing server is switched from pointing to the second application to pointing to the third application. Before the switchover, the WEB connects to the main APP application through the load balancing server. After the switchover, the WEB connects to the standby APP application through the load balancing server.
为了更清楚地理解本发明,下面以具体的实施例对上述流程进行详细描述。In order to understand the present invention more clearly, the above process will be described in detail below with specific examples.
本发明的一种实施例中,原本由双中心系统中的主数据库服务器进行工作,现需切换为备数据库服务器进行工作。实施例具体步骤包括:In one embodiment of the present invention, the primary database server in the dual-center system originally performs work, but now needs to be switched to the standby database server to perform work. The specific steps of the embodiment include:
第一步、双中心切换服务器接收工作人员发出的切换请求指令。In the first step, the dual-center switching server receives the switching request instruction sent by the staff.
第二步、双中心切换服务器将WEB应用的状态标志位从正常状态设置为切换状态。In the second step, the dual-center switching server sets the status flag bit of the WEB application from the normal state to the switching state.
第三步、WEB应用从双中心切换服务器中周期性读取状态标志位的状态信息,并存储在WEB服务器的内存中。In the third step, the WEB application periodically reads the status information of the status flag bit from the dual-center switching server, and stores it in the memory of the WEB server.
第四步、WEB应用接收到业务数据后,读取内存中的状态标志位的状态信息,确定为切换状态,停止处理接收到的业务数据,并告知用户系统暂时停止处理的原因。Step 4: After the WEB application receives the service data, it reads the status information of the status flag in the memory, determines that it is in the switching state, stops processing the received service data, and informs the user of the reason why the system temporarily stops processing.
第五步、在第二步完成的3秒之后,双中心切换服务器将APP应用的状态标志位从正常状态设置为切换状态。In the fifth step, 3 seconds after the completion of the second step, the dual-center switching server sets the status flag of the APP application from the normal state to the switching state.
第六步、APP应用从双中心切换服务器中周期性读取状态标志位的状态信息,并存储在APP服务器的内存中。In the sixth step, the APP application periodically reads the status information of the status flag bit from the dual-center switching server, and stores it in the memory of the APP server.
第七步、APP应用接收到业务数据后,读取内存中的状态标志位的状态信息,确定为切换状态,停止处理接收到的业务数据。Step 7: After the APP application receives the business data, it reads the status information of the status flag bit in the memory, determines the switching status, and stops processing the received business data.
第八步、在第五步完成的3秒之后,双中心切换服务器将数据库服务器的状态标志位从正常状态设置为切换状态。In the eighth step, 3 seconds after the completion of the fifth step, the dual-center switching server sets the status flag of the database server from the normal state to the switching state.
第九步、数据库同步应用从双中心切换服务器中周期性读取状态标志位的状态信息,并存储在数据库同步应用的内存中。Step 9: The database synchronization application periodically reads the status information of the status flag from the dual-center switching server, and stores it in the memory of the database synchronization application.
第十步、主数据库服务器切换为备数据库服务器,备数据库服务器切换为主数据库服务器。In the tenth step, the primary database server is switched to the standby database server, and the standby database server is switched to the primary database server.
第十一步、双中心切换服务器将LDAP中数据库连接指向由指向主数据库改为指向备数据库。In the eleventh step, the dual-center switching server changes the database connection point in LDAP from pointing to the primary database to pointing to the standby database.
第十二步、双中心切换服务器将APP应用的状态标志位从切换状态设置为正常状态。In the twelfth step, the dual-center switching server sets the status flag of the APP application from the switching state to the normal state.
第十三步、APP应用读取到状态标志位为正常状态后,正常向外部提供相应功能。Step 13: After the APP application reads that the status flag is in a normal state, it normally provides corresponding functions to the outside.
第十四步、双中心切换服务器将WEB应用的状态标志位从切换状态设置为正常状态。In the fourteenth step, the dual-center switching server sets the status flag bit of the WEB application from the switching state to the normal state.
第十五步、WEB应用读取到状态标志位为正常状态后,正常向外部提供相应功能。Step 15: After the WEB application reads that the status flag is in a normal state, it normally provides corresponding functions to the outside.
基于相同的技术构思,本发明实施例还提供双中心系统的切换服务器,如图3所示,包括:Based on the same technical concept, the embodiment of the present invention also provides a switching server of a dual-center system, as shown in Figure 3, including:
设置模块1,用于在接收到切换请求指令后,将双中心系统中各应用的状态标志位从正常状态设置为切换状态,以使各应用依据状态标志位停止处理数据;在确定切换完成后,将各应用的状态标志位从切换状态设置为正常状态;Setting module 1 is used to set the status flags of each application in the dual-center system from the normal state to the switching state after receiving the switching request instruction, so that each application stops processing data according to the status flags; after determining that the switching is completed , set the status flag bit of each application from the switching state to the normal state;
连接模块2,用于确定待切换的第二应用,并将第一应用与所述第二应用的连接切换为所述第一应用与所述第三应用的连接,所述第三应用为所述第二应用的备应用。The connection module 2 is configured to determine the second application to be switched, and switch the connection between the first application and the second application to the connection between the first application and the third application, and the third application is the connection between the first application and the second application. The backup application for the second application.
可选的,设置模块1具体用于:Optionally, the setting module 1 is specifically used for:
将所述WEB服务器对应的WEB应用的状态标志位从正常状态设置为切换状态;Setting the status flag bit of the WEB application corresponding to the WEB server from a normal state to a switching state;
第一预定时间后,将所述APP服务器对应的APP应用的状态标志位从正常状态设置为切换状态;After the first predetermined time, the status flag bit of the APP application corresponding to the APP server is set from the normal state to the switching state;
第二预定时间后,将所述数据库服务器对应的数据库同步应用的状态标志位从正常状态设置为切换状态;After the second predetermined time, the state flag bit of the database synchronization application corresponding to the database server is set to the switching state from the normal state;
将所述数据库同步应用的状态标志位从切换状态设置为正常状态;Setting the state flag bit of the database synchronization application from the switching state to the normal state;
第三预定时间后,将所述APP应用的状态标志位从切换状态设置为正常状态;After the third predetermined time, the state flag bit of the APP application is set to a normal state from the switching state;
第四预定时间后,将所述WEB应用的状态标志位从切换状态设置为正常状态。After the fourth predetermined time, set the status flag bit of the WEB application from the switched state to the normal state.
可选的,所述第一应用为APP服务器中的APP应用,所述第二应用为数据库同步应用,所述第一应用通过LDAP连接所述第二应用;Optionally, the first application is an APP application in an APP server, the second application is a database synchronization application, and the first application connects to the second application through LDAP;
连接模块2,具体用于:Connection module 2, specifically for:
将所述第二应用由主应用状态切换为备应用状态,且所述第三应用由备应用状态切换为主应用状态后,将所述第一应用的LDAP连接指向,由所述第二应用切换为所述第三应用。After the second application is switched from the main application state to the standby application state, and the third application is switched from the standby application state to the main application state, the LDAP connection of the first application is pointed to, and the second application Switch to the third application.
可选的,所述第一应用为所述WEB服务器中的WEB应用,所述第二应用为所述APP服务器中的APP应用,所述WEB应用通过负载均衡服务器连接所述第二应用;Optionally, the first application is a WEB application in the WEB server, the second application is an APP application in the APP server, and the WEB application is connected to the second application through a load balancing server;
连接模块2,具体用于:Connection module 2, specifically for:
将所述第二应用由主应用状态切换为备应用状态,且所述第三应用由备应用状态切换为主应用状态后,将所述负载均衡服务器的连接指向,由所述第二应用切换为所述第三应用。After the second application is switched from the main application state to the standby application state, and the third application is switched from the standby application state to the main application state, the connection of the load balancing server is directed to be switched by the second application for the third application.
一种双中心系统的应用服务器,如图4所示,包括:An application server of a dual-center system, as shown in Figure 4, includes:
判断模块3,用于在确定双中心切换服务器将所述第一应用的状态标志位设置为切换状态后,停止处理数据;在确定所述双中心切换服务器将所述第一应用的状态标志位设置为正常状态后,开始处理数据,所述第一应用的状态标志位在所述双中心切换服务器确定切换完成后被设置为正常状态;The judging module 3 is used to stop processing data after determining that the dual-center switching server sets the status flag of the first application to the switching state; after determining that the dual-center switching server sets the status flag of the first application After being set to a normal state, start processing data, and the state flag bit of the first application is set to a normal state after the dual-center switching server determines that the switching is completed;
建立模块4,用于若待切换的应用为所述第一应用连接的第二应用,则与第三应用建立连接,所述第三应用为所述第二应用的备应用。The establishment module 4 is configured to establish a connection with a third application if the application to be switched is a second application connected to the first application, and the third application is a standby application of the second application.
可选的,判断模块3,具体用于:Optionally, the judging module 3 is specifically used for:
周期性从所述双中心切换服务器获取所述状态标志位;Periodically obtain the status flag bit from the dual-center switching server;
接收到数据后,确定获取的所述状态标志位是否为切换状态;After receiving the data, determine whether the acquired state flag is in a switching state;
当确定获取的所述状态标志位为切换状态后,停止处理所述数据。Stop processing the data when it is determined that the acquired status flag bit is in a switching status.
可选的,建立模块4,具体用于:Optionally, build module 4, specifically for:
在所述第二应用由主应用状态切换为备应用状态,且所述第三应用由备应用状态切换为主应用状态后,将所述第一应用的连接指向,由所述第二应用切换为所述第三应用,从而实现所述第一应用与第三应用建立连接。After the second application is switched from the main application state to the standby application state, and the third application is switched from the standby application state to the main application state, direct the connection of the first application to be switched by the second application For the third application, establishing a connection between the first application and the third application is realized.
双中心系统包括依次相连的WEB服务器、APP服务器和数据库服务器;所述第一应用为所述WEB服务器上的WEB应用或所述APP服务器上的APP应用;所述第二应用为所述APP服务器上的APP应用或所述数据库服务器上的数据库同步应用;且所述第一应用为所述WEB应用时,所述第二应用为所述APP应用;所述第一应用为所述APP应用时,所述第二应用为所述数据库同步应用。The dual-center system includes a WEB server, an APP server and a database server connected in sequence; the first application is a WEB application on the WEB server or an APP application on the APP server; the second application is the APP server The APP application on the database server or the database synchronization application on the database server; and when the first application is the WEB application, the second application is the APP application; when the first application is the APP application , the second application is the database synchronization application.
本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It should be understood that each procedure and/or block in the flowchart and/or block diagram, and a combination of procedures and/or blocks in the flowchart and/or block diagram can be realized by computer program instructions. These computer program instructions may be provided to a general purpose computer, special purpose computer, embedded processor, or processor of other programmable data processing equipment to produce a machine such that the instructions executed by the processor of the computer or other programmable data processing equipment produce a An apparatus for realizing the functions specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to operate in a specific manner, such that the instructions stored in the computer-readable memory produce an article of manufacture comprising instruction means, the instructions The device realizes the function specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded onto a computer or other programmable data processing device, causing a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process, thereby The instructions provide steps for implementing the functions specified in the flow chart or blocks of the flowchart and/or the block or blocks of the block diagrams.
尽管已描述了本发明的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例作出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本发明范围的所有变更和修改。While preferred embodiments of the invention have been described, additional changes and modifications to these embodiments can be made by those skilled in the art once the basic inventive concept is appreciated. Therefore, it is intended that the appended claims be construed to cover the preferred embodiment as well as all changes and modifications which fall within the scope of the invention.
显然,本领域的技术人员可以对本发明进行各种改动和变型而不脱离本发明的精神和范围。这样,倘若本发明的这些修改和变型属于本发明权利要求及其等同技术的范围之内,则本发明也意图包含这些改动和变型在内。Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalent technologies, the present invention also intends to include these modifications and variations.
Claims (16)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610157457.2A CN107196987A (en) | 2016-03-15 | 2016-03-15 | The switching method and server of a kind of pair of centring system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610157457.2A CN107196987A (en) | 2016-03-15 | 2016-03-15 | The switching method and server of a kind of pair of centring system |
Publications (1)
Publication Number | Publication Date |
---|---|
CN107196987A true CN107196987A (en) | 2017-09-22 |
Family
ID=59871144
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610157457.2A Pending CN107196987A (en) | 2016-03-15 | 2016-03-15 | The switching method and server of a kind of pair of centring system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107196987A (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108647113A (en) * | 2018-03-30 | 2018-10-12 | 阿里巴巴集团控股有限公司 | A kind of Disaster Recovery Method and server |
CN109885344A (en) * | 2019-02-27 | 2019-06-14 | 四川航空股份有限公司 | Operating system switching method and device |
CN110166524A (en) * | 2019-04-12 | 2019-08-23 | 陆金所(上海)科技服务有限公司 | Switching method, device, equipment and the storage medium of data center |
CN111723066A (en) * | 2020-05-08 | 2020-09-29 | 武汉达梦数据库有限公司 | Database switching method and database switching system based on log analysis synchronization |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101094310A (en) * | 2006-06-23 | 2007-12-26 | 华为技术有限公司 | Method, application, and device for changing application states in multiple current services |
CN101136900A (en) * | 2006-10-16 | 2008-03-05 | 中兴通讯股份有限公司 | Fast transparent fault shift device and implementing method facing to service |
US20100011126A1 (en) * | 2000-09-26 | 2010-01-14 | Foundry Networks, Inc. | Global server load balancing |
CN103647849A (en) * | 2013-12-24 | 2014-03-19 | 华为技术有限公司 | Method and device for migrating businesses and disaster recovery system |
CN204272157U (en) * | 2014-12-29 | 2015-04-15 | 同方威视技术股份有限公司 | switch system |
-
2016
- 2016-03-15 CN CN201610157457.2A patent/CN107196987A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20100011126A1 (en) * | 2000-09-26 | 2010-01-14 | Foundry Networks, Inc. | Global server load balancing |
CN101094310A (en) * | 2006-06-23 | 2007-12-26 | 华为技术有限公司 | Method, application, and device for changing application states in multiple current services |
CN101136900A (en) * | 2006-10-16 | 2008-03-05 | 中兴通讯股份有限公司 | Fast transparent fault shift device and implementing method facing to service |
CN103647849A (en) * | 2013-12-24 | 2014-03-19 | 华为技术有限公司 | Method and device for migrating businesses and disaster recovery system |
CN204272157U (en) * | 2014-12-29 | 2015-04-15 | 同方威视技术股份有限公司 | switch system |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108647113A (en) * | 2018-03-30 | 2018-10-12 | 阿里巴巴集团控股有限公司 | A kind of Disaster Recovery Method and server |
CN109885344A (en) * | 2019-02-27 | 2019-06-14 | 四川航空股份有限公司 | Operating system switching method and device |
CN110166524A (en) * | 2019-04-12 | 2019-08-23 | 陆金所(上海)科技服务有限公司 | Switching method, device, equipment and the storage medium of data center |
CN111723066A (en) * | 2020-05-08 | 2020-09-29 | 武汉达梦数据库有限公司 | Database switching method and database switching system based on log analysis synchronization |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10983880B2 (en) | Role designation in a high availability node | |
CN110224871B (en) | High-availability method and device for Redis cluster | |
US9992058B2 (en) | Redundant storage solution | |
US9954725B2 (en) | Redundant storage solution | |
US9582532B2 (en) | Management and synchronization of batch workloads with active/active sites OLTP workloads | |
CN109951331A (en) | Method, apparatus and computing cluster for sending information | |
CN110874261B (en) | Availability system, method, and storage medium storing program | |
US10430217B2 (en) | High availability using dynamic quorum-based arbitration | |
CN107196987A (en) | The switching method and server of a kind of pair of centring system | |
CN111858161A (en) | Disaster recovery method, apparatus, device and computer-readable storage medium for cloud host | |
CN103188098B (en) | A kind of disaster tolerance switching method, system and device | |
CN104010034A (en) | Management method for group dependence of high-availability cluster | |
CN104980307A (en) | Processing method of data access requests, processing device of data access requests and database server | |
US7475280B1 (en) | Active-active server for high availability of data replication management application | |
CN113467873A (en) | Virtual machine scheduling method and device, electronic equipment and storage medium | |
US12153949B2 (en) | Provisioning and managing data orchestration platforms in a cloud computing environment | |
JP2017536624A (en) | Snapshot processing methods and associated devices | |
CN103412780A (en) | System, device and method for upgrading distributed file system | |
CN118673078A (en) | A method for synchronizing a logical replication slot and a related device | |
CN109964218B (en) | Service processing method and system | |
CN101739406A (en) | Method for synchronizing file service operation on double controllers | |
CN104965752A (en) | Private cloud platform for power quality monitoring system and dynamic migration disaster recovery method | |
CN107590032A (en) | The method and storage cluster system of storage cluster failure transfer | |
CN103152405B (en) | Application method of high availability cluster for storage pool resource | |
CN115665146A (en) | Middleware control method, device, storage medium and equipment |
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 | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20170922 |