CN112437119A - Distributed system upgrading method, device and node - Google Patents

Distributed system upgrading method, device and node Download PDF

Info

Publication number
CN112437119A
CN112437119A CN202011225043.1A CN202011225043A CN112437119A CN 112437119 A CN112437119 A CN 112437119A CN 202011225043 A CN202011225043 A CN 202011225043A CN 112437119 A CN112437119 A CN 112437119A
Authority
CN
China
Prior art keywords
upgrading
node
upgraded
upgrade
control node
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.)
Granted
Application number
CN202011225043.1A
Other languages
Chinese (zh)
Other versions
CN112437119B (en
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.)
New H3C Big Data Technologies Co Ltd
Original Assignee
New H3C Big Data Technologies 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 New H3C Big Data Technologies Co Ltd filed Critical New H3C Big Data Technologies Co Ltd
Priority to CN202011225043.1A priority Critical patent/CN112437119B/en
Publication of CN112437119A publication Critical patent/CN112437119A/en
Application granted granted Critical
Publication of CN112437119B publication Critical patent/CN112437119B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • 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
    • 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
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • H04L41/0813Configuration setting characterised by the conditions triggering a change of settings
    • H04L41/082Configuration setting characterised by the conditions triggering a change of settings the condition being updates or upgrades of network functionality

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Hardware Redundancy (AREA)

Abstract

The embodiment of the invention provides a distributed system upgrading method, a distributed system upgrading device and a distributed system upgrading node, and relates to the technical field of distributed systems.

Description

