CN115328987A - Database switching method and device, computer equipment and storage medium - Google Patents

Database switching method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN115328987A
CN115328987A CN202210978596.7A CN202210978596A CN115328987A CN 115328987 A CN115328987 A CN 115328987A CN 202210978596 A CN202210978596 A CN 202210978596A CN 115328987 A CN115328987 A CN 115328987A
Authority
CN
China
Prior art keywords
database
access
interfaces
target
terminal
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
CN202210978596.7A
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.)
Pingan Payment Technology Service Co Ltd
Original Assignee
Pingan Payment Technology Service 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 Pingan Payment Technology Service Co Ltd filed Critical Pingan Payment Technology Service Co Ltd
Priority to CN202210978596.7A priority Critical patent/CN115328987A/en
Publication of CN115328987A publication Critical patent/CN115328987A/en
Pending legal-status Critical Current

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
    • G06F16/252Integrating or interfacing systems involving database management systems between a Database Management System and a front-end application
    • 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/2453Query optimisation
    • 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
    • G06F16/2471Distributed queries
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/505Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the load

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Computational Linguistics (AREA)
  • Probability & Statistics with Applications (AREA)
  • Mathematical Physics (AREA)
  • Fuzzy Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application discloses a database switching method, a database switching device, computer equipment and a storage medium, wherein the database switching method comprises the following steps: when a terminal is at N interfaces of a first database and data access is to be started, starting to operate N programs corresponding to N interfaces of a target module package, and acquiring access parameters of N access interfaces corresponding to the terminal in the first database, wherein the N programs correspond to the N interfaces one by one; under the condition that an access parameter corresponding to a target interface exceeds a first threshold value, switching a first database corresponding to the target interface into a second database, wherein the target interface is at least one of N interfaces, the first database and the second database are different databases, the first threshold value corresponds to an access pressure threshold value of the first database, and the access pressure threshold value is a maximum access threshold value which can be borne by the first database.

Description

