CN112835988A - Integrated switching method and switching device for application programs and databases - Google Patents
Integrated switching method and switching device for application programs and databases Download PDFInfo
- Publication number
- CN112835988A CN112835988A CN202110346652.0A CN202110346652A CN112835988A CN 112835988 A CN112835988 A CN 112835988A CN 202110346652 A CN202110346652 A CN 202110346652A CN 112835988 A CN112835988 A CN 112835988A
- Authority
- CN
- China
- Prior art keywords
- server
- application program
- application
- closing
- sequence
- 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 58
- 230000002159 abnormal effect Effects 0.000 claims abstract description 13
- 238000011144 upstream manufacturing Methods 0.000 claims description 119
- 238000013515 script Methods 0.000 claims description 43
- 238000004590 computer program Methods 0.000 claims description 12
- 238000012545 processing Methods 0.000 claims description 9
- 238000004891 communication Methods 0.000 claims description 5
- 238000005516 engineering process Methods 0.000 abstract description 4
- 230000008569 process Effects 0.000 description 20
- 238000010586 diagram Methods 0.000 description 4
- 230000006870 function Effects 0.000 description 3
- 230000005856 abnormality Effects 0.000 description 2
- 238000012423 maintenance Methods 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000003213 activating effect Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
- 230000010076 replication Effects 0.000 description 1
- 238000012163 sequencing technique Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/21—Design, administration or maintenance of databases
-
- 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/14—Error detection or correction of the data by redundancy in operation
- G06F11/1402—Saving, restoring, recovering or retrying
- G06F11/1446—Point-in-time backing up or restoration of persistent data
- G06F11/1458—Management of the backup or restore process
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/27—Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Computing Systems (AREA)
- Quality & Reliability (AREA)
- Hardware Redundancy (AREA)
Abstract
The invention provides an integrated switching method and a switching device for an application program and a database, and relates to the field of computers and the field of finance. The switching method comprises the following steps: when the main database server is abnormal, determining the closing sequence and the starting sequence of each application program server which takes the main database server as a data source in a business system; switching the data source of each application program server from the main database server to the standby database server; closing each application program server according to the closing sequence; starting a standby database server of the business system; and starting the application program servers according to the starting sequence. The invention arranges and dispatches the switching steps of the application program and the database, and the machine room attendant does not need to know the professional technology of the application or the database switching, and can complete the integrated switching of the application and the database only by starting the emergency scheme in the dispatching system when the switching is judged to be needed, thereby greatly improving the switching efficiency.
Description
Technical Field
The invention relates to the field of computers and finance, in particular to an integrated switching method and a switching device for application programs and databases.
Background
In a large financial enterprise, a typical business system generally consists of multiple application groups and a set of active and standby database servers. When a main database server of a business system has software or hardware faults, a standby database server needs to be started to serve externally, and meanwhile, a plurality of application programs need to correspondingly modify data source directions to the standby database server and close the data source directions one by one; when the database server is started, the plurality of application program servers are restarted one by one. For an upstream application program and a downstream application program sharing the same database in the same service system, the upstream application program needs to be closed before the database server is switched, and then the downstream application program needs to be closed, so that abnormal transactions are avoided in the closing process of the service system; after the database server is switched, the downstream application program needs to be started first, and then the upstream application program needs to be started. The whole database server switching process is complex and consumes long time, so that the service system stops external service for a long time. Meanwhile, the existing switching process has strict requirements on the start-stop sequence of the application server, and usually requires intervention processing by application operation and maintenance personnel and a database manager, which consumes a large amount of labor and time cost.
Disclosure of Invention
The invention provides an integrated switching method of an application program and a database, and relates to the field of computers and the field of finance. The switching method comprises the following steps:
when the main database server is abnormal, determining the closing sequence and the starting sequence of each application program server which takes the main database server as a data source in a business system;
switching the data source of each application program server from the main database server to the standby database server;
closing each application program server according to the closing sequence;
starting a standby database server of the business system;
and starting the application program servers according to the starting sequence.
In an embodiment, the determining a shutdown order and a startup order of each application server in the business system using the master database server as a data source includes:
determining the closing sequence and the starting sequence of each application program server according to the upstream and downstream relation of each application program server; wherein
The closing sequence is that the upstream application program server is closed first, and then the downstream application program server is closed;
the starting sequence is that the downstream application server is started first, and then the upstream application server is started.
In an embodiment, the sequentially closing the application servers according to the closing order includes:
sequentially closing the upstream application program servers;
and when the upstream application program servers are all closed, closing the downstream application program servers in sequence.
In an embodiment, the sequentially closing the application servers according to the closing order includes:
closing all upstream application servers in parallel;
and after the upstream application program servers are all closed, closing all the downstream application program servers in parallel.
In an embodiment, the closing the application servers according to the closing sequence includes:
calling a closing script on each application program server according to the closing sequence;
the starting of the application servers according to the starting sequence includes:
and calling the starting scripts on the application program servers according to the starting sequence.
The invention also provides an integrated switching device of the application program and the database, which comprises:
the application program server sorting module is used for determining the closing sequence and the starting sequence of each application program server which takes the main database server as a data source in a business system when the main database server is abnormal;
the data source switching module is used for switching the data source of each application program server from the main database server to the standby database server;
the application program server closing module is used for closing each application program server according to the closing sequence;
the database server switching module is used for starting a standby database server of the service system;
and the application program server starting module is used for starting each application program server according to the starting sequence.
In an embodiment, the application server sorting module is specifically configured to:
determining the closing sequence and the starting sequence of each application program server according to the upstream and downstream relation of each application program server; wherein
The closing sequence is that the upstream application program server is closed first, and then the downstream application program server is closed;
the starting sequence is that the downstream application server is started first, and then the upstream application server is started.
In an embodiment, the application server shutdown module is specifically configured to:
sequentially closing the upstream application program servers;
and when the upstream application program servers are all closed, closing the downstream application program servers in sequence.
In an embodiment, the application server shutdown module is specifically configured to:
closing all upstream application servers in parallel;
and after the upstream application program servers are all closed, closing all the downstream application program servers in parallel.
In one embodiment, the application server shutdown module includes a shutdown script calling unit configured to:
calling a closing script on each application program server according to the closing sequence;
the application program server starting module comprises a starting script calling unit used for:
and sequentially calling the starting scripts on the application program servers according to the starting sequence.
The integrated switching method and the switching device for the application program and the database perform scheduling on the switching steps of the application program and the database, and realize the emergency process of one-key application and database integrated switching. After the technical scheme is used, a machine room attendant does not need to know the professional technology of application or database switching, and when the switching is judged to be needed, the application and database can be integrally switched by starting the emergency scheme in the dispatching system. After the scheme is used, the emergency switching time of the application system and the database can be shortened to two minutes from the original thirty minutes, and the switching efficiency is greatly improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic diagram of the distribution of the service system server according to the present invention.
Fig. 2 is a schematic diagram illustrating an integrated switching method of an application program and a database according to the present invention.
Fig. 3 is a flow chart of an example provided by the present invention.
Fig. 4 is a schematic diagram of an integrated switching device for application programs and databases according to the present invention.
Fig. 5 is a schematic diagram of an electronic device according to the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The invention provides an integrated switching method of an application program and a database, and relates to the field of computers and the field of finance.
As shown in fig. 1, the integrated switching method of the present invention is applied to a service system, where the service system includes a database server 1 and a database server 2 that are active and standby, a currently enabled database server is a primary database server, and another non-enabled database server is a standby database server. The business system also comprises a plurality of application program server groups, and each application program server group can contain a plurality of application program servers which are respectively used for providing different application program function services. When the service system runs, the data sources of all the application program servers are the main database servers, namely, each application server performs data interaction with the main database server respectively.
The group of application servers of the business system is further divided into upstream application servers and downstream application servers. The upstream application server is, for example, a Web server (e.g., Nginx, Apache, etc.), and the Web server is generally responsible for displaying an HTML page and providing an entry for a user to input information such as a phone number to be recharged and a recharge amount; the downstream application server is, for example, an application server (such as Tomcat, Jetty, etc.), and generally performs substantial business processing on a request sent by the upstream application server, thereby completing the final recharging logic, and returning a recharging result to the upstream application server for HTML page display.
The integrated switching method of the application program and the database can be applied to the business system or other similar business systems. As shown in fig. 2, the handover method includes:
step S201, when the main database server is abnormal, determining the closing sequence and the starting sequence of each application program server taking the main database server as a data source in the service system.
In step S201, a monitoring system may monitor an operating status of the primary database server in real time, and when detecting that there is an abnormality in software and/or hardware of the primary database server, perform a primary/secondary switch of the database. The operation state of the main database server can be monitored by each application program server in real time, and when the data fed back to the application program server by the main database server is judged to be abnormal by the application program server, the abnormal data can also reflect the abnormal state of the main database server, and the main-standby switching of the database can be executed at the moment.
The database server may be out of service for a period of time during the handoff. Since the primary database server is the data source of each application server, it may cause an exception to each application server. In order to avoid the occurrence of abnormal conditions during the switching process of the main database server, each application server in the service system is usually closed first, then the main database server is switched, and then each application server in the service system is opened one by one. Before the switching of the main database server, the application program servers need to be closed according to a certain sequence, and after the switching of the main database server, the application program servers also need to be started according to a certain sequence. Therefore, the method first needs to determine the shutdown sequence and the startup sequence of each application server.
Step S202, the data source of each application program server is switched from the main database server to the standby database server.
In step S202, in order to directly provide services for each application server after the primary database server is switched to the backup database server, the data source of each application server is switched from the primary database server to the backup database server before each application server is turned off. After the data sources of the application servers are switched, the main database server is currently used by the business system, and the standby database server is not started, so that the standby database server cannot provide services for the application servers for a while.
And step S203, closing the application program servers according to the closing sequence.
Step S204, starting the backup database server of the service system.
In step S204, database server switching of the business system is performed. The service system is provided with two database servers which are mutually a main database server and a standby database server, wherein the database server which is currently started by the service system is called a main database server, and the database server which is not currently started by the service system is called a standby database server. The specific operation of switching the database server is as follows: and deactivating the currently used database server, namely the main database server, and activating the database server which is not started by the service system currently, namely the standby database server.
To describe the primary-backup relationship of two database servers more clearly, the following is taken as an example: assuming that the business system includes a database server 1 and a database server 2, and the current business system is using the database server 1, the database server 1 is a primary database server, and the database server 2 is a backup database server. When the service system performs the database server switching, the currently used database server becomes the database server 2, and at this time, the database server 2 becomes the primary database server, and the database server 1 becomes the backup database server.
Step S205, starting each application server according to the starting sequence.
After step S205 is completed, the new master database server provides services for each application server, and the service system operates normally.
According to the method, the switching steps of the application program and the database are arranged and scheduled, a computer room attendant does not need to know the professional technology of application or database switching, when the switching is judged to be needed, the integrated switching of the application and the database can be completed only by starting the scheme in the scheduling system, the abnormal condition of the database server is quickly responded, and the switching efficiency of the database server is greatly improved.
In an embodiment, the determining a shutdown order and a startup order of each application server in the business system using the master database server as a data source includes:
determining the closing sequence and the starting sequence of each application program server according to the upstream and downstream relation of each application program server; wherein
The closing sequence is that the upstream application program server is closed first, and then the downstream application program server is closed;
the starting sequence is that the downstream application server is started first, and then the upstream application server is started.
Generally, each application server of the business system can be divided into an upper application server and a downstream application server according to a specific business process. The upstream application server refers to an application server that is passed through first in a specific service execution process. In the process of closing the service system, the upstream application server needs to be closed first to ensure that no new service enters, and then the downstream application server is closed. When the service system is started, the downstream application server needs to be started first, and then the upstream application server needs to be started, so that when a new service enters, the downstream application server can normally process a request from the upstream application server.
In this embodiment, a closing sequence and a starting sequence of each application server are determined according to an upstream-downstream relationship of each application server in a business system, and according to rules of closing and starting the business system, it is determined that the upstream application server is closed first and then the downstream application server is closed in a closing process; in the starting process, the downstream application server is started first, and then the upstream application server is started. The embodiment ensures that the business system does not generate abnormity in the process of switching the database server.
In an embodiment, step S203, sequentially closing the application servers according to the closing order includes:
sequentially closing the upstream application program servers;
and when the upstream application program servers are all closed, closing the downstream application program servers in sequence.
This embodiment provides a feasible shutdown method for each application server, which is premised on shutting down the upstream application server first, and then shutting down the downstream application server after the upstream application server is completely shut down. The upstream application servers may be closed in any order, as long as it is ensured that the downstream application servers are closed again when the upstream application servers are all closed. Similarly, the downstream application servers may also be closed in any order, and when the downstream application servers begin to close, it is necessary to ensure that the upstream application servers have all been closed.
In practical application, when the upstream application servers are closed in sequence, the closing sequence of the upstream application servers can be determined according to a preset closing rule.
For example, if the preset closing rule is to determine the closing sequence of each upstream application server according to the CPU occupancy rate, the CPU occupancy rates of each upstream application server may be obtained, and the upstream application servers are sequentially sorted according to the sequence of the CPU occupancy rates from high to low; according to the sorting result, the upstream application server with the highest CPU occupancy rate is closed first, the upstream application server with the lowest CPU occupancy rate is closed last, and the sequence of the CPU occupancy rates from high to low is the closing sequence of the upstream application servers. When there are multiple upstream application servers with the same CPU occupancy, the multiple upstream application servers may continue to be reordered according to other rules, such as by the multiple upstream application server initials, and so on.
For another example, if the preset closing rule is to determine the closing sequence of each upstream application server according to the use duration, the use duration of the current service of each upstream application server may be obtained, and the upstream application servers are sequentially sorted according to the sequence of the use durations from high to low; according to the sequencing result, the upstream application server with the longest service life is closed first, the upstream application server with the shortest service life is closed last, and the sequence of the service lives from long to short is the closing sequence of the upstream application servers. When there are multiple upstream application servers with the same usage duration, the multiple upstream application servers may continue to be reordered according to other rules, such as by the initials of the multiple upstream application servers, and so on.
The method for determining the closing sequence of the upstream application servers is described above, and the method is also applicable to determining the closing sequence of the downstream application servers. It should be understood by those skilled in the art that the present embodiment is merely illustrative of determining the closing sequence of each application server using the CPU occupancy or usage duration of each application server. In practical applications, other one or more parameters of each application server may also be used to determine the shutdown sequence of each application server, which is not limited in this application.
In an embodiment, step S205, sequentially starting the application servers according to the starting sequence includes:
sequentially starting the downstream application program servers;
when the downstream application servers are all started, the upstream application servers are started in sequence.
This embodiment provides a feasible starting method for each application server, which is premised on starting the downstream application server first, and then starting the upstream application server after the downstream application server is completely started. The downstream application servers may be started in any order, as long as it is ensured that the upstream application server is restarted when all of the downstream application servers are started. Similarly, the upstream application server may be started in any order, and when the upstream application server starts to start, it is necessary to ensure that all the downstream application servers are started.
In practical application, when the application servers in the downstream are started in sequence, the start sequence of the application servers in the downstream can be determined according to a preset start rule. For example, similar to the shutdown rule of the downstream application servers, the startup order of the downstream application servers may be determined according to parameters such as the historical usage time of the downstream application servers, and the determination method of the startup order of the upstream application servers may refer to the downstream application servers.
In addition, in addition to determining the starting sequence of the upstream application servers and the downstream application servers by the above method, the starting sequence of the upstream application servers and the downstream application servers can be determined according to the closing sequence of the upstream application servers and the downstream application servers. For example, assume that the order taken when shutting down the application servers is: upstream application server 1, upstream application server 2, … …, upstream application server m-1, upstream application server m, downstream application server 1, downstream application server 2, … …, downstream application server n-1, downstream application server n. Where m is the total number of upstream application servers and n is the total number of downstream application servers. Determining the starting sequence of each upstream application program server and each downstream application program server according to the closing sequence as follows: downstream application server n, downstream application server n-1, …, downstream application server 2, downstream application server 1, upstream application server m-1, … …, upstream application server 2, upstream application server 1.
It should be understood by those skilled in the art that the present embodiment is only an example of determining the starting sequence of each application server, and in practical applications, other one or more parameters of each application server may also be used to determine the starting sequence of each application server, and the starting sequence of each application server may be unrelated to the closing sequence of each application server, and the application is not limited thereto.
In an embodiment, step S203, sequentially closing the application servers according to the closing order includes:
closing all upstream application servers in parallel;
and after the upstream application program servers are all closed, closing all the downstream application program servers in parallel.
In this embodiment, only the rule that the upstream application server is closed first and then the downstream application server is closed is followed, and for each upstream application server, all the upstream application servers are closed in parallel without being sorted, where parallel closing refers to closing at the same time, that is, closing all the upstream application servers at the same time.
The closing mode of the downstream application program server is similar to that of the upstream application program server, and after the upstream application program server is completely closed, all the downstream application program servers are closed in parallel, namely all the downstream application program servers are closed at the same time.
In an embodiment, step S205, sequentially starting the application servers according to the starting sequence includes:
starting all the downstream application program servers in parallel;
when all the downstream application servers are started, all the upstream application servers are started in parallel.
In this embodiment, only the rule that the downstream application server is started first and then the upstream application server is started is followed. Parallel start here means simultaneous start. The parallel starting mode of each application program is similar to the parallel closing mode of each application program, and the detailed description is omitted here.
In an embodiment, the closing the application servers according to the closing sequence includes:
calling a closing script on each application program server according to the closing sequence;
the starting of the application servers according to the starting sequence includes:
and calling the starting scripts on the application program servers according to the starting sequence.
For example, assuming that a Tomcat application is deployed on an application server, a Tomcat close command may be written into a shell script in advance, named app _ stop.sh (i.e., close script), and stored on the application server; meanwhile, a Tomcat start command is written into a shell script in advance, named app _ start. Therefore, when the application server needs to be shut down or started, the shut-down script app _ stop.sh or the start-up script app _ start.sh stored in the application server can be directly called. In this embodiment, only one application server is taken as an example, and other application servers in the service system are similar to each other, and are not described herein again.
It is understood that, for step S202, to switch the data source of each application server from the primary database server to the standby database server, assuming that a Tomcat application is deployed on one application server, the process of "modifying the data source in the data source configuration file of Tomcat (e.g. context. xml file under the config directory) from the primary database server IP to the standby database server IP" may be written as a shell script in advance, named as app _ switch _ to _ standby.sh (i.e. data source switching script), and stored on the application server. When the data source of the application program server needs to be switched, the data source switching script app _ switch _ to _ standby. In this embodiment, only one application server is taken as an example, and other application servers in the service system are similar to each other, and are not described herein again.
In addition, for step S204, as for the backup database server that starts the service system, assuming that there are database server 1 and database server 2 in the service system, and database server 1 is used before switching, database server 1 is the primary database server, and database server 2 is the backup database server. The database server 1 and the database server 2 are Oracle databases, and Data replication is carried out in real time by the main database server and the standby database server by adopting a Data Guard main-standby mode. The standby database server does not provide external services at ordinary times, and when the main database is down, the failover command in Oracle can be used for starting the standby database server to provide external services. In the invention, the process of starting the database server failover command is written into a shell script named db _ failover. And when the database server needs to be switched, directly calling a database server switching script db _ failover.
For convenience of understanding, the present invention provides a specific example to describe the integrated switching method of the application and the database in the above embodiments.
Supposing that the service system is a certain telephone charge recharging system, an upstream application program server in the telephone charge recharging system comprises 2 Apache servers for providing HTML page access service; the downstream application program server comprises 2 Tomcat servers for executing the specific logic operation of the recharging request; the database server of the telephone fee recharging system comprises an Oracle database server 1 and an Oracle database server 2 which are mutually master and backup. The currently enabled Oracle database server 1 is a main database server, and the currently disabled Oracle database server 2 is a standby database server. The IP addresses of the servers in the telephone fee charging system are specifically shown in table 1:
table 1: basic information of each server in telephone charge recharging system
The integrated switching method of the application program and the database applied in the telephone fee recharging system specifically comprises the following steps:
1. the preparation work before the method is executed comprises the following steps:
1) writing a closing command of Apache into app _ stop.sh (closing script) on 2 upstream application program servers; the startup command of the Apache is written into app _ start.sh (startup script) on 2 upstream application servers, and the data source switching command of the Apache is written into app _ switch _ to _ standby.sh (data source switching script) on 2 upstream application servers.
2) Write Tomcat's close command to app _ stop.sh (close script) on 2 downstream application servers; and writing a starting command of Tomcat into app _ start.sh (a starting script) on the 2 downstream application servers, and writing a data source switching command of Tomcat into app _ switch _ to _ standby.sh (a data source switching script) on the 2 downstream application servers.
3) And writing the process of starting the database server failover command into 2 database servers db _ failover. Wherein 2 database servers are all activated.
2. Performing the method comprises (see the flow chart of fig. 3):
1) the 2 upstream application servers (Apache application servers) are closed by calling the close script of the 2 upstream application servers, namely calling app _ stop.sh on 109.0.0.1, 109.0.0.2. Then, a data source switching script of 2 upstream application servers (Apache application servers) is called, namely app _ switch _ to _ standby.sh on 109.0.0.1 and 109.0.0.2 is called, so that the data source of the 2 upstream application servers (Apache application servers) is switched from the database server 1(Oracle host, 109.0.0.5) to the database server 2(Oracle standby 109.0.0.6).
2) The 2 downstream application servers (Tomcat application servers) are closed by calling the close script of the 2 downstream application servers, namely calling app _ stop.sh on 109.0.0.3, 109.0.0.4. Then, a data source switching script of 2 downstream application servers (Tomcat application servers) is called, namely app _ switch _ to _ standby.sh on 109.0.0.3 and 109.0.0.4 is called, and the data source of the 2 downstream application servers (Tomcat application servers) is switched from the database server 1(Oracle host, 109.0.0.5) to the database server 2(Oracle standby 109.0.0.6).
3) And calling a database switching script of the database server 2(Oracle standby 109.0.0.6), namely calling 109.0.0.6 db _ failover.sh, so as to open the external service of the database server 2(Oracle standby 109.0.0.6).
4) The start script of 2 downstream application servers (Tomcat application servers) is called, namely app _ start.sh on 109.0.0.3, 109.0.0.4 is called, and 2 downstream application servers are started.
5) The start script of 2 upstream application servers (Apache application servers) is called, namely app _ start.sh on 109.0.0.1 and 109.0.0.2 is called, and the 2 upstream application servers are started.
In summary, the invention makes the script name specification corresponding to the integrated switching process of the application program and the database, increases the wildcard type of the whole switching process, can adapt to various application programs and databases, and only needs the operation and maintenance personnel to write the relevant strategy function into the specified script after realizing the function. The switching sequence of the upstream application program server and the downstream application program server is added in the whole switching process, the upstream application program server is closed firstly and then the downstream application program server is closed, the downstream application program server is started firstly and then the upstream application program server is started when the upstream application program server is started, and therefore the abnormal transactions can not occur in the process of closing and starting the service system.
The present invention also provides an integrated switching device for an application program and a database, as shown in fig. 4, the switching device includes:
an application server sorting module 41, configured to determine, when there is an abnormality in a master database server, a closing order and a starting order of each application server in a business system that uses the master database server as a data source;
a data source switching module 42, configured to switch a data source of each application server from a primary database server to a secondary database server;
an application server closing module 43, configured to close each application server according to the closing order;
a database server switching module 44, configured to start a backup database server of the service system;
and an application server starting module 45, configured to start each application server according to the starting sequence.
In an embodiment, the application server sorting module 41 is specifically configured to:
determining the closing sequence and the starting sequence of each application program server according to the upstream and downstream relation of each application program server; wherein
The closing sequence is that the upstream application program server is closed first, and then the downstream application program server is closed;
the starting sequence is that the downstream application server is started first, and then the upstream application server is started.
In an embodiment, the application server shutdown module 43 is specifically configured to:
sequentially closing the upstream application program servers;
and when the upstream application program servers are all closed, closing the downstream application program servers in sequence.
In an embodiment, the application server starting module 45 is specifically configured to:
sequentially starting the downstream application program servers;
when the downstream application servers are all started, the upstream application servers are started in sequence.
In an embodiment, the application server shutdown module 43 is specifically configured to:
closing all upstream application servers in parallel;
and after the upstream application program servers are all closed, closing all the downstream application program servers in parallel.
In an embodiment, the application server starting module 45 is specifically configured to:
starting all the downstream application program servers in parallel;
when all the downstream application servers are started, all the upstream application servers are started in parallel.
In one embodiment, the application server shutdown module 43 includes a shutdown script calling unit, configured to:
calling a closing script on each application program server according to the closing sequence;
the application server starting module 45 includes a start script calling unit configured to:
and sequentially calling the starting scripts on the application program servers according to the starting sequence.
The integrated switching method and the switching device for the application program and the database perform scheduling on the switching steps of the application program and the database, and realize the emergency process of one-key application and database integrated switching. After the technical scheme is used, a machine room attendant does not need to know the professional technology of application or database switching, and when the switching is judged to be needed, the application and database can be integrally switched by starting the emergency scheme in the dispatching system. After the scheme is used, the emergency switching time of the application system and the database can be shortened to two minutes from the original thirty minutes, and the switching efficiency is greatly improved.
The present invention further provides an electronic device including the integrated switching device of the application and the database in the foregoing embodiment, referring to fig. 5, the electronic device 500 specifically includes:
a central processing unit (processor)510, a memory (memory)520, a communication module (Communications)530, an input unit 540, an output unit 550, and a power supply 560.
The memory (memory)520, the communication module (Communications)530, the input unit 540, the output unit 550 and the power supply 560 are respectively connected to the central processing unit (processor) 510. The memory 520 stores a computer program, the central processing unit 510 can call the computer program, and the central processing unit 510 implements all the steps of the integrated switching method of the application program and the database in the above embodiments when executing the computer program.
Embodiments of the present application also provide a computer storage medium for storing a computer program executable by a processor. When being executed by a processor, the computer program realizes all the steps of the integrated switching method of the application program and the database in the embodiment.
As will be appreciated by one skilled in the art, embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, embodiments of the present description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present description may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and so forth) having computer-usable program code embodied therein. The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment. In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of an embodiment of the specification.
In this specification, the schematic representations of the terms used above are not necessarily intended to refer to the same embodiment or example. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction. The above description is only an example of the embodiments of the present disclosure, and is not intended to limit the embodiments of the present disclosure. Various modifications and variations to the embodiments described herein will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the embodiments of the present specification should be included in the scope of the claims of the embodiments of the present specification.
Claims (10)
1. An integrated switching method of an application program and a database is characterized by comprising the following steps:
when the main database server is abnormal, determining the closing sequence and the starting sequence of each application program server which takes the main database server as a data source in a business system;
switching the data source of each application program server from the main database server to the standby database server;
closing each application program server according to the closing sequence;
starting a standby database server of the business system;
and starting the application program servers according to the starting sequence.
2. The integrated switching method according to claim 1, wherein determining a shutdown sequence and a startup sequence of each application server in the service system using the master database server as a data source comprises:
determining the closing sequence and the starting sequence of each application program server according to the upstream and downstream relation of each application program server; wherein
The closing sequence is that the upstream application program server is closed first, and then the downstream application program server is closed;
the starting sequence is that the downstream application server is started first, and then the upstream application server is started.
3. The integrated switching method according to claim 2, wherein the sequentially shutting down the application servers according to the shutdown order comprises:
sequentially closing the upstream application program servers;
and when the upstream application program servers are all closed, closing the downstream application program servers in sequence.
4. The integrated switching method according to claim 2, wherein the sequentially shutting down the application servers according to the shutdown order comprises:
closing all upstream application servers in parallel;
and after the upstream application program servers are all closed, closing all the downstream application program servers in parallel.
5. The integrated switching method according to any one of claims 3 to 4,
the closing of the application servers according to the closing sequence includes:
calling a closing script on each application program server according to the closing sequence;
the starting of the application servers according to the starting sequence includes:
and calling the starting scripts on the application program servers according to the starting sequence.
6. An integrated switching device for an application program and a database is characterized by comprising:
the application program server sorting module is used for determining the closing sequence and the starting sequence of each application program server which takes the main database server as a data source in a business system when the main database server is abnormal;
the data source switching module is used for switching the data source of each application program server from the main database server to the standby database server;
the application program server closing module is used for closing each application program server according to the closing sequence;
the database server switching module is used for starting a standby database server of the service system;
and the application program server starting module is used for starting each application program server according to the starting sequence.
7. The integrated switching device of claim 6, wherein the application server ranking module is specifically configured to:
determining the closing sequence and the starting sequence of each application program server according to the upstream and downstream relation of each application program server; wherein
The closing sequence is that the upstream application program server is closed first, and then the downstream application program server is closed;
the starting sequence is that the downstream application server is started first, and then the upstream application server is started.
8. The integrated switching device according to claim 7, wherein:
the application program server closing module comprises a closing script calling unit used for:
calling a closing script on each application program server according to the closing sequence;
the application program server starting module comprises a starting script calling unit used for:
and sequentially calling the starting scripts on the application program servers according to the starting sequence.
9. An electronic device, comprising:
the system comprises a central processing unit, a storage and a communication module, wherein a computer program is stored in the storage, the central processing unit can call the computer program, and the central processing unit realizes the integrated switching method of the application program and the database according to any one of claims 1-5 when executing the computer program.
10. A computer storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements the integrated switching method of an application and a database according to any one of claims 1-5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110346652.0A CN112835988A (en) | 2021-03-31 | 2021-03-31 | Integrated switching method and switching device for application programs and databases |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110346652.0A CN112835988A (en) | 2021-03-31 | 2021-03-31 | Integrated switching method and switching device for application programs and databases |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112835988A true CN112835988A (en) | 2021-05-25 |
Family
ID=75930774
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110346652.0A Pending CN112835988A (en) | 2021-03-31 | 2021-03-31 | Integrated switching method and switching device for application programs and databases |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112835988A (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101183949A (en) * | 2007-03-30 | 2008-05-21 | 腾讯科技(深圳)有限公司 | Client terminal application program starting method, application program server and client terminal |
CN103810174A (en) * | 2012-11-06 | 2014-05-21 | 阿里巴巴集团控股有限公司 | Database switching method and database switching system |
CN109359094A (en) * | 2018-08-03 | 2019-02-19 | 挖财网络技术有限公司 | A kind of full link tracing method and device of distributed system journal |
CN110166524A (en) * | 2019-04-12 | 2019-08-23 | 陆金所(上海)科技服务有限公司 | Switching method, device, equipment and the storage medium of data center |
CN111258740A (en) * | 2020-02-03 | 2020-06-09 | 北京无限光场科技有限公司 | Method and device for starting application program and electronic equipment |
-
2021
- 2021-03-31 CN CN202110346652.0A patent/CN112835988A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101183949A (en) * | 2007-03-30 | 2008-05-21 | 腾讯科技(深圳)有限公司 | Client terminal application program starting method, application program server and client terminal |
CN103810174A (en) * | 2012-11-06 | 2014-05-21 | 阿里巴巴集团控股有限公司 | Database switching method and database switching system |
CN109359094A (en) * | 2018-08-03 | 2019-02-19 | 挖财网络技术有限公司 | A kind of full link tracing method and device of distributed system journal |
CN110166524A (en) * | 2019-04-12 | 2019-08-23 | 陆金所(上海)科技服务有限公司 | Switching method, device, equipment and the storage medium of data center |
CN111258740A (en) * | 2020-02-03 | 2020-06-09 | 北京无限光场科技有限公司 | Method and device for starting application program and electronic equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7779298B2 (en) | Distributed job manager recovery | |
Garg et al. | Analysis of preventive maintenance in transactions based software systems | |
US7451201B2 (en) | Policy driven autonomic computing-specifying relationships | |
CN109284217A (en) | Application exception processing method, device, electronic equipment and storage medium | |
CN110401700B (en) | Model loading method and system, control node and execution node | |
CN109656742B (en) | Node exception handling method and device and storage medium | |
CN111209110B (en) | Task scheduling management method, system and storage medium for realizing load balancing | |
CN111880906A (en) | Virtual machine high-availability management method, system and storage medium | |
CN113312153B (en) | Cluster deployment method and device, electronic equipment and storage medium | |
US7657734B2 (en) | Methods and apparatus for automatically multi-booting a computer system | |
US20210374029A1 (en) | System and Method for Monitoring Computing Platform Parameters and Dynamically Generating and Deploying Monitoring Packages | |
CN111538585B (en) | Js-based server process scheduling method, system and device | |
CN109614153A (en) | Multi core chip and system | |
US10095533B1 (en) | Method and apparatus for monitoring and automatically reserving computer resources for operating an application within a computer environment | |
CN110377664A (en) | Method of data synchronization, device, server and storage medium | |
US20050071449A1 (en) | Policy driven autonomic computing-programmatic policy definitions | |
CN112835988A (en) | Integrated switching method and switching device for application programs and databases | |
JPH01224846A (en) | Process space switching control system | |
CN110677469B (en) | Security disaster recovery system and disaster recovery implementation method | |
Lopes et al. | Fault tolerance in a mobile agent based computational grid | |
CN115344327B (en) | Application module switching method and device, electronic equipment and readable storage medium | |
CN117240693A (en) | Server management method, device, equipment and machine-readable storage medium | |
Sundaram et al. | Improving dependability using shared supplementary memory and opportunistic micro rejuvenation in multi-tasking embedded systems | |
CN117692500A (en) | Operation method, device, equipment and storage medium | |
WO2023198276A1 (en) | Handling failure of an application instance |
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 |