CN117093425A - Method, system, equipment and storage medium for high availability of database - Google Patents

Method, system, equipment and storage medium for high availability of database Download PDF

Info

Publication number
CN117093425A
CN117093425A CN202311117711.2A CN202311117711A CN117093425A CN 117093425 A CN117093425 A CN 117093425A CN 202311117711 A CN202311117711 A CN 202311117711A CN 117093425 A CN117093425 A CN 117093425A
Authority
CN
China
Prior art keywords
database
node
master node
slave
nodes
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
CN202311117711.2A
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.)
Jinan Inspur Data Technology Co Ltd
Original Assignee
Jinan Inspur Data 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 Jinan Inspur Data Technology Co Ltd filed Critical Jinan Inspur Data Technology Co Ltd
Priority to CN202311117711.2A priority Critical patent/CN117093425A/en
Publication of CN117093425A publication Critical patent/CN117093425A/en
Pending legal-status Critical Current

Links

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/16Error detection or correction of the data by redundancy in hardware
    • G06F11/20Error detection or correction of the data by redundancy in hardware using active fault-masking, e.g. by switching out faulty elements or by switching in spare elements
    • G06F11/202Error detection or correction of the data by redundancy in hardware using active fault-masking, e.g. by switching out faulty elements or by switching in spare elements where processing functionality is redundant
    • G06F11/2023Failover techniques
    • G06F11/203Failover techniques using migration
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (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)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application provides a method, a system, equipment and a storage medium for high availability of a database, wherein the method comprises the following steps: respectively configuring database nodes as a master node and at least one slave node, and detecting database services of the master node at regular time; switching the master node to a new slave node in response to the database service of the master node not being started, and selecting one slave node from the at least one slave node to be switched to the new master node; and starting the database service of the new master node and setting the database virtual IP to the new master node. The application provides an NFS shared directory, a database node mounts the shared directory through an NFS protocol, stores the database in the shared directory, and realizes automatic master-slave switching between two nodes of the database when encountering faults through keepalive, thereby realizing high availability of the database.

Description

