WO2021213171A1 - 一种服务器切换方法、装置、管理节点及存储介质 - Google Patents

一种服务器切换方法、装置、管理节点及存储介质 Download PDF

Info

Publication number
WO2021213171A1
WO2021213171A1 PCT/CN2021/084965 CN2021084965W WO2021213171A1 WO 2021213171 A1 WO2021213171 A1 WO 2021213171A1 CN 2021084965 W CN2021084965 W CN 2021084965W WO 2021213171 A1 WO2021213171 A1 WO 2021213171A1
Authority
WO
WIPO (PCT)
Prior art keywords
server
stand
main server
switching
main
Prior art date
Application number
PCT/CN2021/084965
Other languages
English (en)
French (fr)
Inventor
郑舒力
Original Assignee
北京金山云网络技术有限公司
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 北京金山云网络技术有限公司 filed Critical 北京金山云网络技术有限公司
Publication of WO2021213171A1 publication Critical patent/WO2021213171A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1448Management of the data involved in backup or backup restore
    • 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/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44594Unloading

Definitions

  • the present disclosure relates to the field of cloud computing technology, and in particular to a server switching method, device, management node, and storage medium.
  • cloud computing is widely used in more and more fields due to its high efficiency and low cost.
  • the telecommunications field the medical field
  • the education field the telecommunications field
  • Cloud computing refers to decomposing huge data computing processing programs into multiple small programs through the network "cloud”, then analyzing and processing each small program through a server cluster composed of multiple servers, and feeding back the final processing results to users.
  • the database as an important data storage device is an important part of cloud computing.
  • the database may exist in the form of a stand-alone version, that is, the database may be a stand-alone database, for example, MySQL, InfluxDB, and so on.
  • the so-called stand-alone database refers to: the data stored in the database does not have backup data, and at the same time, the database can only run on one server. In other words, at the same time, only one server can provide the service of applying the data stored in the database, that is, at the same time, the data block can only be used by one server.
  • the purpose of the embodiments of the present disclosure is to provide a server switching method, device, management node, and storage medium, so as to improve the usability of a stand-alone database.
  • the specific technical solutions are as follows:
  • embodiments of the present disclosure provide a server switching method, which is applied to a management node of a server cluster.
  • the server cluster includes a currently running primary server and at least one currently not running backup server.
  • the primary server runs a stand-alone database.
  • the method includes: monitoring whether the main server is operating normally; when the monitoring of the main server is not operating normally, selecting the target server from at least one backup server; switching the target server to the new main server, after the switching is completed, the target server There is a stand-alone database running.
  • inventions of the present disclosure provide a server switching device, which is applied to a management node of a server cluster.
  • the server cluster includes a currently running primary server and at least one currently not running backup server.
  • the primary server runs a stand-alone database.
  • the device includes: a server monitoring module, used to monitor whether the main server is operating normally; a server selection module, used to select a target server from at least one backup server when the main server is monitored to be unable to operate normally; a server switching module is used to Switch the target server to the new primary server. After the switch is completed, a stand-alone database is running on the target server.
  • the embodiments of the present disclosure provide a server cluster, including a management node, a currently running main server, and at least one currently not running backup server.
  • the main server runs a stand-alone database; the management node is set to execute the first aspect Provide the steps of any server switching method.
  • embodiments of the present disclosure provide a management node, including a processor, a communication interface, a memory, and a communication bus.
  • the processor, the communication interface, and the memory communicate with each other through the communication bus; the memory is used for storing Computer program; processor, used to implement the steps of any server switching method provided in the first aspect when executing the program stored in the memory.
  • embodiments of the present disclosure provide a computer-readable storage medium in which a computer program is stored, and when the computer program is executed by a processor, any server provided in the first aspect is implemented. Steps to switch methods.
  • the embodiments of the present disclosure also provide a computer program product containing instructions that, when run on a computer, cause the computer to execute the steps of any server switching method provided in the first aspect.
  • the embodiments of the present disclosure provide a computer program that, when running on a computer, causes the computer to execute the steps of any server switching method provided in the first aspect.
  • a server cluster composed of multiple servers can be constructed in advance.
  • the running server in the server cluster is used as the primary server
  • other non-operating servers in the server cluster are used as the backup server of the primary server
  • the stand-alone database is mounted on the primary server
  • the primary server is Internal operation, that is, the main server can provide various services using the data stored in the stand-alone database.
  • the management node of the server cluster can monitor the main server to determine whether the main server is operating normally. Furthermore, when it is monitored that the main server has an operating failure and cannot operate normally, the management node can select a target server from the aforementioned backup servers and switch the target server to a new main server.
  • the target server can run the stand-alone database, that is, after the switch is completed, the stand-alone database can be mounted on the new main server and used by the new main server, thus, The new main server can continue to provide services for applying the data stored in the stand-alone database.
  • the main server running the stand-alone database fails, the main server can be switched to another backup server running the stand-alone database to ensure that there is always normal operation and operation The main server of the stand-alone data.
  • cloud computing can provide services for applying the data stored in the stand-alone database, thereby improving the availability of the stand-alone database.
  • FIG. 1 is a schematic flowchart of a server switching method provided by an embodiment of the disclosure
  • FIG. 2 is a schematic flowchart of an implementation of S103 in FIG. 1;
  • FIG. 3 is a schematic flowchart of another implementation manner of S103 in FIG. 1;
  • FIG. 4 is a schematic structural diagram of a server switching device provided by an embodiment of the disclosure.
  • FIG. 5 is a schematic structural diagram of a management node provided by an embodiment of the disclosure.
  • the database as an important data storage device is an important part of cloud computing.
  • the database may exist in the form of a stand-alone version, that is, the database may be a stand-alone database, for example, MySQL, InfluxDB, and so on.
  • the so-called stand-alone database refers to: the data stored in the database does not have backup data, and at the same time, the database can only run on one server. In other words, at the same time, only one server can provide the service of applying the data stored in the database, that is, at the same time, the data block can only be used by one server.
  • the server running the stand-alone database fails, cloud computing will not be able to provide services for applying the data stored in the stand-alone database, resulting in low availability of the stand-alone database.
  • embodiments of the present disclosure provide a server switching method.
  • the method is applied to a management node of a server cluster, and the server cluster includes a main server currently running and at least one backup server not currently running.
  • the method may include the following steps:
  • the stand-alone database is mounted on the main server, so that the main server runs the stand-alone database to provide various services that apply the data stored in the stand-alone database.
  • a backup server of the primary server there is no running stand-alone database in each backup server, and each backup server can be in a non-running state, that is, each backup server can be in a standby state, thus, Each backup server can be called a "cold machine".
  • the server is implemented by a single node.
  • the single node can be identified by domain name or IP (Internet Protocol, network protocol). That is to say, no matter which server in the server cluster is running, the running server uses the same domain name or IP, that is, after switching to the new master server, the domain name of the new master server and the master server before the switch Or the same IP.
  • domain name or IP Internet Protocol, network protocol
  • the above-mentioned management node may be a device used to manage each server other than the main server and the backup server in the server cluster, or it may be the main server currently running, which is reasonable. , Hereinafter referred to as the management node.
  • the management node of the server cluster can be switched to the new main server.
  • a server cluster consisting of multiple servers can be constructed in advance, and the running server in the server cluster can be used as the master server, and other non-transitory servers in the server cluster can be used as the master server.
  • the running server serves as the backup server of the main server, and the stand-alone database is mounted on the main server and runs in the main server, that is, the main server can provide various services using the data stored in the stand-alone database.
  • the management node of the server cluster can monitor the main server to determine whether the main server is operating normally. Furthermore, when it is monitored that the main server has an operating failure and cannot operate normally, the management node can select a target server from the aforementioned backup servers and switch the target server to a new main server.
  • the target server can run the stand-alone database, that is, after the switch is completed, the stand-alone database can be mounted on the new main server and used by the new main server.
  • the main server can continue to provide services using the data stored in the stand-alone database.
  • the main server running the stand-alone database fails, the main server can be switched to another backup server running the stand-alone database to ensure that there is always normal operation and operation The main server of the stand-alone data.
  • cloud computing can provide services for applying the data stored in the stand-alone database, thereby improving the availability of the stand-alone database.
  • FIG. 1 is a schematic flowchart of a server switching method provided by an embodiment of the present disclosure. As shown in FIG. 1, the method may include the following steps:
  • the main server can be switched in time to improve the availability of the stand-alone database.
  • the management node can monitor whether the main server is operating normally.
  • the management node can monitor the operation status of the main server to determine whether the current operation status of the main server is normal.
  • the normal operation of the main server means that the main server can operate normally with a stand-alone server, so that the main server can provide various services that apply the data stored in the stand-alone database.
  • the main server fails and the stand-alone server cannot operate normally in the main server, and in turn, the main server cannot provide various services that apply the data stored in the stand-alone database, it can be determined that the main server cannot operate normally. For example, the main server is down, the main server has a program error, and so on.
  • the management node can monitor whether the main server is running normally in real time; it can also monitor whether the main server is running normally according to a preset monitoring cycle, that is, check the running state of the main server after every certain period of time.
  • an independent monitoring program may be preset in the management node, so that the management node monitors whether the main server is operating normally by running the monitoring program, that is, the management node executes the above step S101 by calling the monitoring program.
  • step S101 may include the following step A:
  • Step A Detect whether the service port of the main server is alive and/or whether the service process exists; when it is detected that the service port is not alive or the service process does not exist, it is determined that the main server cannot operate normally;
  • the main server provides services to the application layer through the service port, and in the process of providing services, the main server needs to execute service processes corresponding to various services. Obviously, when any one of the service port and the service process fails, the main server cannot operate normally. Therefore, the management node can monitor whether the main server is operating normally by detecting whether the service port and/or service process of the main server is faulty.
  • the management node can determine whether the service port of the main server is faulty by detecting whether the service port of the main server is alive, and the management node can also determine the service process of the main server by detecting whether the service process of the main server exists Whether there is a malfunction.
  • the management node detects whether the service port of the main server is alive, when it is detected that the service port is not alive, the management node can determine that the main server is not operating normally;
  • the management node detects whether the service process of the main server exists, when it detects that the service process does not exist, the management node can determine that the main server cannot operate normally;
  • the management node When the management node detects whether the service port of the main server is alive and whether the service process exists, when at least one of the service port is not alive and the service process does not exist is detected, the management node can determine that the main server is not working properly run.
  • the main server can be used to provide various services that apply the data stored in the stand-alone database. Therefore, each service port on the main server can be related to the stand-alone database, and be monitored by the stand-alone database, and then When the main server provides various services using the data stored in the stand-alone database, the network between each service port and the client is connected.
  • the so-called service port survival refers to whether the process of the stand-alone database correctly monitors the service port in the main server, and whether the network between the client and the service port in the main server is connected.
  • the process of the stand-alone database fails to properly monitor the service port in the main server, and/or the network between the client and the service port in the main server is not connected, it can usually indicate that the process of the stand-alone database is down or An error has occurred in the stand-alone database.
  • it can be determined that the service port of the main server is not alive, and furthermore, it can be determined that the main server will not operate normally.
  • the so-called whether the service process exists refers to whether the service process of the stand-alone database service related to the data processing task exists when the main server runs the single-machine database and completes the data processing task.
  • the management node when the main server does not perform the data processing task, that is, when the main server normally stops the stand-alone database service, the management node can perceive this "normal stop” behavior, and will not be sure that the main server cannot operate normally.
  • step S101 may include the following step B:
  • Step B Call the preset detection program in the stand-alone database to monitor whether the main server is operating normally.
  • the management node monitors whether the main server is operating normally, it can directly call the preset detection program in the stand-alone database to monitor whether the main server is operating normally.
  • the detection program when the detection program detects that the main server is malfunctioning, it can generate a prompt notification to remind the main server that the main server is not operating normally, so that the management node can determine that the main server is not operating normally when the above-mentioned prompt notification is detected. .
  • S103 Switch the target server to a new master server, and after the switch is completed, a stand-alone database is running in the target server.
  • the management node When the management node monitors that the primary server is not operating normally, the management node can select a backup server from at least one backup server as the target server, and then the management node can switch the target server to the new primary server. After the switching is completed, the stand-alone database can be mounted on the new main server, and thus, run on the new main server.
  • the management node when only one backup server is included in the server cluster, can use the backup server as the target server; when there are multiple backup servers in the server cluster, the management node can randomly select any backup server as the target server.
  • the target server can also select a backup server as the target server according to the performance indicators of each backup server. For example, the target server can be selected according to the CPU (Central Processing Unit) load of each backup server, or according to each backup server The size of the available storage space to select the target server, etc.
  • the embodiments of the present disclosure do not make specific limitations.
  • step S103, switching the target server to the new primary server may include the following step C:
  • Step C Call the preset switching program to switch the target server to the new main server.
  • the switching program for switching the main server can be preset, so that when the monitoring of the main server is not working properly, and the management node selects the target server from at least one backup server, the management node can call the preset switching program, Switch the selected target server to the new main server.
  • the management node can call a preset switching program, so that the called switching program can switch the target server to the new main server.
  • the preset switching program may be set in the management node.
  • the preset switching program can also be set in other devices, so that the management node can call the preset switching program from the other device through API (Application Programming Interface).
  • the other device may not be located in the server cluster managed by the management node.
  • the management node monitors whether the main server is running normally through a preset independent monitoring program, then, in this specific implementation, the management node can call the preset switching program through the monitoring program to switch the target server Is the new primary server.
  • switching the target server to the new primary server may include the following steps:
  • S203 Mount the stand-alone database on the target server, and start the stand-alone database on the target server;
  • the management node calls the preset switching program to switch the selected target server to the new primary server, it means that the management node calls the preset switching program so that the called switching program will be The target server is switched to the new main server. Therefore, in the present embodiment, the above steps S201-S204 provide a way of switching the target server to the new main server by the switching program called by the management node.
  • the above-mentioned preset switching procedure may be provided by a preset Load Balance (LB) service. Therefore, the preset switching procedure is the switching procedure corresponding to the preset LB service, and further, when the main server When mounted on the LB service, the management node can call the preset switching procedure. Moreover, at the same time, only one server can be mounted on the LB service.
  • LB Load Balance
  • the main function of the LB service is to ensure that the load gap between multiple servers will not be too large.
  • providing a proxy for the real server and not exposing the real IP to the client is another common function of the LB service.
  • the management node when the management node monitors that the primary server currently mounted on the LB service cannot operate normally, the management node can select the target server from at least one backup server. Therefore, the management node can uninstall the main server from the LB service by calling the preset switching program, and then uninstall the stand-alone database from the main service. Then, you can mount the above-mentioned stand-alone database uninstalled from the main server to the target server, and start the stand-alone database on the target server, so that the stand-alone database can run on the target server. Finally, mount the target server running a stand-alone database to the LB service. In this way, the target server can serve as the new master server. Thus, the new main server starts to run to provide various services using the data stored in the stand-alone database.
  • switching the target server to the new primary server may include the following steps:
  • switching the selected target server to the new main server means: the management node calls the preset switching Program, so that the called switching program switches the target server to the new main server. Therefore, in this embodiment, the above steps S201-S204 provide: the switching program called by the management node switches the target server to the new Way of the main server.
  • the preset switching program may be a switching program corresponding to the preset LB service, and the main server is mounted on the preset LB service. Furthermore, when the main server is mounted on the LB service, the management node can call the preset switching procedure. Moreover, at the same time, only one server can be mounted on the LB service.
  • stand-alone databases can provide redundant multiple copy storage capabilities, that is, the stand-alone database can be backed up, so that multiple copies of the data stored in the stand-alone database can be obtained, and each of the stored data Are the same.
  • cloud hard drives which are usually distributed file storage systems, have the following three characteristics: 1. Compatible with POSIX (Portable Operating System Interface of UNIX, portable operating system interface); 2. Users can pass standard NFS ( Network File System) protocol to access cloud hard drives; 3. Multiple users can share access to cloud hard drives at the same time.
  • POSIX Portable Operating System Interface of UNIX, portable operating system interface
  • NFS Network File System
  • CFS Cloud File Storage
  • NAS Network Attached Storage
  • the backup database of the stand-alone database can be mounted on each backup server. Since the data stored in the backup database is the same as the data stored in the stand-alone database, it can be considered that each backup server has the stand-alone database mounted. Therefore, the target server selected from at least one backup server can mount the stand-alone database.
  • the management node can directly start the stand-alone database mounted in the target server by calling the above-mentioned switching program, without the need to remount the target server
  • the stand-alone database in turn, can mount the target server to the LB service.
  • the target server can serve as the new master server.
  • the new main server starts to run to provide various services using the data stored in the stand-alone database.
  • the embodiment of the present disclosure also provides a server switching device.
  • the device is applied to a management node of a server cluster.
  • the server cluster includes a currently running primary server and at least one currently not running backup server, and the primary server runs a stand-alone database.
  • FIG. 4 is a schematic structural diagram of a server switching device provided by an embodiment of the disclosure. As shown in FIG. 4, the device may include the following modules:
  • the server monitoring module 410 is configured to monitor whether the main server is operating normally
  • the server selection module 420 is configured to select a target server from at least one backup server when it is monitored that the main server cannot operate normally;
  • the server switching module 430 is configured to switch the target server to the new main server. After the switching is completed, a stand-alone database is running in the target server.
  • a server cluster composed of multiple servers can be constructed in advance.
  • the running server in the server cluster is used as the primary server
  • other non-operating servers in the server cluster are used as the backup server of the primary server
  • the stand-alone database is mounted on the primary server
  • the primary server Internal operation that is, the main server can provide various services using the data stored in the stand-alone database.
  • the management node of the server cluster can monitor the main server to determine whether the main server is operating normally. Furthermore, when it is monitored that the main server has an operating failure and cannot operate normally, the management node can select a target server from the above-mentioned backup servers and switch the target server to a new main server.
  • the target server can run the stand-alone database, that is, after the switch is completed, the stand-alone database can be mounted on the new main server and used by the new main server, thus, The new main server can continue to provide services for applying the data stored in the stand-alone database.
  • the main server running the stand-alone database fails, the main server can be switched to another backup server running the stand-alone database to ensure that there is always normal operation and operation The main server of the stand-alone data.
  • cloud computing can provide services for applying the data stored in the stand-alone database, thereby improving the availability of the stand-alone database.
  • the server monitoring module 410 is configured as follows:
  • the server switching module 430 is configured as follows:
  • the preset switching program is: a switching program corresponding to a preset load balancing service, and the main server is mounted on the load balancing service; the server switching module 430 is specifically set to:
  • the preset switching program is: a switching program corresponding to a preset load balancing service, the main server is mounted on the load balancing service, and a stand-alone database is mounted on the target server; the server switching Module 430 is set to:
  • the embodiment of the present disclosure also provides a server cluster.
  • the server cluster includes a management node, a main server that is currently running, and at least one backup server that is not currently running.
  • the main server runs a stand-alone database; the management node is set to execute the steps of any server switching method provided in the foregoing embodiment of the present disclosure. .
  • the management node in the server cluster may be a currently running main server.
  • the embodiment of the present disclosure also provides a management node, as shown in FIG. 5, including a processor 501, a communication interface 502, a memory 503, and a communication bus 504, where , The processor 501, the communication interface 502, and the memory 503 communicate with each other through the communication bus 504,
  • the memory 503 is used to store computer programs
  • the processor 501 is configured to implement the steps of any server switching method provided in the foregoing embodiment of the present disclosure when executing the program stored in the memory 503.
  • the communication bus mentioned by the management node may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus.
  • PCI Peripheral Component Interconnect
  • EISA Extended Industry Standard Architecture
  • the communication bus can be divided into address bus, data bus, control bus and so on. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
  • the communication interface is used for communication between the above-mentioned management node and other devices.
  • the memory may include random access memory (Random Access Memory, RAM), and may also include non-volatile memory (Non-Volatile Memory, NVM), such as at least one disk storage.
  • NVM non-Volatile Memory
  • the memory may also be at least one storage device located far away from the foregoing processor.
  • the above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (Network Processor, NP), etc.; it can also be a digital signal processor (Digital Signal Processing, DSP), a dedicated integrated Circuit (Application Specific Integrated Circuit, ASIC), Field-Programmable Gate Array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
  • CPU central processing unit
  • NP Network Processor
  • DSP Digital Signal Processing
  • ASIC Application Specific Integrated Circuit
  • FPGA Field-Programmable Gate Array
  • FPGA Field-Programmable Gate Array
  • a computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, any one of the above-mentioned servers is implemented. Steps to switch methods.
  • a computer program is also provided.
  • the computer program runs on a computer, the computer executes the steps of any server switching method provided in the first aspect.
  • the computer program product includes one or more computer instructions.
  • the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.
  • the computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website, computer, server, or data center.
  • the computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server or a data center integrated with one or more available media.
  • the usable medium may be a magnetic medium (for example, a floppy disk, a hard disk, and a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid state disk (SSD)).
  • the main server running the stand-alone database fails, the main server can be switched to another backup server running the stand-alone database to ensure There is always a main server that can run normally and can run the single-machine data. Furthermore, it is ensured that cloud computing can provide services for applying the data stored in the stand-alone database, thereby improving the availability of the stand-alone database.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Quality & Reliability (AREA)
  • Computing Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Hardware Redundancy (AREA)

