CN111966520A - Database high availability switching method, device and system - Google Patents

Database high availability switching method, device and system Download PDF

Info

Publication number
CN111966520A
CN111966520A CN202010794037.1A CN202010794037A CN111966520A CN 111966520 A CN111966520 A CN 111966520A CN 202010794037 A CN202010794037 A CN 202010794037A CN 111966520 A CN111966520 A CN 111966520A
Authority
CN
China
Prior art keywords
database
library
standby
main
abnormal
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
CN202010794037.1A
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.)
Shanghai Zhongtongji Network Technology Co Ltd
Original Assignee
Shanghai Zhongtongji Network 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 Shanghai Zhongtongji Network Technology Co Ltd filed Critical Shanghai Zhongtongji Network Technology Co Ltd
Priority to CN202010794037.1A priority Critical patent/CN111966520A/en
Publication of CN111966520A publication Critical patent/CN111966520A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • 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/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0793Remedial or corrective actions
    • 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/1458Management of the backup or restore process
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/302Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本申请涉及一种数据库高可用切换方法,包括:连接并获取多个数据库服务器数据,将每个数据库服务器均配置为主从形式的主库和备库;实时监控当前正在运行的所有主库和备库;当备库出现异常时,停止监控备库和备库对应的主库,并进行告警;当主库出现异常且主库对应的备库正常时,关闭主库,并将主库对应的备库升级为新的主库。当主节点即主库异常或宕机时,能够自动切换到从节点即备库,继续提供数据库服务。并且,本申请中,可以通过监控管理设备实时监控当前正在运行的所有主库和备库,无需额外大量的服务器资源来做支撑。

Figure 202010794037

The present application relates to a database high-availability switching method, which includes: connecting and acquiring data from multiple database servers, configuring each database server as a master-slave master database and a standby database; monitoring all currently running master databases and backup databases in real time. Standby database; when the standby database is abnormal, stop monitoring the standby database and the main database corresponding to the standby database, and issue an alarm; when the main database is abnormal and the standby database corresponding to the main database is normal, close the main database, and set the corresponding The standby database is upgraded to the new primary database. When the master node, the master database, is abnormal or down, it can automatically switch to the slave node, the standby database, and continue to provide database services. Moreover, in the present application, all the main databases and standby databases currently running can be monitored in real time through the monitoring and management device, without requiring a large amount of additional server resources for support.

Figure 202010794037

Description

数据库高可用切换方法、设备及系统Database high availability switching method, device and system

技术领域technical field

本申请涉及数据库管理技术领域,尤其涉及一种数据库高可用切换方法、设备及系统。The present application relates to the technical field of database management, and in particular, to a method, device and system for high-availability switching of databases.

背景技术Background technique

现有技术中,数据库大多为单节点主从模式,当主节点异常或宕机后无法快速恢复,将导致业务长时间不可用。并且,现有的数据库高可用一般是实时应用集群形式,需要消耗大量的服务器资源。In the prior art, most databases are in a single-node master-slave mode. When the master node is abnormal or downtime, it cannot be quickly recovered, which will result in service unavailability for a long time. Moreover, the existing database high availability is generally in the form of a real-time application cluster, which needs to consume a large amount of server resources.

发明内容SUMMARY OF THE INVENTION

为至少在一定程度上克服相关技术中存在的问题,本申请提供一种数据库高可用切换方法、设备及系统。In order to overcome the problems existing in the related art at least to a certain extent, the present application provides a database high-availability switching method, device and system.

本申请的方案如下:The scheme of this application is as follows:

根据本申请实施例的第一方面,提供一种数据库高可用切换方法包括:According to a first aspect of the embodiments of the present application, a method for switching high availability of a database is provided, including:

连接并获取多个数据库服务器数据,将每个数据库服务器均配置为主从形式的主库和备库;Connect and obtain data from multiple database servers, and configure each database server as a master-slave master database and a standby database;

实时监控当前正在运行的所有所述主库和备库;Real-time monitoring of all the main and standby databases currently running;

当所述备库出现异常时,停止监控所述备库和所述备库对应的主库,并进行告警;When the standby database is abnormal, stop monitoring the standby database and the main database corresponding to the standby database, and give an alarm;

当所述主库出现异常且所述主库对应的备库正常时,关闭所述主库,并将所述主库对应的备库升级为新的主库。When the main library is abnormal and the standby library corresponding to the main library is normal, the main library is closed, and the standby library corresponding to the main library is upgraded to a new main library.

