Non-stop upgrading method and device for web server, equipment and medium

By backing up old databases and replaying incremental data logs during the web server upgrade process, the web server is continuously upgraded, solving the problems of upgrading in the existing technology that affects business continuity and database upgrade complexity, reducing costs and Ensure data consistency.

CN119225781APending Publication Date: 2024-12-31厦门天锐科技股份有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411262025.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-10
Publication Date
2024-12-31

AI Technical Summary

Technical Problem

The existing technology needs to stop services during the web server upgrade process, which affects business continuity, and cannot achieve continuous upgrade of database version and library table structure, resulting in high upgrade costs and complex technical support.

Method used

By backing up the old database at the current point in time, mark the running server with an upgrade mark, record the incremental operation log, upgrade the database, and play the incremental data in the new server, and finally switch to the new server to ensure that the operation does not stop. upgrade.

Benefits of technology

It realizes the continuous upgrade of the web server, ensures business continuity, and ensures data consistency through database redirection and incremental data log replay, reducing upgrade costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119225781A_ABST
    Figure CN119225781A_ABST
Patent Text Reader

Abstract

The invention provides a non-stop upgrading method and device for a web server, equipment and a medium, and relates to the technical field of computers. The method comprises the following steps: backing up an old database at a current time point; from the current time point to the upgrading ending time point, an upgrading mark is marked on an old server which is running, and an increment operation log is obtained; performing database upgrading operation on the basis of the old database backup to obtain an upgraded new database; establishing a dependency relationship between the new server and the new database, and starting a web service in the new server; replaying the incremental data in the new server by using a corresponding service method according to the incremental operation log so as to synchronize the incremental data between the current time point and the upgrading end time point to a new database; and switching the web service from the old server to the new server at the upgrade end time point. According to the method and the device, the non-stop upgrading of the web service can be realized under a simple framework, and the upgrading cost of the web server is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, device, equipment and medium for non-stop upgrading of a web server. Background Art

[0002] With the development of computer technology, web servers may be deployed in enterprises, and web servers can provide corresponding services to users.

[0003] The general process of the existing web server upgrade method is: ① stop the web server → ② update the web project file → ③ restart the web server. The web server may also need to rely on some persistent database services. During the upgrade process, if the database version, library table structure, and field changes are involved, in order to ensure that the database upgrade can be rolled back and support the rapid recovery of the old version, generally after stopping the web server, it is necessary to stop the database service and copy a separate database for upgrade, and switch only after the database upgrade is successful. This upgrade method that requires stopping the service has obvious disadvantages. Stopping the service will affect business continuity. During the service upgrade process, users cannot use the service normally. Since the service has been stopped, the workload of technical support for the upgrade has also increased. It is necessary to continue to pay attention to whether the service upgrade is successful. If the upgrade fails, a rollback is required.

[0004] There are also some non-stop web service upgrade methods on the market, some of which are gradual upgrades through load balancing. For example, when using distributed service frameworks such as nginx and dubbo to load two web services A and B, when the upgrade starts, stop service A first, upgrade A, and add the load after the upgrade is successful. Then stop service B, repeat the upgrade steps for service A, and finally complete the upgrade of all services. However, the existing non-stop web upgrade methods mentioned above are applicable to limited scenarios, only for scenarios where the database version does not need to be upgraded and the library table structure does not need to be updated. If the database version needs to be upgraded, it is generally necessary to stop the database for processing. At this time, the web service cannot continue to provide services even if it is not stopped. If the database library table structure needs to be updated, it is generally necessary to stop the old web service at this time, otherwise there will be compatibility issues, which will affect the functional use of the old web service. For example, if a required field is added to a library table and there is no default value, the old web service will inevitably be abnormal when it is entered into the library.

[0005] Therefore, how to better implement non-stop upgrades of web services is a technical problem that urgently needs to be solved in this field. Summary of the invention

[0006] The purpose of the present application is to provide a method, device, electronic device and storage medium for non-stop upgrading of a web server, which can realize non-stop upgrading of web services at a relatively low cost.

[0007] In a first aspect, an embodiment of the present application provides a method for upgrading a web server without downtime, comprising:

[0008] Back up the old database that the old server depends on at the current time point to obtain the old database backup;

[0009] Between the current time point and the upgrade end time point, an upgrade mark is put on the running old server, so that each business module of the running web service saves the incremental data operation record according to the upgrade mark to obtain the incremental operation log;