Distributed system upgrading method, device and node
Technical Field
The present invention relates to the field of distributed system technologies, and in particular, to a method, an apparatus, and a node for upgrading a distributed system.
Background
The distributed system usually comprises a plurality of nodes in communication connection, when the distributed system is upgraded, one upgrade main control node is usually selected to control the upgrade of all the nodes in the distributed system, but if the upgrade main control node is abnormal during the upgrade, all the nodes in the distributed system are in an intermediate state, the upgrade cannot be continued, and the rollback cannot be performed, so that the normal use of each node is influenced.
Disclosure of Invention
The embodiment of the invention aims to provide a distributed system upgrading method, a distributed system upgrading device and nodes, which are used for reducing the influence on each node when a main control node is abnormal. The specific technical scheme is as follows:
in a first aspect of the embodiments of the present invention, an embodiment of the present invention provides a distributed system upgrade method, which is applied to an upgrade master control node that upgrades a node to be upgraded in a distributed system, where the upgrade master control node is in communication connection with a preset upgrade standby control node; the upgrading master control node is in communication connection with the node to be upgraded; the upgrading standby control node is in communication connection with the node to be upgraded; the method comprises the following steps:
determining the current upgrading stage according to the preset execution sequence of different upgrading stages;
sending an upgrading instruction to the node to be upgraded, wherein the upgrading instruction comprises information of a current upgrading stage; so that the node to be upgraded executes the upgrading operation of the current upgrading stage according to the upgrading instruction;
after receiving the upgrade result information of the current upgrade stage returned by the node to be upgraded, synchronizing the current upgrade stage information of the node to be upgraded to the upgrade standby control node; when receiving preset information sent by the node to be upgraded, the upgrading standby control node is switched to a new upgrading main control node, wherein the preset information is sent after the node to be upgraded detects that the upgrading main control node is disconnected;
and determining a current upgrading stage according to the upgrading result information and the execution sequence, and executing the step of sending the upgrading instruction to the node to be upgraded so that the node to be upgraded executes the upgrading operation of the current upgrading stage according to the upgrading instruction.
In a second aspect of the embodiments of the present invention, an embodiment of the present invention provides a distributed system upgrade method, which is applied to an upgrade standby control node that upgrades a node in a distributed system, where the upgrade standby control node is in communication connection with a preset upgrade main control node, and the upgrade standby control node is in communication connection with the node to be upgraded; the upgrade master control node is in communication connection with the node to be upgraded, and the method comprises the following steps:
receiving and storing the current upgrading stage information of the node to be upgraded, which is sent by the upgrading master control node;
when preset information sent by the node to be upgraded is received, switching to a new upgrading main control node, wherein the preset information is sent after the node to be upgraded detects that the node to be upgraded is disconnected from the upgrading main control node;
determining a current upgrading stage according to preset execution sequences of different upgrading stages based on the stored information of the current upgrading stage of the node to be upgraded;
sending an upgrading instruction to the node to be upgraded, wherein the upgrading instruction comprises information of a current upgrading stage; so that the node to be upgraded executes the upgrading operation of the current upgrading stage according to the upgrading instruction;
receiving the upgrade result information of the current upgrade stage returned by the node to be upgraded;
and determining a current upgrading stage according to the upgrading result information and the execution sequence, and executing the step of sending the upgrading instruction to the node to be upgraded so that the node to be upgraded executes the upgrading operation of the current upgrading stage according to the upgrading instruction.
In a third aspect of the embodiments of the present invention, an embodiment of the present invention provides a distributed system upgrade apparatus, which is applied to an upgrade master control node that upgrades a node to be upgraded in a distributed system, where the upgrade master control node is in communication connection with a preset upgrade standby control node; the upgrading master control node is in communication connection with the node to be upgraded; the upgrading standby control node is in communication connection with the node to be upgraded; the device comprises:
the first determining module is used for determining the current upgrading stage according to the preset execution sequence of different upgrading stages;
the sending module is used for sending an upgrading instruction to the node to be upgraded, and the upgrading instruction comprises information of a current upgrading stage; so that the node to be upgraded executes the upgrading operation of the current upgrading stage according to the upgrading instruction;
the synchronization module is used for synchronizing the information of the current upgrading stage of the node to be upgraded to the upgrading standby control node after receiving the upgrading result information of the current upgrading stage returned by the node to be upgraded; when receiving preset information sent by the node to be upgraded, the upgrading standby control node is switched to a new upgrading main control node, wherein the preset information is sent after the node to be upgraded detects that the upgrading main control node is disconnected;
and the second determining module is used for determining the current upgrading stage according to the upgrading result information and the execution sequence, and executing the step of sending the upgrading instruction to the node to be upgraded so that the node to be upgraded executes the upgrading operation of the current upgrading stage according to the upgrading instruction.
In another aspect of the embodiments of the present invention, an embodiment of the present invention provides a distributed system upgrade apparatus, which is applied to an upgrade standby control node for upgrading a node to be upgraded in a distributed system, where the upgrade standby control node is in communication connection with a preset upgrade main control node, and the upgrade standby control node is in communication connection with the node to be upgraded; the upgrade master control node is in communication connection with the node to be upgraded, and the device comprises:
the first receiving module is used for receiving and storing the current upgrading stage information of the node to be upgraded, which is sent by the upgrading main control node;
the switching module is used for switching to a new upgrading main control node when receiving preset information sent by the node to be upgraded, wherein the preset information is sent after the node to be upgraded detects that the node to be upgraded is disconnected with the upgrading main control node;
the first determining module is used for determining the current upgrading stage according to the preset execution sequence of different upgrading stages based on the stored information of the current upgrading stage of the node to be upgraded;
the sending module is used for sending an upgrading instruction to the node to be upgraded, and the upgrading instruction comprises information of a current upgrading stage; so that the node to be upgraded executes the upgrading operation of the current upgrading stage according to the upgrading instruction;
the second receiving module is used for receiving the upgrading result information of the current upgrading stage returned by the node to be upgraded;
and the second determining module is used for determining the current upgrading stage according to the upgrading result information and the execution sequence, and executing the step of sending the upgrading instruction to the node to be upgraded so that the node to be upgraded executes the upgrading operation of the current upgrading stage according to the upgrading instruction.
In another aspect of the embodiments of the present invention, an upgrade master node is provided, including: the system comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;
a memory for storing a computer program;
a processor, configured to implement the method for upgrading a distributed system according to any of the first aspect described above when executing a program stored in a memory.
In another aspect of the embodiments of the present invention, an upgrade standby control node is provided, including: the system comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;
a memory for storing a computer program;
and the processor is used for realizing the distributed system upgrading method of any one of the second aspect when executing the program stored in the memory.
In a further aspect of the embodiments of the present invention, an embodiment of the present invention provides a computer-readable storage medium, in which a computer program is stored, and the computer program, when executed by a processor, implements the distributed system upgrade method according to any one of the first aspect.
In a further aspect of the embodiments of the present invention, there is provided a computer program product including instructions, which when run on a computer, causes the computer to perform the distributed system upgrade method according to any one of the first aspect.
The embodiment of the invention has the following beneficial effects:
according to the distributed system upgrading method, device and node provided by the embodiment of the invention, the upgrading main control node and the upgrading standby control node are arranged, when the node to be upgraded detects that the upgrading main control node is disconnected, the preset information is sent to the upgrading standby control node, the upgrading standby control node is switched to a new upgrading main control node when receiving the preset information sent by the node to be upgraded, and the upgrading standby control node is used as a new upgrading main control node to control the upgrading operation of the node to be upgraded, so that the influence on each node when the main control node is abnormal is reduced. Of course, not all of the advantages described above need to be achieved at the same time in the practice of any one product or method of the invention.
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, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other embodiments can be obtained by using the drawings without creative efforts.
Fig. 1a is a schematic flowchart of a first method for upgrading a distributed system applied to upgrade a master control node according to an embodiment of the present invention;
fig. 1b is a schematic flowchart of a second method for upgrading a distributed system applied to upgrade a master control node according to an embodiment of the present invention;
fig. 1c is a schematic diagram of a third flow of a distributed system upgrading method applied to upgrade a master control node according to an embodiment of the present invention;
fig. 1d is a schematic structural diagram of a distributed upgrade system according to an embodiment of the present invention;
fig. 1e is a schematic diagram of a fourth flowchart of a distributed system upgrading method applied to upgrade a master control node according to an embodiment of the present invention;
fig. 2a is a schematic flowchart of a first method for upgrading a distributed system applied to upgrading a standby control node according to an embodiment of the present invention;
fig. 2b is a schematic flowchart of a second method for upgrading a distributed system applied to upgrading a standby control node according to an embodiment of the present invention;
fig. 2c is a schematic flowchart of a third method for upgrading a distributed system applied to upgrading a standby control node according to an embodiment of the present invention;
fig. 2d is a fourth flowchart illustrating a distributed system upgrading method applied to upgrading a standby control node according to an embodiment of the present invention;
fig. 2e is a fifth flowchart illustrating a distributed system upgrading method applied to upgrading a standby control node according to an embodiment of the present invention;
fig. 3 is a schematic flowchart of a distributed system upgrade method applied to a node to be upgraded according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a distributed upgrade system according to an embodiment of the present invention;
FIG. 5 is an interaction diagram of a distributed upgrade system according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a distributed system upgrading apparatus applied to upgrade a master control node according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of a distributed system upgrade apparatus applied to upgrade standby control nodes according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of an electronic device 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.
In order to solve the problem that in the prior art, if an upgrade master control node is abnormal, all nodes in a distributed system are in an intermediate state, cannot be upgraded continuously or cannot return, and normal use of each node is affected, embodiments of the present invention provide a method, an apparatus, a node, a system, a storage medium, and a computer program product containing instructions for upgrading a distributed system.
First, a distributed system upgrading method provided in an embodiment of the present invention is described below. The method is applied to an upgrading master control node for upgrading a distributed system, and the upgrading master control node can be any electronic equipment capable of providing upgrading services for the distributed system, such as a personal computer, a server and the like. The distributed system upgrading method provided by the embodiment of the invention can be realized by at least one of software, hardware circuit and logic circuit arranged in the electronic equipment.
As shown in fig. 1a, fig. 1a is a first flowchart of a distributed system upgrading method applied to upgrading a master control node according to an embodiment of the present invention, where the method includes:
s110, determining the current upgrading stage according to the preset execution sequence of different upgrading stages;
s120, sending an upgrading instruction to the node to be upgraded, wherein the upgrading instruction comprises information of a current upgrading stage; so that the node to be upgraded executes the upgrading operation of the current upgrading stage according to the upgrading instruction; s130, after receiving the upgrade result information of the current upgrade stage returned by the node to be upgraded, synchronizing the information of the current upgrade stage of the node to be upgraded to the upgrade standby control node; when receiving preset information sent by the node to be upgraded, the upgrading master control node is switched to a new upgrading master control node, wherein the preset information is sent after the node to be upgraded detects that the upgrading master control node is disconnected;
s140, determining a current upgrading stage according to the upgrading result information and the execution sequence, and executing the step of sending the upgrading instruction to the node to be upgraded so that the node to be upgraded executes the upgrading operation of the current upgrading stage according to the upgrading instruction.
It can be seen that, in the embodiment of the present invention, by setting the upgrade master control node and the upgrade standby control node, when the node to be upgraded detects that the upgrade master control node is disconnected, the upgrade standby control node sends the preset information to the upgrade standby control node, when receiving the preset information sent by the node to be upgraded, the upgrade standby control node is switched to a new upgrade master control node, and the upgrade standby control node serves as a new upgrade master control node to control the upgrade operation of the node to be upgraded, so as to reduce the influence on each node when the master control node is abnormal.
The distributed system comprises a plurality of nodes to be upgraded and an upgrade main control node for controlling each node to be upgraded. One upgrade master control node can control the upgrade of one node to be upgraded and can also control the upgrade of a plurality of nodes to be upgraded. Each node to be upgraded has a corresponding upgrade backup control node, wherein each node to be upgraded may have one upgrade backup control node or a plurality of upgrade backup control nodes, and the upgrade backup control node may be specifically set according to an actual situation.
When the node to be upgraded is upgraded, different upgrading stages are included, each upgrading stage executes different operations, and the upgrading stages have a sequence. For example, when a node to be upgraded is upgraded, the following steps, inspection before upgrading, software backup, software package downloading, software operation stopping, software upgrade installation, software restart, and inspection after upgrading, are sequentially performed. And the upgrade master control node sequentially controls the nodes to be upgraded to execute the upgrade operation of each upgrade stage according to the preset execution sequence of different upgrade stages. The preset different upgrading stages are set according to upgrading operation needed when the node to be upgraded is actually upgraded. And is not limited herein.
The upgrading main control node determines the current upgrading stage according to the preset execution sequence of different upgrading stages, and then sends an upgrading instruction to the node to be upgraded, wherein the upgrading instruction comprises the information of the current upgrading stage, the node to be upgraded receives the upgrading instruction sent by the upgrading main control node, and the upgrading operation of the current upgrading stage is executed according to the upgrading instruction of the upgrading main control node. And after the upgrade node finishes the upgrade operation of the current upgrade stage, sending upgrade result information of the current upgrade stage to the upgrade main control node, wherein the upgrade result information can represent whether the current upgrade node is upgraded successfully or unsuccessfully.
After receiving the upgrade result information of the current upgrade stage returned by the node to be upgraded, the upgrade master control node synchronizes the current upgrade stage information of the node to be upgraded to the upgrade standby control node, and the upgrade standby control node stores the current upgrade stage information of the node to be upgraded. Specifically, the upgrade master control node creates a log file for each node to be upgraded, and records the upgrade stage of the node to be upgraded according to the log file. Before each upgrading step is started, the upgrading master control node sends the upgrading log file to the upgrading standby control node for synchronization, and after each upgrading step is finished, the upgrading master control node sends the updated upgrading log file to the upgrading standby control node for synchronization.
The node to be upgraded needs to judge whether the upgrade main control node is disconnected, specifically, the mode that the node to be upgraded judges whether the upgrade main control node is disconnected is that the node to be upgraded sends a data packet to the upgrade main control node according to a preset period, and if the upgrade main control node does not return data to the node to be upgraded within a preset time, the node to be upgraded can determine that the upgrade main control node is disconnected.
And the upgrading standby control node can be switched to a new upgrading main control node when receiving the preset information sent by the node to be upgraded. The preset information may be a heartbeat request, specifically, after the node to be upgraded detects disconnection of the upgrade main control node, the node to be upgraded serves as a heartbeat server, and a short and concise data packet is sent to the upgrade standby control node at regular time, that is, the node to be upgraded sends the heartbeat request to the upgrade standby control node at regular time, and then a low-level thread is started, and a response of the upgrade standby control node is continuously detected in the thread. And if the upgrading standby control node receives the heartbeat request of the node to be upgraded, the upgrading standby control node is switched to a new upgrading main control node.
And if the situation that the upgrading main control node is disconnected does not exist, the current upgrading main control node determines the current upgrading stage according to the upgrading result information and the execution sequence, and executes the step of sending an upgrading instruction to the node to be upgraded so that the node to be upgraded continues to execute the upgrading operation of the current upgrading stage according to the upgrading instruction.
If the situation that the upgrade master control node is disconnected and the upgrade standby control node is switched to the new upgrade master control node exists, the new upgrade master control node determines the current upgrade stage according to the preset execution sequence of different upgrade stages based on the stored current upgrade stage information of the node to be upgraded, and sends an upgrade instruction to the node to be upgraded so as to continuously upgrade the node to be upgraded.
In the specific implementation process, there may be two implementation manners: one is for a node to be upgraded, as long as the node to be upgraded is completed in the current upgrading step, the upgrading master control node can execute the upgrading operation of the next upgrading stage; and the other is that after the upgrading operation of all the nodes to be upgraded at the current stage is completed, the operation of the next stage is performed. The following description is made separately.
Based on the embodiment shown in fig. 1a, the embodiment of the present invention provides a second flowchart of a distributed system upgrading method applied to upgrading a master control node, where the number of nodes to be upgraded corresponding to one upgrading master control node is multiple, and as shown in fig. 1b, the method may include the following steps.
S1101, determining the current upgrading stage according to the preset execution sequence of different upgrading stages.
Generally, the step of executing upgrade by the node to be upgraded includes 7 upgrade steps in total, which are: checking before upgrading, software backup, downloading a software package, stopping software running, installing upgrading software, restarting the software and checking the state after upgrading.
S1201, aiming at each node to be upgraded, sending an upgrading instruction to the node to be upgraded, wherein the upgrading instruction comprises information of a current upgrading stage; so that the node to be upgraded executes the upgrading operation of the current upgrading stage according to the upgrading instruction.
Assuming that the current step is the first step, namely, the pre-upgrade check stage, the upgrade master control node sends a pre-upgrade check instruction to each node to be upgraded.
S1301, after receiving the upgrade result information of the current upgrade stage returned by the node to be upgraded, synchronizing the information of the current upgrade stage of the node to be upgraded to the upgrade standby control node; when receiving the preset information sent by the node to be upgraded, the upgrade standby control node is switched to a new upgrade main control node, and the preset information is sent after the node to be upgraded detects that the upgrade main control node is disconnected.
Similarly, taking the current upgrade node as the first step, i.e., the pre-upgrade check stage as an example, after the node to be upgraded performs the pre-upgrade check according to the pre-upgrade check instruction, the pre-upgrade check result may return a pre-upgrade check result, which indicates that the pre-upgrade check succeeds or fails. And the upgrade master control node generates current upgrade stage information according to the returned check result before upgrade execution, wherein the current upgrade stage information can be the upgrade log information of the node to be upgraded in the first step and then is synchronized to the upgrade standby control node.
In the process, if the node to be upgraded detects that the upgrade main control node is disconnected, the node to be upgraded sends preset information to the upgrade standby control node, the preset information can be a heartbeat request, specifically, the node to be upgraded is used as a heartbeat server, a short and bold data packet is sent to the upgrade standby control node at regular time, namely, the node to be upgraded sends the heartbeat request to the upgrade standby control node at regular time, then a low-level thread is started, and the response of the upgrade standby control node is continuously detected in the thread.
And S1401, for each node to be upgraded, if the node to be upgraded is successfully upgraded in the current upgrading stage, determining the next upgrading stage as the current upgrading stage according to the execution sequence, and executing the step of sending the upgrading instruction to the node to be upgraded so that the node to be upgraded executes the upgrading operation of the current upgrading stage according to the upgrading instruction.
Specifically, for each node to be upgraded, if the node to be upgraded is successfully upgraded in the current upgrade stage, the upgrade master control node determines the next upgrade stage as the current upgrade stage according to the execution sequence, and executes the step of sending the upgrade instruction to the node to be upgraded, so that the upgrade node executes subsequent upgrade operations according to the upgrade instruction.
The upgrading operations among the nodes to be upgraded can not be influenced mutually, so that when one node to be upgraded is in fault, the upgrading operations of other nodes to be upgraded can not be influenced, and subsequent upgrading can be continued.
Based on the embodiment shown in fig. 1a, the embodiment of the present invention provides a third flowchart of a distributed system upgrading method applied to upgrading a master control node, where the number of nodes to be upgraded corresponding to one upgrading master control node is multiple, and as shown in fig. 1c, the method may include the following steps.
S1102, determining the current upgrading stage according to the preset execution sequence of different upgrading stages;
s1202, sending an upgrading instruction to each node to be upgraded, wherein the upgrading instruction comprises information of a current upgrading stage; so that each node to be upgraded executes the upgrading operation of the current upgrading stage according to the upgrading instruction;
s1302, for each node to be upgraded, after receiving the upgrade result information of the current upgrade stage returned by the node to be upgraded, synchronizing the current upgrade stage information of the node to be upgraded to the upgrade standby control node; when receiving preset information sent by the node to be upgraded, the upgrading master control node is switched to a new upgrading master control node, wherein the preset information is sent after the node to be upgraded detects that the upgrading master control node is disconnected;
and S1402, if the nodes to be upgraded are upgraded successfully in the current upgrading stage, determining the next upgrading stage as the current upgrading stage according to the execution sequence, and executing the step of sending upgrading instructions to the nodes to be upgraded.
The upgrade operations between the nodes to be upgraded may affect each other. That is to say, when one upgrade main control node controls N nodes to be upgraded simultaneously to perform upgrade, the upgrade main control node determines a current upgrade stage according to a preset execution sequence of different upgrade stages, and sends an upgrade instruction to the N nodes to be upgraded, and the N nodes to be upgraded execute upgrade operation of the current stage according to the upgrade instruction. And only if the N nodes to be upgraded are upgraded successfully in the current upgrading stage, the upgrading master control node sends the upgrading instruction of the next upgrading stage to the N nodes to be upgraded, namely, the next upgrading stage is determined as the current upgrading stage according to the execution sequence, and the step of sending the upgrading instruction to each node to be upgraded is executed.
The upgrading operations of the nodes to be upgraded are mutually influenced, so that the upgrading operations of the nodes to be upgraded are ensured to be synchronously carried out.
Based on the embodiments shown in fig. 1b, 1c, steps S1401 and S1402 may be performed in the following manner.
Aiming at a node to be upgraded which fails to be upgraded in the current upgrading stage, and the upgrading master control node is not disconnected with the node to be upgraded, sending a recovery instruction to the node to be upgraded so as to recover the node to be upgraded to the state before the current upgrading stage is upgraded; after the node to be upgraded is restored to the state before the current upgrading stage, determining that the upgrading stage before the current upgrading stage is the current upgrading stage, and executing the step of sending the upgrading instruction to the node to be upgraded so that the node to be upgraded executes the upgrading operation of the current upgrading stage according to the upgrading instruction.
If the node to be upgraded fails to be upgraded in the current upgrading stage and the upgrading main control node is not disconnected with the node to be upgraded, it can be determined that the upgrading script of the upgrading node in the current upgrading stage has a problem but the upgrading main control node does not have a fault, and the upgrading main control node sends a recovery instruction to the node to be upgraded so that the node to be upgraded is recovered to the state before being upgraded in the current upgrading stage.
After the node to be upgraded is restored to the state before the current upgrade stage, the node needs to be upgraded continuously, specifically, the upgrade master control node determines that the upgrade stage before the current upgrade stage is the current upgrade stage, and executes the step of sending the upgrade instruction to the node to be upgraded, so that the node to be upgraded executes the upgrade operation of the current upgrade stage according to the upgrade instruction.
In a possible embodiment, after the node to be upgraded is restored to the state before the upgrade at the current upgrade stage, if the node to be upgraded still fails to be upgraded, the upgrade master node pushes the node to be upgraded to the user, so that the user checks the node to be upgraded.
In a possible embodiment, for an upgrade node in a current upgrade stage, if other nodes to be upgraded are successfully upgraded, an upgrade script in the current upgrade stage is acquired from the successfully upgraded node to be upgraded, and the upgrade script is sent to the failed node to be upgraded, so that the failed node to be upgraded executes the upgrade script to be upgraded for upgrading.
If the upgrade master control node is node 1, the nodes to be upgraded are nodes 2 to 9, and the upgrade of node 2 fails when the upgrade step 3 is executed, and the upgrade of the nodes to be upgraded is successful when the nodes to be upgraded are nodes 3 to 9, the node 1 may select a node from each node to be upgraded according to a preset selection sequence of the nodes to be upgraded to obtain the upgrade script of the current upgrade stage, specifically, the node may be selected according to a sequence of node numbers from large to small, or randomly selected from each node to be upgraded, or a node to be upgraded which is successful in upgrade and shortest in time is selected, and a rule for selecting the node to be upgraded is not limited herein.
For example, the node 1 selects the node 3 to obtain the upgrade script of the current upgrade stage, and after obtaining the upgrade script of the current upgrade stage, the upgrade script is sent to the node 2, so that the node 2 executes the upgrade script to perform upgrade.
Furthermore, if the node to be upgraded still fails to be upgraded, it may be determined that the node to be upgraded has failed, and the node to be upgraded is pushed to the user. And pushing the node to be upgraded which fails to be upgraded, so that the user can pertinently check the node to be upgraded which fails to be upgraded.
Based on the embodiment shown in fig. 1a, the number of the upgrade standby nodes is multiple, and step S130 may be performed in the following manner.
After receiving the upgrade result information of the current upgrade stage returned by the node to be upgraded, the upgrade master control node synchronizes the current upgrade stage information of the node to be upgraded to each upgrade standby control node; and switching the first upgrade standby control node which receives preset information sent by the node to be upgraded to an upgrade main control node, wherein the preset information is sent by the node to be upgraded after the node to be upgraded detects that the upgrade main control node is disconnected.
If the number of the upgrade standby control nodes corresponding to the nodes to be upgraded is multiple, the current upgrade stage information of the nodes to be upgraded needs to be synchronized to each upgrade standby control node, when the nodes to be upgraded detect disconnection of the upgrade main control node, the nodes to be upgraded sequentially send preset information to each upgrade standby control node according to a preset sequence, and therefore the upgrade standby control node which receives the preset information sent by the nodes to be upgraded first is switched to the upgrade main control node. The preset rule of the sequence may be set according to the numbering sequence of each upgrade standby control node, and is not limited herein. By arranging a plurality of upgrade backup control nodes, backup can be carried out for a plurality of times, so that the influence on each node when the master control node is abnormal is reduced, and the reliability is improved.
In a possible embodiment, the upgrade master control node is: an upgrade master control node pre-designated from each node of the distributed system, or a node outside the distributed system and in communication connection with a node to be upgraded in the distributed system;
the upgrade standby control node comprises: and the upgrading standby control node is pre-appointed from each node of the distributed system, or the node outside the distributed system is in communication connection with the node to be upgraded in the distributed system.
The determined upgrade master control node may be a node to be upgraded in the distributed system, or may be an electronic device not belonging to the distributed system.
When the upgrade master control node and the upgrade slave control node are to-be-upgraded nodes in the distributed system, a node can be randomly selected from the to-be-upgraded nodes in the distributed system as the upgrade master control node, and a node can be randomly selected from the to-be-upgraded nodes in the distributed system as the upgrade slave control node. The node to be upgraded in the distributed system can be an upgrade master control node or an upgrade standby control node while being used as the node to be upgraded. When a node to be upgraded in the distributed system is used as an upgrade master control node, the upgrade operation of the node may be controlled by the node itself, or may be controlled by other upgrade master control nodes, which is not limited herein.
In a possible embodiment, the number of the nodes to be upgraded is multiple; dividing a plurality of nodes to be upgraded into a plurality of node groups to be upgraded; each node group to be upgraded corresponds to one upgrading master control node and at least one upgrading standby control node.
For example, the distributed system includes a large number of nodes to be upgraded, and in order to reduce workload of upgrading the master control node and improve upgrading efficiency of the nodes to be upgraded, specifically, the nodes to be upgraded in the distributed system may be grouped to obtain node groups to be upgraded, and the upgrade master control node and the upgrade slave control node corresponding to each node group to be upgraded are respectively determined. Each node group to be upgraded corresponds to one upgrading master control node and at least one upgrading standby control node.
In a possible embodiment, if there are node groups to be upgraded, the upgrade master control nodes corresponding to the node groups to be upgraded may back up each other.
For example, there are a node group 1 to be upgraded and a node group 2 to be upgraded, where the upgrade master control node corresponding to the node group 1 to be upgraded is the node 1, and the upgrade master control node corresponding to the node group 1 to be upgraded is the node 2, then the upgrade backup control node corresponding to the node group 1 to be upgraded may be the node 2, and then the upgrade backup control node corresponding to the node group 2 to be upgraded may be the node 1.
As shown in fig. 1d, fig. 1d is a schematic structural diagram of a distributed upgrade system according to an embodiment of the present invention, where the distributed system includes a large number of nodes 010 to be upgraded, and in order to reduce workload of upgrading a master control node and improve upgrade efficiency of the nodes to be upgraded, the nodes 010 to be upgraded in the distributed system are grouped to obtain a group of nodes to be upgraded, and a first group 011 and a second group 012 are obtained, where each group includes a plurality of nodes 010 to be upgraded. The upgrade master control node corresponding to the first group 011 is the upgrade master control node 1, namely 001, and the upgrade master control node corresponding to the second group 012 is the upgrade master control node 2, namely 002, and the upgrade master control nodes corresponding to the node groups to be upgraded are backups of each other. That is, the upgrade master control node 2 is the upgrade standby control node corresponding to the first group 011, the upgrade master control node 1 is the upgrade standby control node corresponding to the second group 012, and for better understanding, the upgrade standby control node corresponding to the second group 012 is marked as the upgrade standby control node 2, and the upgrade standby control node corresponding to the first group 011 is marked as the upgrade standby control node 1.
Based on the embodiment shown in fig. 1a, the embodiment of the present invention provides a fourth flowchart schematic diagram of a distributed system upgrading method applied to upgrading a master control node, and as shown in fig. 1e, the method may include the following steps.
S1103, determining the current upgrading stage according to the preset execution sequence of different upgrading stages;
s1203, sending an upgrading instruction to the node to be upgraded, wherein the upgrading instruction comprises information of a current upgrading stage; so that the node to be upgraded executes the upgrading operation of the current upgrading stage according to the upgrading instruction;
s1303, after receiving the upgrade result information of the current upgrade stage returned by the node to be upgraded, synchronizing the information of the current upgrade stage of the node to be upgraded to the upgrade standby control node; when receiving preset information sent by the node to be upgraded, the upgrading master control node is switched to a new upgrading master control node, wherein the preset information is sent after the node to be upgraded detects that the upgrading master control node is disconnected;
s1403, receiving synchronization information returned by the upgrade standby control node according to a synchronization result;
s1503, determining a current upgrading stage according to the upgrading result information and the execution sequence under the condition that the synchronization represented by the synchronization information is successful, and executing the step of sending the upgrading instruction to the node to be upgraded;
s1603, under the condition that the synchronization information represents synchronization failure, a synchronization failure message is generated so that a user can determine whether to continue upgrading according to the synchronization failure message; and when a preset upgrading continuing instruction sent by a user is received, determining the current upgrading stage according to the upgrading result information and the execution sequence, and executing the step of sending the upgrading instruction to the node to be upgraded.
And after synchronizing the information of the current upgrading stage of the node to be upgraded, the upgrading standby control node generates synchronous information according to the synchronization result and sends the synchronous information to the upgrading main control node, and the upgrading main control node determines the current upgrading stage according to the upgrading result information and the execution sequence under the condition that the synchronization represented by the synchronous information is successful, and executes the step of sending the upgrading instruction to the node to be upgraded. And if the synchronization information represents that the synchronization fails, generating a synchronization failure message so that the user can determine whether to continue upgrading according to the synchronization failure message.
And when the upgrade master control node is disconnected, the upgrade master control node is switched to a new upgrade master control node, so that the new upgrade master control node can determine the current upgrade stage according to the preset execution sequence of different upgrade stages based on the stored current upgrade stage information of the node to be upgraded according to the self synchronous information, and thus, the upgrade operation is continuously completed.
In the embodiments shown in fig. 1a to 1c, the detection mode that the node to be upgraded detects that the upgrade master node is disconnected is performed in the following manner.
The node to be upgraded and the upgrading main control node are in heartbeat connection, the node to be upgraded is used as a heartbeat server, a short and bold data packet is sent to the upgrading main control node at regular time, namely, the node to be upgraded sends a heartbeat request to the upgrading main control node at regular time, then a low-level thread is started, the response of the upgrading main control node is continuously detected in the thread, and if the response of the upgrading main control node is not received within a certain time, for example, 300 seconds, the node to be upgraded determines that the node to be upgraded is disconnected from the upgrading main control node in communication.
In a possible embodiment, if the upgrade main control node does not receive the heartbeat data packet of the node to be upgraded within a certain time, the upgrade main control node is considered to be disconnected from the node to be upgraded, and if the upgrade main control node has no fault, the upgrade main control node may output a message indicating that the node to be upgraded is disconnected, so as to remind a user of disconnecting the node to be upgraded, so that the user checks the disconnected node to be upgraded.
As shown in fig. 2a, fig. 2a is a first flowchart of a distributed system upgrade method applied to upgrade standby control nodes according to an embodiment of the present invention, where the method includes:
s210, receiving and storing the current upgrading stage information of the node to be upgraded, which is sent by the upgrading master control node;
s220, when receiving preset information sent by the node to be upgraded, switching the node to be upgraded into a new upgrading main control node, wherein the preset information is sent after the node to be upgraded detects that the node to be upgraded is disconnected from the upgrading main control node;
s230, determining the current upgrading stage according to the preset execution sequence of different upgrading stages based on the stored information of the current upgrading stage of the node to be upgraded;
s240, sending an upgrading instruction to the node to be upgraded, wherein the upgrading instruction comprises information of a current upgrading stage; so that the node to be upgraded executes the upgrading operation of the current upgrading stage according to the upgrading instruction; s250, receiving the upgrade result information of the current upgrade stage returned by the node to be upgraded;
s260, determining the current upgrading stage according to the upgrading result information and the execution sequence, and executing the step of sending the upgrading instruction to the node to be upgraded so that the node to be upgraded executes the upgrading operation of the current upgrading stage according to the upgrading instruction.
By arranging the upgrading main control node and the upgrading standby control node, when the node to be upgraded detects disconnection of the upgrading main control node, the upgrading standby control node sends preset information to the upgrading standby control node, when receiving the preset information sent by the node to be upgraded, the upgrading standby control node is switched to be a new upgrading main control node, and the upgrading standby control node serves as a new upgrading main control node to control upgrading operation of the node to be upgraded, so that influence on each node when the main control node is abnormal is reduced.
And after detecting that the upgrade main control node is disconnected, the node to be upgraded sends preset information to the upgrade standby control node, the upgrade standby control node is switched to a new upgrade main control node when receiving the preset information sent by the node to be upgraded, and the upgrade standby control node switched to the new upgrade main control node continues to control the upgrade operation of the node to be upgraded, so that the influence on each node when the upgrade main control node is abnormal is reduced.
When the upgrade standby control node is switched to a new upgrade main control node, the current upgrade stage is determined according to the preset execution sequence of different upgrade stages based on the stored information of the current upgrade stage of the node to be upgraded, and after the current upgrade stage is determined, the new upgrade main control node executes the method for executing the upgrade main control node in the embodiment.
Based on the embodiment shown in fig. 2a, the step S230 is specifically implemented as follows:
if the upgrade of the current upgrade stage is successful, determining the next upgrade stage as the current upgrade stage,
and if the upgrading of the current upgrading stage fails, determining that the current upgrading stage is the current upgrading stage.
For example, the upgrade steps executed by the node 1 to be upgraded collectively include 5 steps, when the upgrade standby control node 1 receives preset information sent by the node 1 to be upgraded, the current upgrade stage information of the node to be upgraded, which is stored by the upgrade standby control node 1, is upgrade stage information of a second step, after the upgrade standby control node 1 is switched to a new upgrade main control node, the upgrade standby control node 1 determines the current upgrade stage according to the stored upgrade stage information of the second step and the preset execution sequence of different upgrade stages, if the stored upgrade stage information of the second step represents that the second step is upgraded successfully, the third step is determined to be the current upgrade stage, and if the stored upgrade stage information of the second step represents that the second step is failed, the second step is determined to be the current upgrade stage.
Based on the embodiment shown in fig. 2a, if there are multiple nodes to be upgraded corresponding to the upgrade master control node, as shown in fig. 2b, fig. 2b is a second flowchart of the distributed system upgrade method applied to upgrade backup control nodes provided in the embodiment of the present invention, and S220 may specifically be implemented by the following steps;
and S221, when receiving preset information sent by a preset number of the nodes to be upgraded corresponding to the upgrade master control node, switching to a new upgrade master control node.
If the number of the nodes to be upgraded corresponding to the upgrading main control node is multiple, when the preset information sent by the preset number of the nodes to be upgraded corresponding to the upgrading main control node is received, it is indicated that the preset number of the nodes to be upgraded detect that the upgrading main control node is disconnected. The number of the preset number is set according to the actual situation, and is not limited herein.
For example, after the upgrade standby control node is switched to a new upgrade main control node, for a node to be upgraded, which sends a preset message to the upgrade standby control node, the upgrade standby control node determines a current upgrade stage according to a preset execution sequence of different upgrade stages based on stored current upgrade stage information of the node to be upgraded, and sends an upgrade instruction to the node to be upgraded.
That is, after the upgrade standby control node is switched to the new upgrade main control node, the upgrade standby control node only controls the upgrade of the node to be upgraded, which sends the preset message to the upgrade standby control node.
In a possible embodiment, based on the embodiment shown in fig. 2b, when receiving preset information sent by a preset number of nodes to be upgraded corresponding to the upgrade master control node, and switching to a new upgrade master control node, the upgrade backup control node determines a current upgrade stage based on the stored current upgrade stage information of the nodes to be upgraded according to a preset execution sequence of different upgrade stages, and sends an upgrade instruction to each node to be upgraded corresponding to the original upgrade master control node; the original upgrading master control node is the previous upgrading master control node of the current upgrading master control node, and the current upgrading master control node is a new upgrading master control node formed by switching the upgrading standby control nodes.
That is, after the upgrade standby control node is switched to the new upgrade main control node, the upgrade standby control node controls the upgrade of all the nodes to be upgraded corresponding to the original upgrade main control node.
For example, there are nodes 3 to 9 to be upgraded, the upgrade master control node controlling the nodes 3 to 9 is node 1, and the upgrade slave control node is node 2. When the nodes 3 to 7 send the preset message to the node 2, which indicates that the nodes 3 to 7 are disconnected from the node 1, the node 2 is switched to the upgrade master control node to control the upgrade of the node to be upgraded. Specifically, after the node 2 is switched to the upgrade master control node, only the upgrade from the node 3 to the node 7 may be controlled, and also the upgrade from the node 3 to the node 9 may be controlled.
And sending preset information to the upgrading standby control nodes by a preset number of nodes to be upgraded, judging the faults of the upgrading main control nodes by the upgrading standby control nodes, and switching the upgrading standby control nodes to new upgrading main control nodes so as to control the upgrading of all the nodes to be upgraded corresponding to the original upgrading main control nodes. Therefore, the influence on each node when the master control node is abnormal is reduced.
Illustratively, the upgrade standby control node maintains a data management table, which records the node identifier to be upgraded corresponding to the upgrade standby control node, the upgrade main control node identifier, and the relationship between the nodes to be upgraded corresponding to each upgrade main control node. So that the upgrade standby control node determines whether to perform handover.
For each node to be upgraded, if the number of the upgrade standby control nodes corresponding to the node to be upgraded is multiple, after the current upgrade standby control node is switched to the new upgrade main control node, based on the embodiment shown in fig. 2a, a third flow schematic diagram of the distributed system upgrade method applied to the upgrade standby control nodes provided by the embodiment of the present invention is shown in fig. 2c, and the method includes;
s2101, receive and keep the above-mentioned upgrade present staging information of the above-mentioned node to be upgraded that the above-mentioned upgrade master control node sends;
s2201, when receiving the preset information sent by the node to be upgraded, switching to a new upgrade master control node, where the preset information is sent after the node to be upgraded detects that the node to be upgraded is disconnected from the upgrade master control node;
s2301, based on the stored information of the current upgrade stage of the node to be upgraded, determining the current upgrade stage according to the preset execution sequence of different upgrade stages;
s2401, sending an upgrading instruction to the node to be upgraded, wherein the upgrading instruction comprises information of a current upgrading stage; so that the node to be upgraded executes the upgrading operation of the current upgrading stage according to the upgrading instruction;
s2501, receiving the upgrade result information of the current upgrade stage returned by the node to be upgraded;
s2601, synchronizing the current upgrading stage of the node to be upgraded to the other upgrading standby control nodes; when receiving the preset information sent by the node to be upgraded, the other upgrading standby control nodes are switched to be upgrading main control nodes, and the preset information is sent after the node to be upgraded detects that the current upgrading main control node is disconnected.
S2701, according to the upgrade result information and the execution sequence, determining a current upgrade stage, and executing the step of sending the upgrade instruction to the node to be upgraded, so that the node to be upgraded executes the upgrade operation of the current upgrade stage according to the upgrade instruction.
If the node to be upgraded has other upgrade master control nodes, the current upgrade master control node still synchronizes the current upgrade stage of the node to be upgraded to the other upgrade master control nodes, so that the other upgrade master control nodes are switched to new upgrade master control nodes when receiving the preset information sent by the node to be upgraded. Therefore, the influence on each node when the current upgrading master control node is abnormal is reduced.
In one possible embodiment, when the original upgrade master control node is normal, the original upgrade master control node is the previous upgrade master control node of the current upgrade master control node, and the current upgrade master control node is formed by switching upgrade standby control nodes; and switching the original upgrading master control node into an upgrading standby control node, and synchronizing the current upgrading stage of the node to be upgraded to the original upgrading master control node by the current upgrading master control node.
When the original upgrade master control node is recovered to be normal, the original upgrade master control node can be used as an upgrade backup control node, so that the original upgrade master control node is switched to the upgrade master control node when receiving preset information sent by the node to be upgraded, and the preset information is sent after the node to be upgraded detects that the current upgrade master control node is disconnected.
In a possible embodiment, when the original upgrade master control node is normal, the current upgrade master control node synchronizes the current upgrade stage of the node to be upgraded to the original upgrade master control node, the current upgrade master control node is switched to the upgrade backup control node, the original upgrade master control node determines the current upgrade stage according to the current upgrade stage information and the execution sequence of different preset upgrade stages, sends an upgrade instruction to the node to be upgraded, and synchronizes the upgrade stage information of the node to be upgraded to the upgrade backup control node.
And when the original upgrading master control node is recovered to be normal, the original upgrading master control node is continuously used as an upgrading master control node, and the current upgrading master control node is switched to an upgrading standby control node.
Based on the embodiment shown in fig. 2a, a fourth flowchart of the distributed system upgrade method applied to upgrade standby control nodes according to the embodiment of the present invention is shown in fig. 2d, where the method includes;
s2102, receiving and storing the current upgrade stage information of the node to be upgraded, which is sent by the upgrade master control node;
s2202, generating synchronous information and sending the synchronous information to the upgrade main control node so that the upgrade main control node determines whether to continue upgrading according to the synchronous information;
s2302, when receiving preset information sent by the node to be upgraded, switching the node to be upgraded into a new upgrade main control node, wherein the preset information is sent after the node to be upgraded detects that the node to be upgraded is disconnected from the upgrade main control node;
s2402, based on the stored information of the current upgrading stage of the node to be upgraded, determining the current upgrading stage according to the preset execution sequence of different upgrading stages;
s2502, sending an upgrading instruction to the node to be upgraded, wherein the upgrading instruction comprises information of a current upgrading stage; so that the node to be upgraded executes the upgrading operation of the current upgrading stage according to the upgrading instruction;
s2602, receiving the upgrade result information of the current upgrade stage returned by the node to be upgraded;
s2702, according to the upgrade result information and the execution sequence, determining a current upgrade stage, and executing the step of sending the upgrade instruction to the node to be upgraded, so that the node to be upgraded executes the upgrade operation of the current upgrade stage according to the upgrade instruction.
And after synchronizing the information of the current upgrading stage of the node to be upgraded, the upgrading standby control node generates synchronous information according to the synchronization result and sends the synchronous information to the upgrading main control node, and the upgrading main control node determines the current upgrading stage according to the upgrading result information and the execution sequence under the condition that the synchronization represented by the synchronous information is successful, and executes the step of sending the upgrading instruction to the node to be upgraded. And if the synchronization information represents that the synchronization fails, generating a synchronization failure message so that the user can determine whether to continue upgrading according to the synchronization failure message.
Based on the embodiments of fig. 2a to 2d, as shown in fig. 2e, fig. 2e is a fifth flowchart of the method for upgrading a distributed system of upgrading standby control nodes according to the embodiment of the present invention, in this embodiment, upgrading operations between nodes to be upgraded affect each other, so as to ensure that the upgrading operations of the nodes to be upgraded are performed synchronously. The method specifically comprises the following steps:
s201, judging whether a heartbeat request of a node to be upgraded is received; if yes, step S202 is executed, and if no, the upgrade is ended.
After the upgrade master control node is detected to be disconnected by the node to be upgraded, the node to be upgraded is used as a heartbeat server, a short and bold data packet is sent to the upgrade standby control node at regular time, namely, the node to be upgraded sends a heartbeat request to the upgrade standby control node at regular time, then a low-level thread is started, and the response of the upgrade standby control node is continuously detected in the thread.
S202, sending heartbeat request response to the node to be upgraded which sends the heartbeat request.
And after receiving the heartbeat request sent by the node to be upgraded, the upgrading standby control node sends a heartbeat request response to the node to be upgraded which sends the heartbeat request.
S203, the node to be upgraded which receives the heartbeat request response is marked as a source node.
And simultaneously, the upgrading standby control node marks the node to be upgraded which receives the heartbeat request response as a source node. That is, if the node to be upgraded receives the heartbeat request response, the node to be upgraded and the upgrade standby control node establish heartbeat connection.
By taking the node to be upgraded which sends the heartbeat request as a source node, the upgrade standby control node judges whether heartbeat connection is established with all the nodes to be upgraded, and therefore whether the upgrade standby control node is switched to the upgrade main control node is determined.
S204, judging whether heartbeat connection is established with all nodes to be upgraded, if so, executing the step S205, otherwise, returning to the step S201 to continue execution.
When the upgrading master control node corresponds to a plurality of nodes to be upgraded, the upgrading slave control node judges whether heartbeat connection is established with all the nodes to be upgraded corresponding to the upgrading master control node.
S205, switching to a new upgrading master control node, and sending an upgrading master control node updating instruction to all nodes to be upgraded.
And under the condition that heartbeat connections are established between all the nodes to be upgraded corresponding to the upgrade main control node, switching to a new upgrade main control node, and sending an upgrade main control node updating instruction to all the nodes to be upgraded so that after each node to be upgraded receives the upgrade main control node updating instruction, the nodes to be upgraded continue to be upgraded according to the new upgrade main control node control instruction.
And S206, determining the current upgrading stage according to the preset execution sequence of different upgrading stages based on the stored information of the current upgrading stage of the node to be upgraded.
S207, sending an upgrading instruction to each node to be upgraded, wherein the upgrading instruction comprises information of a current upgrading stage; so that each node to be upgraded executes the upgrading operation of the current upgrading stage according to the upgrading instruction.
And S208, receiving the upgrade result information of the current upgrade stage returned by the node to be upgraded.
S209, determining the current upgrading stage according to the upgrading result information and the execution sequence, and executing the step of sending an upgrading instruction to the node to be upgraded so that the node to be upgraded executes the upgrading operation of the current upgrading stage according to the upgrading instruction;
s210, whether the heartbeat connection with the node to be upgraded is disconnected or not is judged, if yes, the upgrading operation is ended, and if not, the step S211 is executed.
S210, judging whether the current upgrading stage is the last upgrading stage, if so, ending the upgrading operation, otherwise, returning to the step S209 to continue the execution.
Based on the foregoing embodiments, to describe the scheme of the present invention more clearly, an embodiment of the present invention provides a flow diagram of a distributed system upgrade method applied to a node to be upgraded of a distributed system, where an execution subject of the method is the node to be upgraded, and the method specifically includes the following steps:
s301, the node to be upgraded sends a heartbeat request to the upgrade master control node at regular time.
In order to determine that the upgrade main control node is disconnected, the node to be upgraded sends a heartbeat request to the upgrade main control node at regular time, specifically, the node to be upgraded serves as a heartbeat server, a short and bold data packet is sent to the upgrade main control node at regular time, that is, the node to be upgraded sends the heartbeat request to the upgrade main control node at regular time, then a low-level thread is started, the response of the upgrade main control node is continuously detected in the thread, and if the response of the upgrade main control node is not received within a certain time, for example, 300 seconds, the node to be upgraded determines that the node to be upgraded is disconnected from the upgrade main control node in communication.
S302, whether a heartbeat request response sent by the upgrading master control node aiming at the heartbeat request is received or not is judged, if yes, the step S301 is returned to continue execution; if not, go to step S303.
After the node to be upgraded sends a heartbeat request to the upgrade main control node at regular time, if the upgrade main control node is not disconnected with the node to be upgraded, the upgrade main control node responds to the heartbeat request sent by the node to be upgraded and sends a heartbeat request response aiming at the sending of the heartbeat request to the node to be upgraded. And if the heartbeat request response sent by the upgrading main control node aiming at the heartbeat request is not received, determining that the upgrading main control node is disconnected.
S303, judging whether an upgrade standby control node corresponds to the upgrade standby control node, if so, executing the step S304; if not, go to step S308.
Specifically, each node to be upgraded stores information of an upgrade main control node and information of an upgrade standby control node, wherein the information of the upgrade main control node includes upgrade main control node identification information, and the information of the upgrade standby control node includes upgrade standby control node identification information. Whether the upgrading master control node and the upgrading standby control node correspond to each other can be judged according to the information.
Illustratively, the node to be upgraded maintains a data management table, and the table records an upgrade main control node identifier and an upgrade backup control node identifier corresponding to the node to be upgraded, and when a plurality of upgrade backup control nodes exist, the table may further include a serial number corresponding to the upgrade backup control node.
And S304, regularly sending a heartbeat request to the upgrade standby control node.
After the upgrade master control node is detected to be disconnected by the node to be upgraded, the node to be upgraded is used as a heartbeat server, a short and bold data packet is sent to the upgrade standby control node at regular time, namely, the node to be upgraded sends a heartbeat request to the upgrade standby control node at regular time, then a low-level thread is started, and the response of the upgrade standby control node is continuously detected in the thread.
S305, judging whether a heartbeat request response sent by the upgrade standby control node aiming at the heartbeat request is received or not, if so, executing the step S306; if not, step S308 is performed.
And after the upgrade standby control node receives the heartbeat request sent by the node to be upgraded, the upgrade standby control node sends a heartbeat request response to the node to be upgraded according to the heartbeat request. When the node to be upgraded detects that the upgrade standby control node sends a heartbeat request response to the node to be upgraded, it is indicated that the node to be upgraded and the upgrade standby control node establish heartbeat connection.
And after the upgrade standby control node receives the heartbeat request sent by the node to be upgraded, the upgrade standby control node is switched to a new upgrade main control node, and a message for updating the upgrade main control node is sent to the node to be upgraded, so that the node to be upgraded executes the upgrade operation according to the upgrade instruction sent by the new upgrade main control node.
S306, judging whether a message for updating the upgrade master control node sent by the upgrade standby control node is received; if yes, go to step S307, if no, go back to step S304 to continue execution.
The message for updating the upgrade main control node sent by the upgrade standby control node is sent after the upgrade standby control node receives the heartbeat request sent by the node to be upgraded and switches the upgrade standby control node into a new upgrade main control node.
And S307, updating the upgrade master control node and the upgrade standby control node, and returning to the step S301 to continue executing.
After receiving the message for updating the upgrade master control node sent by the upgrade master control node, the node to be upgraded updates the upgrade master control node information and the upgrade slave control node information, continues to upgrade according to the upgrade instruction sent by the new upgrade master control node after the upgrade master control node information and the upgrade slave control node information are updated, and continues to execute the step of S301. The upgrade master control node information and the upgrade backup control node information may be identification information of the upgrade master control node and identification information of the upgrade backup control node, so that the node to be upgraded sends related information to the upgrade master control node and the upgrade backup control node according to the identification information of the upgrade master control node and the identification information of the upgrade backup control node.
S308, outputting an abnormal message and ending the process.
And when the current upgrading master control node is disconnected and the upgrading standby control node does not respond to the heartbeat request or does not have the upgrading standby control node, outputting an abnormal message and ending the process.
For convenience of understanding, the composition of the upgrade master control node and the upgrade standby control node in the distributed system according to the method for upgrading a distributed system provided in the embodiment of the present invention is referred to as a distributed upgrade system.
As shown in fig. 4, fig. 4 is a schematic structural diagram of a distributed upgrade system according to an embodiment of the present invention, where the distributed upgrade system includes a node to be upgraded 410, an upgrade main control node 411, and an upgrade standby control node 412 in the distributed system, where the upgrade main control node 411 is in communication connection with the upgrade standby control node 412, the upgrade main control node 411 is in communication connection with the node to be upgraded 410, and the node to be upgraded 410 is in communication connection with the upgrade standby control node 412.
The upgrade master control node 411 is configured to perform steps performed by the upgrade master control node in the foregoing embodiment, and the node to be upgraded 410 is configured to perform steps performed by the node to be upgraded in the foregoing embodiment; the upgrade standby node 412 is configured to perform steps performed by the upgrade standby node in the above embodiments.
By arranging the upgrading main control node and the upgrading standby control node, when the node to be upgraded detects disconnection of the upgrading main control node, the upgrading standby control node sends preset information to the upgrading standby control node, when receiving the preset information sent by the node to be upgraded, the upgrading standby control node is switched to be a new upgrading main control node, and the upgrading standby control node serves as a new upgrading main control node to control upgrading operation of the node to be upgraded, so that influence on each node when the main control node is abnormal is reduced.
With regard to the system in the above embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
In order to more intuitively view the interaction relationship among the nodes to be upgraded, the upgrade master control node and the upgrade standby control node in the upgrade process, as shown in fig. 5, fig. 5 is an interaction schematic diagram of a distributed upgrade system provided by an embodiment of the present invention. In this embodiment, the node to be upgraded, the upgrade master control node, and the upgrade backup control node are all required to operate normally. The steps of the node to be upgraded for executing the upgrade include: checking before upgrading, software backup, downloading a software package, stopping software running, installing upgrading software, restarting the software and checking the state after upgrading.
Step 1, an upgrade master control sends an upgrade instruction of the first step: checking the instruction before upgrading;
step 2, the node to be upgraded is checked according to execution;
step 3, the node to be upgraded feeds back the checking result to the upgrading master control node;
step 4, the upgrade master control node updates the upgrade log information of the node to be upgraded according to the check result;
step 5, the upgrade master control node sends the updated upgrade log information of the node to be upgraded to the upgrade standby control node;
step 6, synchronously storing the upgrade log information of the node to be upgraded by the upgrade standby control node, and generating synchronous information;
and 7, the upgrading standby control node sends synchronous information to the upgrading main control node.
Fig. 5 only takes the check before the first step of upgrade as an example, and the interaction relationship between software backup, software package download, software operation stop, upgrade software installation, software restart and state check after upgrade is similar to the check before the first step of upgrade, and is not described herein again.
The method comprises the steps that an upgrade main control node sends a check instruction before upgrading to a node to be upgraded, the node to be upgraded executes checking according to the check instruction before upgrading, and a checking result is fed back; after receiving the fed back check result, the upgrade master control node updates the upgrade log information of the node to be upgraded according to the check result and synchronizes the upgrade log information to the upgrade standby control node; and the upgrade standby control node synchronously stores the upgrade log information of the node to be upgraded and generates synchronous information, and the upgrade standby control node feeds the synchronous information back to the upgrade main control node. And when the node to be upgraded is successfully checked before the node to be upgraded performs upgrading and the upgrade backup node is successfully synchronized, the upgrade main control node sends a second step, namely a backup instruction to the node to be upgraded. Until all upgrading operations are completed.
Based on the foregoing method embodiment, an embodiment of the present invention provides a distributed system upgrade apparatus, as shown in fig. 6, fig. 6 is a schematic structural diagram of the distributed system upgrade apparatus applied to upgrade a master control node according to an embodiment of the present invention, and is applied to an upgrade master control node for upgrading a node to be upgraded in a distributed system, where the upgrade master control node is in communication connection with a preset upgrade backup control node; the upgrading main control node is in communication connection with the node to be upgraded; the upgrading standby control node is in communication connection with the node to be upgraded; the above-mentioned device includes:
a first determining module 610, configured to determine a current upgrade stage according to a preset execution sequence of different upgrade stages;
a sending module 620, configured to send an upgrade instruction to the node to be upgraded, where the upgrade instruction includes information of a current upgrade stage; so that the node to be upgraded executes the upgrading operation of the current upgrading stage according to the upgrading instruction;
a synchronization module 630, configured to synchronize, after receiving the update result information of the current update stage returned by the node to be updated, the current update stage information of the node to be updated to the update standby control node; when receiving preset information sent by the node to be upgraded, the upgrading master control node is switched to a new upgrading master control node, wherein the preset information is sent after the node to be upgraded detects that the upgrading master control node is disconnected;
a second determining module 640, configured to determine a current upgrade stage according to the upgrade result information and the execution sequence, and execute the step of sending the upgrade instruction to the node to be upgraded, so that the node to be upgraded executes an upgrade operation in the current upgrade stage according to the upgrade instruction.
In a possible embodiment, the number of the nodes to be upgraded is multiple, and the second determining module 640 is specifically configured to:
and aiming at each node to be upgraded, if the node to be upgraded is successfully upgraded in the current upgrading stage, determining the next upgrading stage as the current upgrading stage according to the execution sequence, and executing the step of sending the upgrading instruction to the node to be upgraded.
In a possible embodiment, the number of the nodes to be upgraded is multiple, and the second determining module 640 is specifically configured to:
and if the nodes to be upgraded are upgraded successfully in the current upgrading stage, determining the next upgrading stage as the current upgrading stage according to the execution sequence, and executing the step of sending upgrading instructions to the nodes to be upgraded.
In a possible embodiment, the second determining module 640 is specifically configured to:
aiming at a node to be upgraded which fails to be upgraded in the current upgrading stage, and the upgrading main control node is not disconnected with the node to be upgraded, sending a recovery instruction to the node to be upgraded so as to recover the node to be upgraded to the state before the current upgrading stage is upgraded; after the node to be upgraded is restored to the state before the current upgrading stage, determining that the upgrading stage before the current upgrading stage is the current upgrading stage, and executing the step of sending the upgrading instruction to the node to be upgraded so that the node to be upgraded executes the upgrading operation of the current upgrading stage according to the upgrading instruction.
In a possible embodiment, the number of the upgrade standby control nodes is multiple; the synchronization module 630 is specifically configured to: after receiving the upgrade result information of the current upgrade stage returned by the node to be upgraded, synchronizing the current upgrade stage information of the node to be upgraded to each upgrade standby control node; and switching the first upgrade standby control node which receives preset information sent by the node to be upgraded to an upgrade main control node, wherein the preset information is sent by the node to be upgraded after the node to be upgraded detects that the upgrade main control node is disconnected.
In a possible embodiment, the upgrade master control node is: an upgrade master control node preassigned from each node of the distributed system, or a node outside the distributed system and in communication connection with a node to be upgraded in the distributed system;
the upgrade standby control node is as follows: and the upgrading standby control node is preassigned from each node of the distributed system, or the node outside the distributed system is in communication connection with the node to be upgraded in the distributed system.
In a possible embodiment, the number of the nodes to be upgraded is multiple; dividing the nodes to be upgraded into a plurality of node groups to be upgraded; each node group to be upgraded corresponds to one upgrading master control node and at least one upgrading standby control node.
In a possible embodiment, the apparatus further comprises:
the receiving module is used for receiving the synchronization information returned by the upgrade standby control node according to the synchronization result;
in a case that the synchronization information represents that the synchronization is successful, the second determining module 640 is specifically configured to: determining a current upgrading stage according to the upgrading result information and the execution sequence, and executing the step of sending the upgrading instruction to the node to be upgraded;
in a case that the synchronization information represents that synchronization fails, the second determining module 640 is specifically configured to: generating a synchronization failure message so that a user can determine whether to continue upgrading according to the synchronization failure message; and when a preset upgrading continuing instruction sent by a user is received, determining the current upgrading stage according to the upgrading result information and the execution sequence, and executing the step of sending the upgrading instruction to the node to be upgraded.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
Based on the foregoing method embodiment, an embodiment of the present invention provides a distributed system upgrade apparatus, as shown in fig. 7, fig. 7 is a schematic structural diagram of the distributed system upgrade apparatus applied to upgrade standby control nodes provided in an embodiment of the present invention, where the upgrade standby control nodes are in communication connection with a preset upgrade main control node, and the upgrade standby control nodes are in communication connection with the nodes to be upgraded; the upgrade master control node is in communication connection with the node to be upgraded, and the device comprises:
a first receiving module 710, configured to receive and store the current upgrade stage information of the node to be upgraded, where the current upgrade stage information is sent by the upgrade master control node;
the switching module 720 is configured to switch to a new upgrade master control node when receiving preset information sent by the node to be upgraded, where the preset information is sent after the node to be upgraded detects that the node to be upgraded is disconnected from the upgrade master control node;
a first determining module 730, configured to determine, based on the stored information of the current upgrade stage of the node to be upgraded, the current upgrade stage according to a preset execution sequence of different upgrade stages;
a sending module 740, configured to send an upgrade instruction to the node to be upgraded, where the upgrade instruction includes information of a current upgrade stage; so that the node to be upgraded executes the upgrading operation of the current upgrading stage according to the upgrading instruction;
a second receiving module 750, configured to receive upgrade result information of the current upgrade stage returned by the node to be upgraded;
a second determining module 760, configured to determine a current upgrade stage according to the upgrade result information and the execution sequence, and execute the step of sending the upgrade instruction to the node to be upgraded, so that the node to be upgraded executes an upgrade operation in the current upgrade stage according to the upgrade instruction.
In a possible embodiment, the first determining module 730 is specifically configured to:
if the upgrade of the current upgrade stage is successful, determining the next upgrade stage as the current upgrade stage;
and if the upgrading of the current upgrading stage fails, determining that the current upgrading stage is the current upgrading stage.
In a possible embodiment, the number of the nodes to be upgraded corresponding to the upgrade master control node is multiple, and the switching module 720 is specifically configured to:
and when receiving preset information sent by a preset number of the nodes to be upgraded corresponding to the upgrade master control node, switching to a new upgrade master control node.
In a possible embodiment, for each node to be upgraded, if the number of upgrade standby control nodes corresponding to the node to be upgraded is multiple, the apparatus further includes:
the synchronization module is used for synchronizing the current upgrading stage of the node to be upgraded to the other upgrading standby control nodes of the node to be upgraded; when receiving the preset information sent by the node to be upgraded, the other upgrading standby control nodes are switched to be new upgrading main control nodes, and the preset information is sent after the node to be upgraded detects that the current upgrading main control node is disconnected.
In a possible embodiment, if there are a plurality of nodes to be upgraded, the second determining module 760 is specifically configured to:
and aiming at each node to be upgraded, if the node to be upgraded is successfully upgraded in the current upgrading stage, determining the next upgrading stage as the current upgrading stage according to the execution sequence, and executing the step of sending the upgrading instruction to the node to be upgraded.
In a possible embodiment, if there are a plurality of nodes to be upgraded, the second determining module 760 is specifically configured to:
and if the nodes to be upgraded are upgraded successfully in the current upgrading stage, determining the next upgrading stage as the current upgrading stage according to the execution sequence, and executing the step of sending upgrading instructions to the nodes to be upgraded.
In a possible embodiment, the second determining module 760 is specifically configured to:
if the node to be upgraded fails to be upgraded in the current upgrading stage and the upgrading master control node is not disconnected with the node to be upgraded, a recovery instruction is sent to the node to be upgraded so that the node to be upgraded is recovered to the state before the current upgrading stage is upgraded.
In a possible embodiment, the apparatus further comprises:
and the generation module is used for generating synchronous information and sending the synchronous information to the upgrading main control node so that the upgrading main control node determines whether to continue upgrading according to the synchronous information.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
An embodiment of the present invention further provides an upgrade master control node, as shown in fig. 8, including a processor 801, a communication interface 802, a memory 803, and a communication bus 804, where the processor 801, the communication interface 802, and the memory 803 complete mutual communication through the communication bus 804,
a memory 803 for storing a computer program;
the processor 801 is configured to implement the following steps when executing the program stored in the memory 803:
determining the current upgrading stage according to the preset execution sequence of different upgrading stages;
sending an upgrading instruction to the node to be upgraded, wherein the upgrading instruction comprises information of a current upgrading stage; so that the node to be upgraded executes the upgrading operation of the current upgrading stage according to the upgrading instruction;
after receiving the upgrade result information of the current upgrade stage returned by the node to be upgraded, synchronizing the current upgrade stage information of the node to be upgraded to the upgrade standby control node; when receiving preset information sent by the node to be upgraded, the upgrading standby control node is switched to a new upgrading main control node, wherein the preset information is sent after the node to be upgraded detects that the upgrading main control node is disconnected;
and determining a current upgrading stage according to the upgrading result information and the execution sequence, and executing the step of sending the upgrading instruction to the node to be upgraded so that the node to be upgraded executes the upgrading operation of the current upgrading stage according to the upgrading instruction.
Optionally, when the processor 801 is configured to execute the program stored in the memory 803, any one of the above-described distributed system upgrading methods applied to upgrading the master control node may also be implemented.
The embodiment of the invention also provides an upgrade standby control node, which comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete mutual communication through the communication bus,
a memory for storing a computer program;
the processor is used for realizing the following steps when executing the program stored in the memory:
receiving and storing the current upgrading stage information of the node to be upgraded, which is sent by the upgrading master control node;
when preset information sent by the node to be upgraded is received, switching to a new upgrading main control node, wherein the preset information is sent after the node to be upgraded detects that the node to be upgraded is disconnected from the upgrading main control node;
determining a current upgrading stage according to preset execution sequences of different upgrading stages based on the stored information of the current upgrading stage of the node to be upgraded;
sending an upgrading instruction to the node to be upgraded, wherein the upgrading instruction comprises information of a current upgrading stage; so that the node to be upgraded executes the upgrading operation of the current upgrading stage according to the upgrading instruction;
receiving the upgrade result information of the current upgrade stage returned by the node to be upgraded;
and determining a current upgrading stage according to the upgrading result information and the execution sequence, and executing the step of sending the upgrading instruction to the node to be upgraded so that the node to be upgraded executes the upgrading operation of the current upgrading stage according to the upgrading instruction.
Optionally, the processor, when being configured to execute the program stored in the memory, may further implement any of the foregoing methods for upgrading a distributed system applied to upgrading a standby control node.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components.
In another embodiment of the present invention, a computer-readable storage medium is further provided, in which a computer program is stored, and the computer program, when executed by a processor, implements any of the above-mentioned methods for upgrading a distributed system applied to upgrade a master node.
In another embodiment provided by the present invention, a computer-readable storage medium is further provided, in which a computer program is stored, and the computer program, when executed by a processor, implements any of the above-mentioned methods for upgrading a distributed system applied to upgrading a standby control node.
In yet another embodiment of the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform any of the above-described embodiments of a distributed system upgrade method applied to upgrade a master node.
In a further embodiment of the present invention, there is also provided a computer program product containing instructions, which when run on a computer, causes the computer to perform any one of the above-described embodiments of the method for upgrading a distributed system applied to upgrade a standby control node.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for method, system, device, node, system, computer-readable storage medium, and computer program product embodiments, the description is relatively simple as it is substantially similar to the method embodiments, and reference may be made to some descriptions of the method embodiments for relevant points.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (10)