优选的,在本申请一种可实现的方式中,所述实时监控当前正在运行的所有所述主库和备库,具体包括:Preferably, in an achievable manner of the present application, the real-time monitoring of all the main and standby databases currently running, specifically includes:

每隔预设时间向所述备库发起一次检测,检测所述备库运行状态;Initiating a detection to the standby database every preset time to detect the running state of the standby database;

若所述备库运行异常则判断为所述备库出现异常;If the standby database runs abnormally, it is determined that the standby database is abnormal;

若所述备库运行正常则对所述备库对应的主库进行建表读写操作;If the standby database is running normally, perform table building and reading and writing operations on the main database corresponding to the standby database;

若在预设次数内均无法对所述主库进行建表读写操作,则判断为所述主库出现异常。If the table building and reading and writing operations cannot be performed on the main library within a preset number of times, it is determined that the main library is abnormal.

优选的,在本申请一种可实现的方式中,还包括:Preferably, in an achievable manner of the present application, it also includes:

对所述新的主库进行建表读写操作,若对所述新的主库进行建表读写操作成功,则判断为切换成功;若对所述新的主库进行建表读写操作失败,则判断为切换失败。Perform table building read and write operations on the new main library, if the new main library is successfully built with table read and write operations, then judged as successful switching; if the new main library is performed with table construction read and write operations If it fails, it is judged that the handover fails.

优选的,在本申请一种可实现的方式中,还包括:Preferably, in an achievable manner of the present application, it also includes:

若切换成功,则通过预设通信方式告知内部工作人员;If the switch is successful, the internal staff will be notified through the preset communication method;

若切换失败,则通过预设通信方式告知内部工作人员,并将切换失败产生的异常信息进行写入日志。If the switching fails, the internal staff will be notified through the preset communication method, and the abnormal information generated by the switching failure will be written into the log.

优选的,在本申请一种可实现的方式中,还包括:Preferably, in an achievable manner of the present application, it also includes:

对所述新的主库重新配置新的备库,并实时监控所述新的主库和所述新的备库。A new standby database is reconfigured for the new primary database, and the new primary database and the new standby database are monitored in real time.

优选的,在本申请一种可实现的方式中,还包括:Preferably, in an achievable manner of the present application, it also includes:

当所述备库出现异常时,将所述备库出现异常产生的异常信息进行写入日志。When the standby database is abnormal, the abnormal information generated by the abnormality of the standby database is written into a log.

优选的,在本申请一种可实现的方式中,所述数据库服务器通过高可用性数据库方案配置为主从形式的主库和备库。Preferably, in an achievable manner of the present application, the database server is configured with a master database and a backup database in a master-slave form through a high-availability database solution.

根据本申请实施例的第二方面,提供一种数据库高可用切换设备,包括:According to a second aspect of the embodiments of the present application, a database high-availability switching device is provided, including:

处理器和存储器;processor and memory;

所述处理器与存储器通过通信总线相连接:The processor and the memory are connected through a communication bus:

其中,所述处理器,用于调用并执行所述存储器中存储的程序;Wherein, the processor is used to call and execute the program stored in the memory;

所述存储器,用于存储程序,所述程序至少用于执行如以上任一项所述的数据库高可用切换方法。The memory is used to store a program, and the program is at least used to execute the method for switching high availability of a database according to any one of the above.

根据本申请实施例的第三方面,提供一种数据库高可用切换系统,包括:According to a third aspect of the embodiments of the present application, a database high-availability switching system is provided, including:

监控管理设备,多个数据库服务器;Monitoring and management equipment, multiple database servers;

所述监控管理设备分别连接各所述数据库服务器;The monitoring and management devices are respectively connected to each of the database servers;

所述数据库服务器均配置为主从形式的主库和备库;The database servers are all configured with master and slave databases in master and slave form;

所述监控管理设备用于实时监控当前正在运行的所有所述主库和备库;当所述备库出现异常时,停止监控所述备库和所述备库对应的主库,并进行告警;当所述主库出现异常且所述主库对应的备库正常时,关闭所述主库,并将所述主库对应的备库升级为新的主库。The monitoring and management device is used for real-time monitoring of all the main libraries and standby libraries currently running; when an abnormality occurs in the standby libraries, it stops monitoring the main libraries corresponding to the standby libraries and the standby libraries, and gives an alarm ; When the main library is abnormal and the standby library corresponding to the main library is normal, the main library is closed, and the standby library corresponding to the main library is upgraded to a new main library.