Database switching method and device, computer equipment and storage medium
Technical Field
The embodiment of the invention relates to the field of big data, in particular to a database switching method and device, computer equipment and a storage medium.
Background
At present, with the rapid development of network device technology, network access through a terminal is very common, wherein database access is an important component of network access, and the security and stability in the database access process are very important.
In the related art, the load capacity of a database determines the minimum load capacity in a network access project, and generally, a database system is composed of a master database and a plurality of slave databases. The master database is used for updating data and inquiring data when the terminal accesses. In the case of an excessive load, the stress of the master database may be reduced by switching the database method.
However, switching databases in situations where the timing of switching databases is not right (e.g., early switching databases) may cause a problem of reduced data security.
Disclosure of Invention
The embodiment of the invention provides a database switching method and device, computer equipment and a storage medium, which can improve the reliability and safety of database switching.
In order to solve the above technical problem, the embodiment of the present invention adopts a technical solution that: provided is a database switching method, comprising: when a terminal is at N interfaces of a first database and data access is to be started, starting to operate N programs corresponding to N interfaces of a target module package, and acquiring access parameters of N access interfaces corresponding to the terminal in the first database, wherein the N programs correspond to the N interfaces one by one; under the condition that an access parameter corresponding to a target interface exceeds a first threshold value, switching a first database corresponding to the target interface into a second database, wherein the target interface is at least one of N interfaces, the first database and the second database are different databases, the first threshold value corresponds to an access pressure threshold value of the first database, and the access pressure threshold value is a maximum access threshold value which can be borne by the first database.
Optionally, after the first database corresponding to the target interface is switched to the second database, the method further includes: starting a terminal access current limiting instruction under the condition that the access parameters of the terminal on the N interfaces exceed a second threshold, wherein the second threshold is larger than the first threshold, and the terminal access current limiting instruction is used for: and indicating to limit the access requests of the terminal on the N interfaces.
Optionally, when the terminal is at N interfaces of the first database and data access is to be started, starting to run N programs of the target module package corresponding to the N interfaces, and acquiring access parameters of the N access interfaces corresponding to the first database, includes: when a terminal wants to start data access at N interfaces of a first database, starting a target module packet corresponding to the first database; sending indication information of agreeing to access the first database to a terminal; and acquiring access parameters of N access interfaces corresponding to the first database according to the running results of the target module packet in the N programs corresponding to the N interfaces.
Optionally, before the terminal starts to run the target module package at the N programs corresponding to the N interfaces and obtains the access parameters of the N access interfaces corresponding to the first database when the terminal wants to start data access at the N interfaces of the first database, the method further includes: and inserting the target module package into the access program of the server corresponding to the first database.
Optionally, the inserting the target module package into the access program of the server corresponding to the first database includes: inserting the target program corresponding to the target module package into the running program corresponding to the first database; and adding a target note for a target program field corresponding to the target program in the running program corresponding to the first database.
Optionally, when the terminal wants to start data access at N interfaces of the first database, starting to run N programs corresponding to the N interfaces of the target module package, including: when a terminal wants to start data access at N interfaces of a first database, reading a target annotation in the first database; and starting to operate the N programs corresponding to the N interfaces of the target module package according to the target annotation.
Optionally, the starting and running of the N programs corresponding to the target module package on the N interfaces includes: starting up a section programming corresponding to the running of the target program, wherein the section programming is used for: and the trigger server runs N programs aiming at the N interfaces.
To solve the foregoing technical problem, an embodiment of the present invention further provides a database switching device, including: the acquisition module is used for starting N programs corresponding to N interfaces of an operation target module package under the condition that a terminal wants to start data access at the N interfaces of a first database, and acquiring access parameters of N access interfaces corresponding to the terminal in the first database, wherein the N programs correspond to the N interfaces one by one; the switching module is configured to switch a first database corresponding to a target interface to a second database when an access parameter corresponding to the target interface acquired by the acquisition module exceeds a first threshold, where the target interface is at least one of N interfaces, the first database and the second database are different databases, the first threshold corresponds to an access pressure threshold of the first database, and the access pressure threshold is a maximum access threshold that the first database can bear.
Optionally, the apparatus further includes an initiating module, where the initiating module is configured to initiate a terminal access throttling instruction when access parameters of the terminal at the N interfaces exceed a second threshold, where the second threshold is greater than the first threshold, and the terminal access throttling instruction is configured to: and indicating to limit the access requests of the terminal on the N interfaces.
Optionally, the apparatus further comprises: the starting module is used for starting a target module package corresponding to a first database when a terminal is at N interfaces of the first database and data access is to be started; the sending module is used for sending indication information of granting access to the first database to a terminal; the obtaining module is specifically configured to obtain, according to the operation result of the target module package at the N programs corresponding to the N interfaces, access parameters of the N access interfaces corresponding to the first database.
Optionally, the apparatus further comprises: and the inserting module is used for inserting the target module package into the access program of the server corresponding to the first database.
Optionally, the apparatus further comprises: the inserting module is specifically configured to insert the target program corresponding to the target module package into the running program corresponding to the first database; and the adding module is used for adding a target note to a target program field corresponding to the target program inserted by the inserting module in the running program corresponding to the first database.
Optionally, the apparatus further comprises: the reading module is used for reading the target annotation in the first database when the terminal is at N interfaces of the first database and data access is to be started; and the starting module is used for starting and operating the N programs corresponding to the N interfaces of the target module package according to the target annotation read by the reading module.
Optionally, the apparatus further comprises: a starting module, configured to start a section program corresponding to the target program, where the section program is configured to: and the trigger server runs N programs aiming at the N interfaces.
In order to solve the above technical problem, an embodiment of the present invention further provides a computer device, including a memory and a processor, where the memory stores computer-readable instructions, and the computer-readable instructions, when executed by the processor, cause the processor to perform the steps of the database switching method.
In order to solve the above technical problem, an embodiment of the present invention further provides a storage medium storing computer-readable instructions, which, when executed by one or more processors, cause the one or more processors to perform the steps of the database switching method described above.
The embodiment of the invention has the beneficial effects that: when the terminal needs to perform data access at the N interfaces of the first database, the network device starts to operate the N programs of the target module package corresponding to the N interfaces, and further obtains access parameters (the N programs are in one-to-one correspondence with the N interfaces) of the N interface access interfaces corresponding to the first database during the process that the terminal accesses the first database, and when the access parameter of at least one interface of the N interfaces exceeds a first threshold value, the network device switches the first database corresponding to the target interface to a second database different from the first database, so that the terminal accesses data contents required to be accessed by the previous target interface through the second database. Therefore, the network equipment switches the database of the target interface under the condition that the access parameter of the target interface in the N interfaces reaches a preset threshold value through the target module package monitoring terminal, and then flexibly switches part or all of the monitored interfaces according to the actual access condition by dynamically monitoring the access parameters of the plurality of interfaces.
Drawings
The foregoing and/or additional aspects and advantages of the present application will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
fig. 1 is a schematic basic flow chart of a database switching method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a basic structure of a database switching apparatus according to an embodiment of the present invention;
fig. 3 is a block diagram showing a basic configuration of a computer device according to an embodiment of the present invention.
Detailed Description
Reference will now be made in detail to embodiments of the present application, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are exemplary only for the purpose of explaining the present application and are not to be construed as limiting the present application.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It will be understood by those within the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. It will be further understood that terms, such as those defined in commonly used dictionaries, should be interpreted as having a meaning that is consistent with their meaning in the context of the prior art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein.
As used herein, a "terminal" includes both devices that are wireless signal receivers, devices that have only wireless signal receivers without transmit capability, and devices that have receive and transmit hardware, devices that have receive and transmit hardware capable of performing two-way communication over a two-way communication link, as will be understood by those skilled in the art. Such a device may include: a cellular or other communication device having a single line display or a multi-line display or a cellular or other communication device without a multi-line display; PCS (Personal Communications Service), which may combine voice, data processing, facsimile and/or data communication capabilities; a PDA (Personal Digital Assistant), which may include a radio frequency receiver, a pager, internet/intranet access, a web browser, a notepad, a calendar and/or a GPS (Global Positioning System) receiver; a conventional laptop and/or palmtop computer or other appliance having and/or including a radio frequency receiver. As used herein, a "terminal" may be portable, transportable, installed in a vehicle (aeronautical, maritime, and/or land-based), or situated and/or configured to operate locally and/or in a distributed fashion at any other location(s) on earth and/or in space. The "terminal" used herein may also be a communication terminal, a web-enabled terminal, a music/video playing terminal, such as a PDA, an MID (Mobile Internet Device) and/or a Mobile phone with music/video playing function, and may also be a smart tv, a set-top box, etc.
Referring to fig. 1, fig. 1 is a schematic diagram of a basic flow of a database switching method provided in this embodiment, which is applied to a network device, and includes steps 201 and 202:
step 201: when the terminal is at the N interfaces of the first database and data access is to be started, the network device starts to operate the N programs of the target module package corresponding to the N interfaces, and access parameters of the terminal at the N access interfaces corresponding to the first database are obtained.
In the embodiment of the present application, the N programs correspond to the N interfaces one to one.
In an embodiment of the application, the N access interfaces are access interfaces of the terminal in the first database.
It should be noted that the interface for the terminal to access the database may include various types, such as an inquiry interface, an addition interface, a modification interface, and the like. The number of each type of interface is not limited under the condition that the terminal accesses one database.
In this embodiment, the N interfaces are query interfaces when the terminal accesses the database.
In this embodiment of the application, the data access to be started by the terminal at the N interfaces of the first database may be: the terminal sends an access request to the network device (e.g., server) to access the database, and the network device has not accepted grant of the access request.
In the embodiment of the present application, the target module package is a module package pre-stored in the server for processing a relevant program of the terminal for accessing the database. For example, a relevant program for processing terminal access to the database in the server inserts a program corresponding to the object module packet.
In this embodiment of the present application, the target module package may be set by a user in a self-defined manner, or may be pre-stored in the network device, for example, the network device is self-defined, and this is not limited in this embodiment of the present application.
In one example, the target module package may be a target agent class, such as a Jar package, the Jar package name being: jar, sentinel database.
In this embodiment, the object module package includes an object program, and the object program is to be started to run when the terminal accesses the database.
Further, the target program belongs to a program of a network device layer, and is applicable to all databases.
In the embodiment of the present application, the target program will generate the section programming when starting to run.
It is understood that the above section programming means: and inserting the program corresponding to the target module package through a related program for accessing the database at the processing terminal. The section programming may enable the server to run the programs corresponding to the object module package when the N interfaces of the first database are accessed by the terminal, that is, to run the N programs on the N interfaces, that is, the N programs are triggered and generated by running the object module package.
Optionally, in this embodiment of the present application, the starting operation target module in step 201 is included in N programs corresponding to the N interfaces, and the database switching method provided in this embodiment of the present application includes the following step a:
step A: and the network equipment starts to operate the section programming corresponding to the target program.
Illustratively, the above-described profile programming is used to: and the trigger server runs N programs aiming at the N interfaces.
It can be understood that the target module package triggers generation of the section programming when starting operation, and the section programming can be cut into the operation process of the N interfaces, that is, one program is operated at each interface of the N interfaces, and the N interfaces correspond to the N programs to monitor the access parameters of the N interfaces.
Therefore, N interfaces of the terminal for accessing the database can be monitored by starting the section programming mode corresponding to the running target program, so that the reliability of statistical access parameters is ensured, and the safety of data access during subsequent database switching is ensured to the maximum extent.
Step 202: and the network equipment switches the first database corresponding to the target interface into a second database under the condition that the access parameter corresponding to the target interface exceeds a first threshold value.
In an embodiment of the application, the target interface is at least one of N interfaces, and the first database and the second database are different databases.
In this embodiment of the present application, the target interface may be a part of or all of the N interfaces, which is not limited in this embodiment of the present application.
In this embodiment, the access parameter may be a parameter related to the terminal accessing the first database, for example, the number of accesses.
In this embodiment of the present application, the first threshold may be preset by a network device, or may be set by a user in a self-defined manner, and this embodiment of the present application is not limited.
In the embodiment of the present application, the first threshold corresponds to an access parameter, and for example, when the access parameter is the number of accesses, the first threshold corresponds to a threshold of the number of accesses.
In an embodiment of the present application, the first threshold corresponds to a pressure threshold of the first database.
It is understood that the first threshold is an access pressure to which the first database is subjected, and the access pressure threshold is a maximum access threshold to which the first database can be subjected.
In an embodiment of the present application, the first database is a master database, and the second database is a slave database.
Further, the second database may include one or more databases.
In the embodiment of the present application, the first database and the second database are connected to each other through a network.
In one embodiment, the server may set a first threshold for the access parameter of the N interfaces of the first database, and switch a target interface used by the terminal for access from the first database to the second database if the access parameter of the target interface of the N interfaces exceeds the first threshold.
Example 1: the server presets that the upper limit of the access times of each query interface in the first database is 10 times/microsecond, the first database is accessed by the terminal and comprises 3 query interfaces, wherein the query interfaces 1, 2 and 3 are respectively used for querying, and if the access times of the query interfaces 1 and 2 exceed 10 times/microsecond, the databases corresponding to the query interfaces 1 and 2 are switched from the first database to the second database.
Further, in a case that the second database is a plurality of second databases, the network device may perform polling switching on the target interface among the plurality of second databases, which is not limited in this embodiment of the present application.
In the database switching method provided by the embodiment of the application, when a terminal needs to perform data access at N interfaces of a first database, a network device starts to operate N programs in which a target module is wrapped on the N interfaces, so as to obtain access parameters (the N programs correspond to the N interfaces one to one) of N interface access interfaces corresponding to the first database in a process that the terminal accesses the first database, and when the access parameter of at least one of the N interfaces exceeds a first threshold, the network device switches the first database corresponding to the target interface to a second database different from the first database, so that the terminal accesses data contents, which need to be accessed by the previous target interface, through the second database. Therefore, the network equipment switches the database of the target interface under the condition that the access parameter of the target interface in the N interfaces reaches a preset threshold value through the target module package monitoring terminal, and then flexibly switches partial or all monitored interfaces according to the actual access condition by dynamically monitoring the access parameters of the plurality of interfaces.
Optionally, in this embodiment of the present application, after the step 202, the database switching method provided in this embodiment of the present application further includes the following step B:
and B: and starting a terminal access current limiting instruction under the condition that the access parameters of the terminal on the N interfaces exceed a second threshold value.
For example, the second threshold is greater than the first threshold, and the terminal access throttling command is configured to: and indicating to limit the access requests of the terminal on the N interfaces.
In this embodiment of the present application, the second threshold may be preset by a network device, or may be set by a user in a self-defined manner, and this embodiment of the present application is not limited.
In the embodiment of the present application, the second threshold corresponds to an access parameter, and for example, when the access parameter is the number of accesses, the second threshold corresponds to a threshold of the number of accesses.
In this embodiment of the application, the access parameter defined by the second threshold is an access parameter corresponding to the entire N interfaces of the terminal, that is, the sum of the access parameters of the N interfaces is compared with the second threshold.
Example 2: with reference to example 1, if the server presets that the access times of all the query interfaces in the first database are limited to 30 times/microsecond, after the databases corresponding to the query interface 1 and the query interface 2 are switched from the first database to the second database, if the access times of the query interface 1, the query interface 2, and the query interface 3 are summed up to 30 times/microsecond, the server will send an access current limiting instruction to the terminal to limit the access of the terminal.
Therefore, by setting the second threshold value, the network device monitors the access parameters of the N interfaces by starting the target module packet, and limits the current in time when the access parameters exceed the second threshold value, so that the stability of the server is ensured simultaneously when the normal access of a user is ensured to the maximum extent, and the phenomenon of avalanche of the server is avoided to the maximum extent.
Optionally, in this embodiment of the present application, in step 201, the database switching method provided in this embodiment of the present application includes the following steps C1 to C3:
step C1: when a terminal is at N interfaces of a first database and data access is to be started, starting a target module packet corresponding to the first database by network equipment;
and step C2: and the network equipment sends the indication information of granting access to the first database to the terminal.
And C3: and the network equipment acquires the access parameters of the N access interfaces corresponding to the first database according to the running results of the N programs corresponding to the N interfaces of the target module packet.
Illustratively, the network device accepts an access request of the terminal to access the first database, and sends indication information of granting access to the first database to the terminal.
For example, the destination module package may refer to the foregoing description, and is not described herein again.
In this embodiment of the present application, the network sends, to the terminal, indication information agreeing to access the first database, where the indication information agreeing to access the first database is used to formally start an action of the terminal to access the database, that is, the network device sends, to the terminal, indication information agreeing to access the first database, where the N interfaces generate access data of the terminal, and the network device wraps, through an operation target module, N programs corresponding to the N interfaces, to obtain an operation result, and further obtains access parameters of the N access interfaces corresponding to the first database.
In this embodiment of the present application, the operation result includes access parameters of N access interfaces corresponding to the first database.
Therefore, the network equipment can start the monitoring program in advance before the terminal formally accesses the first database by setting the target module packet, so that the access parameters of the N interfaces can be comprehensively and accurately monitored subsequently, and the stability of the database is ensured while the efficiency of the terminal accessing the database is improved.
Optionally, in this embodiment of the present application, before the step 201, the database switching method provided in this embodiment of the present application includes the following step D:
step D: and the network equipment inserts the target module packet into the access program of the server corresponding to the first database.
It is understood that the object module package may be a monitoring program that can be inserted into an access program of a corresponding server of the first database. For example, the monitoring program may be JAVA code
It should be noted that, the monitoring program has compatibility with the access program of the server corresponding to the first database, which does not substantially change the access program of the server corresponding to the first database, but only adds a monitoring function to the access program.
Therefore, the target module packet with compatibility is inserted into the access program of the server corresponding to the first database, so that the access program is reasonably expanded, the access program is not changed substantially, the efficiency of accessing the database can be improved and the stability of the database can be ensured when a subsequent terminal accesses the database.
Optionally, in this embodiment of the present application, in step C, the database switching method provided in this embodiment of the present application includes the following steps E1 and E2:
step E1: and the network equipment inserts the target program corresponding to the target module packet into the running program corresponding to the first database.
Step E2: and the network equipment adds a target note to a target program field corresponding to the target program in an operating program corresponding to the first database.
Illustratively, the target program may be a program for monitoring N interfaces when the terminal accesses the database.
For example, the target annotation may prompt the network device to run the target program first when the terminal intends to start data access at N interfaces of the first database.
For example, the target annotation may be user-defined or preset by the network device, and is not limited in this embodiment.
For example, the target module package is a Jar package, which has the name: jar, then its annotation may be: @ Sentineldabase
Optionally, in this embodiment of the present application, in the case that the terminal starts data access at N interfaces of the first database in step 201, the start-up operation target module is included in N programs corresponding to the N interfaces, and the database switching method provided in this embodiment of the present application includes steps E1 and E2 as follows:
step F1: when the terminal starts data access at N interfaces of the first database, the network equipment reads the target annotation in the first database.
Step F2: and the network equipment starts to operate the N programs corresponding to the N interfaces of the target module package according to the target annotation.
Therefore, before the terminal really starts to access the database, the network equipment firstly operates the N programs corresponding to the N interfaces of the target module package by reading the target annotation, so that the subsequent terminal does not omit the statistic access parameters after really starting to access the database, and the accuracy of the statistic access parameters is ensured.
In order to solve the above technical problem, an embodiment of the present invention further provides a database switching device. Referring to fig. 2, fig. 2 is a schematic diagram of a basic structure of the database switching apparatus according to the present embodiment.
As shown in fig. 2, a database switching apparatus includes: an obtaining module 301, configured to, when a terminal is at N interfaces of a first database and data access is to be started, start to run N programs, corresponding to N interfaces, of a target module package, and obtain access parameters of N access interfaces, corresponding to the first database, of the terminal, where the N programs are in one-to-one correspondence with the N interfaces; a switching module 302, configured to switch a first database corresponding to a target interface obtained by the obtaining module 301 to a second database when an access parameter corresponding to the target interface exceeds a first threshold, where the target interface is at least one of N interfaces, the first database and the second database are different databases, the first threshold corresponds to an access pressure threshold of the first database, and the access pressure threshold is a maximum access threshold that can be borne by the first database.
When the terminal needs to perform data access at the N interfaces of the first database, the database switching device starts to operate the N programs of the target module packet corresponding to the N interfaces, so as to obtain access parameters (the N programs are in one-to-one correspondence with the N interfaces) of the N interface access interfaces corresponding to the first database during the process that the terminal accesses the first database, and when the access parameter of at least one interface of the N interfaces exceeds a first threshold value, the database switching device switches the first database corresponding to the target interface to a second database different from the first database, so that the terminal accesses data contents required to be accessed by the previous target interface through the second database. Therefore, the database switching device switches the database of the target interface under the condition that the access parameter of the target interface in the N interfaces reaches a preset threshold value through the target module package monitoring terminal, and then flexibly switches partial or all monitored interfaces according to the actual access condition by dynamically monitoring the access parameters of the plurality of interfaces.
In some embodiments, the apparatus further includes an initiating module, configured to initiate a terminal access throttling instruction if the access parameter of the terminal at the N interfaces exceeds a second threshold, where the second threshold is greater than the first threshold, and the terminal access throttling instruction is configured to: and indicating to limit the access requests of the terminal on the N interfaces.
In some embodiments, the apparatus further comprises: the starting module is used for starting a target module package corresponding to a first database when a terminal is at N interfaces of the first database and data access is to be started; the sending module is used for sending indication information of agreeing to access the first database to a terminal; the obtaining module is specifically configured to obtain, according to the operation result of the target module package at the N programs corresponding to the N interfaces, access parameters of the N access interfaces corresponding to the first database.
In some embodiments, the apparatus further comprises: and the inserting module is used for inserting the target module package into the access program of the server corresponding to the first database.
In some embodiments, the apparatus further comprises: the inserting module is specifically configured to insert the target program corresponding to the target module package into the running program corresponding to the first database; and the adding module is used for adding a target note to a target program field corresponding to the target program inserted by the inserting module in the running program corresponding to the first database.
In some embodiments, the apparatus further comprises: the reading module is used for reading the target annotation in the first database when the terminal is at N interfaces of the first database and data access is to be started; and the starting module is used for starting and operating the N programs corresponding to the N interfaces of the target module package according to the target annotation read by the reading module.
In some embodiments, the apparatus further comprises: a starting module, configured to start a section program corresponding to the target program, where the section program is configured to: and the trigger server runs N programs aiming at the N interfaces.
In order to solve the above technical problem, an embodiment of the present invention further provides a computer device. Referring to fig. 3, fig. 3 is a block diagram of a basic structure of a computer device according to the present embodiment.
As shown in fig. 3, the internal structure of the computer device is schematically illustrated. The computer device includes a processor, a non-volatile storage medium, a memory, and a network interface connected by a system bus. The non-volatile storage medium of the computer device stores an operating system, a database and computer readable instructions, the database can store control information sequences, and the computer readable instructions, when executed by the processor, can enable the processor to implement a data relationship reconstruction method. The processor of the computer device is used for providing calculation and control capability and supporting the operation of the whole computer device. The memory of the computer device may have stored therein computer readable instructions that, when executed by the processor, may cause the processor to perform a data relationship reconstruction method. The network interface of the computer device is used for connecting and communicating with the terminal. Those skilled in the art will appreciate that the architecture shown in fig. 3 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In this embodiment, the processor is configured to execute specific functions of the obtaining module 301 and the switching module 302 in fig. 2, and the memory stores program codes and various data required for executing the modules. The network interface is used for data transmission to and from a user terminal or a server. The memory in this embodiment stores program codes and data necessary for executing all the submodules in the data relationship reconstruction device, and the server can call the program codes and data of the server to execute the functions of all the submodules.
The computer equipment constructs the data relationship between the collected transaction nodes into a node feature graph and a corresponding adjacency matrix, extracts the features of the node feature graph and the adjacency matrix by adopting a graph neural network, reconstructs the relationship according to the extracted features, reconstructs the data based on the hidden logic relationship between the learned data when reconstructing the relationship, and the process of reconstructing the relationship is the process of restoring the data node feature graph and the adjacency matrix. The graph neural network verifies the correctness of the learned hidden incidence relation between the transaction nodes in the process of scattering and recombining the data node characteristic graph and the adjacency matrix, then conducts relation reconstruction on the transaction nodes by using the learned hidden relation, selects the target transaction nodes meeting the conditions for subsequent application, and deeply reads out the logical relation behind the data through a graph processing technology, so that the depth and the efficiency of data analysis are improved.
The present invention also provides a storage medium storing computer-readable instructions, which when executed by one or more processors, cause the one or more processors to perform the steps of the data relationship reconstruction method of any of the above embodiments.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above may be implemented by a computer program, which may be stored in a computer readable storage medium, and when executed, may include the processes of the embodiments of the methods described above. The storage medium may be a non-volatile storage medium such as a magnetic disk, an optical disk, a Read-Only Memory (ROM), or a Random Access Memory (RAM).
The present invention also provides a storage medium storing computer-readable instructions, which when executed by one or more processors, cause the one or more processors to perform the steps of the data relationship reconstruction method of any of the above embodiments.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and can include the processes of the embodiments of the methods described above when the computer program is executed. The storage medium may be a non-volatile storage medium such as a magnetic disk, an optical disk, a Read-Only Memory (ROM), or a Random Access Memory (RAM).
Those of skill in the art will appreciate that the various operations, methods, steps in the processes, acts, or solutions discussed in this application can be interchanged, modified, combined, or eliminated. Further, other steps, measures, or schemes in various operations, methods, or flows that have been discussed in this application can be alternated, altered, rearranged, broken down, combined, or deleted. Further, steps, measures, schemes in the prior art having various operations, methods, procedures disclosed in the present application may also be alternated, modified, rearranged, decomposed, combined, or deleted.
The foregoing is only a few embodiments of the present application and it should be noted that those skilled in the art can make various improvements and modifications without departing from the principle of the present application, and that these improvements and modifications should also be considered as the protection scope of the present application.