Abstract

一种服务器切换方法、装置、管理节点及存储介质,涉及云计算技术领域。该方法应用于服务器集群的管理节点,所述服务器集群包括当前正在运行的主服务器和至少一个当前未运行的备份服务器,所述主服务器运行有单机数据库;包括:监控主服务器是否正常运行(S101);当监控到主服务器不能正常运行时,在至少一个备份服务器中选取目标服务器(S102);将目标服务器切换为新的主服务器,在切换完成后,目标服务器中运行有单机数据库(S103)。与相关技术相比,应用该方法,能够提高单机数据库的可用性。

Description

一种服务器切换方法、装置、管理节点及存储介质
本公开要求于2020年4月24日提交中国专利局、申请号为202010330470.X发明名称为“一种服务器切换方法、装置、管理节点及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本公开中。
技术领域
本公开涉及云计算技术领域,特别是涉及一种服务器切换方法、装置、管理节点及存储介质。
背景技术
当前,随着网络技术的不断发展,云计算凭借其效率高、成本低等特点,在越来越多的领域中被广泛应用。例如,电信领域、医疗领域、教育领域等。
云计算是指:通过网络“云”将巨大的数据计算处理程序分解为多个小程序,然后通过多个服务器组成的服务器集群分析和处理各个小程序,并将最终的处理结果反馈给用户。
在云计算中,数据库作为重要的数据存储装置是云计算的重要组成部分。其中,数据库可以以单机版的形式存在,即数据库可以为单机数据库,例如,MySQL、InfluxDB等。所谓单机数据库是指:数据库中所存储的数据不存在备份数据,并且,在同一时间,该数据库仅可以运行在一台服务器中。也就是说,在同一时间,仅有一台服务器可以提供应用该数据库所存储的数据的服务,即在同一时间,该数据块仅可以被一台服务器所使用。
显然,当运行单机数据库的服务器出现故障时,云计算将无法提供应用该单机数据库所存储的数据的服务,从而导致单机数据库的可用性较低。
发明内容
本公开实施例的目的在于提供一种服务器切换方法、装置、管理节点及存储介质,以实现提高单机数据库的可用性。具体技术方案如下:
第一方面,本公开实施例提供了一种服务器切换方法,应用于服务器集群的管理节点,该服务器集群包括当前正在运行的主服务器和至少一个当前未运行的备份服务器,主服务器运行有单机数据库;该方法包括:监控主服 务器是否正常运行;当监控到主服务器不能正常运行时,在至少一个备份服务器中选取目标服务器;将目标服务器切换为新的主服务器,在切换完成后,目标服务器中运行有单机数据库。
第二方面,本公开实施例提供了一种服务器切换装置,应用于服务器集群的管理节点,该服务器集群包括当前正在运行的主服务器和至少一个当前未运行的备份服务器,主服务器运行有单机数据库;该装置包括:服务器监控模块,用于监控主服务器是否正常运行;服务器选取模块,用于当监控到主服务器不能正常运行时,在至少一个备份服务器中选取目标服务器;服务器切换模块,用于将目标服务器切换为新的主服务器,在切换完成后,目标服务器中运行有单机数据库。
第三方面,本公开实施例提供了一种服务器集群,包括管理节点、当前正在运行的主服务器和至少一个当前未运行的备份服务器,主服务器运行有单机数据库;管理节点设置为执行第一方面提供的任一服务器切换方法的步骤。
第四方面,本公开实施例提供了一种管理节点,包括处理器、通信接口、存储器和通信总线,其中,处理器,通信接口,存储器通过通信总线完成相互间的通信;存储器,用于存放计算机程序;处理器,用于执行存储器上所存放的程序时,实现上述第一方面提供的任一服务器切换方法的步骤。
第五方面,本公开实施例提供了一种计算机可读存储介质,所述计算机可读存储介质内存储有计算机程序,所述计算机程序被处理器执行时实现上述第一方面提供的任一服务器切换方法的步骤。
第六方面,本公开实施例还提供了一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述第一方面提供的任一服务器切换方法的步骤。
第七方面,本公开实施例提供了一种计算机程序,所述计算机程序在计算机上运行时,使得计算机执行上述第一方面提供的任一服务器切换方法的步骤。
本公开实施例有益效果:
应用本公开实施例提供的方案,在云计算中,可以预先构建由多个服务器组成的服务器集群。其中,将该服务器集群中正在运行的服务器作为主服务器,将该服务器集群中其他未运行的服务器作为该主服务器的备份服务器,并且,单机数据库挂载在该主服务器上,并在该主服务器内运行,即该主服务器可以提供应用该单机数据库所存储的数据的各类服务。这样,该服务器集群的管理节点便可以对该主服务器进行监控,以判断该主服务器运行是否正常。进而,当监控到该主服务器出现运行故障,不能正常运行时,该管理节点便可以从上述备份服务器中选取一目标服务器,并将该目标服务器切换为新的主服务器。
其中,由于在切换完成后,目标服务器可以运行有该单机数据库,也就是说,在切换完成后,单机数据库可以挂载在新的主服务器上,并被该新的主服务器所使用,从而,该新的主服务器便可以继续提供应用该单机数据库所存储的数据的服务。基于此,应用本公开实施例提供的方案,在运行单机数据库的主服务器出现故障时,可以通过将主服务器切换至另一运行该单机数据库的备份服务器来保证始终存在能够正常运行,且能够运行该单机数据的主服务器。进而,保证云计算可以提供应用该单机数据库所存储的数据的服务,从而,提高单机数据库的可用性。
附图说明
为了更清楚地说明本公开实施例和相关技术的技术方案,下面对实施例和相关技术中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本公开的一些实施例,本领域普通技术人员来讲还可以根据这些附图获得其他的附图。
图1为本公开实施例提供的一种服务器切换方法的流程示意图;
图2为图1中S103的一种实施方式的流程示意图;
图3为图1中S103的另一种实施方式的流程示意图;
图4为本公开实施例提供的一种服务器切换装置的结构示意图;
图5为本公开实施例提供的一种管理节点的结构示意图。
具体实施方式
为使本公开实施例的目的、技术方案、及优点更加清楚明白,以下参照附图并举实施例,对本公开实施例进一步详细说明。显然,所描述的实施例仅仅是本公开实施例一部分实施例,而不是全部的实施例。本领域普通技术人员基于本公开实施例中的实施例所获得的所有其他实施例,都属于本公开实施例保护的范围。
当前,在云计算中,数据库作为重要的数据存储装置是云计算的重要组成部分。其中,数据库可以以单机版的形式存在,即数据库可以为单机数据库,例如,MySQL、InfluxDB等。所谓单机数据库是指:数据库中所存储的数据不存在备份数据,并且,在同一时间,该数据库仅可以运行在一台服务器中。也就是说,在同一时间,仅有一台服务器可以提供应用该数据库所存储的数据的服务,即在同一时间,该数据块仅可以被一台服务器所使用。显然,当运行单机数据库的服务器出现故障时,云计算将无法提供应用该单机数据库所存储的数据的服务,从而导致单机数据库的可用性较低。
为了解决该技术问题,本公开实施例提供了一种服务器切换方法。该方法应用于服务器集群的管理节点,并且,该服务器集群包括当前正在运行的主服务器和至少一个当前未运行的备份服务器。该方法可以包括如下步骤:
监控主服务器是否正常运行;
当监控到主服务器不能正常运行时,在至少一个备份服务器中选取目标服务器;
将目标服务器切换为新的主服务器,在切换完成后,目标服务器中运行有单机数据库。
也就是说,单机数据库挂载在该主服务器上,从而,该主服务器运行有该单机数据库,以提供应用该单机数据库所存储的数据的各类服务。而作为主服务器的备用服务器,各个备份服务器中是不存在正在运行的单机数据库的,并且,各个备份服务器可以是处于未运行状态的,也就是说,每个备份服务器可以处于待机状态,从而,各个备份服务器可以被称为“冷机”。
在本公开实施例中,虽然服务器集群中存在多个服务器,但是,只有一 台服务器处于运行状态中,也就是说,当该服务器集群向应用层提供各类服务时,是通过处于运行状态的服务器这一单一节点实现的。并且,该单一节点可以通过域名或者IP(Internet Protocol,网络协议)进行标识。也就是说,无论该服务器集群中哪台服务器正在运行,该正在运行的服务器使用相同的域名或IP,即在切换至新的主服务器后,该新的主服务器与切换前的主服务器的域名或IP相同。
此外,在本公开实施例中,上述管理节点可以是服务器集群中除主服务器和备份服务器之外的,用于管理该各个服务器的设备,也可以是当前正在运行的主服务器,这都是合理的,以下简称管理节点。
在一实施方式中,当上述管理节点为当前正在运行的主服务器时,当该主服务器切换至新的主服务器时,则该服务器集群的管理节点即可以切换为该新的主服务器。
以上可见,应用本公开实施例提供的方案,在云计算中,可以预先构建由多个服务器组成的服务器集群,并将该服务器集群中正在运行的服务器作为主服务器,将该服务器集群中其他未运行的服务器作为该主服务器的备份服务器,并且,单机数据库挂载在该主服务器上,并在该主服务器内运行,即该主服务器可以提供应用该单机数据库所存储的数据的各类服务。这样,该服务器集群的管理节点便可以对该主服务器进行监控,以判断该主服务器运行是否正常。进而,当监控到该主服务器出现运行故障,不能正常运行时,该管理节点便可以从上述备份服务器中选取一目标服务器,并将该目标服务器切换为新的主服务器。
由于在切换完成后,目标服务器可以运行有该单机数据库,也就是说,在切换完成后,单机数据库可以挂载在新的主服务器上,并被该新的主服务器所使用,从而,该新的主服务器便可以继续提供应用该单机数据库所存储的数据的服务。基于此,应用本公开实施例提供的方案,在运行单机数据库的主服务器出现故障时,可以通过将主服务器切换至另一运行该单机数据库的备份服务器来保证始终存在能够正常运行,且能够运行该单机数据的主服务器。进而,保证云计算可以提供应用该单机数据库所存储的数据的服务,从而,提高单机数据库的可用性。
下面,对本公开实施例提供的一种服务器切换方法进行具体说明。
图1为本公开实施例提供的一种服务器切换方法的流程示意图,如图1所示,该方法可以包括如下步骤:
S101:监控主服务器是否正常运行;
为了保证能够及时发现主服务器出现故障,不能正常运行,从而及时对主服务器进行切换,以提高单机数据库的可用性,在主服务运行过程中,管理节点可以监控主服务器是否正常运行。
也就是说,在主服务器运行过程中,管理节点可以对主服务器的运行状态进行监控,以判断主服务器当前的运行状态是否正常。
主服务器正常运行是指:主服务器可以正常运行有单机服务器从而,主服务器可以提供应用该单机数据库所存储的数据的各类服务。当主服务器出现故障导致单机服务器不能在主服务器中正常运行,进而,导致主服务器不能提供应用该单机数据库所存储的数据的各类服务时,可以确定主服务器不能正常运行。例如,主服务器宕机、主服务器出现程序错误等。
管理节点可以实时监控主服务器是否正常运行;也可以按照预设监控周期,监控主服务器是否正常运行,即在每相隔一定时间后,对主服务器的运行状态进行一次检测。
在一实施方式中,管理节点中可以预先设置有独立的监控程序,从而,管理节点通过运行该监控程序监控主服务器是否正常运行,即管理节点通过调用该监控程序来执行上述步骤S101。
在一实施方式中,上述步骤S101可以包括如下步骤A:
步骤A:探测主服务器的服务端口是否存活和/或服务进程是否存在;当探测到服务端口未存活或服务进程不存在时,确定主服务器不能正常运行;
主服务器是通过服务端口向应用层提供服务的,并且,在提供服务的过程中,主服务器需要执行与各类服务对应的服务进程。显然,当服务端口和服务进程中的任一个出现故障时,主服务器均不能够正常运行。因此,管理 节点便可以通过探测主服务器的服务端口和/或服务进程是否出现故障来监控主服务器是否正常运行。
在一实施方式中,管理节点可以通过探测主服务器的服务端口是否存活,来确定主服务器的服务端口是否出现故障,管理节点也可以通过探测主服务器的服务进程是否存在来确定主服务器的服务进程是否出现故障。
在管理节点探测主服务器的服务端口是否存活的情况下,当探测到该服务端口未存活,则管理节点可以确定主服务器不能正常运行;
在管理节点探测主服务器的服务进程是否存在的情况下,当探测到该服务进程不存在,则管理节点可以确定主服务器不能正常运行;
在管理节点探测主服务器的服务端口是否存活和服务进程是否存在的情况下,则探测到该服务端口未存活和该服务进程不存在中的至少一种情况时,管理节点可以确定主服务器不能正常运行。
在本实施方式中,主服务器可以用于提供应用该单机数据库所存储的数据的各类服务,因此,该主服务器上的各个服务端口可以与单机数据库相关,并且,被单机数据库所监听,进而,在主服务器向外提供应用该单机数据库所存储的数据的各类服务时,各个服务端口与客户端之间的网络是连通的。
基于此,所谓服务端口是否存活是指:单机数据库的进程是否正确监听了主服务器中的服务端口,以及客户端到主服务器中的服务端口之间的网络是否连通。这样,如果单机数据库的进程未能正确监听主服务器中的服务端口,和/或,客户端到主服务器中的服务端口之间的网络未连通,通常便可以说明单机数据库的进程已经宕机或者单机数据库内部已经发生错误。此时,可以确定主服务器的服务端口未存活,进而,确定主服务器将不能正常运行。
所谓服务进程是否存在是指:在主服务器运行单机数据库,完成数据处理任务的过程中,检测与该数据处理任务相关的单机数据库服务的服务进程是否存在。
在一实施方式中,当主服务器未执行数据处理任务,即主服务器正常停止单机数据库服务时,管理节点可以感知这种“正常停止”的行为,而不会确定主服务器不能正常运行。
在一实施方式中,上述步骤S101可以包括如下步骤B:
步骤B:调用单机数据库中预设的检测程序,监控主服务器是否正常运行。
在单机数据库中可以存在用于监控单机数据库所挂载主服务器是否正常运行的检测程序,例如,mertics接口、health接口等检测程序。从而,管理节点在监控主服务器是否正常运行时,便可以直接调用单机数据库中预设的检测程序,来监控主服务器是否正常运行。
这样,当该检测程序检测到该主服务器出现故障时,可以生成用于提示该主服务器不能正常运行的提示通知,从而,管理节点在检测到上述提示通知时,便可以确定主服务器不能正常运行。
S102:当监控到主服务器不能正常运行时,在至少一个备份服务器中选取目标服务器;
S103:将目标服务器切换为新的主服务器,在切换完成后,目标服务器中运行有单机数据库。
在管理节点监控到主服务器不能正常运行时,管理节点便可以在至少一个备份服务器中选取一备份服务器作为目标服务器,进而,管理节点便可以将该目标服务器切换为新的主服务器。而在该切换完成后,该单机数据库便可以挂载到该新的主服务器上,从而,在该新的主服务器中运行。
在一实施方式中,当服务器集群中只包括一个备份服务器时,管理节点便可以将该备份服务器作为目标服务器;当服务器集群中存在多个备份服务器时,管理节点可以随机选取任一备份服务器作为目标服务器,也可以按照各个备份服务器的性能指标,选取一备份服务器作为目标服务器,例如,可以根据各个备份服务器的CPU(Central Processing Unit,中央处理器)负载选取目标服务器,也可以根据各个备份服务器的可用存储空间大小选取目标服务器等。对此,本公开实施例不做具体限定。
在一实施方式中,上述步骤S103,将目标服务器切换为新的主服务器可以包括如下步骤C:
步骤C:调用预设的切换程序,将目标服务器切换为新的主服务器。
可以预先设置用于切换主服务器的切换程序,从而,当监控到主服务器不能正常运行,且管理节点从至少一个备份服务器中选取得到目标服务器时,管理节点便可以调用该预设的切换程序,将所选取的目标服务器切换为新的主服务器。
也就是说,在本实施方式中,管理节点可以调用预设的切换程序,以使得所调用的切换程序可以将目标服务器切换为新的主服务器。
在一实施方式中,该预设的切换程序可以设置在该管理节点中。
在一实施方式中,该预设的切换程序也可以设置在其他设备中,从而,管理节点可以通过API(Application Programming Interface,应用程序编程接口)从该其他设备中调用该预设的切换程序,并且,该其他设备可以不位于管理节点所管理的服务器集群中。
此外,当管理节点通过预先设置的独立的监控程序监控主服务器是否正常运行时,那么,在本具体实现方式中,管理节点便可以通过该监控程序调用该预设的切换程序,将目标服务器切换为新的主服务器。
在一实施方式中,在上述实施方式中所提供的预设的切换程序的基础上,如图2所示,上述步骤S103,将目标服务器切换为新的主服务器,可以包括如下步骤:
S201:将主服务器从负载均衡服务上卸载;
S202:从主服务器上卸载单机数据库;
S203:在目标服务器上挂载单机数据库,并在目标服务器中启动单机数据库;
S204:将目标服务器挂载到负载均衡服务上。
在本实施方式中,由于管理节点调用该预设的切换程序,将所选取的目标服务器切换为新的主服务器,是指:管理节点调用预设的切换程序,以使得所调用的切换程序将目标服务器切换为新的主服务器,因此,在本实施方式中,上述步骤S201-S204所提供的是:管理节点所调用的切换程序将目标服务器切换为新的主服务器的方式。
上述预设的切换程序可以是预设的负载均衡(LB,Load Balance)服务所提供的,因此,该预设的切换程序即为该预设的LB服务所对应的切换程序,进而,当主服务器挂载在该LB服务上时,管理节点便可以调用该预设的切换程序。并且,在同一时间,该LB服务上只能挂载一个服务器。
LB服务的主要功能为:保证多台服务器之间的负载差距不会太大,此外,提供真实服务器的代理,不对客户端暴露真实IP也是LB服务的另一种常见功能。
这样,当管理节点监控到LB服务当前所挂载的主服务器不能正常运行时,管理节点便可以在至少一个备份服务器中选取目标服务器。从而,管理节点便可以通过调用预设的切换程序,将该主服务器从该LB服务上卸载,进而,从该主服务上卸载单机数据库。接着,便可以将上述从主服务器上卸载的单机数据库挂载到该目标服务器上,并在该目标服务器上启动该单机数据库,以使得单机数据库可以在目标服务器上运行。最后,将该运行有单机数据库的目标服务器挂载到该LB服务上。这样,该目标服务器便可以作为新的主服务器。从而,该新的主服务器开始运行,以提供应用该单机数据库所存储的数据的各类服务。
在一实施方式中,在上述实施方式中所提供的切换程序的基础上,如图3所示,上述步骤S103,将目标服务器切换为新的主服务器,可以包括如下步骤:
S301:将主服务器从负载均衡服务上卸载;
S302:在目标服务器中启动单机数据库;
S303:将目标服务器挂载到负载均衡服务上。
与图2所示实施方式相似的,在本实施方式中,由于管理节点调用该预设的切换程序,将所选取的目标服务器切换为新的主服务器,是指:管理节点调用预设的切换程序,以使得所调用的切换程序将目标服务器切换为新的主服务器,因此,在本实施方式中,上述步骤S201-S204所提供的是:管理节点所调用的切换程序将目标服务器切换为新的主服务器的方式。
预设的切换程序可以为预设的LB服务对应的切换程序,且主服务器挂载 在该预设的LB服务上。进而,当主服务器挂载在该LB服务上时,管理节点便可以调用该预设的切换程序。并且,在同一时间,该LB服务上只能挂载一个服务器。
此外,某些类型的单机数据库能够提供冗余多副本存储能力,也就是说,可以对该单机数据库进行备份,从而,得到多份该单机数据库所存储的数据,并且,每份所存储的数据是相同的。
例如,云硬盘,云硬盘通常为分布式文件存储系统,其具有如下三个特点:1、可以兼容POSIX(Portable Operating System Interface of UNIX,可移植操作系统接口);2、用户可以通过标准NFS(Network File System,网络文件系统)协议访问云硬盘;3、多个用户可以同时共享访问云硬盘。示例性的,CFS(Cloud File Storage,云文件存储)产品和NAS(Network Attached Storage,网络附属存储)产品均属于云硬盘类型产品。
基于此,在构建上述服务器集群时,可以在各个备份服务器中挂载该单机数据库的备份数据库。由于该备份数据库所存的数据与该单机数据库所存储的数据相同,因此,可以认为各个备份服务器挂载了该单机数据库。因此,从至少一个备份服务器中所选取得到的目标服务器便可以挂载该单机数据库。
这样,在本实施方式中,在将主服务器从LB服务上卸载之后,管理节点可以通过调用上述切换程序直接启动目标服务器中所挂载的单机数据库,而不需要重新在该目标服务器中挂载该单机数据库,进而,便可以将目标服务器挂载到该LB服务上。这样,该目标服务器便可以作为新的主服务器。从而,该新的主服务器开始运行,以提供应用该单机数据库所存储的数据的各类服务。
相应于上述本公开实施例提供的一种服务器切换方法,本公开实施例还提供了一种服务器切换装置。其中,该装置应用于服务器集群的管理节点,该服务器集群包括当前正在运行的主服务器和至少一个当前未运行的备份服务器,该主服务器运行有单机数据库。
图4为本公开实施例提供的一种服务器切换装置的结构示意图,如图4所示,该装置可以包括如下模块:
服务器监控模块410,设置为监控主服务器是否正常运行;
服务器选取模块420,设置为当监控到主服务器不能正常运行时,在至少一个备份服务器中选取目标服务器;
服务器切换模块430,设置为将目标服务器切换为新的主服务器,在切换完成后,目标服务器中运行有单机数据库。
应用本公开实施例提供的方案,在云计算中,可以预先构建由多个服务器组成的服务器集群。其中,将该服务器集群中正在运行的服务器作为主服务器,将该服务器集群中其他未运行的服务器作为该主服务器的备份服务器,并且,单机数据库挂载在该主服务器上,并在该主服务器内运行,即该主服务器可以提供应用该单机数据库所存储的数据的各类服务。这样,该服务器集群的管理节点便可以对该主服务器进行监控,以判断该主服务器运行是否正常。进而,当监控到该主服务器出现运行故障,不能正常运行时,该管理节点便可以从上述备份服务器中选取一目标服务器,并将该目标服务器切换为新的主服务器。
其中,由于在切换完成后,目标服务器可以运行有该单机数据库,也就是说,在切换完成后,单机数据库可以挂载在新的主服务器上,并被该新的主服务器所使用,从而,该新的主服务器便可以继续提供应用该单机数据库所存储的数据的服务。基于此,应用本公开实施例提供的方案,在运行单机数据库的主服务器出现故障时,可以通过将主服务器切换至另一运行该单机数据库的备份服务器来保证始终存在能够正常运行,且能够运行该单机数据的主服务器。进而,保证云计算可以提供应用该单机数据库所存储的数据的服务,从而,提高单机数据库的可用性。
在一实施方式中,上述服务器监控模块410设置为:
探测主服务器的服务端口是否存活和/或服务进程是否存在;当探测到服务端口未存活或服务进程不存在时,确定主服务器不能正常运行;
或者,
调用单机数据库中预设的检测程序,监控主服务器是否正常运行。
在一实施方式中,上述服务器切换模块430设置为:
调用预设的切换程序,将目标服务器切换为新的主服务器。
在一实施方式中,上述预设的切换程序为:预设的负载均衡服务对应的切换程序,上述主服务器挂载在该负载均衡服务上;上述服务器切换模块430具体设置为:
将主服务器从负载均衡服务上卸载;
从主服务器上卸载单机数据库;
在目标服务器上挂载上述单机数据库,并在目标服务器中启动该单机数据库;
将目标服务器挂载到负载均衡服务上。
在一实施方式中,上述预设的切换程序为:预设的负载均衡服务对应的切换程序,上述主服务器挂载在该负载均衡服务上,上述目标服务器中挂载有单机数据库;上述服务器切换模块430设置为:
将主服务器从负载均衡服务上卸载;
在目标服务器中启动单机数据库;
将目标服务器挂载到上述负载均衡服务上。
相应于上述本公开实施例提供的一种服务器切换方法,本公开实施例还提供了一种服务器集群。该服务器集群包括管理节点、当前正在运行的主服务器和至少一个当前未运行的备份服务器,主服务器运行有单机数据库;该管理节点设置为执行上述本公开实施例提供的任一服务器切换方法的步骤。
在一实施方式中,上述服务器集群中的管理节点可以为当前正在运行的主服务器。
相应于上述本公开实施例提供的一种服务器切换方法,本公开实施例还提供了一种管理节点,如图5所示,包括处理器501、通信接口502、存储器503和通信总线504,其中,处理器501,通信接口502,存储器503通过通信总线504完成相互间的通信,
存储器503,用于存放计算机程序;
处理器501,用于执行存储器503上所存放的程序时,实现上述本公开实施例提供的任一服务器切换方法的步骤。
上述管理节点提到的通信总线可以是外设部件互连标准(Peripheral Component Interconnect,PCI)总线或扩展工业标准结构(Extended Industry Standard Architecture,EISA)总线等。该通信总线可以分为地址总线、数据总线、控制总线等。为便于表示,图中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。
通信接口用于上述管理节点与其他设备之间的通信。
存储器可以包括随机存取存储器(Random Access Memory,RAM),也可以包括非易失性存储器(Non-Volatile Memory,NVM),例如至少一个磁盘存储器。可选的,存储器还可以是至少一个位于远离前述处理器的存储装置。
上述的处理器可以是通用处理器,包括中央处理器(Central Processing Unit,CPU)、网络处理器(Network Processor,NP)等;还可以是数字信号处理器(Digital Signal Processing,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。
在本公开实施例提供的又一实施例中,还提供了一种计算机可读存储介质,该计算机可读存储介质内存储有计算机程序,所述计算机程序被处理器执行时实现上述任一服务器切换方法的步骤。
在本公开实施例提供的又一实施例中,还提供了一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述实施例中任一服务器切换方法。
本公开实施例提供的又一实施例中,还提供了一种计算机程序,计算机程序在计算机上运行时,使得计算机执行上述第一方面提供的任一服务器切换方法的步骤。
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本公开实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘Solid State Disk(SSD))等。
需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。
本说明书中的各个实施例均采用相关的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于装置实施例、管理节点实施例、计算机可读存储介质实施例、计算机程序产品实施例,以及计算机程序实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。
以上所述仅为本公开实施例的较佳实施例,并不用以限制本公开实施例, 凡在本公开实施例的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本公开实施例保护的范围之内。
工业实用性
基于本公开实施例提供的一种服务器切换方法、装置、管理节点及存储介质,在运行单机数据库的主服务器出现故障时,可以通过将主服务器切换至另一运行该单机数据库的备份服务器来保证始终存在能够正常运行,且能够运行该单机数据的主服务器。进而,保证云计算可以提供应用该单机数据库所存储的数据的服务,从而提高单机数据库的可用性。