优选的,在本申请一种可实现的方式中,各所述数据库服务器均搭载Oracle软件;Preferably, in an achievable manner of the present application, each of the database servers is equipped with Oracle software;

所述监控管理设备部署Python3软件,Oracle软件,以及开源的允许访问Oracle数据库服务器的Python扩展模块The monitoring and management device deploys Python3 software, Oracle software, and an open source Python extension module that allows access to the Oracle database server

本申请提供的技术方案可以包括以下有益效果:由于本申请中连接并获取多个数据库服务器数据,将每个数据库服务器均配置为主从形式的主库和备库;实时监控当前正在运行的所有主库和备库;当备库出现异常时,停止监控备库和备库对应的主库,并进行告警;当主库出现异常且主库对应的备库正常时,关闭主库,并将主库对应的备库升级为新的主库。当主节点即主库异常或宕机时,能够自动切换到从节点即备库,继续提供数据库服务。并且,本申请中,可以通过监控管理设备实时监控当前正在运行的所有主库和备库,无需额外大量的服务器资源来做支撑。The technical solution provided by the present application may include the following beneficial effects: due to the connection and acquisition of multiple database server data in the present application, each database server is configured as a master database and a backup database in the form of master and slave; real-time monitoring of all currently running databases The main database and the standby database; when the standby database is abnormal, stop monitoring the main database corresponding to the standby database and the standby database, and issue an alarm; when the main database is abnormal and the standby database corresponding to the main database is normal, close the main database and reset the main database to the main database. The standby database corresponding to the database is upgraded to the new primary database. When the master node, the master database, is abnormal or down, it can automatically switch to the slave node, the standby database, and continue to provide database services. Moreover, in the present application, all the main databases and standby databases currently running can be monitored in real time through the monitoring and management device, without the need for a large amount of additional server resources for support.

应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,并不能限制本申请。It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not limiting of the present application.

附图说明Description of drawings

此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本申请的实施例,并与说明书一起用于解释本申请的原理。The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description serve to explain the principles of the application.

图1是本申请一个实施例提供的一种数据库高可用切换方法的流程示意图;FIG. 1 is a schematic flowchart of a database high-availability switching method provided by an embodiment of the present application;

图2是本申请一个实施例提供的一种数据库高可用切换方法的实际运行时的流程示意图;FIG. 2 is a schematic flowchart of an actual runtime of a database high availability switching method provided by an embodiment of the present application;

图3是本申请一个实施例提供的一种数据库高可用切换设备的结构示意图;3 is a schematic structural diagram of a database high-availability switching device provided by an embodiment of the present application;

图4是本申请一个实施例提供的一种数据库高可用切换系统的结构示意图。FIG. 4 is a schematic structural diagram of a database high-availability switching system provided by an embodiment of the present application.

具体实施方式Detailed ways

这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本申请相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本申请的一些方面相一致的装置和方法的例子。Exemplary embodiments will be described in detail herein, examples of which are illustrated in the accompanying drawings. Where the following description refers to the drawings, the same numerals in different drawings refer to the same or similar elements unless otherwise indicated. The implementations described in the illustrative examples below are not intended to represent all implementations consistent with this application. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present application as recited in the appended claims.

图1是本申请一个实施例提供的一种数据库高可用切换方法的流程示意图,参照图1,一种数据库高可用切换方法,包括:FIG. 1 is a schematic flowchart of a database high availability switching method provided by an embodiment of the present application. Referring to FIG. 1, a database high availability switching method includes:

S11:连接并获取多个数据库服务器数据,将每个数据库服务器均配置为主从形式的主库和备库;S11: Connect to and obtain data from multiple database servers, and configure each database server as a master-slave master database and a standby database;

S12:实时监控当前正在运行的所有主库和备库;S12: Real-time monitoring of all the main and standby databases currently running;

S13:当备库出现异常时,停止监控备库和备库对应的主库,并进行告警;S13: When the standby database is abnormal, stop monitoring the standby database and the main database corresponding to the standby database, and issue an alarm;

S14:当主库出现异常且主库对应的备库正常时,关闭主库,并将主库对应的备库升级为新的主库。S14: When the main library is abnormal and the standby library corresponding to the main library is normal, the main library is closed, and the standby library corresponding to the main library is upgraded to a new main library.

本实施例中,可以同时监控多个数据库服务器,每个数据库服务器可以配置在不同的环境中。In this embodiment, multiple database servers can be monitored at the same time, and each database server can be configured in a different environment.

优选的,各数据库服务器均搭载Oracle软件;Preferably, each database server is equipped with Oracle software;

