CN110874234A - Program upgrading method and system - Google Patents

Program upgrading method and system Download PDF

Info

Publication number
CN110874234A
CN110874234A CN201910978323.0A CN201910978323A CN110874234A CN 110874234 A CN110874234 A CN 110874234A CN 201910978323 A CN201910978323 A CN 201910978323A CN 110874234 A CN110874234 A CN 110874234A
Authority
CN
China
Prior art keywords
nginx
version
old version
new
program
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
Application number
CN201910978323.0A
Other languages
Chinese (zh)
Inventor
马哲
刘信
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
BEIJING LEISHI TIANDI ELECTRONIC TECHNOLOGY Co Ltd
Original Assignee
BEIJING LEISHI TIANDI ELECTRONIC TECHNOLOGY Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by BEIJING LEISHI TIANDI ELECTRONIC TECHNOLOGY Co Ltd filed Critical BEIJING LEISHI TIANDI ELECTRONIC TECHNOLOGY Co Ltd
Priority to CN201910978323.0A priority Critical patent/CN110874234A/en
Publication of CN110874234A publication Critical patent/CN110874234A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network

Abstract

The embodiment of the invention provides a program upgrading method and system. The method comprises the following steps: s1, according to the number of the old version of the nginx main process, sending a USR2 signal to the old version of the nginx main process through a kill command to start a new version of the nginx program file; s2, sending a WINCH signal to the old version nginx main process through a kill command so that the old version nginx main process stops processing new requests. And S3, sending a QUIT signal to the old version nginx main process through a kill command so as to close the old version nginx program file. By using the technical scheme of the invention, the upgrading program can be upgraded in a background silent mode, and when a user uses the service of the cloud server, the operation cannot be interrupted due to the program upgrading of the server, so that better user experience is obtained. Meanwhile, the service function of the server cannot be interrupted, so that the long-time use of the KTV cloud server can be ensured, the requirement of long-time high-frequency use of the client is met for the client frequently used, and the time of the user is saved.

Description