1. A distributed system upgrading method is characterized in that the method is applied to an upgrading master control node for upgrading a node to be upgraded in a distributed system, and the upgrading master control node is in communication connection with a preset upgrading master control node; the upgrading master control node is in communication connection with the node to be upgraded; the upgrading standby control node is in communication connection with the node to be upgraded; the method comprises the following steps:
determining the current upgrading stage according to the preset execution sequence of different upgrading stages;
sending an upgrading instruction to the node to be upgraded, wherein the upgrading instruction comprises information of a current upgrading stage; so that the node to be upgraded executes the upgrading operation of the current upgrading stage according to the upgrading instruction;
after receiving the upgrade result information of the current upgrade stage returned by the node to be upgraded, synchronizing the current upgrade stage information of the node to be upgraded to the upgrade standby control node; when receiving preset information sent by the node to be upgraded, the upgrading standby control node is switched to a new upgrading main control node, wherein the preset information is sent after the node to be upgraded detects that the upgrading main control node is disconnected;
and determining a current upgrading stage according to the upgrading result information and the execution sequence, and executing the step of sending the upgrading instruction to the node to be upgraded so that the node to be upgraded executes the upgrading operation of the current upgrading stage according to the upgrading instruction.
2. The method according to claim 1, wherein the number of the nodes to be upgraded is plural, and the step of determining a current upgrade stage according to the upgrade result information and the execution sequence and sending the upgrade instruction to the nodes to be upgraded comprises:
for each node to be upgraded, if the node to be upgraded is successfully upgraded in the current upgrading stage, determining the next upgrading stage as the current upgrading stage according to the execution sequence, and executing the step of sending the upgrading instruction to the node to be upgraded; alternatively, the first and second electrodes may be,
and if the nodes to be upgraded are upgraded successfully in the current upgrading stage, determining the next upgrading stage as the current upgrading stage according to the execution sequence, and executing the step of sending upgrading instructions to the nodes to be upgraded.
3. The method according to claim 2, wherein the step of determining a current upgrade stage according to the upgrade result information and the execution sequence, and sending the upgrade instruction to the node to be upgraded is executed, further comprises:
aiming at a node to be upgraded which fails to be upgraded in the current upgrading stage, and the upgrading main control node is not disconnected with the node to be upgraded, sending a recovery instruction to the node to be upgraded so as to recover the node to be upgraded to the state before the current upgrading stage is upgraded; after the node to be upgraded is restored to the state before the current upgrading stage, determining that the upgrading stage before the current upgrading stage is the current upgrading stage, and executing the step of sending the upgrading instruction to the node to be upgraded so that the node to be upgraded executes the upgrading operation of the current upgrading stage according to the upgrading instruction.
4. The method according to claim 1, wherein the number of the nodes to be upgraded is plural; dividing the nodes to be upgraded into a plurality of node groups to be upgraded; each node group to be upgraded corresponds to one upgrading master control node and at least one upgrading standby control node.
5. The method according to claim 1, wherein before the determining a current upgrade stage according to the upgrade result information and the execution sequence, and executing the step of sending the upgrade instruction to the node to be upgraded, the method further comprises:
receiving synchronization information returned by the upgrade standby control node according to a synchronization result;
under the condition that the synchronous information representation is successfully synchronized, determining the current upgrading stage according to the upgrading result information and the execution sequence, and executing the step of sending the upgrading instruction to the node to be upgraded;
under the condition that the synchronization information represents synchronization failure, generating a synchronization failure message so that a user determines whether to continue upgrading according to the synchronization failure message; and when a preset upgrading continuing instruction sent by a user is received, determining the current upgrading stage according to the upgrading result information and the execution sequence, and executing the step of sending the upgrading instruction to the node to be upgraded.
6. A distributed system upgrading method is characterized in that the method is applied to a upgrading standby control node for upgrading a node to be upgraded in a distributed system, the upgrading standby control node is in communication connection with a preset upgrading main control node, and the upgrading standby control node is in communication connection with the node to be upgraded; the upgrade master control node is in communication connection with the node to be upgraded, and the method comprises the following steps:
receiving and storing the current upgrading stage information of the node to be upgraded, which is sent by the upgrading master control node;
when preset information sent by the node to be upgraded is received, switching to a new upgrading main control node, wherein the preset information is sent after the node to be upgraded detects that the node to be upgraded is disconnected from the upgrading main control node;
determining a current upgrading stage according to preset execution sequences of different upgrading stages based on the stored information of the current upgrading stage of the node to be upgraded;
sending an upgrading instruction to the node to be upgraded, wherein the upgrading instruction comprises information of a current upgrading stage; so that the node to be upgraded executes the upgrading operation of the current upgrading stage according to the upgrading instruction;
receiving the upgrade result information of the current upgrade stage returned by the node to be upgraded;
and determining a current upgrading stage according to the upgrading result information and the execution sequence, and executing the step of sending the upgrading instruction to the node to be upgraded so that the node to be upgraded executes the upgrading operation of the current upgrading stage according to the upgrading instruction.
7. A distributed system upgrading device is characterized in that the device is applied to an upgrading master control node for upgrading a node to be upgraded in a distributed system, and the upgrading master control node is in communication connection with a preset upgrading master control node; the upgrading master control node is in communication connection with the node to be upgraded; the upgrading standby control node is in communication connection with the node to be upgraded; the device comprises:
the first determining module is used for determining the current upgrading stage according to the preset execution sequence of different upgrading stages;
the sending module is used for sending an upgrading instruction to the node to be upgraded, and the upgrading instruction comprises information of a current upgrading stage; so that the node to be upgraded executes the upgrading operation of the current upgrading stage according to the upgrading instruction;
the synchronization module is used for synchronizing the information of the current upgrading stage of the node to be upgraded to the upgrading standby control node after receiving the upgrading result information of the current upgrading stage returned by the node to be upgraded; when receiving preset information sent by the node to be upgraded, the upgrading standby control node is switched to a new upgrading main control node, wherein the preset information is sent after the node to be upgraded detects that the upgrading main control node is disconnected;
and the second determining module is used for determining the current upgrading stage according to the upgrading result information and the execution sequence, and executing the step of sending the upgrading instruction to the node to be upgraded so that the node to be upgraded executes the upgrading operation of the current upgrading stage according to the upgrading instruction.
8. A distributed system upgrading device is characterized in that the device is applied to an upgrading standby control node for upgrading a node to be upgraded in a distributed system, the upgrading standby control node is in communication connection with a preset upgrading main control node, and the upgrading standby control node is in communication connection with the node to be upgraded; the upgrade master control node is in communication connection with the node to be upgraded, and the device comprises:
the first receiving module is used for receiving and storing the current upgrading stage information of the node to be upgraded, which is sent by the upgrading main control node;
the switching module is used for switching to a new upgrading main control node when receiving preset information sent by the node to be upgraded, wherein the preset information is sent after the node to be upgraded detects that the node to be upgraded is disconnected with the upgrading main control node;
the first determining module is used for determining the current upgrading stage according to the preset execution sequence of different upgrading stages based on the stored information of the current upgrading stage of the node to be upgraded;
the sending module is used for sending an upgrading instruction to the node to be upgraded, and the upgrading instruction comprises information of a current upgrading stage; so that the node to be upgraded executes the upgrading operation of the current upgrading stage according to the upgrading instruction;
the second receiving module is used for receiving the upgrading result information of the current upgrading stage returned by the node to be upgraded;
and the second determining module is used for determining the current upgrading stage according to the upgrading result information and the execution sequence, and executing the step of sending the upgrading instruction to the node to be upgraded so that the node to be upgraded executes the upgrading operation of the current upgrading stage according to the upgrading instruction.
9. An upgrade master node, comprising: the system comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any one of claims 1-5 when executing a program stored on a memory.
10. An upgrade backup node, comprising: the system comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;
a memory for storing a computer program;
a processor adapted to perform the method steps recited in claim 6 when executing the program stored in the memory.
CN202011225043.1A 2020-11-05 2020-11-05 Distributed system upgrading method, device and node Active CN112437119B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011225043.1A CN112437119B (en) 2020-11-05 2020-11-05 Distributed system upgrading method, device and node

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011225043.1A CN112437119B (en) 2020-11-05 2020-11-05 Distributed system upgrading method, device and node