Claims (15)

  1. 一种服务器切换方法,应用于服务器集群的管理节点,所述服务器集群包括当前正在运行的主服务器和至少一个当前未运行的备份服务器,所述主服务器运行有单机数据库;所述方法包括:
    监控所述主服务器是否正常运行;
    当监控到所述主服务器不能正常运行时,在所述至少一个备份服务器中选取目标服务器;
    将所述目标服务器切换为新的主服务器,在切换完成后,所述目标服务器中运行有所述单机数据库。
  2. 根据权利要求1所述的方法,其中,所述监控所述主服务器是否正常运行的步骤,包括:
    探测所述主服务器的服务端口是否存活和/或服务进程是否存在;当探测到所述服务端口未存活或所述服务进程不存在时,确定所述主服务器不能正常运行;
    或者,
    调用所述单机数据库中预设的检测程序,监控所述主服务器是否正常运行。
  3. 根据权利要求1所述的方法,其中,所述将所述目标服务器切换为新的主服务器的步骤,包括:
    调用预设的切换程序,将所述目标服务器切换为新的主服务器。
  4. 根据权利要求3所述的方法,其中,所述预设的切换程序为:预设的负载均衡服务对应的切换程序,所述主服务器挂载在所述负载均衡服务上;所述将所述目标服务器切换为新的主服务器的步骤,包括:
    将所述主服务器从所述负载均衡服务上卸载;
    从所述主服务器上卸载所述单机数据库;
    在所述目标服务器上挂载所述单机数据库,并在所述目标服务器中启动 所述单机数据库;
    将所述目标服务器挂载到所述负载均衡服务上。
  5. 根据权利要求3所述的方法,其中,所述预设的切换程序为:预设的负载均衡服务对应的切换程序,所述主服务器挂载在所述负载均衡服务上,所述目标服务器中挂载有所述单机数据库;所述将所述目标服务器切换为新的主服务器的步骤,包括:
    将所述主服务器从所述负载均衡服务上卸载;
    在所述目标服务器中启动所述单机数据库;
    将所述目标服务器挂载到所述负载均衡服务上。
  6. 一种服务器切换装置,应用于服务器集群的管理节点,所述服务器集群包括当前正在运行的主服务器和至少一个当前未运行的备份服务器,所述主服务器运行有单机数据库;所述装置包括:
    服务器监控模块,设置为监控所述主服务器是否正常运行;
    服务器选取模块,设置为当监控到所述主服务器不能正常运行时,在所述至少一个备份服务器中选取目标服务器;
    服务器切换模块,设置为将所述目标服务器切换为新的主服务器,在切换完成后,所述目标服务器中运行有所述单机数据库。
  7. 根据权利要求6所述的装置,其中,所述服务器监控模块设置为:
    探测所述主服务器的服务端口是否存活和/或服务进程是否存在;当探测到所述服务端口未存活或所述服务进程不存在时,确定所述主服务器不能正常运行;
    或者,
    调用所述单机数据库中预设的检测程序,监控所述主服务器是否正常运行。
  8. 根据权利要求6所述的装置,其中,所述服务器切换模块设置为:
    调用预设的切换程序,将所述目标服务器切换为新的主服务器。
  9. 根据权利要求8所述的装置,其中,所述预设的切换程序为:预设的负载均衡服务对应的切换程序,所述主服务器挂载在所述负载均衡服务上;所述服务器切换模块设置为:
    将所述主服务器从所述负载均衡服务上卸载;
    从所述主服务器上卸载所述单机数据库;
    在所述目标服务器上挂载所述单机数据库,并在所述目标服务器中启动所述单机数据库;
    将所述目标服务器挂载到所述负载均衡服务上。
  10. 根据权利要求8所述的装置,其中,所述预设的切换程序为:预设的负载均衡服务对应的切换程序,所述主服务器挂载在所述负载均衡服务上,所述目标服务器中挂载有所述单机数据库;所述服务器切换模块设置为:
    将所述主服务器从所述负载均衡服务上卸载;
    在所述目标服务器中启动所述单机数据库;
    将所述目标服务器挂载到所述负载均衡服务上。
  11. 一种服务器集群,包括管理节点、当前正在运行的主服务器和至少一个当前未运行的备份服务器,所述主服务器运行有单机数据库;所述管理节点设置为执行权利要求1-5任一所述的方法步骤。
  12. 一种管理节点,包括处理器、通信接口、存储器和通信总线,其中,处理器,通信接口,存储器通过通信总线完成相互间的通信;
    存储器,设置为存放计算机程序;
    处理器,设置为执行存储器上所存放的程序时,实现权利要求1-5任一所述的方法步骤。
  13. 一种计算机可读存储介质,所述计算机可读存储介质内存储有计算机程序,所述计算机程序被处理器执行时实现权利要求1-5任一所述的方法步骤。
  14. 一种包含指令的计算机程序产品,所述包含指令的计算机程序产品在计算机上运行时,使得计算机执行权利要求1-5任一所述的方法步骤。
  15. 一种计算机程序,所述计算机程序在计算机上运行时,使得计算机执行权利要求1-5任一所述的方法步骤。