Program upgrading method and system
Technical Field
The invention relates to the technical field of internet, in particular to a program upgrading method and system.
Background
In the KTV cloud nginx server operation and maintenance field, in actual operation and maintenance, in order to provide technical support for network security and business, version upgrading can be carried out on the current nginx server or a new function module can be added. And all the services in the cloud end are unavailable in the upgrading process of the server.
When the existing KTV cloud server is upgraded, the service function of the server to a user is forcibly stopped, and then program upgrading is carried out. Therefore, during upgrading, a user cannot obtain the service function of the cloud server, silent upgrading cannot be realized under the condition that the user does not sense, user experience is poor, and if the upgrading is slow, the user can only wait for the completion of the upgrading, cannot use the service, and wastes time of the user.
In view of the above problems, no effective solution has been proposed.
Disclosure of Invention
The embodiment of the invention provides a program upgrading method and system, which are used for completing program upgrading under the condition that a user does not sense without interrupting service when a KTV cloud server program is upgraded.
In one aspect, an embodiment of the present invention provides a program upgrading method, including:
s1, according to the number of the old version of the nginx main process, sending a USR2 signal to the old version of the nginx main process through a kill command to start a new version of the nginx program file;
s2, sending a WINCH signal to the old version nginx main process through a kill command so as to enable the old version nginx main process to stop processing new requests;
and S3, sending a QUIT signal to the old version nginx main process through a kill command so as to close the old version nginx program file.
Further, before step S1, the method further includes:
s01, downloading a new version of nginx software package, and decompressing the new version of nginx software package;
s02, configuring new version compiling information in the same mode as old version compiling information, and executing a compiling command on the decompressed nginx software package of the new version according to the new version compiling information to obtain a nginx program file of the new version;
s03, copying the new version of the nginx program file to a folder where the old version of the nginx program file is located, and replacing the old version of the nginx program file.
Further, before step S1, the method further includes:
s0. looks up the running nginx host process number of the old version through the ps command.
Further, before step S03, the method further includes:
s030, creating a new folder, and copying the nginx program file of the old version into the new folder.
By adopting the technical scheme, the following beneficial effects can be obtained:
by using the program upgrading method, the upgrading program can be upgraded in a background silent mode, and when a user uses the service of the cloud server, the operation cannot be interrupted or even cannot be operated due to the program upgrading of the server, so that better user experience is obtained. Meanwhile, the service function of the server cannot be interrupted, so that the long-time use of the KTV cloud server can be ensured, the requirement of long-time high-frequency use of the client is met for the client frequently used, and the time of the user is saved.
In another aspect, an embodiment of the present invention provides a program upgrading system, including:
the starting module is used for sending a USR2 signal to the nginx main process of the old version through a kill command according to the number of the nginx main process of the old version so as to start the nginx program file of the new version;
a stopping module, configured to send a WINCH signal to the old version of nginx host process through a kill command, so that the old version of nginx host process stops processing a new request;
and the closing module is used for sending a QUIT signal to the old version nginx main process through a kill command so as to close the old version nginx program file.
Further, the method also comprises the following steps:
the upgrade file acquisition module is used for downloading the nginx software package of the new version and decompressing the nginx software package of the new version;
the upgrade file compiling module is used for configuring the new version compiling information in the same mode as the old version compiling information, and executing a compiling command on the decompressed nginx software package of the new version according to the new version compiling information to obtain the nginx program file of the new version;
and the version replacing module is used for copying the new version nginx program file to the folder where the old version nginx program file is located and replacing the old version nginx program file.
Further, the method also comprises the following steps:
and the searching module is used for searching the running nginx main process number of the old version through a ps command.
Further, the method also comprises the following steps:
and the backup module is used for creating a new folder and copying the nginx program file of the old version into the new folder.
By adopting the technical scheme, the following beneficial effects can be obtained:
by using the program upgrading system, the upgrading program can be upgraded in a background silent mode, and when a user uses the service of the cloud server, the operation cannot be interrupted or even cannot be operated due to the program upgrading of the server, so that better user experience is obtained. Meanwhile, the service function of the server cannot be interrupted, so that the long-time use of the KTV cloud server can be ensured, the requirement of long-time high-frequency use of the client is met for the client frequently used, and the time of the user is saved.
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 flowchart of a method for upgrading a program according to an embodiment of the present invention;
FIG. 2 is a flow diagram for upgrading a file according to an embodiment of the invention;
FIG. 3 is a flow chart of the lookup step according to an embodiment of the invention;
FIG. 4 is a flowchart of the backup steps according to an embodiment of the invention;
FIG. 5 is a block diagram of a program upgrade system according to an embodiment of the present invention;
FIG. 6 is a block diagram of the structure of an upgrade file according to an embodiment of the present invention;
FIG. 7 is a block diagram of a lookup module according to an embodiment of the invention;
FIG. 8 is a block diagram of a backup module according to an embodiment of 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.
Example 1:
as shown in fig. 1, an embodiment of the present invention provides a program upgrading method, including:
s1, according to the number of the old version of the nginx main process, sending a USR2 signal to the old version of the nginx main process through a kill command to start a new version of the nginx program file;
the old version of nginx host process renames its pid file to:. oldbin (e.g.: var/run/nginx. pid. oldbin), then executes the new version of nginx program file, and starts a new host process and a new work process in turn. At this time, the nginx main process of the new version and the nginx main process of the old version can run simultaneously, and the input requests are processed together.
S2, sending a WINCH signal to the old version nginx main process through a kill command so as to enable the old version nginx main process to stop processing new requests;
to gradually stop the old version of the nginx host process, a WINCH signal must be sent to the old version of the nginx host process. Its work process will then begin to gracefully shut down.
And S3, sending a QUIT signal to the old version nginx main process through a kill command so as to close the old version nginx program file.
At this time, it can be decided whether to use the new version or to restore to the old version. If the old version is used, the nginx main process of the new version can be quitted, and then the nginx main process of the old version can remove the oldbin suffix and restore the oldbin suffix into the pid file of the old version, so that all the processes are restored to the state before the upgrade; if the upgrade is successful, and it is desired to retain a new server, a QUIT signal may be sent to the old version of the nginx host process to cause it to exit leaving only the new version of the nginx host process running.
At this time, the replacement of the nginx main process of the new version for the nginx main process of the old version is completed, and the upgrade is completed.
As shown in fig. 2, before step S1, the method further includes:
s01, downloading a new version of nginx software package, and decompressing the new version of nginx software package;
s02, configuring new version compiling information in the same mode as old version compiling information, and executing a compiling command on the decompressed nginx software package of the new version according to the new version compiling information to obtain a nginx program file of the new version;
s03, copying the new version of the nginx program file to a folder where the old version of the nginx program file is located, and replacing the old version of the nginx program file.
When the new version nginx program file is used for replacing the old version nginx program file, the new version nginx program file can be compiled and installed into an installation path of the old version nginx program file for the compiled and installed nginx.
As shown in fig. 3, before step S1, the method further includes:
s0. looks up the running nginx host process number of the old version through the ps command.
As shown in fig. 4, before step S03, the method further includes:
s030, creating a new folder, and copying the nginx program file of the old version into the new folder.
Before replacing the old version of nginx program file with the new version of nginx program file, the old version of nginx program file is preferably backed up to prevent the upgrading from failing or needing to be rolled back to the old version after upgrading.
By using the program upgrading method, the upgrading program can be upgraded in a background silent mode, and when a user uses the service of the cloud server, the operation cannot be interrupted or even cannot be operated due to the program upgrading of the server, so that better user experience is obtained. Meanwhile, the service function of the server cannot be interrupted, so that the long-time use of the KTV cloud server can be ensured, the requirement of long-time high-frequency use of the client is met for the client frequently used, and the time of the user is saved.
Example 2:
as shown in fig. 5, an embodiment of the present invention provides a program upgrading system, including:
the starting module 1 is used for sending a USR2 signal to the nginx main process of the old version through a kill command according to the number of the nginx main process of the old version so as to start the nginx program file of the new version;
the old version of nginx host process renames its pid file to:. oldbin (e.g.: var/run/nginx. pid. oldbin), then executes the new version of nginx program file, and starts a new host process and a new work process in turn. At this time, the nginx main process of the new version and the nginx main process of the old version can run simultaneously, and the input requests are processed together.
A stopping module 2, configured to send a WINCH signal to the old version nginx main process through a kill command, so that the old version nginx main process stops processing a new request;
to gradually stop the old version of the nginx host process, a WINCH signal must be sent to the old version of the nginx host process. Its work process will then begin to gracefully shut down.
And the closing module 3 is used for sending a QUIT signal to the old version nginx main process through a kill command so as to close the old version nginx program file.
At this time, it can be decided whether to use the new version or to restore to the old version. If the old version is used, the nginx main process of the new version can be quitted, and then the nginx main process of the old version can remove the oldbin suffix and restore the oldbin suffix into the pid file of the old version, so that all the processes are restored to the state before the upgrade; if the upgrade is successful, wishing to retain a new server, the shutdown module 3 may send a QUIT signal to the old version of the nginx host process, causing it to exit leaving only the new version of the nginx host process running.
At this time, the replacement of the nginx main process of the new version for the nginx main process of the old version is completed, and the upgrade is completed.
As shown in fig. 6, the method further includes:
the upgrade file acquisition module 01 is used for downloading the nginx software package of the new version and decompressing the nginx software package of the new version;
the upgrade file compiling module 02 is used for configuring the new version compiling information in the same way as the old version compiling information, and executing a compiling command on the decompressed nginx software package of the new version according to the new version compiling information to obtain the nginx program file of the new version;
and the version replacement module 03 is configured to copy the new version of nginx program file to the folder where the old version of nginx program file is located, and replace the old version of nginx program file.
When the version replacement module 03 is used to replace the nginx program file of the old version with the nginx program file of the new version, for the compiled and installed nginx, the nginx program file of the new version can be compiled and installed into an installation path of the nginx program file of the old version.
As shown in fig. 7, the method further includes:
and the searching module 0 is used for searching the running nginx main process number of the old version through a ps command.
As shown in fig. 8, the method further includes:
and the backup module 030 is configured to create a new folder, and copy the nginx program file of the old version into the new folder.
Before replacing the old version of nginx program file with the new version of nginx program file, the old version of nginx program file is preferably backed up to prevent the upgrading from failing or needing to be rolled back to the old version after upgrading.
By using the program upgrading system, the upgrading program can be upgraded in a background silent mode, and when a user uses the service of the cloud server, the operation cannot be interrupted or even cannot be operated due to the program upgrading of the server, so that better user experience is obtained. Meanwhile, the service function of the server cannot be interrupted, so that the long-time use of the KTV cloud server can be ensured, the requirement of long-time high-frequency use of the client is met for the client frequently used, and the time of the user is saved.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present invention in further detail, and it should be understood that the above-mentioned embodiments are merely exemplary embodiments of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (8)

