CN114564530A - Database access method, device, equipment and storage medium - Google Patents

Database access method, device, equipment and storage medium Download PDF

Info

Publication number
CN114564530A
CN114564530A CN202210182423.4A CN202210182423A CN114564530A CN 114564530 A CN114564530 A CN 114564530A CN 202210182423 A CN202210182423 A CN 202210182423A CN 114564530 A CN114564530 A CN 114564530A
Authority
CN
China
Prior art keywords
database
access
registration
cluster
virtual
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.)
Granted
Application number
CN202210182423.4A
Other languages
Chinese (zh)
Other versions
CN114564530B (en
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.)
Suzhou Inspur Intelligent Technology Co Ltd
Original Assignee
Suzhou Inspur Intelligent 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 Suzhou Inspur Intelligent Technology Co Ltd filed Critical Suzhou Inspur Intelligent Technology Co Ltd
Priority to CN202210182423.4A priority Critical patent/CN114564530B/en
Publication of CN114564530A publication Critical patent/CN114564530A/en
Application granted granted Critical
Publication of CN114564530B publication Critical patent/CN114564530B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • 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/21Design, administration or maintenance of databases
    • 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/24Querying
    • G06F16/245Query processing
    • G06F16/2458Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
    • 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)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Mathematical Physics (AREA)
  • Computational Linguistics (AREA)
  • Software Systems (AREA)
  • Probability & Statistics with Applications (AREA)
  • Fuzzy Systems (AREA)
  • Computing Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application discloses a database access method, a database access device and a storage medium. The method comprises the following steps: acquiring a plurality of database registration requests through a reserved registration interface, and performing corresponding database registration according to the database registration requests to obtain a registered database cluster; creating a corresponding virtual database for the database cluster; and acquiring a data access request through the virtual database, and screening a target access database from the database cluster according to a preset screening rule so as to execute the data access request by using the target access database. By means of the automatic routing scheme of the unified entry, the problem that after a multi-database master-slave is established, user services access multi-node services is solved, the database registration routing scheme with high master-slave availability is achieved, multi-nodes of the database can be uniformly controlled, the use of the whole service cannot be influenced by the fault of a certain node, and the database access efficiency is improved.

Description