对应的,监控管理设备部署Python3软件,Oracle软件,以及开源的允许访问Oracle数据库服务器的Python扩展模块。Correspondingly, the monitoring and management device deploys Python3 software, Oracle software, and an open source Python extension module that allows access to the Oracle database server.

优选的,监控管理设备采用ODM监控管理机。Preferably, the monitoring and management device adopts an ODM monitoring and management machine.

由于本申请中连接并获取多个数据库服务器数据,将每个数据库服务器均配置为主从形式的主库和备库;实时监控当前正在运行的所有主库和备库;当备库出现异常时,停止监控备库和备库对应的主库,并进行告警;当主库出现异常且主库对应的备库正常时,关闭主库,并将主库对应的备库升级为新的主库。当主节点即主库异常或宕机时,能够自动切换到从节点即备库,继续提供数据库服务。并且,本申请中,可以通过监控管理设备实时监控当前正在运行的所有主库和备库,无需额外大量的服务器资源来做支撑。Due to the connection and acquisition of data from multiple database servers in this application, each database server is configured as a master-slave master database and a backup database; all currently running master databases and backup databases are monitored in real time; when an exception occurs in the backup database , stop monitoring the standby database and the main database corresponding to the standby database, and issue an alarm; when the main database is abnormal and the standby database corresponding to the main database is normal, close the main database, and upgrade the standby database corresponding to the main database to the new main database. When the master node, the master database, is abnormal or down, it can automatically switch to the slave node, the standby database, and continue to provide database services. Moreover, in the present application, all the main databases and standby databases currently running can be monitored in real time through the monitoring and management device, without requiring a large amount of additional server resources for support.

进一步的,参照图2,实时监控当前正在运行的所有主库和备库,具体包括:Further, referring to Figure 2, real-time monitoring of all the main and standby databases currently running, including:

每隔预设时间向备库发起一次检测,检测备库运行状态;Initiate a test to the standby database every preset time to detect the running status of the standby database;

若备库运行异常则判断为备库出现异常;If the standby database runs abnormally, it is judged that the standby database is abnormal;

若备库运行正常则对备库对应的主库进行建表读写操作;If the standby database is running normally, perform table creation and read and write operations on the main database corresponding to the standby database;

若在预设次数内均无法对主库进行建表读写操作,则判断为主库出现异常。If the table creation and read/write operations cannot be performed on the main library within the preset number of times, it is determined that the main library is abnormal.

预设时间可以为一秒,即每隔一秒向备库发起一次检测,检测备库运行状态。在备库运行正常时则执行对备库对应的主库进行建表读写操作。The preset time can be one second, that is, a test is initiated to the standby database every one second to detect the running status of the standby database. When the standby database is running normally, perform table creation and read and write operations on the main database corresponding to the standby database.

预设次数可以为三次,即在连续三次均无法对主库进行建表读写操作时,判断为主库出现异常。The preset number of times can be three times, that is, when the main library cannot be created or read and written for three consecutive times, it is determined that the main library is abnormal.

一些实施例中的数据库高可用切换方法,参照图2,还包括:The database high-availability switching method in some embodiments, referring to FIG. 2 , further includes:

对新的主库进行建表读写操作,若对新的主库进行建表读写操作成功,则判断为切换成功;若对新的主库进行建表读写操作失败,则判断为切换失败。Perform table building read and write operations on the new main database. If the table building read and write operations on the new main database are successful, the switch is judged to be successful; if the new main database table building read and write operations fail, it is judged as a switch. fail.

将备库升级为新的主库后,对新的主库进行建表读写操作以防新的主库无法正常提供数据支持。在确认新的主库进行建表读写操作成功后,判断为切换成功。After upgrading the standby database to the new primary database, perform table building and reading and writing operations on the new primary database to prevent the new primary database from providing data support normally. After confirming that the new main database successfully performs the table building and reading and writing operations, it is judged that the switching is successful.

优选的,对新的主库进行多次建表读写操作进行测试,如三次。Preferably, the new main library is tested for multiple times of table creation and read and write operations, such as three times.

一些实施例中的数据库高可用切换方法,参照图2,还包括:The database high-availability switching method in some embodiments, referring to FIG. 2 , further includes:

若切换成功,则通过预设通信方式告知内部工作人员;If the switch is successful, the internal staff will be notified through the preset communication method;

若切换失败,则通过预设通信方式告知内部工作人员,并将切换失败产生的异常信息进行写入日志。If the switching fails, the internal staff will be notified through the preset communication method, and the abnormal information generated by the switching failure will be written into the log.