[0010] Perform a database upgrade operation based on the old database backup to obtain an upgraded new database;

[0011] Establishing a dependency relationship between the new server and the new database, and starting a web service in the new server;

[0012] Replay the incremental operation log again in the new server using the corresponding business method to synchronize the incremental data between the current time point and the upgrade end time point to the new database;

[0013] At the upgrade end time point, the web service is switched from the old server to the new server.

[0014] In a possible implementation, the method further includes:

[0015] The timing starts at the upgrade end time point. If the web service switch is not completed after the preset time, the running old server is marked as read-only so that each business module of the web service provides corresponding services based on the read-only mark, so that no new incremental data is generated during the web service switch.

[0016] In a possible implementation, the preset duration is set to 10 seconds.

[0017] In a possible implementation, backing up the old database that the old server depends on at the current time point to obtain the old database backup includes:

[0018] At the current time point, use the mysqldump tool to back up the old database that the old server depends on to obtain a backup of the old database; when using the mysqldump tool to export the database, add the --single-transaction option parameter.

[0019] In a possible implementation, performing a database upgrade operation based on the old database backup to obtain an upgraded new database includes:

[0020] Use the mysql import tool to import the old database backup into a database component that is consistent with the old database version to obtain a complete and usable new database;

[0021] Modify the new database port to avoid conflict with the old database port;

[0022] After starting the new database, perform a database upgrade operation on the new database to obtain an upgraded new database.

[0023] In a possible implementation, switching the web service from the old server to the new server at the upgrade end time point includes:

[0024] At the end time of the upgrade, the access address of the new server is added to the load control component, and then the access address of the old server in the load control component is deleted, and the load control component is restarted.

[0025] In a possible implementation, the method further includes:

[0026] Between the current time point and the upgrade end time point, the auto-increment and / or random key values ​​are recorded in the incremental operation log.

[0027] In a second aspect, an embodiment of the present application provides a non-stop upgrade device for a web server, comprising:

[0028] The database upgrade module is used to back up the old database that the old server depends on at the current time point to obtain the old database backup; between the current time point and the upgrade end time point, mark the running old server with an upgrade mark so that each business module of the running web service saves the incremental data operation record according to the upgrade mark to obtain the incremental operation log; perform the database upgrade operation on the basis of the old database backup to obtain the upgraded new database;

[0029] The incremental data processing module is used to establish a dependency relationship between the new server and the new database, and start the web service in the new server; replay the incremental operation log in the new server using the corresponding business method to synchronize the incremental data between the current time point and the upgrade end time point to the new database;

[0030] The service load control module is used to switch the web service from the old server to the new server at the end time of the upgrade.

[0031] In a possible implementation, the service load control module is further used to:

[0032] The timing starts at the upgrade end time point. If the web service switch is not completed after the preset time, the running old server is marked as read-only so that each business module of the web service provides corresponding services based on the read-only mark, so that no new incremental data is generated during the web service switch.

[0033] In a possible implementation, the preset duration is set to 10 seconds.

[0034] In a possible implementation, the database upgrade module is specifically used to:

[0035] At the current time point, use the mysqldump tool to back up the old database that the old server depends on to obtain a backup of the old database; when using the mysqldump tool to export the database, add the --single-transaction option parameter.

[0036] In a possible implementation, the database upgrade module is specifically used to:

[0037] Use the mysql import tool to import the old database backup into a database component that is consistent with the old database version to obtain a complete and usable new database;

[0038] Modify the new database port to avoid conflict with the old database port;

[0039] After starting the new database, perform a database upgrade operation on the new database to obtain an upgraded new database.

[0040] In a possible implementation, the service load control module is specifically configured to:

[0041] At the end time of the upgrade, the access address of the new server is added to the load control component, and then the access address of the old server in the load control component is deleted, and the load control component is restarted.

[0042] In a possible implementation, the database upgrade module is further used to:

[0043] Between the current time point and the upgrade end time point, the auto-increment and / or random key values ​​are recorded in the incremental operation log.

[0044] In a third aspect, the present application provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method described in the first aspect.

[0045] In a fourth aspect, the present application provides a computer-readable storage medium having computer-readable instructions stored thereon, wherein the computer-readable instructions can be executed by a processor to implement the method described in the first aspect.