PCT/CN2021/084965 2020-04-24 2021-04-01 一种服务器切换方法、装置、管理节点及存储介质 WO2021213171A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010330470.X 2020-04-24
CN202010330470.XA CN111414247A (zh) 2020-04-24 2020-04-24 一种服务器切换方法、装置、管理节点及存储介质

Publications (1)

Publication Number Publication Date
WO2021213171A1 true WO2021213171A1 (zh) 2021-10-28

Family

ID=71492211

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/084965 WO2021213171A1 (zh) 2020-04-24 2021-04-01 一种服务器切换方法、装置、管理节点及存储介质

Country Status (2)

Country Link
CN (1) CN111414247A (zh)
WO (1) WO2021213171A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114326511A (zh) * 2021-12-29 2022-04-12 珠海万力达电气自动化有限公司 基于monitor配置工具的工矿企业电力集控系统双机切换方法

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111414247A (zh) * 2020-04-24 2020-07-14 北京金山云网络技术有限公司 一种服务器切换方法、装置、管理节点及存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110066672A1 (en) * 2009-09-14 2011-03-17 Red Hat, Inc. Transaction Sticky Load Balance Policies
CN108040108A (zh) * 2017-12-11 2018-05-15 杭州电魂网络科技股份有限公司 通信切换方法、装置、协调服务器及可读存储介质
CN110333974A (zh) * 2019-06-03 2019-10-15 腾讯科技(深圳)有限公司 一种云存储服务的切换方法和设备
CN111414247A (zh) * 2020-04-24 2020-07-14 北京金山云网络技术有限公司 一种服务器切换方法、装置、管理节点及存储介质

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101876924B (zh) * 2009-04-30 2013-10-30 升东网络科技发展(上海)有限公司 数据库故障自动检测及转移方法
CN106982259A (zh) * 2017-04-19 2017-07-25 聚好看科技股份有限公司 服务器集群的故障解决方法
CN107911238A (zh) * 2017-11-13 2018-04-13 郑州云海信息技术有限公司 一种基于ipsan服务器双机备份方法和系统
CN108259239A (zh) * 2018-01-11 2018-07-06 郑州云海信息技术有限公司 一种数据库高可用性保障方法和系统
CN109618000B (zh) * 2019-01-09 2021-08-31 广州视源电子科技股份有限公司 负载均衡服务的主从切换方法、装置、系统及服务器

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110066672A1 (en) * 2009-09-14 2011-03-17 Red Hat, Inc. Transaction Sticky Load Balance Policies
CN108040108A (zh) * 2017-12-11 2018-05-15 杭州电魂网络科技股份有限公司 通信切换方法、装置、协调服务器及可读存储介质
CN110333974A (zh) * 2019-06-03 2019-10-15 腾讯科技(深圳)有限公司 一种云存储服务的切换方法和设备
CN111414247A (zh) * 2020-04-24 2020-07-14 北京金山云网络技术有限公司 一种服务器切换方法、装置、管理节点及存储介质

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114326511A (zh) * 2021-12-29 2022-04-12 珠海万力达电气自动化有限公司 基于monitor配置工具的工矿企业电力集控系统双机切换方法