预设通信方式可以为钉钉,邮件等方式。The default communication method can be DingTalk, mail, etc.

无论切换成功失败,均通过钉钉,邮件等方式告知内部工作人员。Regardless of the success or failure of the switch, the internal staff will be informed through DingTalk, email, etc.

在切换失败时,将切换失败产生的异常信息进行写入日志,方便内部工作人员查看失败原因,以便进行处理。When the switching fails, the abnormal information generated by the switching failure is written into the log, so that the internal staff can check the failure reason for processing.

一些实施例中的数据库高可用切换方法,参照图2,还包括:The database high-availability switching method in some embodiments, referring to FIG. 2 , further includes:

对新的主库重新配置新的备库,并实时监控新的主库和新的备库。Reconfigure the new standby database for the new primary database, and monitor the new primary database and the new standby database in real time.

在将备库升级为新的主库后,需要为新的主库重新配置新的备库,并实时监控新的主库和新的备库,以防止新的主库出现异常或宕机。After the standby database is upgraded to the new primary database, it is necessary to reconfigure the new standby database for the new primary database, and monitor the new primary database and the new standby database in real time to prevent abnormality or downtime of the new primary database.

一些实施例中的数据库高可用切换方法,参照图2,还包括:The database high-availability switching method in some embodiments, referring to FIG. 2 , further includes:

当备库出现异常时,将备库出现异常产生的异常信息进行写入日志。When the standby database is abnormal, the abnormal information generated by the abnormality of the standby database is written into the log.

当备库出现异常时,将备库出现异常产生的异常信息进行写入日志,方便内部工作人员查看失败原因,以便进行处理。When an exception occurs in the standby database, the abnormal information generated by the abnormality of the standby database is written into the log, so that the internal staff can check the failure reason for processing.

一些实施例中的数据库高可用切换方法,数据库服务器通过高可用性数据库方案配置为主从形式的主库和备库。In the database high availability switching method in some embodiments, the database server is configured with a master database and a standby database in a master-slave form through a high-availability database scheme.

优选的,采用DataGuard方案,DataGuard方案是甲骨文公司推出的一种高可用性数据库方案,它是在主节点与备用节点间通过日志同步来保证数据的同步,可以实现数据库快速切换与灾难性恢复。Data Guard只是在软件上对数据库进行设置,并不需要额外购买任何组件。用户能够在对主数据库影响很小的情况下,实现主备数据库的同步。而主备机之间的数据差异只限于在线日志部分。Preferably, the DataGuard solution is adopted. The DataGuard solution is a high-availability database solution launched by Oracle Corporation. It uses log synchronization between the primary node and the standby node to ensure data synchronization, and can realize rapid database switching and disaster recovery. Data Guard just sets the database on the software, and does not need to purchase any additional components. Users can synchronize the primary and secondary databases with little impact on the primary database. The data difference between the active and standby servers is limited to the online log part.

一种数据库高可用切换设备,参照图3,包括:A database high-availability switching device, referring to Figure 3, includes:

处理,21和存储器22;processing, 21 and memory 22;

处理器21与存储器22通过通信总线相连接:The processor 21 is connected with the memory 22 through a communication bus:

其中,处理器21,用于调用并执行存储器22中存储的程序;Wherein, the processor 21 is used for calling and executing the program stored in the memory 22;

存储器22,用于存储程序,程序至少用于执行如以上任一实施例中的数据库高可用切换方法。The memory 22 is used for storing a program, and the program is at least used for executing the database high-availability switching method in any of the above embodiments.

一种数据库高可用切换系统,参照图4,包括:A database high-availability switching system, referring to Figure 4, includes:

监控管理设备31,多个数据库服务器32;Monitoring and management equipment 31, multiple database servers 32;

监控管理设备31分别连接各数据库服务器32;The monitoring and management device 31 is respectively connected to each database server 32;

数据库服务器32均配置为主从形式的主库和备库;The database servers 32 are all configured as master and slave databases in the form of master and slave databases;

监控管理设备31用于实时监控当前正在运行的所有主库和备库;当备库出现异常时,停止监控备库和备库对应的主库,并进行告警;当主库出现异常且主库对应的备库正常时,关闭主库,并将主库对应的备库升级为新的主库。The monitoring and management device 31 is used for real-time monitoring of all the main libraries and standby libraries currently running; when the standby library is abnormal, it stops monitoring the main library corresponding to the standby library and the standby library, and gives an alarm; when the main library is abnormal and the main library corresponds to When the standby database is normal, close the main database and upgrade the standby database corresponding to the main database to the new main database.