Publications (2)

Publication Number Publication Date
CN112437119A true CN112437119A (en) 2021-03-02
CN112437119B CN112437119B (en) 2022-03-22

Family

ID=74694718

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011225043.1A Active CN112437119B (en) 2020-11-05 2020-11-05 Distributed system upgrading method, device and node

Country Status (1)

Country Link
CN (1) CN112437119B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114500525A (en) * 2021-12-24 2022-05-13 天翼云科技有限公司 Method, device, computer equipment and medium for updating nodes in distributed system
CN118034750A (en) * 2024-04-12 2024-05-14 成都赛力斯科技有限公司 Upgrade control instruction response method and device, mobile terminal and readable storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2010148739A1 (en) * 2009-06-22 2010-12-29 中兴通讯股份有限公司 Terminal device and upgrade method and system thereof
CN102307113A (en) * 2007-12-28 2012-01-04 华为技术有限公司 System upgrading method, system and device
CN104679604A (en) * 2015-02-12 2015-06-03 大唐移动通信设备有限公司 Method and device for switching between master node and standby node
CN107220197A (en) * 2017-06-19 2017-09-29 郑州云海信息技术有限公司 A kind of dual control storage device master/standby control method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102307113A (en) * 2007-12-28 2012-01-04 华为技术有限公司 System upgrading method, system and device
WO2010148739A1 (en) * 2009-06-22 2010-12-29 中兴通讯股份有限公司 Terminal device and upgrade method and system thereof
CN104679604A (en) * 2015-02-12 2015-06-03 大唐移动通信设备有限公司 Method and device for switching between master node and standby node
CN107220197A (en) * 2017-06-19 2017-09-29 郑州云海信息技术有限公司 A kind of dual control storage device master/standby control method and device

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114500525A (en) * 2021-12-24 2022-05-13 天翼云科技有限公司 Method, device, computer equipment and medium for updating nodes in distributed system
CN114500525B (en) * 2021-12-24 2024-04-26 天翼云科技有限公司 Method, device, computer equipment and medium for updating nodes in distributed system
CN118034750A (en) * 2024-04-12 2024-05-14 成都赛力斯科技有限公司 Upgrade control instruction response method and device, mobile terminal and readable storage medium
CN118034750B (en) * 2024-04-12 2024-06-18 成都赛力斯科技有限公司 Upgrade control instruction response method and device, mobile terminal and readable storage medium