[0046] Compared with the prior art, the non-stop upgrade method of the web server provided by the present application backs up the old database that the old server depends on at the current time point to obtain the old database backup; between the current time point and the upgrade end time point, an upgrade mark is put on the running old server, so that each business module of the running web service saves the incremental data operation record according to the upgrade mark to obtain the incremental operation log; performs a database upgrade operation on the basis of the old database backup to obtain the upgraded new database; establishes a dependency relationship between the new server and the new database, and starts the web service in the new server; replays the incremental operation log again in the new server according to the corresponding business method to synchronize the incremental data between the current time point and the upgrade end time point to the new database; and switches the web service from the old server to the new server at the upgrade end time point. Compared with the prior art, through the present application, the non-stop upgrade of the web service can be realized under a simple architecture, so that the web server can continue to provide services to users at a relatively low cost. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present application. Also, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:

[0048] Figure 1 A flowchart of a method for upgrading a web server without downtime provided by an embodiment of the present application is shown;

[0049] Figure 2 A schematic diagram of upgrading and switching a web server based on nginx provided in an embodiment of the present application is shown;

[0050] Figure 3 An interactive diagram of web server upgrade and switching provided by an embodiment of the present application is shown;

[0051] Figure 4 A flowchart of another method for upgrading a web server without downtime provided by an embodiment of the present application is shown;

[0052] Figure 5A schematic diagram showing the structure of a device for non-stop upgrading of a web server provided in an embodiment of the present application is shown;

[0053] Figure 6 A schematic structural diagram of an electronic device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0054] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

[0055] It should be noted that, unless otherwise specified, the technical terms or scientific terms used in this application should have the common meanings understood by technicians in the field to which this application belongs.

[0056] In addition, the terms "first" and "second" etc. are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units that are not listed, or may optionally include other steps or units that are inherent to these processes, methods, products or devices.

[0057] In a highly competitive environment, it is critical to maintain business continuity. Business continuity refers to the ability of an enterprise to maintain operations, provide products and services in the face of various unpredictable challenges and disasters to ensure customer satisfaction and sustainable development. Business continuity is more than just a plan, it is a key survival and success factor for an enterprise. Through smart risk management, effective business continuity planning and the adoption of best practices, enterprises can ensure that they can continue to provide products and services, protect their reputation, maintain customer satisfaction, and achieve sustainable growth in the face of various challenges and disasters. Building a strong business continuity culture will make enterprises more competitive, more resilient, and able to cope with future uncertainties.

[0058] There are also some complex large-scale systems on the market. When ensuring the non-stop upgrade of services, they mainly rely on the separation of system business modules, subdividing the business into various microservices. Each microservice also supports horizontal expansion clusters. With certain coding habits, they can ensure the forward and backward compatibility of the business methods provided by new and old servers, and can indeed ensure the continuity and stability of business during server upgrades. However, for some small and medium-sized enterprises, the investment and cost in software are often limited, and there may not be enough hardware or software resources to deploy and architect such complex software systems.

[0059] If there is a way to achieve non-stop upgrades of web services under a simple architecture, it will be possible to ensure that the software of small and medium-sized enterprises can continue to provide services to corporate users at a lower cost.

[0060] Figure 1 is a flowchart of a method for upgrading a web server without downtime provided by an embodiment of the present application. For ease of understanding, the present application also provides Figure 2 The schematic diagram of web server upgrade and switching based on nginx is shown, and Figure 3 Interaction diagram of web server upgrade and switch shown.

[0061] Please refer to Figure 1 , Figure 2 and Figure 3 The above method includes the following steps S101 to S106:

[0062] S101, backing up the old database that the old server depends on at the current time point to obtain a backup of the old database;

[0063] Specifically, the mysqldump tool can be used to back up the database. The above step S101 can be implemented as follows: at the current time point, the mysqldump tool is used to back up the old database that the old server depends on to obtain a backup of the old database; wherein, when using the mysqldump tool to perform a database export operation, the --single-transaction option parameter is added.

[0064] S102, between the current time point and the upgrade end time point, an upgrade mark is added to the running old server, so that each business module of the running web service saves the incremental data operation record according to the upgrade mark to obtain the incremental operation log;

[0065] In some embodiments, the step of obtaining the above-mentioned incremental operation log also includes: recording the self-incrementing and / or random key values ​​into the incremental operation log between the current time point and the upgrade end time point.

[0066] S103, performing a database upgrade operation based on the old database backup to obtain an upgraded new database;

[0067] Specifically, the above step S103 can be implemented as follows: use the mysql import tool to import the old database backup into a database component that is consistent with the old database version to obtain a complete and usable new database; modify the new database port to avoid conflict with the old database port; and after starting the new database, perform a database upgrade operation on the new database to obtain an upgraded new database.