一些实施例中的数据库高可用切换系统,各数据库服务器32均搭载Oracle软件;In the database high-availability switching system in some embodiments, each database server 32 is equipped with Oracle software;

监控管理设备31部署Python3软件,Oracle软件,以及开源的允许访问Oracle数据库服务器的Python扩展模块。The monitoring and management device 31 deploys Python3 software, Oracle software, and an open source Python extension module that allows access to the Oracle database server.

可以理解的是,上述各实施例中相同或相似部分可以相互参考,在一些实施例中未详细说明的内容可以参见其他实施例中相同或相似的内容。It can be understood that, the same or similar parts in the above embodiments may refer to each other, and the content not described in detail in some embodiments may refer to the same or similar content in other embodiments.

需要说明的是,在本申请的描述中,术语“第一”、“第二”等仅用于描述目的,而不能理解为指示或暗示相对重要性。此外,在本申请的描述中,除非另有说明,“多个”的含义是指至少两个。It should be noted that, in the description of the present application, the terms "first", "second", etc. are only used for the purpose of description, and should not be construed as indicating or implying relative importance. Also, in the description of this application, unless otherwise specified, the meaning of "plurality" means at least two.

流程图中或在此以其他方式描述的任何过程或方法描述可以被理解为,表示包括一个或更多个用于实现特定逻辑功能或过程的步骤的可执行指令的代码的模块、片段或部分,并且本申请的优选实施方式的范围包括另外的实现,其中可以不按所示出或讨论的顺序,包括根据所涉及的功能按基本同时的方式或按相反的顺序,来执行功能,这应被本申请的实施例所属技术领域的技术人员所理解。Any description of a process or method in the flowcharts or otherwise described herein may be understood to represent a module, segment or portion of code comprising one or more executable instructions for implementing a specified logical function or step of the process , and the scope of the preferred embodiments of the present application includes alternative implementations in which the functions may be performed out of the order shown or discussed, including performing the functions substantially concurrently or in the reverse order depending upon the functions involved, which should It is understood by those skilled in the art to which the embodiments of the present application belong.

应当理解,本申请的各部分可以用硬件、软件、固件或它们的组合来实现。在上述实施方式中,多个步骤或方法可以用存储在存储器中且由合适的指令执行系统执行的软件或固件来实现。例如,如果用硬件来实现,和在另一实施方式中一样,可用本领域公知的下列技术中的任一项或他们的组合来实现:具有用于对数据信号实现逻辑功能的逻辑门电路的离散逻辑电路,具有合适的组合逻辑门电路的专用集成电路,可编程门阵列(PGA),现场可编程门阵列(FPGA)等。It should be understood that various parts of this application may be implemented in hardware, software, firmware, or a combination thereof. In the above-described embodiments, various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented by any one or a combination of the following techniques known in the art: Discrete logic circuits, application specific integrated circuits with suitable combinational logic gates, Programmable Gate Arrays (PGA), Field Programmable Gate Arrays (FPGA), etc.

本技术领域的普通技术人员可以理解实现上述实施例方法携带的全部或部分步骤是可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种计算机可读存储介质中,该程序在执行时,包括方法实施例的步骤之一或其组合。Those skilled in the art can understand that all or part of the steps carried by the methods of the above embodiments can be completed by instructing the relevant hardware through a program, and the program can be stored in a computer-readable storage medium, and the program can be stored in a computer-readable storage medium. When executed, one or a combination of the steps of the method embodiment is included.

此外,在本申请各个实施例中的各功能单元可以集成在一个处理模块中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。所述集成的模块如果以软件功能模块的形式实现并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。In addition, each functional unit in each embodiment of the present application may be integrated into one processing module, or each unit may exist physically alone, or two or more units may be integrated into one module. The above-mentioned integrated modules can be implemented in the form of hardware, and can also be implemented in the form of software function modules. If the integrated modules are implemented in the form of software functional modules and sold or used as independent products, they may also be stored in a computer-readable storage medium.

上述提到的存储介质可以是只读存储器,磁盘或光盘等。The above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, and the like.

在本说明书的描述中,参考术语“一个实施例”、“一些实施例”、“示例”、“具体示例”、或“一些示例”等的描述意指结合该实施例或示例描述的具体特征、结构、材料或者特点包含于本申请的至少一个实施例或示例中。在本说明书中,对上述术语的示意性表述不一定指的是相同的实施例或示例。而且,描述的具体特征、结构、材料或者特点可以在任何的一个或多个实施例或示例中以合适的方式结合。In the description of this specification, description with reference to the terms "one embodiment," "some embodiments," "example," "specific example," or "some examples", etc., mean specific features described in connection with the embodiment or example , structure, material or feature is included in at least one embodiment or example of the present application. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.