Method, system, equipment and storage medium for high availability of database
Technical Field
The present application relates to the field of distributed archiving systems, and more particularly, to a method, system, apparatus, and storage medium for high availability of databases.
Background
With the rapid development of computer technology and network technology. In recent years, various types of data have been explosively increased, and almost all enterprises face the need for mass data storage. Based on the extensive need for mass data application scenario data archiving, distributed archiving systems have evolved. Most of the prior filing systems are single-machine versions, and the databases used are also single-machine versions. Postgresql is an open-source relational database management system supporting most of the SQL standards and providing many other modern features, supporting streaming replication to achieve a database high availability solution; but the high availability scheme configuration steps for stream replication are cumbersome and complex. Once the single-machine version database fails, the whole system cannot be used, and the problems of data loss, irrecoverability and the like can occur, so that the requirements of high reliability and high availability of the distributed archiving system cannot be met. While the high availability configuration scheme for Postgresql stream replication is a number of configuration steps and is complex.
Disclosure of Invention
In view of this, an object of the embodiments of the present application is to provide a method, a system, an electronic device, and a computer readable storage medium for high availability of a database, which fully uses the high reliability of NFS sharing in distributed file storage, and the function of automatically performing master-slave switching in a keepalive fault scenario, so as to implement the dual-node high availability configuration of a Postgresql database, and adapt to the high availability requirement of a distributed archiving system.
Based on the above objects, an aspect of the embodiments of the present application provides a method for high availability of a database, including the steps of: respectively configuring database nodes as a master node and at least one slave node, and detecting database services of the master node at regular time; switching the master node to a new slave node in response to the database service of the master node not being started, and selecting one slave node from the at least one slave node to be switched to the new master node; and starting the database service of the new master node and setting the database virtual IP to the new master node.
In some embodiments, the step of configuring the database node as one master node and at least one slave node, respectively, comprises: and creating an NFS shared directory at the distributed file storage end, and setting the NFS shared directory to store the shared directory for all database nodes.
In some embodiments, the step of configuring the database node as one master node and at least one slave node, respectively, comprises: and mounting the NFS shared directory on the database node through an NFS protocol.
In some embodiments, the step of configuring the database node as one master node and at least one slave node, respectively, comprises: and selecting any database node, decompressing the database file to the NFS shared directory, and giving the database user permission to execute the database file.
In some embodiments, the step of configuring the database node as one master node and at least one slave node, respectively, comprises: respectively deploying keepalive on each database node, configuring one database node as a master node, and configuring the rest database nodes as slave nodes; setting a first script and a second script in a configuration file of the keepalive, wherein the first script is used for checking database services on a main node, and the second script is used for starting the database services; and setting the first script to detect the database service on the master node at the timing, and setting the second script to start the database service of the new master node after the master node and the slave node are switched.
In some embodiments, the step of configuring the database node as one master node and at least one slave node, respectively, comprises: in response to the configuration being completed, restarting all database nodes, starting database services at the master node, and setting database virtual IP to the master node.
In some embodiments, the method further comprises: the database is accessed through a database virtual IP to implement an archiving service.
In another aspect of the embodiments of the present application, there is provided a system for high availability of a database, including: the construction module is used for configuring the database nodes into a master node and at least one slave node respectively, and detecting database services of the master node at regular time; the switching module is used for switching the master node into a new slave node in response to the fact that the database service of the master node is not started, and selecting one slave node from the at least one slave node to switch into the new master node; and the execution module is used for starting the database service of the new master node and setting the database virtual IP to the new master node.
In still another aspect of the embodiment of the present application, there is also provided an electronic device, including: at least one processor; and a memory storing computer instructions executable on the processor, which when executed by the processor, perform the steps of the method as above.
In yet another aspect of the embodiments of the present application, there is also provided a computer-readable storage medium storing a computer program which, when executed by a processor, implements the method steps as described above.
The application has the following beneficial technical effects: the high reliability of the distributed file storage NFS sharing is fully utilized, and the function of automatically performing master-slave switching on the keepalive fault scene is realized, so that the high availability configuration of the two nodes of the Postgresql database is realized, and the high availability requirement of the distributed filing system is met.
Drawings
In order to more clearly illustrate the embodiments of the application or the technical solutions in the prior art, the drawings that are necessary for the description of the embodiments or the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the application and that other embodiments may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram of an embodiment of a method for database high availability provided by the present application;
FIG. 2 is a flow chart of an embodiment of a method for database high availability provided by the present application;
FIG. 3 is a schematic diagram of a high availability distributed file storage architecture for a database according to the present application;
FIG. 4 is a schematic diagram of an embodiment of a database high availability system provided by the present application;
FIG. 5 is a schematic diagram of a hardware architecture of an embodiment of a database highly available electronic device according to the present application;
FIG. 6 is a schematic diagram of an embodiment of a highly available computer storage medium for a database provided by the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the following embodiments of the present application will be described in further detail with reference to the accompanying drawings.
It should be noted that, in the embodiments of the present application, all the expressions "first" and "second" are used to distinguish two entities with the same name but different entities or different parameters, and it is noted that the "first" and "second" are only used for convenience of expression, and should not be construed as limiting the embodiments of the present application, and the following embodiments are not described one by one.
In a first aspect of the embodiments of the present application, an embodiment of a method for high availability of a database is presented. FIG. 1 is a schematic diagram of an embodiment of a method for providing high availability of databases provided by the present application.
As shown in fig. 1, the embodiment of the present application includes the following steps:
s1, respectively configuring database nodes into a master node and at least one slave node, and detecting database services of the master node at regular time;
s2, switching the master node into a new slave node in response to the fact that the database service of the master node is not started, and selecting one slave node from the at least one slave node to switch into the new master node; and
s3, starting the database service of the new master node, and setting the virtual IP of the database to the new master node.
With the rapid development and wide application of enterprise informatization, the dependency of enterprises on data is stronger and stronger, and the data becomes a source of enterprise life. In the face of massive data growth in geometric levels, conventional storage approaches have failed to meet this rapidly growing data storage requirement. How to effectively store mass data for a long time; on the premise of effectively controlling the cost, reasonably managing mass data; how to fully exert the application value of mass data, so that the data can be fully utilized; and how to stand out in strong market competition, to obtain greater market benefits, has become a key problem in informatization work of each enterprise, and data storage will also become the greatest challenge facing the enterprise.
The distributed archiving system is used for making a life cycle management strategy of the data product, providing hierarchical storage management of online, near-line and offline data and realizing automatic migration and back migration of the data under a multi-level storage system; the remote backup management function is provided, so that remote disaster recovery and recovery of metadata and product data of the main data center are realized, timely recovery after disaster occurs in the main data center is ensured, and normal service operation of an application system is supported. The database used by the distributed archiving system is Postgresql for migration metadata storage and management, including task information, system configuration information, tape metadata information, migration object metadata information, migration file metadata information, and the like. Postgresql is an open-source relational database, and is generally used as a single-machine version in traditional applications, but there is a need for high availability in a distributed archiving system, so that in order to ensure high availability, a corresponding database high availability scheme is required to be adopted to realize automatic switching of fault scenes among a plurality of database nodes.
Fig. 2 is a flowchart of an embodiment of a method for providing high availability of a database, as shown in fig. 2, in which a distributed file storage shared directory is created, a shared directory is mounted on a database node, and a database is deployed and configured.
keepalive works at the third, fourth and fifth layers of the TCP/IP reference model, namely the network layer, transport layer and application layer. Network layer: an ICMP packet (similar to a ping function) is sent to each node of the cluster through ICMP protocol, if a certain node does not return a response packet, it is determined that the node fails, keepalive will report the failure of the node, and the failed node is removed from the cluster. Transmission layer: judging whether the cluster nodes are normal or not through port connection and scanning technology of TCP protocol, and once the ports are detected to have no response data return in the transmission layer, considering that the nodes corresponding to the ports have faults, and eliminating the fault nodes from the cluster. Application layer: the user can run the keepalive by writing the script of the program, and the keepalive detects whether various programs or services are normal according to the script, and if the fault is detected, the corresponding service is deleted from the server.
FIG. 3 is a schematic diagram of a highly available distributed file storage architecture for a database according to the present application. In the embodiment of the application, two node databases are taken as an example for configuration, a storage deployment scene is a file scene, a use protocol is NFS, and a specific architecture is shown in figure 3.
In some embodiments, the step of configuring the database node as one master node and at least one slave node, respectively, comprises: and creating an NFS shared directory at the distributed file storage end, and setting the NFS shared directory to store the shared directory for all database nodes. And creating an NFS shared directory at the distributed file storage end, and providing the NFS shared directory for two database nodes to be used as a database file storage shared directory.
In some embodiments, the step of configuring the database node as one master node and at least one slave node, respectively, comprises: and mounting the NFS shared directory on the database node through an NFS protocol.
In some embodiments, the step of configuring the database node as one master node and at least one slave node, respectively, comprises: and selecting any database node, decompressing the database file to the NFS shared directory, and giving the database user permission to execute the database file. And the two database nodes mount the shared directory provided by the distributed file storage through the NFS protocol respectively, then any one node is selected, the Postgresql data file is decompressed to the shared directory, and the database file is endowed with executable authority of a database user.
In some embodiments, the step of configuring the database node as one master node and at least one slave node, respectively, comprises: respectively deploying keepalive on each database node, configuring one database node as a master node, and configuring the rest database nodes as slave nodes; setting a first script and a second script in a configuration file of the keepalive, wherein the first script is used for checking database services on a main node, and the second script is used for starting the database services; and setting the first script to detect the database service on the master node at the timing, and setting the second script to start the database service of the new master node after the master node and the slave node are switched.
And respectively deploying keepalive by the two database nodes, and modifying and configuring the keepalive configuration file. One of the nodes needs to be configured as master node, i.e. master node, and the other node needs to be configured as backup node, i.e. slave node. In the keepalive configuration, two scripts are also called, wherein the check_pg.sh script is used for service check on the master node, and the pg_ha.sh script is used for starting the database service. In addition, the keepalive service needs to be set to be booted up.
In some embodiments, the step of configuring the database node as one master node and at least one slave node, respectively, comprises: in response to the configuration being completed, restarting all database nodes, starting database services at the master node, and setting database virtual IP to the master node.
After the configuration is completed and two nodes of the database are restarted, the database service is started by setting the keepalive as a master node, and the virtual IP of the database also drifts to the database master node. And then the keepalive can detect the database service of the master node at regular time, once the database service of the master node is detected to be not started, the keepalive can switch the original master node into a backup node, the original backup node is switched into the master node, meanwhile, the database service of a new master node is started through the pg_ha.sh script, and the database virtual IP is drifted to the new master node. Whether a failover is to be performed or not and whether a high availability configuration is valid can be confirmed by manually disabling master node database service.
In some embodiments, the method further comprises: the database is accessed through a database virtual IP to implement an archiving service.
And creating an NFS shared directory in the distributed file storage, wherein the NFS shared directory is used for providing two database nodes to serve as a database file storage shared directory. And the two database nodes mount the NFS shared directory provided by the distributed file storage through the NFS protocol respectively, then select any node, decompress the Postgresql data file to the shared directory, and endow the database file with executable rights of database users (Postgres). Next, deploying keepalive software and modifying the keepalive configuration file for two database nodes, wherein one database node needs to be configured as a master, namely a master node, and the other database node needs to be configured as a backup, namely a slave node; two scripts are called in the active configuration file, wherein a check_pg.sh script is used for checking and monitoring the database service on the database master node, and a pg_ha.sh script is used for starting the database service. Initially, the database service will be started on the database master node configured by keepalive, and the database virtual IP will also drift to that node. And detecting database services of the database master node at regular time by the keepalive, switching the original database master node to the slave node when detecting that the database services of the database master node are not started, switching the original database slave node to the master node, drifting the virtual IP of the database to a new database master node, and starting the database services of the new database master node through the pg_ha.sh script. The archiving service accesses the database through the database virtual IP, the fault automatic switching is carried out between the two database nodes, the database virtual IP is always available, and the front-end service is not influenced by the master-slave switching of the database, thereby realizing high availability.
The embodiment of the application comprises the following steps: the distributed file storage NFS shared directory creation, database node mount NFS shared directory, postgresql database installation, keepaled configuration, database service detection script configuration, and the like. The high reliability of the distributed file storage NFS sharing is fully utilized, and the function of automatically performing master-slave switching on the keepalive fault scene is realized, so that the high availability configuration of the two nodes of the Postgresql database is realized, and the high availability requirement of the distributed filing system is met. According to the embodiment of the application, the NFS shared directory is provided through the distributed file storage, the database nodes mount the shared directory through the NFS protocol, the database is stored in the shared directory, and the automatic master-slave switching between the two nodes of the database is realized through the keepalive, so that the high availability of the database is realized.
It should be noted that, the steps in the embodiments of the database high availability method may be intersected, replaced, added and deleted, so that the method of reasonable permutation and combination transformation is also included in the protection scope of the present application, and the protection scope of the present application should not be limited to the embodiments.
Based on the above object, a second aspect of the embodiments of the present application proposes a system with high availability of databases. As shown in fig. 4, the system 200 includes the following modules: the construction module is used for configuring the database nodes into a master node and at least one slave node respectively, and detecting database services of the master node at regular time; the switching module is used for switching the master node into a new slave node in response to the fact that the database service of the master node is not started, and selecting one slave node from the at least one slave node to switch into the new master node; and the execution module is used for starting the database service of the new master node and setting the database virtual IP to the new master node.
In some embodiments, the build module is further to: and creating an NFS shared directory at the distributed file storage end, and setting the NFS shared directory to store the shared directory for all database nodes.
In some embodiments, the build module is further to: and mounting the NFS shared directory on the database node through an NFS protocol.
In some embodiments, the build module is further to: and selecting any database node, decompressing the database file to the NFS shared directory, and giving the database user permission to execute the database file.
In some embodiments, the build module is further to: respectively deploying keepalive on each database node, configuring one database node as a master node, and configuring the rest database nodes as slave nodes; setting a first script and a second script in a configuration file of the keepalive, wherein the first script is used for checking database services on a main node, and the second script is used for starting the database services; and setting the first script to detect the database service on the master node at the timing, and setting the second script to start the database service of the new master node after the master node and the slave node are switched.
In some embodiments, the build module is further to: in response to the configuration being completed, restarting all database nodes, starting database services at the master node, and setting database virtual IP to the master node.
In some embodiments, the system further comprises an archiving module for: the database is accessed through a database virtual IP to implement an archiving service.
According to the embodiment of the application, the NFS shared directory is provided through the distributed file storage, the database nodes mount the shared directory through the NFS protocol, the database is stored in the shared directory, and the automatic master-slave switching between the two nodes of the database is realized through the keepalive, so that the high availability of the database is realized.
In view of the above object, a third aspect of an embodiment of the present application provides an electronic device, including: at least one processor; and a memory storing computer instructions executable on the processor, the instructions being executable by the processor to perform the steps of: s1, respectively configuring database nodes into a master node and at least one slave node, and detecting database services of the master node at regular time; s2, switching the master node into a new slave node in response to the fact that the database service of the master node is not started, and selecting one slave node from the at least one slave node to switch into the new master node; and S3, starting the database service of the new master node, and setting the database virtual IP to the new master node.
In some embodiments, the step of configuring the database node as one master node and at least one slave node, respectively, comprises: and creating an NFS shared directory at the distributed file storage end, and setting the NFS shared directory to store the shared directory for all database nodes.
In some embodiments, the step of configuring the database node as one master node and at least one slave node, respectively, comprises: and mounting the NFS shared directory on the database node through an NFS protocol.
In some embodiments, the step of configuring the database node as one master node and at least one slave node, respectively, comprises: and selecting any database node, decompressing the database file to the NFS shared directory, and giving the database user permission to execute the database file.
In some embodiments, the step of configuring the database node as one master node and at least one slave node, respectively, comprises: respectively deploying keepalive on each database node, configuring one database node as a master node, and configuring the rest database nodes as slave nodes; setting a first script and a second script in a configuration file of the keepalive, wherein the first script is used for checking database services on a main node, and the second script is used for starting the database services; and setting the first script to detect the database service on the master node at the timing, and setting the second script to start the database service of the new master node after the master node and the slave node are switched.
In some embodiments, the step of configuring the database node as one master node and at least one slave node, respectively, comprises: in response to the configuration being completed, restarting all database nodes, starting database services at the master node, and setting database virtual IP to the master node.
In some embodiments, the steps further comprise: the database is accessed through a database virtual IP to implement an archiving service.
According to the embodiment of the application, the NFS shared directory is provided through the distributed file storage, the database nodes mount the shared directory through the NFS protocol, the database is stored in the shared directory, and the automatic master-slave switching between the two nodes of the database is realized through the keepalive, so that the high availability of the database is realized.
As shown in fig. 5, a hardware structure diagram of an embodiment of the electronic device with high database availability provided by the present application is shown.
Taking the example of the apparatus shown in fig. 5, a processor 301 and a memory 302 are included in the apparatus.
The processor 301 and the memory 302 may be connected by a bus or otherwise, for example in fig. 5.
The memory 302 serves as a non-volatile computer readable storage medium, and may be used to store non-volatile software programs, non-volatile computer executable programs, and modules, such as program instructions/modules corresponding to the highly available methods of the database in embodiments of the present application. The processor 301 executes various functional applications of the server and data processing, i.e., a method of achieving high availability of the database, by running nonvolatile software programs, instructions, and modules stored in the memory 302.
Memory 302 may include a storage program area that may store an operating system, at least one application program required for functionality, and a storage data area; the storage data area may store data created according to the use of a highly available method of the database, etc. In addition, memory 302 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid-state storage device. In some embodiments, memory 302 may optionally include memory located remotely from processor 301, which may be connected to the local module via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
Computer instructions 303 corresponding to one or more database high availability methods are stored in memory 302 that, when executed by processor 301, perform the database high availability method of any of the method embodiments described above.
Any one embodiment of an electronic device that performs the database highly available method described above may achieve the same or similar effects as any one of the method embodiments described above that corresponds to it.
The application also provides a computer readable storage medium storing a computer program which when executed by a processor performs a method of database high availability.
As shown in fig. 6, a schematic diagram of an embodiment of the database highly available computer storage medium is provided in the present application. Taking a computer storage medium as shown in fig. 6 as an example, the computer readable storage medium 401 stores a computer program 402 that when executed by a processor performs the above method.
Finally, it should be noted that, as will be appreciated by those skilled in the art, implementing all or part of the above-described methods in the embodiments, the program of the database highly available method may be stored in a computer readable storage medium, and the program may include the steps of the above-described embodiments when executed. The storage medium of the program may be a magnetic disk, an optical disk, a read-only memory (ROM), a random-access memory (RAM), or the like. The computer program embodiments described above may achieve the same or similar effects as any of the method embodiments described above.
The foregoing is an exemplary embodiment of the present disclosure, but it should be noted that various changes and modifications could be made herein without departing from the scope of the disclosure as defined by the appended claims. The functions, steps and/or actions of the method claims in accordance with the disclosed embodiments described herein need not be performed in any particular order. Furthermore, although elements of the disclosed embodiments may be described or claimed in the singular, the plural is contemplated unless limitation to the singular is explicitly stated.
It should be understood that as used herein, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly supports the exception. It should also be understood that "and/or" as used herein is meant to include any and all possible combinations of one or more of the associated listed items.
The foregoing embodiment of the present application has been disclosed with reference to the number of embodiments for the purpose of description only, and does not represent the advantages or disadvantages of the embodiments.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program for instructing relevant hardware, and the program may be stored in a computer readable storage medium, where the storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
Those of ordinary skill in the art will appreciate that: the above discussion of any embodiment is merely exemplary and is not intended to imply that the scope of the disclosure of embodiments of the application, including the claims, is limited to such examples; combinations of features of the above embodiments or in different embodiments are also possible within the idea of an embodiment of the application, and many other variations of the different aspects of the embodiments of the application as described above exist, which are not provided in detail for the sake of brevity. Therefore, any omission, modification, equivalent replacement, improvement, etc. of the embodiments should be included in the protection scope of the embodiments of the present application.