[0068] Steps S101 to S103 are mainly steps for upgrading the database of the web server without stopping the server. In order to ensure the smooth upgrade of the database of the web server, this application specifically strips the module for the upgrade of the database and handles it separately. By dumping and importing the database without stopping the database service, a data backup that is not much different from the existing data of the business system is obtained. Based on this backup, database upgrade operations such as database version and library table changes are performed.

[0069] Taking the MySQL database as an example, in order to ensure that the availability of the web server is not affected, when using mysqldump for export operations, you can add the --single-transaction option parameter. This will not lock the table and cause the web server to be unavailable. The exported data is also a database snapshot based on the export time node. For a separate export transaction, under the default transaction consistency policy REPEATABLE READ, even if incremental business data is generated during the export, it will not be exported to the result file.

[0070] The exported database result file is imported into the database component with the same version as the currently used database using the database import command, so that a complete and usable database is obtained. Then modify the database component port to avoid conflicts with the currently used database port. After starting the database, you can perform database upgrades such as database version and library table changes.

[0071] Although the export and import operations are time-consuming, users are unaware of the impact and do not care much about the timeliness of the upgrade because the continuity of existing web services is not affected. In addition, the re-imported database virtually tidies up database fragments and improves database query performance.

[0072] S104, establishing a dependency relationship between the new server and the new database, and starting a web service in the new server;

[0073] S105, replaying the incremental operation log in the new server using the corresponding business method to synchronize the incremental data between the current time point and the upgrade end time point to the new database;

[0074] Step S105 is mainly for processing the incremental data generated during the server upgrade to ensure the consistency of the business data of the new and old servers.

[0075] Because the consistency of data after the switch between the old and new servers must be guaranteed, after the database export begins, an upgrade mark needs to be added to the running web server, and each business module of the running web service will save the incremental data operation records according to the upgrade mark. That is, the incremental change data generated during the upgrade should be saved in the running database and in the form of operation logs. The operation log does not record the specific result data, but only records what operations have been done and some necessary business parameters. After the new web service is started, the incremental change data generated during the upgrade will be replayed in the new server using the corresponding business method according to the details of the operation log, so as to ensure the data consistency between the old and new servers. For some key values ​​such as self-incrementing or random id values, in order to ensure that the new server also uses the relevant values, they should also be recorded in the incremental operation log when the old server is recorded, so that they can be used when the new server is replayed.

[0076] S106: Switch the web service from the old server to the new server at the upgrade end time point.

[0077] Specifically, the above step S106 can be implemented as follows: adding the access address of the new server to the load control component at the end time of the upgrade, then deleting the access address of the old server in the load control component, and restarting the load control component.

[0078] In some embodiments, Figure 4 As shown, the non-stop upgrade method of the web server further includes the following steps:

[0079] S201, starting the timing at the upgrade end time point, if the web service switching is not completed after the preset time, the running old server is marked as read-only, so that each business module of the web service provides corresponding services according to the read-only mark, so that no new incremental data is generated during the web service switching. Preferably, the preset time can be set to 10 seconds.

[0080] Step S106 mainly controls the seamless switching of the new and old services to ensure business continuity. Specifically, the new server is successfully upgraded, and the incremental operation log has been replayed and the incremental data has been synchronized. It is necessary to switch the web service, and at this time it is necessary to rely on the service load control component (such as nginx). First, add the access address of the new server to the load control component, and then delete the old server access address. At this time, restart the load control component to complete the switching of the new and old servers.

[0081] In order to ensure the validity of the access identity of the new / old server users and to maintain it after the switch, the web service can be designed to be stateless, that is, the identity verification information carried by the access request on the old server is still valid on the new server (such as jwt identity verification). Under this design, the processing of business requests should also be stateless. After each request is processed, the resources related to the request are released. There is no mutual dependence and timing requirements between different requests. Different machine nodes in the same stateless service are completely equivalent.

[0082] Normally, restarting a load or switching a configuration change is quick. However, if the switching time is long, such as more than 10 seconds, the system should add a read-only tag. When the switch starts, the old running server should be marked with a read-only tag. Each business module provides corresponding functions based on this read-only tag. For example, only business queries are supported during the switch, and changes such as system configuration are not supported. This ensures that no new incremental data is generated during the web service switch.

[0083] In summary, the web server can be upgraded without downtime by re-directing and upgrading the database, replaying the operation log of incremental data, and switching with the load control component.