1. A program upgrade method, comprising:
s1, according to the number of the old version of the nginx main process, sending a USR2 signal to the old version of the nginx main process through a kill command to start a new version of the nginx program file;
s2, sending a WINCH signal to the old version nginx main process through a kill command so as to enable the old version nginx main process to stop processing new requests;
and S3, sending a QUIT signal to the old version nginx main process through a kill command so as to close the old version nginx program file.
2. The program upgrading method of claim 1, further comprising, before step S1:
s01, downloading a new version of nginx software package, and decompressing the new version of nginx software package;
s02, configuring new version compiling information in the same mode as old version compiling information, and executing a compiling command on the decompressed nginx software package of the new version according to the new version compiling information to obtain a nginx program file of the new version;
s03, copying the new version of the nginx program file to a folder where the old version of the nginx program file is located, and replacing the old version of the nginx program file.
3. The program upgrading method of claim 1, further comprising, before step S1:
s0. looks up the running nginx host process number of the old version through the ps command.
4. The program upgrading method according to claim 2, further comprising, before step S03:
s030, creating a new folder, and copying the nginx program file of the old version into the new folder.
5. A program upgrade system, comprising:
the starting module is used for sending a USR2 signal to the nginx main process of the old version through a kill command according to the number of the nginx main process of the old version so as to start the nginx program file of the new version;
a stopping module, configured to send a WINCH signal to the old version of nginx host process through a kill command, so that the old version of nginx host process stops processing a new request;
and the closing module is used for sending a QUIT signal to the old version nginx main process through a kill command so as to close the old version nginx program file.
6. The program upgrade system according to claim 5, further comprising:
the upgrade file acquisition module is used for downloading the nginx software package of the new version and decompressing the nginx software package of the new version;
the upgrade file compiling module is used for configuring the new version compiling information in the same mode as the old version compiling information, and executing a compiling command on the decompressed nginx software package of the new version according to the new version compiling information to obtain the nginx program file of the new version;
and the version replacing module is used for copying the new version nginx program file to the folder where the old version nginx program file is located and replacing the old version nginx program file.
7. The program upgrade system according to claim 5, further comprising:
and the searching module is used for searching the running nginx main process number of the old version through a ps command.
8. The program upgrade system according to claim 6, further comprising:
and the backup module is used for creating a new folder and copying the nginx program file of the old version into the new folder.
CN201910978323.0A 2019-10-15 2019-10-15 Program upgrading method and system Pending CN110874234A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910978323.0A CN110874234A (en) 2019-10-15 2019-10-15 Program upgrading method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910978323.0A CN110874234A (en) 2019-10-15 2019-10-15 Program upgrading method and system