Also Published As

Publication number Publication date
CN112437119B (en) 2022-03-22

Similar Documents

Publication Publication Date Title
EP3493471B1 (en) Data disaster recovery method, apparatus and system
CN112437119B (en) Distributed system upgrading method, device and node
CN112100005B (en) Redis copy set implementation method and device
EP2600565B1 (en) Disaster tolerance service system and disaster tolerance method
CN104679534A (en) System application installation package loading processing method, device and terminal
CN112463448B (en) Distributed cluster database synchronization method, device, equipment and storage medium
CN111478796B (en) Cluster capacity expansion exception handling method for AI platform
CN110727550B (en) Data replication processing method, data replication processing device, disaster recovery system, disaster recovery equipment and storage medium
CN110545207B (en) Synchronous automatic intelligent DNS system and configuration method
CN115658390A (en) Container disaster tolerance method, system, device, equipment and computer readable storage medium
CN111752577B (en) Upgrading method and equipment for system version
CN114130035A (en) User matching method, device, equipment and storage medium
CN111488163B (en) Firmware updating method and device, electronic equipment and storage medium
CN107623705B (en) Storage mode upgrading method, device and system based on video cloud storage system
CN111090537B (en) Cluster starting method and device, electronic equipment and readable storage medium
WO2017080362A1 (en) Data managing method and device
CN108595292B (en) System optimization method, mobile terminal and computer storage medium
CN114676118B (en) Database switching method, device, equipment and storage medium
CN113434354B (en) Bus exception handling method and device, electronic equipment and readable storage medium
CN112491633B (en) Fault recovery method, system and related components of multi-node cluster
CN109510867B (en) Data request processing method and device, storage medium and electronic equipment
CN113890880A (en) Method, system, equipment and storage medium for data synchronization among multiple nodes
CN112612652A (en) Distributed storage system abnormal node restarting method and system
CN111209141A (en) Dual-system switching method and device applied to system iteration
CN109412891B (en) Method and device for detecting client state

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
GR01 Patent grant
GR01 Patent grant