[0084] The non-stop upgrade method for a web server provided in the embodiment of the present application has the following beneficial effects:

[0085] 1. The web server does not need to be shut down for upgrades.

[0086] 2. The database service that the web server relies on obtains a database backup that can be upgraded independently without shutting down the server through the re-boot method. Moreover, the database backup is a defragmented database backup, which improves the efficiency of new database query and matching.

[0087] 3. The incremental data generated during the upgrade is replayed using logs to ensure data consistency between the new and old servers after the upgrade switch.

[0088] In the above-mentioned embodiment, a method for upgrading a web server without downtime is provided. Correspondingly, the present application also provides a device for upgrading a web server without downtime. The device for upgrading a web server without downtime provided in the embodiment of the present application can implement the above-mentioned method for upgrading a web server without downtime. The device for upgrading a web server without downtime can be implemented by software, hardware or a combination of software and hardware. For example, the device for upgrading a web server without downtime can include integrated or separate functional modules or units to execute the corresponding steps in the above-mentioned methods.

[0089] Please refer to Figure 5 As shown, the non-stop upgrade device of the web server provided by the present application includes:

[0090] The database upgrade module 101 is used to back up the old database that the old server depends on at the current time point to obtain the old database backup; between the current time point and the upgrade end time point, mark an upgrade mark on the running old server so that each business module of the running web service saves the incremental data operation record according to the upgrade mark to obtain the incremental operation log; perform a database upgrade operation on the basis of the old database backup to obtain the upgraded new database;

[0091] The incremental data processing module 102 is used to establish a dependency relationship between the new server and the new database, and start the web service in the new server; replay the incremental operation log in the new server using the corresponding business method to synchronize the incremental data between the current time point and the upgrade end time point to the new database;

[0092] The service load control module 103 is used to switch the web service from the old server to the new server at the upgrade end time.

[0093] In a possible implementation, the service load control module 103 is further configured to:

[0094] The timing starts at the upgrade end time point. If the web service switch is not completed after the preset time, the running old server is marked as read-only so that each business module of the web service provides corresponding services based on the read-only mark, so that no new incremental data is generated during the web service switch.

[0095] In a possible implementation, the preset duration is set to 10 seconds.

[0096] In a possible implementation, the database upgrade module 101 is specifically used to:

[0097] At the current time point, use the mysqldump tool to back up the old database that the old server depends on to obtain a backup of the old database; when using the mysqldump tool to export the database, add the --single-transaction option parameter.

[0098] In a possible implementation, the database upgrade module 101 is specifically used to:

[0099] Use the mysql import tool to import the old database backup into a database component that is consistent with the old database version to obtain a complete and usable new database;

[0100] Modify the new database port to avoid conflict with the old database port;

[0101] After starting the new database, perform a database upgrade operation on the new database to obtain an upgraded new database.

[0102] In a possible implementation, the service load control module 103 is specifically configured to:

[0103] At the end time of the upgrade, the access address of the new server is added to the load control component, and then the access address of the old server in the load control component is deleted, and the load control component is restarted.

[0104] In a possible implementation, the database upgrade module 101 is further used to:

[0105] Between the current time point and the upgrade end time point, the auto-increment and / or random key values ​​are recorded in the incremental operation log.

[0106] The non-stop upgrading device of the web server provided in the embodiment of the present application and the non-stop upgrading method of the web server provided in the embodiment of the present application are based on the same inventive concept and have the same beneficial effects as the methods adopted, run or implemented therein.

[0107] The embodiment of the present application also provides an electronic device corresponding to the method provided in the above embodiment, and the electronic device can be an electronic device for a client, such as a mobile phone, a laptop computer, a tablet computer, a desktop computer, etc., to execute the above-mentioned method for non-stop upgrading of the web server.

[0108] Please refer to Figure 6 , which shows a schematic diagram of an electronic device provided by some embodiments of the present application. Figure 6As shown, the electronic device 20 includes: a processor 200, a memory 201, a bus 202 and a communication interface 203, and the processor 200, the communication interface 203 and the memory 201 are connected via the bus 202; the memory 201 stores a computer program that can be run on the processor 200, and when the processor 200 runs the computer program, the non-stop upgrade method of the web server provided in any of the aforementioned embodiments of the present application is executed.

[0109] The memory 201 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk memory. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 203 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used.