Publications (1)

Publication Number Publication Date
CN110874234A true CN110874234A (en) 2020-03-10

Family

ID=69717870

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910978323.0A Pending CN110874234A (en) 2019-10-15 2019-10-15 Program upgrading method and system

Country Status (1)

Country Link
CN (1) CN110874234A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101483556A (en) * 2009-01-06 2009-07-15 中兴通讯股份有限公司 Automatic upgrading method and system for switch remote target terminal
CN105100232A (en) * 2015-07-14 2015-11-25 焦点科技股份有限公司 Smooth upgrade method for server end program without interrupting service
US20170034023A1 (en) * 2015-07-27 2017-02-02 Datagrid Systems, Inc. Techniques for evaluating server system reliability, vulnerability and component compatibility using crowdsourced server and vulnerability data
US20180115586A1 (en) * 2016-10-24 2018-04-26 Nubeva, Inc. Seamless Service Updates for Cloud-Based Security Services

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101483556A (en) * 2009-01-06 2009-07-15 中兴通讯股份有限公司 Automatic upgrading method and system for switch remote target terminal
CN105100232A (en) * 2015-07-14 2015-11-25 焦点科技股份有限公司 Smooth upgrade method for server end program without interrupting service
US20170034023A1 (en) * 2015-07-27 2017-02-02 Datagrid Systems, Inc. Techniques for evaluating server system reliability, vulnerability and component compatibility using crowdsourced server and vulnerability data
US20180115586A1 (en) * 2016-10-24 2018-04-26 Nubeva, Inc. Seamless Service Updates for Cloud-Based Security Services

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
DOMINIC BAINES: "《Samba技术内幕》", 机械工业出版社 *
民工哥技术之路: ""1分钟搞定Nginx版本的平滑升级与回滚的方法"", 《HTTPS://WWW.JB51.NET/ARTICLE/171790.HTM》 *