Database access method, device, equipment and storage medium
Technical Field
The present invention relates to the field of database management, and in particular, to a database access method, apparatus, device, and storage medium.
Background
At present, with the development of internet technology, a database is used as a core base for all services and storage of key data, and the importance of the database is self-evident, but the database has the characteristics of being fragile and difficult to maintain. Factors such as power failure due to an emergency, misoperation due to human factors, large request flow and the like may cause data loss and service downtime, thereby affecting the normal operation of the service. Mysql, the most popular open source database within the community, is the choice of most businesses. In order to ensure high availability and stable operation of services, multiple sets of database instances are generally deployed in the actual use process, a mysql built-in binlog log system is used for establishing a master-slave cluster, but with the requirements of projects, the database cluster is often expanded transversely along with the development of services, and a huge data network is further formed.
Disclosure of Invention
In view of the above, the present invention provides a database access method, apparatus, device and medium, which can improve database access efficiency. The specific scheme is as follows:
in a first aspect, the present application discloses a database access method, including:
acquiring a plurality of database registration requests through a reserved registration interface, and performing corresponding database registration according to the database registration requests to obtain a registered database cluster;
creating a corresponding virtual database for the database cluster;
and acquiring a data access request through the virtual database, and screening a target access database from the database cluster according to a preset screening rule so as to execute the data access request by using the target access database.
Optionally, the obtaining multiple database registration requests through the reserved registration interface, and performing corresponding database registration according to the database registration requests to obtain a registered database cluster includes:
sequentially acquiring registration requests corresponding to a plurality of databases through a reserved registration interface, and sequentially verifying connectivity of each database according to the registration requests; the reserved registration interface is an application programming interface;
and performing persistent storage on the database with normal connectivity to obtain a registered database so as to obtain the database cluster.
Optionally, the creating a corresponding virtual database for the database cluster includes:
acquiring database screening conditions through a reserved data resource interface;
screening a target database from the database cluster according to the database screening conditions; the target database at least comprises a main node database;
and creating a corresponding virtual database for the target database.
Optionally, the screening out the target access database from the database cluster according to a preset screening rule to execute the data access request by using the target access database includes:
screening a target access database from the database cluster according to the current throughput of each database in the database cluster and the preset screening rule;
and accessing the target access database by using a preset routing strategy according to the data access request, and generating a corresponding data query result.
Optionally, the creating a corresponding virtual database for the database cluster includes:
constructing a data connection pool based on the database connection corresponding to each database;
creating a corresponding virtual database for the database cluster, and disclosing a virtual IP and an access password corresponding to the virtual database;
correspondingly, the accessing the target access database by using a preset routing policy according to the data access request includes:
and acquiring a connection route corresponding to the target access database from the data connection pool, and accessing the target access database according to the connection route.
Optionally, after performing corresponding database registration according to the database registration request to obtain a registered database cluster, the method further includes:
configuring corresponding routing attributes for each database, and obtaining the preset routing strategy based on all the routing attributes;
and configuring a flow control rule, wherein the flow control rule comprises database access frequency control and database access flow control.
Optionally, after the creating the corresponding virtual database for the database cluster, the method further includes:
monitoring each database in the database cluster through a heartbeat mechanism to obtain the running state of the database cluster;
judging whether the database cluster has a fault according to a preset fault detection rule and the running state;
and if the database cluster is judged to have a fault, generating a corresponding alarm prompt.
In a second aspect, the present application discloses a database access device, comprising:
the system comprises a registration request acquisition module, a database registration request acquisition module and a database registration request acquisition module, wherein the registration request acquisition module is used for acquiring a plurality of database registration requests through a reserved registration interface and performing corresponding database registration according to the database registration requests to obtain a registered database cluster;
the virtual database creating module is used for creating a corresponding virtual database for the database cluster;
and the data access module is used for acquiring a data access request through the virtual database, screening a target access database from the database cluster according to a preset screening rule, and executing the data access request by using the target access database.
In a third aspect, the present application discloses an electronic device, comprising:
a memory for storing a computer program;
a processor for executing the computer program to implement the aforementioned database access method.
In a fourth aspect, the present application discloses a computer readable storage medium for storing a computer program; wherein the computer program realizes the aforementioned database access method when executed by a processor.
In the application, a plurality of database registration requests are acquired through a reserved registration interface, and corresponding database registration is carried out according to the database registration requests to obtain a registered database cluster; creating a corresponding virtual database for the database cluster; and acquiring a data access request through the virtual database, and screening a target access database from the database cluster according to a preset screening rule so as to execute the data access request by using the target access database. It can be seen that, by creating a corresponding virtual database for a database cluster, receiving a data access request by using the virtual database, then allocating a corresponding target access database to execute the data access request, allowing a user to quickly complete high-availability configuration of a registered data service through a provided reserved registration interface, after the configuration is completed, providing the data access service for the user by taking the exposed virtual database as a uniform entry, and aiming at the difficult situation of the user service accessing multi-node service after the multi-database master-slave establishment, providing a scheme of uniform entry automatic routing, realizing a master-slave high-availability database registration routing scheme, uniformly managing and controlling multiple nodes of the database, and the use of the whole service cannot be influenced by the fault of a certain node, thereby improving the database access efficiency.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
FIG. 1 is a flow chart of a database access method provided herein;
FIG. 2 is a diagram illustrating a database access method according to the prior art provided by the present application;
FIG. 3 is a schematic diagram of a database access method provided in the present application;
FIG. 4 is a flow chart of a specific database access method provided herein;
FIG. 5 is a diagram of a specific database access system architecture provided herein;
FIG. 6 is a timing diagram illustrating a specific database access provided herein;
FIG. 7 is a schematic diagram of a database access device according to the present application;
fig. 8 is a block diagram of an electronic device provided in the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In the prior art, a database cluster is usually expanded transversely along with the development of services, so that a huge data network is formed, and in an actual scene, the management, access and use of the nodes of the databases are usually difficult and tedious. In order to overcome the technical distinguishing characteristics, the database access method provided by the application solves the difficult situation of user service accessing multi-node service after multi-database master-slave establishment through a scheme of uniform entry automatic routing, realizes a master-slave high-availability database registration routing scheme, can perform uniform control on multiple nodes of a database, and improves the database access efficiency because the fault of a certain node does not influence the use of the whole service.
The embodiment of the application discloses a database access method, and as shown in fig. 1, the method can include the following steps:
step S11: and acquiring a plurality of database registration requests through a reserved registration interface, and performing corresponding database registration according to the database registration requests to obtain a registered database cluster.
In this embodiment, first, a registration request of a user for a plurality of existing databases is obtained through a reserved registration interface, and then, corresponding database registration is performed according to the database registration request, so as to obtain a database cluster including a plurality of databases after registration, where the database may be mysql. The reserved registration Interface may be an open API (Application Programming Interface) Interface or a graphical user Interface.
In this embodiment, the obtaining of the plurality of database registration requests through the reserved registration interface, and performing corresponding database registration according to the database registration requests to obtain the registered database cluster may include: sequentially acquiring registration requests corresponding to a plurality of databases through a reserved registration interface, and sequentially verifying connectivity of each database according to the registration requests; the reserved registration interface is an application programming interface; and performing persistent storage on the database with normal connectivity to obtain a registered database so as to obtain the database cluster. The database which requests to register is firstly subjected to connectivity verification and then registered, and the database can be permanently registered in the storage.
Step S12: and creating a corresponding virtual database for the database cluster.
In this embodiment, after the database registration is completed, a corresponding virtual database is created for the database cluster, and the virtual database may be used as a unified entry to receive a data access request.
In this embodiment, the creating a corresponding virtual database for the database cluster may include: acquiring a database screening condition through a reserved data resource interface; screening a target database from the database cluster according to the database screening conditions; the target database at least comprises a main node database; and creating a corresponding virtual database for the target database. Namely, part of database resources in the database cluster can be selected according to requirements to create a corresponding virtual database, that is, only part of database resources can be opened to allow access.
In this embodiment, after creating the corresponding virtual database for the database cluster, the method may further include: monitoring each database in the database cluster through a heartbeat mechanism to obtain the running state of the database cluster; judging whether the database cluster has a fault according to a preset fault detection rule and the running state; and if the database cluster is judged to have a fault, generating a corresponding alarm prompt. That is, the heartbeat mechanism will check the availability of each database node, and as long as the virtual database meets the requirement of the minimum specification, that is, at least one main node database survives, the user service will not be paralyzed due to the failure of the individual database node. Therefore, by means of the heartbeat mechanism of the platform, even if partial service nodes are failed, the availability of the whole service can be still ensured, and valuable buffer time is provided for users to overhaul the database.
Step S13: and acquiring a data access request through the virtual database, and screening a target access database from the database cluster according to a preset screening rule so as to execute the data access request by using the target access database.
In this embodiment, the virtual database is used to obtain a data access request sent by a user, and a target access database is screened from the database cluster according to a preset screening rule, so that the data access request is executed by using the target access database.
In this embodiment, the screening out the target access database from the database cluster according to a preset screening rule to execute the data access request by using the target access database may include: screening a target access database from the database cluster according to the current throughput of each database in the database cluster and the preset screening rule; and accessing the target access database by using a preset routing strategy according to the data access request, and generating a corresponding data query result. That is, in this embodiment, with the help of the preset routing policy, all request commands can be distributed to the idle database as much as possible, and high utilization of the database of the user is ensured. The platform distributes external request commands to each node as evenly as possible through a set routing strategy, so that partial nodes are prevented from being in idle states while high throughput is achieved, and database resources of users can be utilized to the maximum extent. For example, as shown in fig. 2, in the prior art, a direct connection method is used for data access, and when a problem occurs in a certain slave database, the use of a corresponding service is affected, whereas in the present embodiment, as shown in fig. 3, after a virtual database is used for accepting access, a suitable database is allocated for data access, and normal access to the service can be ensured as long as a master database is normally operated.
In this embodiment, the creating a corresponding virtual database for the database cluster may include: constructing a data connection pool based on the database connection corresponding to each database; creating a corresponding virtual database for the database cluster, and disclosing a virtual IP and an access password corresponding to the virtual database; correspondingly, the accessing the target access database according to the data access request by using a preset routing policy may include: and acquiring a connection route corresponding to the target access database from the data connection pool, and accessing the target access database according to the connection route. The user can directly access all database resources through a unified entry of the virtual database, that is, after the user passes through the registration service to the platform, the user does not need to configure different database connections on each service, and can access the database through the unified entry. That is, for example, as shown in fig. 4, after the user obtains the virtual database connection, all requests are requested to the virtual database, and the virtual database attempts to obtain an available database connection from the connection pool corresponding to the virtual database, and routes the database connection to the real database through the connection, executes the request statement, and returns a corresponding result.
In this embodiment, after performing corresponding database registration according to the database registration request to obtain a registered database cluster, the method may further include: configuring corresponding routing attributes for each database, and obtaining the preset routing strategy based on all the routing attributes; and configuring a flow control rule, wherein the flow control rule comprises database access frequency control and database access flow control.
Further, FIG. 5 discloses a database access system architecture diagram including a Core (Core), a service (Server), and an OpenAPI. The Core is a foundation of the platform and provides a foundation support for the Server, including storage, and is used for providing storage capacity of all metadata bases; the metadata base management is used for managing all configuration metadata bases of the users; the virtual database is used for realizing a unified model between the externally exposed database connection and the real database; the flow control is used for controlling the access frequency and the flow control of the database according to the configuration; and the routing strategy is used for defining different database load routing strategies. The Server is further realized based on basic functions provided by the Core, and Core services of the services are constructed, wherein the Core services comprise a connection pool which is used for suggesting a database connection pool based on database metadata registered by a user; heartbeat detection for determining database availability based on the connection pool; the data route is used for processing the external data request and distributing the data request according to the routing strategy; the OpenAPI/GUI is used for integrating Server capability and providing an external interface API.
The usage process of the database access system by the user mainly comprises three processes of service registration, service configuration and service usage, and specifically, as shown in fig. 6, a specific database access sequence chart is shown, it can be seen that the user registers the existing databases into the platform of this embodiment in sequence through the API, the platform checks the connectivity of each database in sequence in the registration process, and if the metadata information of the database without errors is communicated, the metadata information is persisted into the storage for the use of the subsequent processes. After the database registration is finished, the user can integrate the existing database resources to create a virtual database. The virtual database is composed of a plurality of database nodes, and the minimum specification requires at least one main node database. After all nodes pass master-slave verification, the virtual database is completely established, and the platform can distribute a virtual IP and a random access password. And a corresponding data connection pool is created in the platform for the virtual database, and a request command is waited.
As can be seen from the above, in this embodiment, a plurality of database registration requests are obtained through a reserved registration interface, and corresponding database registration is performed according to the database registration requests to obtain a registered database cluster; creating a corresponding virtual database for the database cluster; and acquiring a data access request through the virtual database, and screening a target access database from the database cluster according to a preset screening rule so as to execute the data access request by using the target access database. It can be seen that the difficulty of user service accessing multi-node service after multi-database master-slave establishment is solved through a scheme of automatic routing of a uniform entry, a master-slave high-availability database registration routing scheme is realized, multiple nodes of a database can be uniformly controlled, the use of the whole service cannot be influenced by the fault of a certain node, and the database access efficiency is improved.
Correspondingly, the embodiment of the present application further discloses a database access device, as shown in fig. 7, the database access device includes:
a registration request obtaining module 11, configured to obtain multiple database registration requests through a reserved registration interface, and perform corresponding database registration according to the database registration requests to obtain a registered database cluster;
a virtual database creating module 12, configured to create a corresponding virtual database for the database cluster;
and the data access module 13 is configured to obtain a data access request through the virtual database, and screen a target access database from the database cluster according to a preset screening rule, so as to execute the data access request by using the target access database.
As can be seen from the above, a plurality of database registration requests are obtained through a reserved registration interface, and corresponding database registration is performed according to the database registration requests to obtain a registered database cluster; creating a corresponding virtual database for the database cluster; and acquiring a data access request through the virtual database, and screening a target access database from the database cluster according to a preset screening rule so as to execute the data access request by using the target access database. It can be seen that the difficulty of user service accessing multi-node service after multi-database master-slave establishment is solved by a scheme of automatic routing of a uniform entry, a master-slave high-availability database registration routing scheme is realized, multiple nodes of a database can be uniformly controlled, the use of the whole service cannot be influenced by the fault of a certain node, and the database access efficiency is improved.
In some specific embodiments, the registration request obtaining module 11 may specifically include:
the connectivity verification unit is used for sequentially acquiring registration requests corresponding to the multiple databases through a reserved registration interface and sequentially verifying the connectivity of each database according to the registration requests; the reserved registration interface is an application programming interface;
and the registration unit is used for performing persistent storage on the database with normal connectivity to obtain a registered database so as to obtain the database cluster.
In some specific embodiments, the virtual database creation module 12 may specifically include:
a database screening condition obtaining unit, configured to obtain a database screening condition through a reserved data resource interface;
the screening unit is used for screening a target database from the database cluster according to the database screening conditions; the target database at least comprises a main node database;
and the virtual database creating unit is used for creating a corresponding virtual database for the target database.
In some specific embodiments, the data access module 13 may specifically include:
the target access database determining unit is used for screening a target access database from the database cluster according to the current throughput of each database in the database cluster and the preset screening rule;
and the access unit is used for accessing the target access database by using a preset routing strategy according to the data access request and generating a corresponding data query result.
In some specific embodiments, the virtual database creation module 12 may specifically include:
the connection pool construction unit is used for constructing and obtaining a data connection pool based on the database connection corresponding to each database;
the virtual database creating unit is used for creating a corresponding virtual database for the database cluster and disclosing a virtual IP and an access password corresponding to the virtual database;
correspondingly, the access unit comprises:
and the connection route acquisition unit is used for acquiring a connection route corresponding to the target access database from the data connection pool and accessing the target access database according to the connection route.
In some embodiments, the database access device may specifically include:
a routing attribute configuration unit, configured to configure a corresponding routing attribute for each database, and obtain the preset routing policy based on all the routing attributes;
and the flow control rule configuration unit is used for configuring flow control rules, and the flow control rules comprise database access frequency control and database access flow control.
In some embodiments, the database access device may specifically include:
the monitoring unit is used for monitoring each database in the database cluster through a heartbeat mechanism to obtain the running state of the database cluster;
the fault judgment unit is used for judging whether the database cluster has faults or not according to preset fault detection rules and the running state;
and the alarm unit is used for generating a corresponding alarm prompt if the database cluster is judged to have a fault.
Further, the embodiment of the present application also discloses an electronic device, which is shown in fig. 8, and the content in the drawing cannot be considered as any limitation to the application scope.
Fig. 8 is a schematic structural diagram of an electronic device 20 according to an embodiment of the present disclosure. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input output interface 25, and a communication bus 26. Wherein the memory 22 is used for storing a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the database access method disclosed in any of the foregoing embodiments.
In this embodiment, the power supply 23 is configured to provide an operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and an external device, and a communication protocol followed by the communication interface is any communication protocol applicable to the technical solution of the present application, and is not specifically limited herein; the input/output interface 25 is configured to obtain external input data or output data to the outside, and a specific interface type thereof may be selected according to specific application requirements, which is not specifically limited herein.
In addition, the storage 22 is used as a carrier for resource storage, and may be a read-only memory, a random access memory, a magnetic disk or an optical disk, etc., and the resources stored thereon include an operating system 221, a computer program 222, data 223 including a training set, etc., and the storage may be a transient storage or a permanent storage.
The operating system 221 is used for managing and controlling each hardware device and the computer program 222 on the electronic device 20, so as to realize the operation and processing of the mass data 223 in the memory 22 by the processor 21, and may be Windows Server, Netware, Unix, Linux, and the like. The computer programs 222 may further include computer programs that can be used to perform other specific tasks in addition to the computer programs that can be used to perform the database access method disclosed in any of the foregoing embodiments and executed by the electronic device 20.
Further, an embodiment of the present application further discloses a computer storage medium, where computer-executable instructions are stored in the computer storage medium, and when the computer-executable instructions are loaded and executed by a processor, the steps of the database access method disclosed in any of the foregoing embodiments are implemented.
The embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same or similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The above detailed description is provided for a database access method, apparatus, device and medium provided by the present invention, and the present application describes the principle and implementation of the present invention by applying specific examples, and the description of the above embodiments is only used to help understanding the method and core idea of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (10)