[0110] The bus 202 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. The memory 201 is used to store programs, and the processor 200 executes the programs after receiving the execution instruction. The method for upgrading the web server without downtime disclosed in any implementation of the embodiment of the present application may be applied to the processor 200, or implemented by the processor 200.

[0111] The processor 200 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 200. The above processor 200 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a readily available programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware decoding processor to be executed, or the hardware and software modules in the decoding processor can be executed. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 201, and the processor 200 reads the information in the memory 201 and completes the steps of the above method in combination with its hardware.

[0112] The electronic device provided in the embodiment of the present application and the method for non-stop upgrading of the web server provided in the embodiment of the present application are based on the same inventive concept and have the same beneficial effects as the methods adopted, run or implemented therein.

[0113] The present application also provides a computer-readable storage medium corresponding to the method for non-stop upgrading of a web server provided in the aforementioned embodiment, on which a computer program (i.e., a program product) is stored. When the computer program is executed by a processor, the method for non-stop upgrading of a web server provided in any of the aforementioned embodiments is executed.

[0114] It should be noted that examples of the computer-readable storage medium may also include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other optical or magnetic storage media, which are not listed here one by one.

[0115] The computer-readable storage medium provided in the above-mentioned embodiment of the present application and the method for upgrading the web server without downtime provided in the embodiment of the present application are based on the same inventive concept, and have the same beneficial effects as the method adopted, run or implemented by the application program stored therein.

[0116] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application, and they should all be included in the scope of the claims and specification of the present application.

Claims

1. A method for upgrading a web server without downtime, characterized in that: include: Back up the old database that the old server depends on at the current time point to obtain the old database backup; Between the current time point and the upgrade end time point, an upgrade mark is put on the running old server, so that each business module of the running web service saves the incremental data operation record according to the upgrade mark to obtain the incremental operation log; Perform a database upgrade operation based on the old database backup to obtain an upgraded new database; Establishing a dependency relationship between the new server and the new database, and starting a web service in the new server; Replay the incremental operation log again in the new server using the corresponding business method to synchronize the incremental data between the current time point and the upgrade end time point to the new database; At the upgrade end time point, the web service is switched from the old server to the new server.

2. The method according to claim 1, characterized in that The method further comprises: The timing starts at the upgrade end time point. If the web service switch is not completed after the preset time, the running old server is marked as read-only so that each business module of the web service provides corresponding services based on the read-only mark, so that no new incremental data is generated during the web service switch.

3. The method according to claim 2, characterized in that The preset duration is set to 10 seconds.

4. The method according to claim 1, characterized in that The backing up of the old database that the old server depends on at the current time point to obtain the old database backup includes: At the current time point, use the mysqldump tool to back up the old database that the old server depends on to obtain a backup of the old database; when using the mysqldump tool to export the database, add the --single-transaction option parameter.

5. The method according to claim 4, characterized in that Performing a database upgrade operation based on the old database backup to obtain an upgraded new database includes: Use the mysql import tool to import the old database backup into a database component that is consistent with the old database version to obtain a complete and usable new database; Modify the new database port to avoid conflict with the old database port; After starting the new database, perform a database upgrade operation on the new database to obtain an upgraded new database.

6. The method according to claim 1, characterized in that The switching of the web service from the old server to the new server at the upgrade end time point includes: At the end time of the upgrade, the access address of the new server is added to the load control component, and then the access address of the old server in the load control component is deleted, and the load control component is restarted.

7. The method according to claim 1, characterized in that The method further comprises: Between the current time point and the upgrade end time point, the auto-increment and / or random key values ​​are recorded in the incremental operation log.

8. A device for upgrading a web server without downtime, characterized in that: include: A database upgrade module is used to back up the old database that the old server depends on at the current time point to obtain a backup of the old database; Between the current time point and the upgrade end time point, an upgrade mark is put on the running old server, so that each business module of the running web service saves the incremental data operation record according to the upgrade mark to obtain the incremental operation log; the database upgrade operation is performed on the basis of the old database backup to obtain the upgraded new database; The incremental data processing module is used to establish a dependency relationship between the new server and the new database, and start the web service in the new server; replay the incremental operation log in the new server using the corresponding business method to synchronize the incremental data between the current time point and the upgrade end time point to the new database; The service load control module is used to switch the web service from the old server to the new server at the end time of the upgrade.

9. An electronic device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method according to any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium, characterized in that: Computer-readable instructions are stored thereon, and the computer-readable instructions can be executed by a processor to implement the method according to any one of claims 1 to 7.