Similar Documents

Publication Publication Date Title
CN101321187B (en) System, method and program product for backing up data
CN105260209A (en) Hot-update solution of program
CN109361542B (en) Client fault processing method, device, system, terminal and server
CN110730090B (en) Batch updating method, device, medium and electronic equipment for agent terminals in cloud environment
CN101383724B (en) Network updating method and operation maintaining element, and network element updating system
US20090210871A1 (en) System and method for software application migration
CN109634638B (en) Cluster software upgrading method, device, equipment and medium
CN101119188B (en) Single board updating method for implementing uninterruptive service
US8806477B2 (en) Space efficient software package management
CN111309365A (en) Method and device for responding to access request and computer readable storage medium
CN115202680A (en) System and method for automatically upgrading local client on line in remote manner
US7340738B2 (en) Time optimized replacement of a software application
CN111433739A (en) Program upgrading method and embedded device
KR20170045981A (en) System including a software and non-stop upgrading method of running software
CN110874234A (en) Program upgrading method and system
CN104090802A (en) Protection method for network camera power failure
WO2017000586A1 (en) Method and device for upgrading virtual network element, and computer storage medium
KR100416809B1 (en) Memory structure of unit for remote download and method thereof
CN105594184B (en) Method for upgrading software version, device and equipment
CN114265605A (en) Version rollback method and device for functional component of business system
CN113515291A (en) Equipment online upgrading method and device
JP2015153128A (en) Call processing control device and software update method of the same, call processing system, and computer program
US20230126244A1 (en) Method, electronic device, and computer program product for managing operating system
JP2003140905A (en) Version up method of system program, program for version up of system program, and recording medium of program for version up of system program
CN111142921A (en) Software upgrading method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20200310

RJ01 Rejection of invention patent application after publication