Disclosure of Invention
The embodiment of the application provides a method, equipment, a system, computer equipment and a storage medium for equipment upgrading in a cluster system, which are used for reducing storage space occupied by system upgrading and ensuring the safety of equipment upgrading in the cluster system.
The embodiment of the invention provides a method for upgrading equipment in a cluster system, wherein the cluster system comprises first equipment and second equipment, and the method comprises the following steps:
the first equipment downloads a system upgrade package;
the method comprises the steps that a first device sends a control instruction to a second device to establish a first physical link between the first device and the second device, wherein the second device is a device to be upgraded;
and the first equipment is connected with the second equipment through the first physical link, and system upgrade is carried out on the second equipment according to the system upgrade package.
Further, after the system upgrade is performed on the second device according to the system upgrade package, the method further includes:
the first equipment determines whether the second equipment is upgraded successfully;
and if the first equipment determines that the second equipment is not upgraded successfully, performing system upgrade again on the second equipment according to the system upgrade package until the second equipment is upgraded successfully.
Further, after the first device determines whether the upgrade of the second device is successful, the method further includes:
if the first device determines that the second device is successfully upgraded, the first device receives a control instruction sent by the second device to establish a second physical link between the first device and the second device, wherein the second physical link is used for the second device to perform system upgrade on the first device according to the downloaded system upgrade package.
Specifically, the sending, by the first device, a control instruction to the second device to establish the first physical link between the first device and the second device includes:
the first device sends a power-off instruction to the second device so as to power off the second device;
the first equipment sends a flashing instruction to the second equipment so that the second equipment enters a flashing mode;
the first equipment starts a flash program and sends a power-on instruction to the second equipment so as to power on the second equipment;
the first device establishes a first physical link between the first device and a second device.
The embodiment of the invention provides a device for upgrading equipment in a cluster system, wherein the cluster system comprises first equipment and second equipment, and the device comprises:
the downloading module is used for the first equipment to download the system upgrading package;
a physical link establishing module, configured to send a control instruction to a second device by the first device to establish a first physical link between the first device and the second device, where the second device is a device to be upgraded;
and the upgrading module is used for connecting the first equipment with the second equipment through the first physical link and carrying out system upgrading on the second equipment according to the system upgrading packet.
Further, the apparatus further comprises:
a determining module, configured to determine, by the first device, whether the second device is upgraded successfully;
and the upgrading module is further used for carrying out system upgrading again on the second equipment according to the system upgrading package until the second equipment is upgraded successfully if the first equipment determines that the second equipment is not upgraded successfully.
Further, the upgrade module is further configured to receive a control instruction sent by the second device to establish a second physical link between the first device and the second device if the first device determines that the second device is successfully upgraded, where the second physical link is used for the second device to perform system upgrade on the first device according to the downloaded system upgrade package.
Specifically, the physical link establishing module includes:
a power control pin, configured to send a power-off instruction to the second device by the first device, so as to power off the second device;
the system comprises a flashing control pin, a first device and a second device, wherein the flashing control pin is used for sending a flashing instruction to the second device by the first device so that the second device enters a flashing mode;
the starting unit is used for starting the flash program by the first equipment;
the power control pin is further used for the first device to send a power-on instruction to the second device so that the second device is powered on;
a link establishing unit, configured to establish, by the first device, a first physical link between the first device and a second device.
The embodiment of the invention provides a system for upgrading equipment in a cluster system, wherein the system comprises first equipment and second equipment;
the first equipment is used for downloading the system upgrading package;
the first device is further configured to send a control instruction to the second device to establish a first physical link between the first device and the second device, where the second device is a device to be upgraded;
and the first equipment and the second equipment are connected through the first physical link, and system upgrade is carried out on the second equipment according to the system upgrade package.
Further, the first device is configured to determine whether the second device is upgraded successfully;
and if the first equipment determines that the second equipment is not upgraded successfully, the first equipment is also used for carrying out system upgrade again on the second equipment according to the system upgrade package until the second equipment is upgraded successfully.
Further, if the first device determines that the second device is upgraded successfully, the second device is further configured to download the system upgrade package;
the second device is configured to send a control instruction to the first device to establish a second physical link between the second device and the first device, where the first device is a device to be upgraded;
and the second device is connected with the first device through the second physical link, and carries out system upgrade on the first device according to the system upgrade package, wherein the second physical link is used for carrying out system upgrade on the first device by the second device according to the downloaded system upgrade package.
A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, the processor implementing a method for device upgrade in a cluster system as described above when executing the computer program.
A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the method for upgrading a device in a cluster system as described above.
The invention provides a method, a device, a system, computer equipment and a storage medium for equipment upgrading in a cluster system. Compared with the prior art that each device in the cluster is independently upgraded, the device in the cluster is mutually upgraded, namely the first device upgrades the second device according to the downloaded system upgrade package in the process of upgrading the second device by the first device, and the first device and the second device belong to two different physical devices, and the first device is not upgraded in the process of upgrading the second device, so that the normal operation of the device is not influenced even if the second device fails to be upgraded, and the safety of upgrading the device in the cluster system is ensured while the storage space occupied by upgrading the system is reduced.
Detailed Description
In order to better understand the technical solutions described above, the technical solutions of the embodiments of the present application are described in detail below with reference to the drawings and the specific embodiments, and it should be understood that the specific features of the embodiments and the embodiments of the present application are detailed descriptions of the technical solutions of the embodiments of the present application, and are not limitations of the technical solutions of the present application, and the technical features of the embodiments and the embodiments of the present application may be combined with each other without conflict.
The invention aims to provide a method, a device, a system, computer equipment and a storage medium for upgrading equipment in a cluster system, wherein mutual upgrading is carried out on the equipment in an equipment cluster, for example, a cluster of 100 modules is divided into A, B groups, the A group of equipment firstly upgrades the B group of equipment through a physical fan link, and if the upgrading fails, the A group of equipment upgrades the B group of equipment again. If the upgrade is successful, the group B device continues to upgrade the group A device in reverse, and similarly, if the upgrade fails, the group B device can refresh the storage of the group A device. Therefore, the safety of the upgrading process is ensured, and the storage space in the equipment is saved.
The following embodiments may be applied to the system for upgrading devices in the cluster system shown in fig. 1, where the system shown in fig. 1 includes a first device 10 and at least one second device 20 physically connected to the first device 10. The following description will take the first device 10 as an example to upgrade the second device 20:
the first device 10 is used for downloading a system upgrade package;
the first device 10 is configured to send a control instruction to the second device 20 to establish a first physical link between the first device 10 and the second device 20, where the second device 20 is a device to be upgraded;
the first device 10 is connected to the second device 20 through the first physical link, and performs system upgrade on the second device 20 according to the system upgrade package.
The link for data transmission between the first device 10 and the second device 20 is a full-duplex or half-duplex data bus, including but not limited to USB and UART.
It should be noted that, during the upgrade process of the second device 20 by the first device 10, unexpected situations such as power failure of the second device 20 may occur, so that the upgrade of the second device 20 is unsuccessful. Therefore, after the first device 10 of the present system performs system upgrade on the second device 20, it needs to determine whether the upgrade of the second device 20 is successful, and if the upgrade of the second device 20 is unsuccessful, the first device 10 needs to upgrade the second device again until the upgrade of the second device 20 is successful.
If it is determined that the second device 20 is successfully upgraded, the identity of the first device 10 and the identity of the second device 20 need to be exchanged, that is, the second device 20 upgrades the first device 10. Specifically, after determining that the second device 20 is upgraded successfully, the second device 20 downloads a system upgrade package, then the second device 20 sends a control instruction to the first device 10 to establish a physical link between the second device 20 and the first device 10, at this time, the first device 10 is a device to be upgraded, then the second device 20 connects to the first device 10 through the physical link, and performs system upgrade on the first device 10 according to the downloaded system upgrade package, and if it is determined that the upgrade of the first device 10 fails, the second device 20 performs upgrade on the first device 10 again until the upgrade of the first device 10 succeeds.
As shown in fig. 2, which is a link interface between the first device 10 and the second device 20, the present invention mainly establishes the first physical link between the first device 10 and the second device 20 through the link interface shown in fig. 2, and mainly establishes the following steps:
wherein Tx and Rx represent data transmitting ports and data receiving ports of the first device 10 and the second device 20, typical interfaces have USB, UART, I2C, etc., and embodiments of the present invention are not limited in detail.
Pwr _ ctl is a power control pin and is used for controlling whether opposite-end equipment is powered on or not;
pwr _ pin is a power switch, and once a level signal is received, the power switch is powered off or on;
DA _ ctl is a control pin of the flashing machine and controls whether the opposite-end equipment enters a flashing mode or not;
DA _ pin is a pin of the flash, and if the signal is detected to be low level, the mode enters a forced flash mode.
In this embodiment of the present invention, the specific process of establishing the first link between the first device 10 and the second device 20 is as follows: the first device 10 first sets the power control pin Pwr _ ctl to be pulled low, that is, controls the second device 20 to enter the power-off mode, then the first device 10 sets the refresh control pin DA _ ctl to be pulled low, that is, controls the second device 20 to enter the refresh mode, then the first device 10 starts the refresh program, and sets the power control pin Pwr _ ctl to be pulled high, that is, controls the second device 20 to enter the power-on mode. Then, the first device 10 connects to the second device 20 through the established physical link, and performs system upgrade on the second device 20 according to the system upgrade package.
The specific process of establishing the second link between the first device 10 and the second device 20 is as follows: the second device 20 first sets the power control pin Pwr _ ctl to be pulled low, i.e. controls the first device 10 to enter the power-off mode, then the second device 20 sets the refresh control pin DA _ ctl to be pulled low, i.e. controls the first device 10 to enter the refresh mode, then the second device 20 starts the refresh program, and sets the power control pin Pwr _ ctl to be pulled high, i.e. controls the first device 10 to enter the power-on mode. Thereafter, the second device 20 connects to the first device 10 through the established physical link, and performs system upgrade on the first device 10 according to the system upgrade package.
The invention provides a system for upgrading equipment in a cluster system, wherein in the process of upgrading second equipment by first equipment, the first equipment firstly downloads a system upgrading package, then sends a control instruction to the second equipment to establish a physical link between the first equipment and the second equipment, and then the first equipment is connected with the second equipment through the physical link and carries out system upgrading on the second equipment according to the system upgrading package. Compared with the existing cluster in which each device is independently upgraded, the cluster equipment upgrading method and the cluster equipment upgrading device have the advantages that the devices in the cluster equipment are mutually upgraded, namely the first device upgrades the second device according to the downloaded system upgrading package in the process of upgrading the second device by the first device, the first device and the second device belong to two different physical devices, and the first device is not upgraded in the process of upgrading the second device, so that the normal operation of the device cannot be influenced even if the second device fails to be upgraded, and the cluster equipment upgrading device can ensure the safety of the device upgrading in the cluster system while reducing the storage space occupied by the system upgrading.
Referring to fig. 3, a method for upgrading a device in a cluster system according to a first embodiment of the present invention is shown, which is applicable to any device in a system for upgrading a device in the cluster system. The method can be implemented by hardware and/or software in the system for upgrading the devices in the cluster system, and specifically includes steps S01-S03.
And S01, the first device downloads the system upgrade package.
S02, the first device sends a control instruction to a second device to establish a first physical link between the first device and the second device, and the second device is a device to be upgraded.
In this embodiment of the present invention, a method for a first device to send a control instruction to a second device to establish a first physical link between the first device and the second device includes: the first device sends a power-off instruction to the second device so as to power off the second device; the first equipment sends a flashing instruction to the second equipment so that the second equipment enters a flashing mode; the first equipment starts a flash program and sends a power-on instruction to the second equipment so as to power on the second equipment; a first device establishes a physical link between the first device and a second device.
Specifically, as shown in fig. 2, what is included in the description is a link interface between the first device 10 and the second device 20, the present invention mainly establishes a physical link between the first device 10 and the second device 20 through the link interface shown in fig. 2, and mainly establishes the physical link through the following manners:
wherein Tx and Rx represent data transmitting ports and data receiving ports of the first device 10 and the second device 20, typical interfaces have USB, UART, I2C, etc., and embodiments of the present invention are not limited in detail.
Pwr _ ctl is a power control pin and is used for controlling whether opposite-end equipment is powered on or not;
pwr _ pin is a power switch, and once a level signal is received, the power switch is powered off or on;
DA _ ctl is a control pin of the flashing machine and controls whether the opposite-end equipment enters a flashing mode or not;
DA _ pin is a pin of the flash, and if the signal is detected to be low level, the mode enters a forced flash mode.
In the embodiment of the present invention, the specific process of establishing the link between the first device 10 and the second device 20 is as follows: the first device 10 first sets the power control pin Pwr _ ctl to be pulled low, that is, controls the second device 20 to enter the power-off mode, then the first device 10 sets the refresh control pin DA _ ctl to be pulled low, that is, controls the second device 20 to enter the refresh mode, then the first device 10 starts the refresh program, and sets the power control pin Pwr _ ctl to be pulled high, that is, controls the second device 20 to enter the power-on mode. Then, the first device 10 connects to the second device 20 through the established physical link, and performs system upgrade on the second device 20 according to the system upgrade package.
And S03, the first device is connected with the second device through the first physical link, and system upgrade is carried out on the second device according to the system upgrade package.
The link for data transmission between the first device and the second device is a full-duplex or half-duplex data bus, including but not limited to USB and UART.
The invention provides a method for upgrading equipment in a cluster system, wherein in the process of upgrading second equipment by first equipment, the first equipment firstly downloads a system upgrading package, then sends a control instruction to the second equipment to establish a physical link between the first equipment and the second equipment, and then the first equipment is connected with the second equipment through the physical link and carries out system upgrading on the second equipment according to the system upgrading package. Compared with the existing cluster in which each device is independently upgraded, the cluster equipment upgrading method and the cluster equipment upgrading device have the advantages that the devices in the cluster equipment are mutually upgraded, namely the first device upgrades the second device according to the downloaded system upgrading package in the process of upgrading the second device by the first device, the first device and the second device belong to two different physical devices, and the first device is not upgraded in the process of upgrading the second device, so that the normal operation of the device cannot be influenced even if the second device fails to be upgraded, and the cluster equipment upgrading device can ensure the safety of the device upgrading in the cluster system while reducing the storage space occupied by the system upgrading.
As shown in fig. 4, in an embodiment provided in the present invention, after performing a system upgrade on the second device according to the system upgrade package, the method further includes:
s04, the first device determines whether the second device is upgraded successfully.
And S05A, if the first equipment determines that the second equipment is not upgraded successfully, performing system upgrade again on the second equipment according to the system upgrade package until the second equipment is upgraded successfully.
S05B, if the first device determines that the second device is upgraded successfully, the first device receives a control instruction sent by the second device to establish a second physical link between the first device and the second device, wherein the second physical link is used for the second device to upgrade the system of the first device according to the downloaded system upgrade package.
It should be noted that, in the process of upgrading the first device 10 by the second device 20, the content of the link established between the second device 20 and the first device 10 is the same as the content of the link established between the first device 10 and the second device 20, and details of the embodiment of the present invention are not described herein again.
As shown in fig. 5, which is a flowchart of a method for upgrading devices in a cluster system according to an embodiment of the present invention, a group a device in the flowchart first upgrades a group B device, and after the group B device is successfully upgraded, the group B device then upgrades the group a device, and the specific content is as follows:
the group A device downloads a flash package firstly, then the group A device sets a power control pin Pwr _ ctl to be pulled low, namely, the group B device is controlled to enter a power-off mode, then the group A device sets a flash control pin DA _ ctl to be pulled low, namely, the group B device is controlled to enter a flash mode, then the group A device starts a flash program, and sets the power control pin Pwr _ ctl to be pulled high, namely, the group B device is controlled to enter a power supply mode. And C, the group A equipment performs the brushing on the group B equipment according to the brushing package, determines whether the group B equipment is successful in brushing, and if the group B equipment is unsuccessful in brushing, jumps to the step A to pull down the power supply control pin Pwr _ ctl to continue to execute downwards until the group B equipment is successful in brushing.
If the group B equipment is determined to be successful in refreshing, the group B equipment downloads a refreshing package firstly, then the group B equipment sets a power supply control pin Pwr _ ctl to be pulled down, namely, the group A equipment is controlled to enter a power-off mode, then the group B equipment sets a refreshing control pin DA _ ctl to be pulled down, namely, the group A equipment is controlled to enter a refreshing mode, then the group B equipment starts a refreshing program, and sets the power supply control pin Pwr _ ctl to be pulled up, namely, the group A equipment is controlled to enter a power supply mode. And B, the group B device performs the brushing on the group A device according to the brushing package, determines whether the group A device is successful in brushing, and if the group A device is unsuccessful in brushing, jumps to the step B device to set the power supply control pin Pwr _ ctl to be pulled down and continues to be executed downwards until the group A device is successful in brushing.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.
In an embodiment, an apparatus for upgrading devices in a cluster system is provided, and the apparatus corresponds to the method for upgrading devices in the cluster system in the foregoing embodiment one to one. As shown in fig. 6, the cluster system includes a first device and a second device, and the apparatus includes: a download module 10, a physical link establishing module 20, and an upgrade module 30. The functional modules are explained in detail as follows:
a downloading module 10, configured to download, by the first device, the system upgrade package;
a physical link establishing module 20, configured to send a control instruction to a second device by a first device to establish a first physical link between the first device and the second device, where the second device is a device to be upgraded;
and the upgrading module 30 is configured to connect the first device to the second device through the first physical link, and perform system upgrading on the second device according to the system upgrading packet.
Further, the apparatus further comprises:
a determining module 40, configured to determine, by the first device, whether the second device is successfully upgraded;
the upgrade module 30 is further configured to, if the first device determines that the second device is not successfully upgraded, perform system upgrade again on the second device according to the system upgrade package until the second device is successfully upgraded.
The upgrade module 30 is further configured to receive a control instruction sent by the second device to establish a second physical link between the first device and the second device if the first device determines that the second device is successfully upgraded, where the second physical link is used for the second device to perform system upgrade on the first device according to the downloaded system upgrade package.
Specifically, the physical link establishing module 20 includes:
a power control pin 21, configured to send a power-off instruction to the second device by the first device, so as to power off the second device;
a flush control pin 22, configured to send a flush instruction to the second device by the first device, so that the second device enters a flush mode;
a starting unit 23, configured to start a flash program by the first device;
the power control pin 21 is further configured to send a power-on instruction to the second device by the first device, so that the second device is powered on;
a link establishing unit 24, configured to establish a first physical link between the first device and the second device.
For specific limitations of the device, reference may be made to the above limitations of the method for upgrading the device in the cluster system, and details are not described here. The various modules in the above-described apparatus may be implemented in whole or in part by software, hardware, and combinations thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a server, the internal structure of which may be as shown in fig. 7. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a method for device upgrade in a cluster system.
In one embodiment, a computer device is provided, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the following steps when executing the computer program:
the first equipment downloads a system upgrade package;
the method comprises the steps that a first device sends a control instruction to a second device to establish a first physical link between the first device and the second device, wherein the second device is a device to be upgraded;
and the first equipment is connected with the second equipment through the first physical link, and system upgrade is carried out on the second equipment according to the system upgrade package.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of:
the first equipment downloads a system upgrade package;
the method comprises the steps that a first device sends a control instruction to a second device to establish a first physical link between the first device and the second device, wherein the second device is a device to be upgraded;
and the first equipment is connected with the second equipment through the first physical link, and system upgrade is carried out on the second equipment according to the system upgrade package.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions.
The above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present invention, and are intended to be included within the scope of the present invention.