1. A database access method, comprising:
acquiring a plurality of database registration requests through a reserved registration interface, and performing corresponding database registration according to the database registration requests to obtain a registered database cluster;
creating a corresponding virtual database for the database cluster;
and acquiring a data access request through the virtual database, and screening a target access database from the database cluster according to a preset screening rule so as to execute the data access request by using the target access database.
2. The database access method according to claim 1, wherein the obtaining of the plurality of database registration requests through the reserved registration interface and the performing of the corresponding database registration according to the database registration requests to obtain the registered database cluster comprises:
sequentially acquiring registration requests corresponding to a plurality of databases through a reserved registration interface, and sequentially verifying connectivity of each database according to the registration requests; the reserved registration interface is an application programming interface;
and performing persistent storage on the database with normal connectivity to obtain a registered database so as to obtain the database cluster.
3. The database access method according to claim 1, wherein the creating of the corresponding virtual database for the database cluster comprises:
acquiring database screening conditions through a reserved data resource interface;
screening a target database from the database cluster according to the database screening conditions; the target database at least comprises a main node database;
and creating a corresponding virtual database for the target database.
4. The database access method according to claim 1, wherein the screening out the target access database from the database cluster according to a preset screening rule to execute the data access request by using the target access database comprises:
screening a target access database from the database cluster according to the current throughput of each database in the database cluster and the preset screening rule;
and accessing the target access database by using a preset routing strategy according to the data access request, and generating a corresponding data query result.
5. The database access method according to claim 4, wherein the creating of the corresponding virtual database for the database cluster comprises:
constructing a data connection pool based on the database connection corresponding to each database;
creating a corresponding virtual database for the database cluster, and disclosing a virtual IP and an access password corresponding to the virtual database;
correspondingly, the accessing the target access database by using a preset routing policy according to the data access request includes:
and acquiring a connection route corresponding to the target access database from the data connection pool, and accessing the target access database according to the connection route.
6. The database access method according to claim 4, wherein after the corresponding database registration is performed according to the database registration request to obtain the registered database cluster, the method further comprises:
configuring corresponding routing attributes for each database, and obtaining the preset routing strategy based on all the routing attributes;
and configuring a flow control rule, wherein the flow control rule comprises database access frequency control and database access flow control.
7. The database access method according to any one of claims 1 to 6, further comprising, after creating the corresponding virtual database for the database cluster:
monitoring each database in the database cluster through a heartbeat mechanism to obtain the running state of the database cluster;
judging whether the database cluster has a fault or not according to a preset fault detection rule and the running state;
and if the database cluster is judged to have a fault, generating a corresponding alarm prompt.
8. A database access apparatus, comprising:
the system comprises a registration request acquisition module, a database registration request acquisition module and a database registration request acquisition module, wherein the registration request acquisition module is used for acquiring a plurality of database registration requests through a reserved registration interface and performing corresponding database registration according to the database registration requests to obtain a registered database cluster;
the virtual database creating module is used for creating a corresponding virtual database for the database cluster;
and the data access module is used for acquiring a data access request through the virtual database, screening a target access database from the database cluster according to a preset screening rule, and executing the data access request by using the target access database.
9. An electronic device, comprising:
a memory for storing a computer program;
a processor for executing the computer program to implement the database access method of any of claims 1 to 7.
10. A computer-readable storage medium for storing a computer program; wherein the computer program when executed by the processor implements a database access method as claimed in any one of claims 1 to 7.
CN202210182423.4A 2022-02-25 2022-02-25 Database access method, device, equipment and storage medium Active CN114564530B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210182423.4A CN114564530B (en) 2022-02-25 2022-02-25 Database access method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210182423.4A CN114564530B (en) 2022-02-25 2022-02-25 Database access method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN114564530A true CN114564530A (en) 2022-05-31
CN114564530B CN114564530B (en) 2024-10-15

