CN116821144A - Upgrading method, device, equipment and storage medium - Google Patents

Upgrading method, device, equipment and storage medium Download PDF

Info

Publication number
CN116821144A
CN116821144A CN202310798281.9A CN202310798281A CN116821144A CN 116821144 A CN116821144 A CN 116821144A CN 202310798281 A CN202310798281 A CN 202310798281A CN 116821144 A CN116821144 A CN 116821144A
Authority
CN
China
Prior art keywords
copies
pods
pod
slave
configuration file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310798281.9A
Other languages
Chinese (zh)
Inventor
柯煜昌
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Qingyun Science And Technology Co ltd
Original Assignee
Beijing Qingyun Science And Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Qingyun Science And Technology Co ltd filed Critical Beijing Qingyun Science And Technology Co ltd
Priority to CN202310798281.9A priority Critical patent/CN116821144A/en
Publication of CN116821144A publication Critical patent/CN116821144A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2379Updates performed during online database operations; commit processing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Computer Security & Cryptography (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses an upgrading method, device, equipment and storage medium. The method comprises the following steps: acquiring the number of copies and the current number of copies in a configuration file; determining a copy number state according to the copy number and the current copy number in the configuration file; according to the POD in the database cluster, the POD is updated according to the copy number state, and by the technical scheme of the invention, the zero downtime of the database cluster can be updated under the condition that the service availability is not affected, and the safety and the availability of the updating are ensured.

Description

Upgrading method, device, equipment and storage medium
Technical Field
The embodiment of the invention relates to the technical field of computers, in particular to an upgrading method, device, equipment and storage medium.
Background
The database is in a basic position in a service system, and reliable data assurance and data support are provided for the service system. In the process of operating and maintaining the database, the database is inevitably expanded and upgraded.
In the traditional database operation and maintenance technology, upgrading and expanding are carried out, and shutdown is inevitably required, so that service is not available. The additional costs and service interruption losses are often very large and even unacceptable. Therefore, in order to guarantee service availability, a rolling upgrade scheme is proposed.
In the conventional scheme of rolling upgrading of the database cluster, during the rolling upgrading process, the main POD of the database cluster is easily deleted, so that service data is interrupted, and fatal faults such as inconsistent data occur.
Disclosure of Invention
The embodiment of the invention provides an upgrading method, device, equipment and storage medium, which can realize zero downtime upgrading of a database cluster under the condition of not influencing service availability, and ensure the safety and availability of the upgrading.
According to an aspect of the present invention, there is provided an upgrade method including:
acquiring the number of copies and the current number of copies in a configuration file;
determining a copy number state according to the copy number and the current copy number in the configuration file;
and upgrading the PODs in the database cluster according to the copy number state.
According to another aspect of the present invention, there is provided an upgrade apparatus including:
the cost acquisition module is used for acquiring the cost and the current cost in the configuration file;
the copy number state determining module is used for determining the copy number state according to the copy number in the configuration file and the current copy number;
and the upgrading module is used for upgrading the PODs in the database cluster according to the duplicate number state.
According to another aspect of the present invention, there is provided an electronic apparatus including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein, the liquid crystal display device comprises a liquid crystal display device,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the upgrade method of any one of the embodiments of the present invention.
According to another aspect of the present invention, there is provided a computer readable storage medium storing computer instructions for causing a processor to execute an upgrade method according to any one of the embodiments of the present invention.
The embodiment of the invention obtains the number of the copies and the current number of the copies in the configuration file; determining a copy number state according to the copy number and the current copy number in the configuration file; the PODs in the database cluster are updated according to the copy number state, so that the zero-shutdown time updating of the containerized database can be realized under the condition that service availability is not affected, and the safety and availability of updating are ensured.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the invention or to delineate the scope of the invention. Other features of the present invention will become apparent from the description that follows.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the embodiments will be briefly described below, it being understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and other related drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of an upgrade method in an embodiment of the present invention;
FIG. 2 is a topology diagram of a K8s high availability database cluster in an embodiment of the invention;
FIG. 3 is a flow chart of another upgrade method in an embodiment of the present invention;
FIG. 4 is a schematic diagram of an upgrade apparatus according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device in an embodiment of the present invention.
Detailed Description
In order that those skilled in the art will better understand the present invention, a technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present invention and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It will be appreciated that prior to using the technical solutions disclosed in the embodiments of the present disclosure, the user should be informed and authorized of the type, usage range, usage scenario, etc. of the personal information related to the present disclosure in an appropriate manner according to the relevant legal regulations.
Example 1
Fig. 1 is a flowchart of an upgrade method provided in an embodiment of the present invention, where the present embodiment is applicable to a case of upgrading a POD in a database cluster, the method may be performed by an upgrade apparatus in the embodiment of the present invention, and the apparatus may be implemented in a software and/or hardware manner, as shown in fig. 1, and the method specifically includes the following steps:
s110, obtaining the number of the copies and the current number of the copies in the configuration file.
The configuration file may be a yaml file, the configuration file is a configuration file for a database cluster, and the configuration file may include: the total number of PODs, and attribute information of each POD, etc.
Specifically, the method for obtaining the current copy number may be: acquiring the number of PODs with target prefixes; the number of PODs whose prefixes are target prefixes is determined as the current number of copies. Wherein the target prefix may be sample-mysql.
Specifically, the method for obtaining the number of copies in the configuration file may be: and acquiring the total number of PODs in the configuration file, and determining the total number of PODs in the configuration file as the number of copies in the configuration file.
S120, determining the copy number state according to the copy number and the current copy number in the configuration file.
Wherein the duplicate number state may include: any one of an increase in the number of copies, a constant number of copies, and a decrease in the number of copies; the copy number state may further include: any one of the number of copies increases, the number of copies is unchanged, the number of copies decreases and is not 2, and the number of copies decreases to 2.
Specifically, the manner of determining the copy number state according to the copy number and the current copy number in the configuration file may be: if the number of copies in the configuration file is larger than the current number of copies, determining that the state of the number of copies is that the number of copies is increased; if the number of copies in the configuration file is equal to the current number of copies, determining that the state of the number of copies is unchanged; and if the number of copies in the configuration file is smaller than the current number of copies, determining that the state of the number of copies is that the number of copies is reduced. Specifically, the mode of determining the copy number state according to the copy number and the current copy number in the configuration file may further be: if the number of copies in the configuration file is larger than the current number of copies, determining that the state of the number of copies is that the number of copies is increased; if the number of copies in the configuration file is equal to the current number of copies, determining that the state of the number of copies is unchanged; if the number of copies in the configuration file is smaller than the current number of copies and the number of copies in the configuration file is larger than 2, determining that the state of the number of copies is that the number of copies is reduced and not 2; if the number of copies in the configuration file is smaller than the current number of copies and the number of copies in the configuration file is equal to 2, determining that the state of the number of copies is that the number of copies is reduced to 2.
And S130, upgrading the PODs in the database cluster according to the copy number state.
Specifically, the method for upgrading the POD in the database cluster according to the duplicate number state may be: if the state of the number of copies is that the number of copies is increased, keeping the original POD unchanged, and directly cloning data according to the POD; if the state of the copy number is that the copy number is unchanged, upgrading each slave POD in sequence, and after all the slave PODs are successfully upgraded, upgrading the master POD; if the duplicate number state is that the duplicate number is reduced, determining the number of the to-be-deleted secondary PODs according to the difference value between the current duplicate number and the duplicate number in the configuration file, and deleting the secondary PODs according to the number of the to-be-deleted secondary PODs. Specifically, the method for upgrading the POD in the database cluster according to the duplicate number state may further be: if the state of the number of copies is that the number of copies is increased, the original POD is kept unchanged, and a new slave POD is created according to the difference value between the number of copies in the configuration file and the current number of copies and the slave POD; if the copy number state is that the copy number is unchanged, each slave POD is updated in sequence, after all the slave PODs are updated successfully, the master POD is updated, if the fact that the original master POD is unavailable is detected through a high availability component, one POD is selected from the updated slave PODs through the high availability component to serve as a new master POD, and the original master POD is added into a database cluster according to the identity of the slave POD; if the high availability component detects that the original main POD is available, the main POD does not need to be selected again, and the identity of the original main POD is kept unchanged; if the state of the number of copies is that the number of copies is reduced, determining the number of secondary PODs to be deleted according to the difference between the current number of copies and the number of copies in the configuration file, deleting the secondary PODs according to the number of secondary PODs to be deleted, selecting a new primary POD from all PODs through a high availability component if the primary POD is detected to be unavailable through the high availability component, determining the rest PODs as secondary PODs, and keeping the identity of the primary POD unchanged without selecting the primary POD again if the primary POD is detected to be available through the high availability component.
Optionally, determining the copy number state according to the copy number and the current copy number in the configuration file includes:
if the number of copies in the configuration file is larger than the current number of copies, determining that the state of the number of copies is that the number of copies is increased;
if the number of copies in the configuration file is equal to the current number of copies, determining that the state of the number of copies is unchanged;
and if the number of copies in the configuration file is smaller than the current number of copies, determining that the state of the number of copies is that the number of copies is reduced.
It should be noted that, if the number of copies in the configuration file is smaller than the current number of copies, determining that the state of the number of copies is the reduction of the number of copies may include: if the number of copies in the configuration file is smaller than the current number of copies and the number of copies in the configuration file is larger than 2, determining that the state of the number of copies is that the number of copies is reduced and not 2; if the number of copies in the configuration file is smaller than the current number of copies and the number of copies in the configuration file is equal to 2, determining that the state of the number of copies is that the number of copies is reduced to 2.
Optionally, upgrading the POD in the database cluster according to the duplicate number state includes:
if the state of the number of copies is that the number of copies is increased, the original POD is kept unchanged, and a new slave POD is created according to the difference value between the number of copies in the configuration file and the current number of copies and the slave POD;
if the state of the copy number is that the copy number is unchanged, upgrading each slave POD in sequence, and after all the slave PODs are successfully upgraded, upgrading the master POD;
if the duplicate number state is that the duplicate number is reduced, determining the number of the to-be-deleted secondary PODs according to the difference value between the current duplicate number and the duplicate number in the configuration file, and deleting the secondary PODs according to the number of the to-be-deleted secondary PODs.
Specifically, the mode of keeping the original POD unchanged is: the original master POD in the database cluster is kept unchanged, and the original slave POD is kept unchanged.
Specifically, the manner of creating a new slave POD from the POD according to the difference between the number of copies in the configuration file and the current number of copies may be: the new slave POD is added according to the original slave POD, and the new slave POD is the same as the original slave POD.
The method for upgrading the slave POD comprises the following steps: the original slave PODs in the database cluster are deleted, and a new slave POD is created according to the configuration file. The main POD may be upgraded in the following manner: and deleting the original main POD in the database cluster, and creating a new main POD according to the configuration file.
Specifically, each slave POD is upgraded in turn, and after all the slave PODs are upgraded successfully, the mode of upgrading the master POD may be: and upgrading each slave POD in the database cluster in turn according to the randomly selected sequence, and upgrading the master POD after all the slave PODs are successfully upgraded. For example, the database cluster may include: sample-mysql-0 (original POD), sample-mysql-1 (original POD 1), sample-mysql-2 (original POD 2), if the number of copies in the configuration file is 3 and the current number of copies is 3, determining that the state of the number of copies is unchanged, upgrading sample-mysql-1 first, after the sample-mysql-1 is successfully upgraded, upgrading sample-mysql-2, and after the sample-mysql-2 is successfully upgraded, upgrading sample-mysql-0.
Specifically, if the duplicate number state is that the duplicate number is reduced, determining the number of secondary PODs to be deleted according to the difference between the current duplicate number and the duplicate number in the configuration file, and deleting the secondary PODs according to the number of secondary PODs to be deleted may be: if the copy number state is that the copy number is reduced and the copy number in the configuration file is more than 2, determining the number of the secondary PODs to be deleted according to the difference value between the current copy number and the copy number in the configuration file; the slave PODs are deleted according to the number of slave PODs to be deleted. If the copy number state is that the copy number is reduced and the copy number in the configuration file is equal to 2, setting the main POD to a read-only mode; when the data in the slave PODs are consistent with the data in the master PODs, determining the number of the slave PODs to be deleted according to the difference value between the current number of the copies and the number of the copies in the configuration file; the slave PODs are deleted according to the number of slave PODs to be deleted. Specifically, if the duplicate number state is that the duplicate number is reduced, determining the number of secondary PODs to be deleted according to the difference between the current duplicate number and the duplicate number in the configuration file, and deleting the secondary PODs according to the number of secondary PODs to be deleted may further be: if the state of the copy number is that the copy number is reduced and is not 2, determining the number of the secondary PODs to be deleted according to the difference value of the current copy number and the copy number in the configuration file; the slave PODs are deleted according to the number of slave PODs to be deleted. If the state of the number of copies is that the number of copies is reduced and is 2, setting the main POD to a read-only mode; when the data in the slave PODs are consistent with the data in the master PODs, determining the number of the slave PODs to be deleted according to the difference value between the current number of the copies and the number of the copies in the configuration file; the slave PODs are deleted according to the number of slave PODs to be deleted.
Optionally, if the copy number status is that the copy number is unchanged, upgrading each slave POD in turn, after all slave PODs are successfully upgraded, after upgrading the master POD, further including:
if the high availability component detects that the original main POD is unavailable, selecting one POD from the successfully upgraded auxiliary PODs as a new main POD by the high availability component, and adding the original main POD into the database cluster according to the identity of the auxiliary POD.
Wherein, the unavailability of the original main POD means that the original main POD cannot access, or access timeout, etc.
Wherein the high availability component may be xenon.
If the original POD is not available, the original POD needs to be selected again, and if the original POD is available, the original POD does not need to be selected again, and the identity of the original POD is kept unchanged.
In a specific example, if the original primary POD is detected as unavailable by xenon, selecting one POD from the successfully upgraded secondary PODs by xenon as a new primary POD, and adding the original primary POD to the database cluster with the secondary POD identity.
Optionally, if the duplicate number state is that the duplicate number is reduced, determining the number of secondary PODs to be deleted according to the difference between the current duplicate number and the duplicate number in the configuration file, and deleting the secondary PODs according to the number of secondary PODs to be deleted, further including:
if the high availability component detects that the original main POD is not available, the high availability component selects a new main POD from all PODs, and the rest PODs are determined as slave PODs.
Wherein, all PODs are all PODs in the database cluster. For example, if the current number of copies is 5 and the number of copies in the configuration file is 3, it may be determined that the difference between the current number of copies and the number of copies in the configuration file is 2, 2 slave PODs in the database cluster are deleted, and 1 master POD (a) and 2 slave PODs (B and C) remain in the database cluster. If the master POD is not available, then a and C are determined to be slave PODs by selecting a new master POD (B) from A, B, C by the high availability component.
Wherein the remaining PODs are other PODs in the database cluster than the new primary POD.
If the original POD is not available, the original POD needs to be selected again, and if the original POD is available, the original POD does not need to be selected again, and the identity of the original POD is kept unchanged.
In a specific example, if the original primary POD is detected as not being available through xenon, a new primary POD is selected from all PODs through xenon, and the remaining PODs are determined as secondary PODs.
Optionally, if the duplicate number state is that the duplicate number is reduced, determining the number of secondary PODs to be deleted according to the difference between the current duplicate number and the duplicate number in the configuration file, and deleting the secondary PODs according to the number of secondary PODs to be deleted includes:
if the copy number state is that the copy number is reduced and the copy number in the configuration file is more than 2, determining the number of the secondary PODs to be deleted according to the difference value between the current copy number and the copy number in the configuration file;
the slave PODs are deleted according to the number of slave PODs to be deleted.
Optionally, if the duplicate number state is that the duplicate number is reduced, determining the number of secondary PODs to be deleted according to the difference between the current duplicate number and the duplicate number in the configuration file, and deleting the secondary PODs according to the number of secondary PODs to be deleted includes:
if the copy number state is that the copy number is reduced and the copy number in the configuration file is equal to 2, setting the main POD to a read-only mode;
when the data in the slave PODs are consistent with the data in the master PODs, determining the number of the slave PODs to be deleted according to the difference value between the current number of the copies and the number of the copies in the configuration file;
the slave PODs are deleted according to the number of slave PODs to be deleted.
In order to ensure that the data in the slave POD and the data in the master POD agree, the master POD needs to be set to the read-only mode first. The precondition for deleting a slave POD is that all the data in the slave PODs in the database cluster are consistent with the data in the master POD. That is, after all the data in the slave PODs in the database cluster are consistent with the data in the master POD, the slave PODs are deleted, so that the security of the data can be ensured.
Optionally, obtaining the current number of copies includes:
acquiring the number of PODs with target prefixes;
the number of PODs whose prefixes are target prefixes is determined as the current number of copies.
If the cluster name is sample, the target prefix may be sample-mysql.
In a specific example, fig. 2 is a topology diagram of a K8s high availability database cluster, as shown in fig. 2, the database cluster includes: a master POD (sample-mysql-0), a slave POD1 (sample-mysql-1), and a slave POD2 (sample-mysql-2). Wherein sample-mysql-0 to sample-mysql-2 are names of Pod assigned by statefulset for K8 s. The container composition of the main POD includes: mySQL database containers, xenon is a high availability component container, as well as other functional containers. As can be seen from fig. 2, the current copy number is 3, and if the copy number in the configuration file is 3, the copy number state is determined to be unchanged, and the upgrading process is as follows: step 1, upgrading sample-mysql-1; step 2, after the sample-mysql-1 is successfully upgraded, upgrading another slave POD, namely sample-mysql-2; step 3, after the sample-mysql-2 is successfully upgraded, upgrading the main POD, namely the sample-mysql-0; and 4, after the sample-mysql-0 is successfully upgraded, selecting the sample-mysql-1 by xenon as a new master POD, and modifying the identity of the sample-mysql-0 into a slave POD.
The database cluster provided by the embodiment of the invention can be a radondb-MySQL-kubernetes open source item, and xenon is a MySQL high availability and replication management middleware based on a Raft protocol.
In another specific example, as shown in FIG. 3, an embodiment of the present invention is directed to implementing a secure rolling upgrade of a database. Different from the original rolling upgrade mode of K8s, the embodiment of the invention customizes the upgrade rule to ensure the safety and usability of the data, and processes the following cases respectively:
case 1: and the number of copies is increased, and capacity expansion is performed. In this case, a method of adding copies is adopted, the original Pod is kept unchanged, and a new slave Pod is directly created by cloning data from the Pod node.
Case 2: the number of the copies is unchanged, and the copies are updated. At this point, some modification of the system is required. The Operator first handles the slave POD: the slave POD is deleted, and after the slave POD is successfully upgraded, the next slave POD is processed. After all the slave PODs are processed, deleting the master POD and waiting for the master POD to be upgraded. At this time, the high availability component container (the component is the open source high availability component xenon) will select a new master POD from the slave PODs, and the original master POD will be added to the database cluster with the identity of the slave POD.
Case 3: the number of copies is reduced, but the number of copies is not 2. In this case, the slave POD is selected to be deleted and the master POD is reselected, and the original master POD is added to the database cluster with the identity of the slave POD.
Case 4: the number of copies was reduced to 2. At this point, the Raft cluster will be converted to a pure master-slave cluster. First, it is necessary to set the master POD to a read-only mode, and delete the slave POD after waiting for the data in the slave POD to coincide with the data in the master POD. Next, a new master POD is selected by the high availability component xenon, and the remaining PODs are determined to be slave PODs.
Through the processing mode, the safe rolling upgrading of the database is realized, and the safety and the usability of the data are ensured.
According to the technical scheme, the number of the copies and the current number of the copies in the configuration file are obtained; determining a copy number state according to the copy number and the current copy number in the configuration file; the PODs in the database cluster are updated according to the copy number state, so that the zero-shutdown time updating of the containerized database can be realized under the condition that service availability is not affected, and the safety and availability of updating are ensured.
Example two
Fig. 4 is a schematic structural diagram of an upgrade apparatus according to an embodiment of the present invention. The embodiment may be applicable to the case of upgrading the POD in the database cluster, where the apparatus may be implemented in a software and/or hardware manner, and the apparatus may be integrated in any device that provides an upgrade function, as shown in fig. 4, where the upgrade apparatus specifically includes: a copy number acquisition module 210, a copy number status determination module 220, and an upgrade module 230.
The copy number acquisition module is used for acquiring the copy number and the current copy number in the configuration file;
the copy number state determining module is used for determining the copy number state according to the copy number in the configuration file and the current copy number;
and the upgrading module is used for upgrading the PODs in the database cluster according to the duplicate number state.
The product can execute the method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
According to the technical scheme, the number of the copies and the current number of the copies in the configuration file are obtained; determining a copy number state according to the copy number and the current copy number in the configuration file; the PODs in the database cluster are updated according to the copy number state, so that the zero-shutdown time updating of the containerized database can be realized under the condition that service availability is not affected, and the safety and availability of updating are ensured.
Example III
Fig. 5 shows a schematic diagram of the structure of an electronic device 10 that may be used to implement an embodiment of the invention. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. Electronic equipment may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the inventions described and/or claimed herein.
As shown in fig. 5, the electronic device 10 includes at least one processor 11, and a memory, such as a Read Only Memory (ROM) 12, a Random Access Memory (RAM) 13, etc., communicatively connected to the at least one processor 11, in which the memory stores a computer program executable by the at least one processor, and the processor 11 may perform various appropriate actions and processes according to the computer program stored in the Read Only Memory (ROM) 12 or the computer program loaded from the storage unit 18 into the Random Access Memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 may also be stored. The processor 11, the ROM 12 and the RAM 13 are connected to each other via a bus 14. An input/output (I/O) interface 15 is also connected to bus 14.
Various components in the electronic device 10 are connected to the I/O interface 15, including: an input unit 16 such as a keyboard, a mouse, etc.; an output unit 17 such as various types of displays, speakers, and the like; a storage unit 18 such as a magnetic disk, an optical disk, or the like; and a communication unit 19 such as a network card, modem, wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunication networks.
The processor 11 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, digital Signal Processors (DSPs), and any suitable processor, controller, microcontroller, etc. The processor 11 performs the various methods and processes described above, such as the upgrade method.
In some embodiments, the upgrade method may be implemented as a computer program tangibly embodied on a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 10 via the ROM 12 and/or the communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the upgrade method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the upgrade method in any other suitable manner (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
A computer program for carrying out methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be implemented. The computer program may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) through which a user can provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), blockchain networks, and the internet.
The computing system may include clients and servers. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical hosts and VPS service are overcome.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps described in the present invention may be performed in parallel, sequentially, or in a different order, so long as the desired results of the technical solution of the present invention are achieved, and the present invention is not limited herein.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.