尽管上面已经示出和描述了本申请的实施例,可以理解的是,上述实施例是示例性的,不能理解为对本申请的限制,本领域的普通技术人员在本申请的范围内可以对上述实施例进行变化、修改、替换和变型。Although the embodiments of the present application have been shown and described above, it should be understood that the above embodiments are exemplary and should not be construed as limitations to the present application. Embodiments are subject to variations, modifications, substitutions and variations.

Claims (10)

1. A database high-availability switching method is characterized by comprising the following steps:
connecting and acquiring data of a plurality of database servers, and configuring each database server into a master database and a slave database in a master-slave mode;
monitoring all the main libraries and the standby libraries which are currently running in real time;
when the standby library is abnormal, stopping monitoring the standby library and the main library corresponding to the standby library, and giving an alarm;
and when the main library is abnormal and the standby library corresponding to the main library is normal, closing the main library and upgrading the standby library corresponding to the main library to a new main library.
2. The method according to claim 1, wherein the monitoring, in real time, all the primary libraries and the backup libraries currently running specifically includes:
initiating detection to the standby library once every preset time, and detecting the running state of the standby library;
if the standby library is abnormal in operation, judging that the standby library is abnormal;
if the standby library runs normally, performing table building read-write operation on a main library corresponding to the standby library;
and if the table building read-write operation cannot be carried out on the main library within the preset times, judging that the main library is abnormal.
3. The method of claim 2, further comprising:
performing table building read-write operation on the new master library, and if the table building read-write operation on the new master library is successful, judging that the switching is successful; and if the table building read-write operation on the new master library fails, judging that the switching fails.
4. The method of claim 3, further comprising:
if the switching is successful, informing internal workers through a preset communication mode;
and if the switching fails, informing internal workers in a preset communication mode, and writing abnormal information generated by the switching failure into a log.
5. The method of claim 1, further comprising:
and reconfiguring a new standby library for the new main library, and monitoring the new main library and the new standby library in real time.
6. The method of claim 1, further comprising:
and when the standby library is abnormal, writing abnormal information generated by the abnormal standby library into a log.
7. The method of claim 1, wherein the database server is configured as a master library and a slave library in a master-slave fashion via a high availability database schema.
8. A database high availability switching device, comprising:
a processor and a memory;
the processor and the memory are connected through a communication bus:
the processor is used for calling and executing the program stored in the memory;
the memory for storing a program for performing at least the database high availability switching method of any one of claims 1-7.
9. A database high availability switching system, comprising:
a monitoring management device, a plurality of database servers;
the monitoring management equipment is respectively connected with each database server;
the database servers are all configured into a master library and a slave library in master-slave mode;
the monitoring management equipment is used for monitoring all the main libraries and the standby libraries which are currently running in real time; when the standby library is abnormal, stopping monitoring the standby library and the main library corresponding to the standby library, and giving an alarm; and when the main library is abnormal and the standby library corresponding to the main library is normal, closing the main library and upgrading the standby library corresponding to the main library to a new main library.
10. The database high availability switching system of claim 9, wherein each of the database servers is loaded with Oracle software;
the monitoring management device deploys Python3 software, Oracle software, and an open-source Python extension module allowing access to the Oracle database server.
CN202010794037.1A 2020-08-10 2020-08-10 Database high availability switching method, device and system Pending CN111966520A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010794037.1A CN111966520A (en) 2020-08-10 2020-08-10 Database high availability switching method, device and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010794037.1A CN111966520A (en) 2020-08-10 2020-08-10 Database high availability switching method, device and system

Publications (1)

Publication Number Publication Date
CN111966520A true CN111966520A (en) 2020-11-20

Family

ID=73366238

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010794037.1A Pending CN111966520A (en) 2020-08-10 2020-08-10 Database high availability switching method, device and system

Country Status (1)