Claims (10)

1. A database switching method is applied to network equipment, and is characterized by comprising the following steps:
when a terminal is at N interfaces of a first database and data access is to be started, starting to operate N programs corresponding to N interfaces of a target module package, and acquiring access parameters of N access interfaces corresponding to the terminal in the first database, wherein the N programs correspond to the N interfaces one by one;
under the condition that an access parameter corresponding to a target interface exceeds a first threshold value, a first database corresponding to the target interface is switched to a second database, the target interface is at least one of N interfaces, the first database and the second database are different databases, the first threshold value corresponds to an access pressure threshold value of the first database, and the access pressure threshold value is a maximum access threshold value which can be borne by the first database.
2. The method according to claim 1, wherein after the switching the first database corresponding to the target interface to the second database, the method further comprises:
starting a terminal access current limiting instruction under the condition that the access parameters of the terminal on the N interfaces exceed a second threshold, wherein the second threshold is larger than the first threshold, and the terminal access current limiting instruction is used for: and indicating to limit the access requests of the terminal on the N interfaces.
3. The method according to claim 1, wherein when the terminal wants to start data access at N interfaces of a first database, starting to run N programs corresponding to N interfaces of a target module package to obtain access parameters of the N access interfaces corresponding to the first database includes:
when a terminal is at N interfaces of a first database and data access is to be started, starting a target module packet corresponding to the first database;
sending indication information of agreeing to access the first database to a terminal;
and acquiring access parameters of N access interfaces corresponding to the first database according to the running results of the target module package in the N programs corresponding to the N interfaces.
4. The method according to claim 1, wherein when the terminal wants to start data access at N interfaces of a first database, before starting to run N programs corresponding to N interfaces of a target module package and acquiring access parameters of N access interfaces corresponding to the first database, the method further comprises:
and inserting the target module package into the access program of the server corresponding to the first database.
5. The method of claim 4, wherein inserting the object module package into the access program of the server corresponding to the first database comprises:
inserting the target program corresponding to the target module package into the running program corresponding to the first database;
and adding a target annotation to a target program field corresponding to the target program in the running program corresponding to the first database.
6. The method according to claim 5, wherein the starting of the running of the N programs of the target module package corresponding to the N interfaces when the terminal wants to start data access at the N interfaces of the first database comprises:
when a terminal wants to start data access at N interfaces of a first database, reading a target annotation in the first database;
and starting to operate N programs corresponding to the N interfaces of the target module package according to the target annotation.
7. The method according to claim 1, wherein the starting and running of the N programs corresponding to the target module package at the N interfaces comprises:
starting up a section programming corresponding to the running of the target program, wherein the section programming is used for: and the trigger server runs N programs aiming at the N interfaces.
8. A database switching apparatus, comprising:
the terminal comprises an acquisition module, a first database and a second database, wherein the acquisition module is used for starting N programs corresponding to N interfaces of an operation target module package under the condition that the terminal is at the N interfaces of the first database and data access is to be started, and acquiring access parameters of the N access interfaces corresponding to the first database of the terminal, wherein the N programs correspond to the N interfaces one by one;
the switching module is configured to switch a first database corresponding to a target interface to a second database when an access parameter corresponding to the target interface acquired by the acquisition module exceeds a first threshold, where the target interface is at least one of N interfaces, the first database and the second database are different databases, the first threshold corresponds to an access pressure threshold of the first database, and the access pressure threshold is a maximum access threshold that the first database can bear.
9. A computer device comprising a memory and a processor, the memory having stored therein computer readable instructions which, when executed by the processor, cause the processor to carry out the steps of the database switching method according to any one of claims 1 to 7.
10. A storage medium having computer-readable instructions stored thereon, which, when executed by one or more processors, cause the one or more processors to perform the steps of the database switching method of any one of claims 1 to 7.
CN202210978596.7A 2022-08-16 2022-08-16 Database switching method and device, computer equipment and storage medium Pending CN115328987A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210978596.7A CN115328987A (en) 2022-08-16 2022-08-16 Database switching method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210978596.7A CN115328987A (en) 2022-08-16 2022-08-16 Database switching method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115328987A true CN115328987A (en) 2022-11-11