Claims (11)

1. An upgrade method, comprising:
acquiring the number of copies and the current number of copies in a configuration file;
determining a copy number state according to the copy number and the current copy number in the configuration file;
and upgrading the PODs in the database cluster according to the copy number state.
2. The method of claim 1, wherein determining the copy number status based on the number of copies in the configuration file and the current copy number comprises:
if the number of copies in the configuration file is larger than the current number of copies, determining that the state of the number of copies is that the number of copies is increased;
if the number of copies in the configuration file is equal to the current number of copies, determining that the state of the number of copies is unchanged;
and if the number of copies in the configuration file is smaller than the current number of copies, determining that the state of the number of copies is that the number of copies is reduced.
3. The method of claim 2, wherein upgrading PODs in a database cluster according to the replica number status comprises:
if the state of the number of copies is that the number of copies is increased, the original POD is kept unchanged, and a new slave POD is created according to the difference value between the number of copies in the configuration file and the current number of copies and the slave POD;
if the state of the copy number is that the copy number is unchanged, upgrading each slave POD in sequence, and after all the slave PODs are successfully upgraded, upgrading the master POD;
if the duplicate number state is that the duplicate number is reduced, determining the number of the to-be-deleted secondary PODs according to the difference value between the current duplicate number and the duplicate number in the configuration file, and deleting the secondary PODs according to the number of the to-be-deleted secondary PODs.
4. The method of claim 3, wherein if the copy number status is that the copy number is unchanged, upgrading each slave POD in turn, after all slave PODs are successfully upgraded, after upgrading the master POD, further comprising:
if the high availability component detects that the original main POD is unavailable, selecting one POD from the successfully upgraded auxiliary PODs as a new main POD by the high availability component, and adding the original main POD into the database cluster according to the identity of the auxiliary POD.
5. The method of claim 3, wherein determining the number of slave PODs to be deleted according to the difference between the current number of copies and the number of copies in the configuration file if the state of the number of copies is a decrease in the number of copies, and deleting the slave PODs according to the number of slave PODs to be deleted further comprises:
if the high availability component detects that the original main POD is not available, the high availability component selects a new main POD from all PODs, and the rest PODs are determined as slave PODs.
6. The method of claim 3, wherein determining the number of slave PODs to be deleted from the difference between the current number of copies and the number of copies in the configuration file if the state of the number of copies is a decrease in the number of copies, and deleting the slave PODs from the number of slave PODs to be deleted comprises:
if the copy number state is that the copy number is reduced and the copy number in the configuration file is more than 2, determining the number of the secondary PODs to be deleted according to the difference value between the current copy number and the copy number in the configuration file;
the slave PODs are deleted according to the number of slave PODs to be deleted.
7. The method of claim 3, wherein if the duplicate status is a decrease in duplicate, determining the number of secondary PODs to be deleted based on the difference between the current duplicate and the duplicate in the configuration file, and deleting the secondary PODs based on the number of secondary PODs to be deleted comprises:
if the copy number state is that the copy number is reduced and the copy number in the configuration file is equal to 2, setting the main POD to a read-only mode;
when the data in the slave PODs are consistent with the data in the master PODs, determining the number of the slave PODs to be deleted according to the difference value between the current number of the copies and the number of the copies in the configuration file;
the slave PODs are deleted according to the number of slave PODs to be deleted.
8. The method of claim 1, wherein obtaining the current number of copies comprises:
acquiring the number of PODs with target prefixes;
the number of PODs whose prefixes are target prefixes is determined as the current number of copies.
9. An upgrade apparatus, comprising:
the cost acquisition module is used for acquiring the cost and the current cost in the configuration file;
the copy number state determining module is used for determining the copy number state according to the copy number in the configuration file and the current copy number;
and the upgrading module is used for upgrading the PODs in the database cluster according to the duplicate number state.
10. An electronic device, the electronic device comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein, the liquid crystal display device comprises a liquid crystal display device,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the upgrade method of any one of claims 1-8.
11. A computer readable storage medium storing computer instructions for causing a processor to perform the upgrade method of any one of claims 1-8 when executed.
CN202310798281.9A 2023-06-30 2023-06-30 Upgrading method, device, equipment and storage medium Pending CN116821144A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310798281.9A CN116821144A (en) 2023-06-30 2023-06-30 Upgrading method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310798281.9A CN116821144A (en) 2023-06-30 2023-06-30 Upgrading method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116821144A true CN116821144A (en) 2023-09-29