Country Link
CN (1) CN111966520A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113722151A (en) * 2021-07-30 2021-11-30 浪潮电子信息产业股份有限公司 Metadata polling method, device, equipment and medium for big data platform
CN113806121A (en) * 2021-02-09 2021-12-17 京东科技控股股份有限公司 Instance backup abnormity detection method and device, electronic equipment and storage medium
CN114785789A (en) * 2022-04-26 2022-07-22 平安普惠企业管理有限公司 Database fault management method and device, electronic equipment and storage medium
CN114925052A (en) * 2022-05-18 2022-08-19 京东科技信息技术有限公司 Method, device, equipment and computer readable medium for restarting database

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103064860A (en) * 2011-10-21 2013-04-24 阿里巴巴集团控股有限公司 Database high availability implementation method and device
US20150347250A1 (en) * 2014-05-30 2015-12-03 Altibase Corp. Database management system for providing partial re-synchronization and partial re-synchronization method of using the same
CN110442650A (en) * 2019-08-09 2019-11-12 中国工商银行股份有限公司 Database switching method, device, system, electronic equipment and storage medium
CN110955723A (en) * 2019-11-15 2020-04-03 北京浪潮数据技术有限公司 Master-slave database synchronization state monitoring method and device and electronic equipment
CN111460039A (en) * 2020-04-07 2020-07-28 中国建设银行股份有限公司 Relational database processing system, client, server and method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103064860A (en) * 2011-10-21 2013-04-24 阿里巴巴集团控股有限公司 Database high availability implementation method and device
US20150347250A1 (en) * 2014-05-30 2015-12-03 Altibase Corp. Database management system for providing partial re-synchronization and partial re-synchronization method of using the same
CN110442650A (en) * 2019-08-09 2019-11-12 中国工商银行股份有限公司 Database switching method, device, system, electronic equipment and storage medium
CN110955723A (en) * 2019-11-15 2020-04-03 北京浪潮数据技术有限公司 Master-slave database synchronization state monitoring method and device and electronic equipment
CN111460039A (en) * 2020-04-07 2020-07-28 中国建设银行股份有限公司 Relational database processing system, client, server and method

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113806121A (en) * 2021-02-09 2021-12-17 京东科技控股股份有限公司 Instance backup abnormity detection method and device, electronic equipment and storage medium
CN113806121B (en) * 2021-02-09 2024-05-17 京东科技控股股份有限公司 Instance backup anomaly detection method and device, electronic equipment and storage medium
CN113722151A (en) * 2021-07-30 2021-11-30 浪潮电子信息产业股份有限公司 Metadata polling method, device, equipment and medium for big data platform
CN114785789A (en) * 2022-04-26 2022-07-22 平安普惠企业管理有限公司 Database fault management method and device, electronic equipment and storage medium
CN114785789B (en) * 2022-04-26 2024-01-16 永诚恒易网络科技股份有限公司 Database fault management method and device, electronic equipment and storage medium
CN114925052A (en) * 2022-05-18 2022-08-19 京东科技信息技术有限公司 Method, device, equipment and computer readable medium for restarting database

Similar Documents

Publication Publication Date Title
CN111966520A (en) Database high availability switching method, device and system
CN107660289B (en) Automatic network control
US7716520B2 (en) Multi-CPU computer and method of restarting system
CN108710673A (en) Realize database high availability method, system, computer equipment and storage medium
CN111143044B (en) Task scheduling management system, method, device and storage medium thereof
CN109144789B (en) A method, device and system for restarting OSD
CN113726553A (en) Node fault recovery method and device, electronic equipment and readable storage medium
CN111966380A (en) BMC (baseboard management controller) firmware upgrading method, system, terminal and storage medium
CN111858240A (en) A monitoring method, system, device and medium for a distributed storage system
CN108108255A (en) The detection of virtual-machine fail and restoration methods and device
US20190187977A1 (en) Dual boot operating system installation using multiple redundant drives
US8984333B2 (en) Automatic computer storage medium diagnostics
CN105119765B (en) A kind of Intelligent treatment fault system framework
WO2019179459A1 (en) Method and system for verifying software version
CN119690754A (en) A memory fault processing method, device, medium and server
CN114942859A (en) Method, device, equipment, medium and program product for processing node failure
US11474904B2 (en) Software-defined suspected storage drive failure identification
US20100023801A1 (en) Method to recover from ungrouped logical path failures
CN111338678A (en) A method and device for upgrading and verifying a storage system
CN109947602A (en) PowerVM-based partition recovery method, device, device and medium
CN117033115A (en) Fault processing method, device, equipment and storage medium
CN116069583A (en) A database cluster management method, device and network equipment
CN114201393A (en) Processing methods, apparatus, equipment, media and program products for software testing
Cisco Operational Traps
Cisco Operational Traps

Legal Events

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

Application publication date: 20201120

RJ01 Rejection of invention patent application after publication