Claims (10)

1. A method for high availability of a database, comprising the steps of:
respectively configuring database nodes as a master node and at least one slave node, and detecting database services of the master node at regular time;
switching the master node to a new slave node in response to the database service of the master node not being started, and selecting one slave node from the at least one slave node to be switched to the new master node; and
and starting the database service of the new master node, and setting the database virtual IP to the new master node.
2. The method of claim 1, wherein the step of configuring the database nodes as a master node and at least one slave node, respectively, comprises:
and creating an NFS shared directory at the distributed file storage end, and setting the NFS shared directory to store the shared directory for all database nodes.
3. The method of claim 2, wherein the step of configuring the database nodes as a master node and at least one slave node, respectively, comprises:
and mounting the NFS shared directory on the database node through an NFS protocol.
4. The method of claim 2, wherein the step of configuring the database nodes as a master node and at least one slave node, respectively, comprises:
and selecting any database node, decompressing the database file to the NFS shared directory, and giving the database user permission to execute the database file.
5. The method of claim 1, wherein the step of configuring the database nodes as a master node and at least one slave node, respectively, comprises:
respectively deploying keepalive on each database node, configuring one database node as a master node, and configuring the rest database nodes as slave nodes;
setting a first script and a second script in a configuration file of the keepalive, wherein the first script is used for checking database services on a main node, and the second script is used for starting the database services; and
and setting the first script to detect the database service on the master node at the timing, and setting the second script to start the database service of the new master node after the master node and the slave node are switched.
6. The method of claim 1, wherein the step of configuring the database nodes as a master node and at least one slave node, respectively, comprises:
in response to the configuration being completed, restarting all database nodes, starting database services at the master node, and setting database virtual IP to the master node.
7. The method of high availability of databases according to claim 1, further comprising:
the database is accessed through a database virtual IP to implement an archiving service.
8. A system for high availability of a database, comprising:
the construction module is used for configuring the database nodes into a master node and at least one slave node respectively, and detecting database services of the master node at regular time;
the switching module is used for switching the master node into a new slave node in response to the fact that the database service of the master node is not started, and selecting one slave node from the at least one slave node to switch into the new master node; and
and the execution module is used for starting the database service of the new master node and setting the database virtual IP to the new master node.
9. An electronic device, comprising:
at least one processor; and
a memory storing computer instructions executable on the processor, which when executed by the processor, perform the steps of the method of any one of claims 1-7.
10. A computer readable storage medium storing a computer program, characterized in that the computer program when executed by a processor implements the steps of the method of any one of claims 1-7.
CN202311117711.2A 2023-08-31 2023-08-31 Method, system, equipment and storage medium for high availability of database Pending CN117093425A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311117711.2A CN117093425A (en) 2023-08-31 2023-08-31 Method, system, equipment and storage medium for high availability of database

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311117711.2A CN117093425A (en) 2023-08-31 2023-08-31 Method, system, equipment and storage medium for high availability of database