Family

ID=88123832

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310798281.9A Pending CN116821144A (en) 2023-06-30 2023-06-30 Upgrading method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116821144A (en)

Similar Documents

Publication Publication Date Title
CN115580645A (en) Service switching method and device, electronic equipment and storage medium
CN115358411A (en) Data processing method, device, equipment and medium
CN112540805B (en) Integrated item packaging method, integrated item packaging device, integrated item packaging apparatus, integrated item packaging device, integrated item packaging storage medium, and integrated item packaging program product
CN114070889B (en) Configuration method, traffic forwarding device, storage medium, and program product
CN116821144A (en) Upgrading method, device, equipment and storage medium
CN113747423B (en) Cloud mobile phone state synchronization method, device, equipment, storage medium and program product
CN116225312A (en) Mirror image cleaning method and device, electronic equipment and storage medium
CN114691781A (en) Data synchronization method, system, device, equipment and medium
CN114722003A (en) Centralized data acquisition method, device, equipment and storage medium
CN114116288A (en) Fault processing method, device and computer program product
CN116775171B (en) Architecture switching method and device, electronic equipment and storage medium
CN113609145B (en) Database processing method, device, electronic equipment, storage medium and product
CN117234779A (en) Exception recovery method, device, equipment and medium for distributed database
CN115543691A (en) Data backup method, device, equipment and medium for cloud native application
CN116755744A (en) Patch package generation method and device, electronic equipment and storage medium
CN115408195A (en) Batch task management method, equipment and storage medium for heterogeneous platform
CN115421665A (en) Data storage method, device, equipment and storage medium
CN117093607A (en) Optimization method for data statistics query in big data scene
CN117539525A (en) Rolling updating method, device and equipment based on K8S and storage medium
CN116991825A (en) Database flashback method, device, equipment and storage medium
CN115509612A (en) Redis cluster processing method, device, equipment and storage medium
CN116594764A (en) Application program updating method and device, electronic equipment and storage medium
CN116932033A (en) Component packaging method and device, electronic equipment and storage medium
CN115857828A (en) Customized system implementation method and device, electronic equipment and storage medium
CN115658341A (en) Method, device, equipment and medium for reading and writing data by Freeswitch

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