Family

ID=83924157

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210978596.7A Pending CN115328987A (en) 2022-08-16 2022-08-16 Database switching method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115328987A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115794416A (en) * 2023-02-02 2023-03-14 徐工汉云技术股份有限公司 Data hot switching method and device based on Storm and Nacos

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115794416A (en) * 2023-02-02 2023-03-14 徐工汉云技术股份有限公司 Data hot switching method and device based on Storm and Nacos
CN115794416B (en) * 2023-02-02 2023-04-07 徐工汉云技术股份有限公司 Data hot switching method and device based on Storm and Nacos

Similar Documents

Publication Publication Date Title
CN110647438B (en) Event monitoring method and device, computer equipment and storage medium
CN106936441B (en) Data compression method and device
CN111625301A (en) Idempotent processing method, apparatus, device and storage medium
CN110535928B (en) Event pushing method for JAVA intelligent contract of block chain
CN112906024A (en) Data desensitization method, device, storage medium and server
CN115328987A (en) Database switching method and device, computer equipment and storage medium
CN111475324A (en) Log information analysis method and device, computer equipment and storage medium
CN111488331B (en) Database connection method and device and computer equipment
CN112613993A (en) Transaction data processing method and device, computer equipment and storage medium
CN112100152A (en) Service data processing method, system, server and readable storage medium
CN112699034B (en) Virtual login user construction method, device, equipment and storage medium
CN112507010B (en) Service data processing method and device, computer equipment and storage medium
CN115277678B (en) File downloading method, device, computer equipment and storage medium
CN112653668B (en) Data interaction method and device, computer equipment and storage medium
CN113840313B (en) Network mode control method and device of mobile terminal and computer equipment
CN110798222B (en) Data compression method and device
CN113986391A (en) Request processing method, device, medium and computing equipment
CN113259449A (en) Distributed storage method, device, equipment and storage medium
CN111552551A (en) User management method and device based on master-slave system, computer equipment and medium
CN112383665A (en) Information processing method, information processing device, computer equipment and storage medium
CN117573428B (en) Disaster recovery backup method, device, computer equipment and storage medium
CN112016115B (en) Event subscription system based on block chain
CN109388508B (en) Embedded cache sharing system and method for realizing zero dependence
CN114640534A (en) Access interception control method, device, equipment and medium
CN105930496A (en) Data query method and system

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