Publications (1)

Publication Number Publication Date
CN117093425A true CN117093425A (en) 2023-11-21

Family

ID=88773328

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311117711.2A Pending CN117093425A (en) 2023-08-31 2023-08-31 Method, system, equipment and storage medium for high availability of database

Country Status (1)

Country Link
CN (1) CN117093425A (en)

Similar Documents

Publication Publication Date Title
US10713134B2 (en) Distributed storage and replication system and method
CN107343034B (en) QConf-based Redis high availability system and method
US9037899B2 (en) Automated node fencing integrated within a quorum service of a cluster infrastructure
US9348706B2 (en) Maintaining a cluster of virtual machines
CN112084072B (en) Method, system, medium and terminal for improving disaster tolerance capability of PostgreSQL cluster
WO2022036901A1 (en) Implementation method and apparatus for redis replica set
CN111708560A (en) Automatic deployment method and device of database high-availability management system
CN105511987A (en) Distributed task management system with high consistency and availability
CN114116912A (en) Method for realizing high availability of database based on Keepalived
CN111400285B (en) mySQL data fragment processing method, device, computer equipment and readable storage medium
CN113515316A (en) Novel edge cloud operating system
US8789072B2 (en) Distributed multi-system management
CN105323271B (en) Cloud computing system and processing method and device thereof
CN111176904B (en) Method, system, equipment and medium for data backup under private cloud architecture
CN111813606A (en) Fault-tolerant method, system, equipment and medium for double-node virtual machine
WO2017080362A1 (en) Data managing method and device
CN117093425A (en) Method, system, equipment and storage medium for high availability of database
CN103327105B (en) Slave node service automatic recovery method in hadoop system
CN115658390A (en) Container disaster tolerance method, system, device, equipment and computer readable storage medium
CN114363356B (en) Data synchronization method, system, device, computer equipment and storage medium
WO2013189409A2 (en) Service disaster recovery method and system
WO2022155121A1 (en) Fabric availability and synchronization
CN112131201A (en) Method, system, equipment and medium for high availability of network additional storage
CN112416515A (en) Method, system, equipment and medium for deploying Keepalived cluster
CN114422280B (en) Network deployment method, device, node and storage medium

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