Family

ID=81716066

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210182423.4A Active CN114564530B (en) 2022-02-25 2022-02-25 Database access method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114564530B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115470303A (en) * 2022-11-14 2022-12-13 苏州浪潮智能科技有限公司 Database access method, device, system, equipment and readable storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111367983A (en) * 2020-03-10 2020-07-03 中国联合网络通信集团有限公司 Database access method, system, device and storage medium
WO2021031549A1 (en) * 2020-03-03 2021-02-25 深圳晶泰科技有限公司 Method for establishing molecular structure and activity database
CN112749045A (en) * 2021-01-11 2021-05-04 深圳市伊欧乐科技有限公司 Database cluster switching method, device, storage medium and apparatus
CN113377866A (en) * 2021-06-10 2021-09-10 全球能源互联网研究院有限公司 Load balancing method and device for virtualized database proxy service

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021031549A1 (en) * 2020-03-03 2021-02-25 深圳晶泰科技有限公司 Method for establishing molecular structure and activity database
CN111367983A (en) * 2020-03-10 2020-07-03 中国联合网络通信集团有限公司 Database access method, system, device and storage medium
CN112749045A (en) * 2021-01-11 2021-05-04 深圳市伊欧乐科技有限公司 Database cluster switching method, device, storage medium and apparatus
CN113377866A (en) * 2021-06-10 2021-09-10 全球能源互联网研究院有限公司 Load balancing method and device for virtualized database proxy service

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
杨鹏飞;刘波;党佳乐;吕文凯;: "面向条件受限环境的动态可重构异构计算平台", 空间控制技术与应用, no. 03, 15 June 2020 (2020-06-15), pages 15 - 21 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115470303A (en) * 2022-11-14 2022-12-13 苏州浪潮智能科技有限公司 Database access method, device, system, equipment and readable storage medium