Also Published As

Publication number Publication date
CN111414247A (zh) 2020-07-14

Similar Documents

Publication Publication Date Title
US10044550B2 (en) Secure cloud management agent
US10445197B1 (en) Detecting failover events at secondary nodes
US10725763B1 (en) Update and rollback of configurations in a cloud-based architecture
US8676959B2 (en) Integrated heartbeat monitoring and failover handling for high availability
WO2021213171A1 (zh) 一种服务器切换方法、装置、管理节点及存储介质
US10275326B1 (en) Distributed computing system failure detection
US8452901B1 (en) Ordered kernel queue for multipathing events
CA2376351A1 (en) Node shutdown in clustered computer system
JP2014522052A (ja) ハードウェア故障の軽減
WO2018121456A1 (zh) 一种数据存储方法、服务器以及存储系统
WO2021184587A1 (zh) 基于Prometheus的私有云监控方法、装置、计算机设备及存储介质
US11953997B2 (en) Systems and methods for cross-regional back up of distributed databases on a cloud service
US11784905B2 (en) Method and apparatus for ensuring continued device operational reliability in cloud-degraded mode
US20240004766A1 (en) Selecting a witness service when implementing a recovery plan
WO2021112911A1 (en) Cross storage protocol access response for object data stores
US8793710B2 (en) Distributed multi-system management
US8578093B1 (en) Managing indications in data storage systems
US8977595B1 (en) Message-recovery file log locating and monitoring
US9317355B2 (en) Dynamically determining an external systems management application to report system errors
WO2024077930A1 (zh) 服务访问方法及装置、存储介质及电子设备
CN113254245A (zh) 一种存储集群的故障检测方法和系统
WO2023029485A1 (zh) 数据处理方法、装置、计算机设备及计算机可读存储介质
JP2016513309A (ja) 分散コンピューティングシステムのコンピューティングノードにおける障害に起因するエラー伝播の制御
WO2023107641A1 (en) Enforcing location-based data privacy rules across networked workloads
US20230289203A1 (en) Server maintenance control device, server maintenance system, server maintenance control method, and program

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21791844

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21791844

Country of ref document: EP

Kind code of ref document: A1