Also Published As

Publication number Publication date
CN114564530B (en) 2024-10-15

Similar Documents

Publication Publication Date Title
CN108549580B (en) Method for automatically deploying Kubernets slave nodes and terminal equipment
US11089115B2 (en) Discovery of cloud-based infrastructure and resources
CN109067828B (en) Kubernetes and OpenStack container-based cloud platform multi-cluster construction method, medium and equipment
WO2021056949A1 (en) Edge application management method and system
WO2020062131A1 (en) Container cloud management system based on blockchain technology
US8713177B2 (en) Remote management of networked systems using secure modular platform
WO2019184116A1 (en) Method and device for automatically building kubernetes main node, terminal device and computer-readable storage medium
CN109542611A (en) Database, that is, service system, database dispatching method, equipment and storage medium
US7260818B1 (en) System and method for managing software version upgrades in a networked computer system
CN110224860B (en) Load balancing application creation method and device, computer equipment and storage medium
CN111258627B (en) Interface document generation method and device
US10230567B2 (en) Management of a plurality of system control networks
CN110417870A (en) configuration file management method, device, equipment and storage medium
EP3442201B1 (en) Cloud platform construction method and cloud platform
WO2022134797A1 (en) Data fragmentation storage method and apparatus, a computer device, and a storage medium
CN113821268A (en) Kubernetes network plug-in method fused with OpenStack Neutron
CN111970337B (en) P2P network communication construction method, system, medium and terminal under cross-cloud environment
CN112698952A (en) Unified management method and device for computing resources, computer equipment and storage medium
CN114036236A (en) Multi-gateway cluster system
CN113037891A (en) Access method and device for stateful application in edge computing system and electronic equipment
CN117354260A (en) Electromagnetic transient cross-domain distributed parallel computing scheduling method and device
CN114564530A (en) Database access method, device, equipment and storage medium
CN116781564B (en) Network detection method, system, medium and electronic equipment of container cloud platform
CN116743762A (en) Service registration cluster flow switching method, flow switching device and storage medium
CN111818188A (en) Load balancing availability improving method and device for Kubernetes cluster

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
GR01 Patent grant