Method, apparatus, device and medium for assigning a switch to a database server

By allocating switches based on the database server's business and sub-database identification and setting a threshold for the number of databases to be kicked out, the problem of business interruption caused by switch failure is solved, and business continuity and resource conservation of the database system are achieved.

CN117194557BActive Publication Date: 2025-10-17NETSUNION CLEARING CORP
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210604814.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-30
Publication Date
2025-10-17
Estimated Expiration
2042-05-30

AI Technical Summary

Technical Problem

In the prior art, database servers are prone to service interruption when a switch fails, especially in a distributed database architecture where the primary and secondary databases of the same service are isolated and inaccessible, resulting in poor service continuity.

Method used

According to the business ID and sub-database ID of the database server, determine the number of sets of multiple database servers, and set the threshold for the number of database servers to be kicked out when allocating switches to ensure that the number of database servers connected to each switch does not exceed the threshold. The master and slave databases are allocated to different switches to avoid global business interruption caused by switch failure.

Benefits of technology

It improves the business continuity of the database system, ensuring that when a switch fails, only some database servers are isolated, and the remaining servers can still meet business needs, reducing network resource waste and ensuring normal business operation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117194557B_ABST
    Figure CN117194557B_ABST
Patent Text Reader

Abstract

The present disclosure provides a method, device, equipment and medium for assigning switches to database servers, relating to the technical field of databases. The method comprises: for a database server of a split database architecture, determining a plurality of groups of database servers according to the service identifier of the database server; for a group of database servers in the plurality of groups of database servers, determining the number of sets of the group of database servers according to the split database identifier of the database server, one set of database servers comprising a plurality of database servers having a correlation relationship; if the number of sets of the group of database servers is greater than a preset resource limit value, obtaining a kick-out set threshold; and assigning switches to the group of database servers from a plurality of switches according to the kick-out set threshold, so that for any one of the plurality of switches, the total number of database servers in the group of database servers assigned to the switch is not greater than the kick-out set threshold, thereby improving the service continuity of the system.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the technical field of database, in particular, to a method and device for assigning a switch to a database server, equipment and readable storage medium. BACKGROUND

[0002] A set of databases in a database of a split database architecture adopted by the financial industry usually includes a master database (hereinafter referred to as a master) and a slave database (or a backup database, hereinafter referred to as a slave). The establishment of the master and the slave is usually based on the following considerations: disaster recovery, load balancing, and data collection and distribution, etc. A large number of database servers can be arranged in each computer room. The master and the slave can be deployed with a kick-out program. The working principle of the kick-out program is to detect the survival state of the predetermined port (for example, the database of the relational database management system MySQL is 3306 port) of the other party's database, for example, 1 time per second. If it is not connected for 3 times in a row, the kick-out operation will be performed, and the business will be automatically isolated, for example, the master stops processing new business, and processes the clearing and reconciliation business by accessing the slave; for example, high availability (HA) software can be deployed on the master and the slave to judge the survival state of the master and the slave, and to be responsible for the switching of the virtual internet protocol (VIP) address. If the master fails, the VIP will drift to the slave. If the slave fails, the HA will modify the semi-synchronous state of the master to asynchronous replication to ensure that the master can write data.

[0003] In the related art, database servers are deployed in batches according to business needs, and after configuration according to IP planning, database deployment and business online are performed. The scheme of assigning a switch to a database is not planned. For example, for a split database architecture including multiple sets of databases, multiple sets of databases of the same business are assigned under the same switch according to IP planning. If the switch fails, the kick-out program detects that the database is lost, and each set of database can be isolated for business. In this case, all databases of the business are isolated, resulting in business interruption.

[0004] As described above, how to assign a switch to a database to improve the business continuity of the database system has become a problem to be solved.

[0005] The above information disclosed in the background section is only used to strengthen the understanding of the background of the present disclosure, and therefore it can include information that does not constitute prior art known to those of ordinary skill in the art. SUMMARY

[0006] The purpose of the present disclosure is to provide a method, device, equipment and readable storage medium for assigning switches to database servers, and to improve business continuity of a database system to some extent.

[0007] Other characteristics and advantages of the present disclosure will become apparent from the following detailed description, or will be learned by practice of the present disclosure.

[0008] According to an aspect of the present disclosure, a method for assigning switches to database servers is provided, comprising: determining a plurality of groups of database servers according to business identifiers of the database servers for database servers of a split database architecture; determining a number of sets of database servers for a group of database servers from the plurality of groups of database servers according to split database identifiers of the database servers, one set of database servers comprising a plurality of database servers having an association relationship; if the number of sets of database servers is greater than a preset resource limit value, obtaining a kick-out set threshold; and assigning switches to the group of database servers from a plurality of switches according to the kick-out set threshold, so that for any one of the plurality of switches, the total number of database servers in the group of database servers assigned to the switch is not greater than the kick-out set threshold.

[0009] According to an embodiment of the present disclosure, the plurality of database servers having an association relationship comprises a master database server and a corresponding slave database server; and assigning switches to the group of database servers from a plurality of switches according to the kick-out set threshold comprises assigning different switches to the master database server and the corresponding slave database server from the plurality of switches.

[0010] According to an embodiment of the present disclosure, the plurality of switches comprises a first switch; and assigning switches to the group of database servers from a plurality of switches according to the kick-out set threshold comprises assigning a predetermined number of target database servers in the group of database servers to the first switch, and assigning each database server in the group of database servers except the predetermined number of target database servers to different switches from the first switch in the plurality of switches, the predetermined number being the kick-out set threshold, the target database server being a master database server or a slave database server, and any two target database servers not belonging to the same set of database servers.

[0011] According to an embodiment of the present disclosure, if the number of the groups of database servers is greater than the preset resource limit value, the number of kicked-out groups threshold is obtained, including: obtaining the rated processing efficiency of each group of database servers in the groups of database servers; obtaining the current processing efficiency of the database servers that have been online in the groups of database servers; and obtaining the number of kicked-out groups threshold according to the rated processing efficiency, the current processing efficiency and the number of the groups of database servers.

[0012] According to an embodiment of the present disclosure, the number of kicked-out groups threshold is obtained according to the rated processing efficiency, the current processing efficiency and the number of the groups of database servers, including: subtracting the current processing efficiency from the rated processing efficiency to obtain the difference between the rated processing efficiency and the current processing efficiency; multiplying the difference between the rated processing efficiency and the current processing efficiency by the number of the groups of database servers to obtain the residual processing efficiency; and obtaining the number of kicked-out groups threshold according to the ratio of the residual processing efficiency to the rated processing efficiency.

[0013] According to an embodiment of the present disclosure, the method further includes: obtaining the architecture category identifier of a database server; determining whether the database server is in a database-splitting architecture or in a non-database-splitting architecture according to the architecture category identifier; obtaining the service identifier of each database server for the plurality of database servers in the non-database-splitting architecture; and assigning different switches to the database servers with the same service identifier.

[0014] According to an embodiment of the present disclosure, the method further includes: obtaining the number of idle interfaces of each switch in the plurality of switches; and assigning the switches to the groups of database servers from the plurality of switches according to the number of kicked-out groups threshold, including: assigning the switches to the groups of database servers from the plurality of switches according to the number of kicked-out groups threshold, so that for any switch in the plurality of switches, the total number of the database servers in the groups of database servers that are assigned to the switch is neither greater than the number of kicked-out groups threshold nor greater than the number of idle interfaces of the switch.

[0015] According to still another aspect of the present disclosure, there is provided an apparatus for allocating switches for database servers, comprising: a server grouping module configured to determine a plurality of groups of database servers according to service identifiers of the database servers for database servers of a split database architecture; a group number determining module configured to determine a group number of a group of database servers according to split database identifiers of the database servers for the group of database servers, wherein a group of database servers comprises a plurality of database servers having an association relationship; a kick-out threshold obtaining module configured to obtain a kick-out group number threshold if the group number of the group of database servers is greater than a preset resource limit value; and a switch allocating module configured to allocate a switch for the group of database servers from a plurality of switches according to the kick-out group number threshold, so that for any one of the plurality of switches, a total number of database servers of the group of database servers allocated to the switch is not greater than the kick-out group number threshold.

[0016] According to an embodiment of the present disclosure, the plurality of database servers having an association relationship comprises a master database server and a corresponding slave database server; and the switch allocating module is further configured to allocate a switch for the group of database servers from a plurality of switches according to the kick-out group number threshold, so that for any one of the plurality of switches, a total number of database servers of the group of database servers allocated to the switch is not greater than the kick-out group number threshold, and the master database server and the corresponding slave database server are allocated different switches from the plurality of switches.

[0017] According to an embodiment of the present disclosure, the plurality of switches comprises a first switch; and the switch allocating module is further configured to allocate a predetermined number of target database servers in the group of database servers to the first switch, and allocate each database server in the group of database servers except the predetermined number of target database servers to a different switch from the plurality of switches except the first switch, wherein the predetermined number is the kick-out group number threshold, the target database server is a master database server or a slave database server, and any two target database servers do not belong to the same group of database servers.

[0018] According to an embodiment of the present disclosure, the kick-out threshold obtaining module comprises: a processing efficiency obtaining module configured to obtain a rated processing efficiency of each group of database servers in the group of database servers; and obtain a current processing efficiency of online database servers in the group of database servers; and a kick-out threshold calculating module configured to obtain the kick-out group number threshold according to the rated processing efficiency, the current processing efficiency, and the group number of the group of database servers.

[0019] According to an embodiment of the present disclosure, the kickout threshold calculation module is further configured to subtract the rated processing efficiency from the current processing efficiency to obtain a difference between the rated processing efficiency and the current processing efficiency; multiply the difference between the rated processing efficiency and the current processing efficiency by the number of groups of database servers to obtain a residual processing efficiency; and obtain the kickout group number threshold according to a ratio of the residual processing efficiency to the rated processing efficiency.

[0020] According to an embodiment of the present disclosure, the apparatus further includes: an architecture category identifier obtaining module configured to obtain an architecture category identifier of a database server; and an architecture determining module configured to determine, according to the architecture category identifier, whether the database server is in a database-grouping architecture or in a non-database-grouping architecture; and the switch assigning module is further configured to, for a plurality of database servers in the non-database-grouping architecture, obtain a service identifier of each database server, and assign different switches to database servers with the same service identifier.

[0021] According to an embodiment of the present disclosure, the switch assigning module includes: a switch interface number obtaining module configured to obtain a number of idle interfaces of each switch in the plurality of switches; and the switch assigning module is further configured to assign switches to the group of database servers from the plurality of switches according to the kickout group number threshold, such that for any switch in the plurality of switches, a total number of database servers in the group of database servers assigned to the switch is neither greater than the kickout group number threshold nor greater than the number of idle interfaces of the switch.

[0022] According to still another aspect of the present disclosure, there is provided an apparatus including a memory, a processor, and executable instructions stored in the memory and executable in the processor, the processor implementing any of the above methods when executing the executable instructions.

[0023] According to still another aspect of the present disclosure, there is provided a computer-readable storage medium having stored thereon computer-executable instructions, the executable instructions being executed by a processor to implement any of the above methods.

[0024] Embodiments of the present disclosure provide a method for assigning switches to database servers, for a database server of a split database architecture, a plurality of groups of database servers are determined according to service identifiers of the database servers, and for a group of database servers in the plurality of groups of database servers, a number of sets of the group of database servers is determined according to split database identifiers of the database servers, if the number of sets of the group of database servers is greater than a preset resource limit value, a switch is assigned to the group of database servers from a plurality of switches according to a kick-out set number threshold, so that for any switch in the plurality of switches, the total number of database servers in the group of database servers assigned to the switch is not greater than the kick-out set number threshold, so that in the case that any switch fails and less than the kick-out set number threshold number of sets of database servers connected to the switch are kicked out, the remaining available sets of database servers can meet the service demand of the group of database servers, and the service continuity of the database system can be improved to a certain extent.

[0025] It should be understood that the foregoing general description and the following detailed description are only examples, and are not limiting of the present disclosure. BRIEF DESCRIPTION OF DRAWINGS

[0026] The above and other objects, features and advantages of the present disclosure will become more apparent from the following detailed description when taken in conjunction with the accompanying drawings in which:

[0027] Figure 1 A schematic diagram showing a system structure in an embodiment of the present disclosure.

[0028] Figure 2A A flowchart showing a method for assigning switches to database servers in an embodiment of the present disclosure.

[0029] Figure 2B A schematic diagram showing a connection mode of a database and a switch in an embodiment of the present disclosure.

[0030] Figure 3 A flowchart showing a method for obtaining a kick-out set number threshold in an embodiment of the present disclosure.

[0031] Figure 4 A flowchart showing another method for assigning switches to database servers in an embodiment of the present disclosure.

[0032] Figure 5 A flowchart showing a method for assigning switches to database servers according to an example embodiment.

[0033] Figure 6 A block diagram showing an apparatus for assigning switches to database servers in an embodiment of the present disclosure.

[0034] Figure 7A block diagram of an apparatus for assigning a switch to a database server is shown.

[0035] Figure 8 A structural schematic diagram of an electronic device is shown. DETAILED DESCRIPTION

[0036] Example embodiments now will be described more fully hereinafter with reference to the accompanying drawings. Example embodiments, may, however, be implemented in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of example embodiments to those skilled in the art. Like reference numerals refer to like elements throughout the description. The terminology used in the description presented below is intended to be interpreted in accordance with the principles of etymology and the contextual press and not be construed too liberally to fit a preconceived notion or definition.

[0037] Moreover, the described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the disclosure. One skilled in the relevant art will recognize, however, that the techniques described herein can be practiced without one or more of the specific details, or with other methods, components, materials, and so forth. In other instances, well-known structures, materials, or operations are not shown or described in detail in order to avoid obscuring aspects of the disclosure.

[0038] In addition, the terms "first", "second", and the like, do not denote any quantity or order but are used as labels for distinguishing between different entities. Thus, a feature having a "first" and a "second" can include one or more of the features. In the description of the disclosure, the meaning of "a plurality" is at least two, for example, two, three, and the like, unless otherwise explicitly specified and limited. The symbol " / " generally represents an "or" relationship between the objects before and after it.

[0039] In the present disclosure, unless otherwise explicitly specified and limited, the term "connected" and the like should be interpreted broadly, for example, can be electrically connected or can communicate with each other; can be directly connected, or can be indirectly connected through an intermediate medium. For those skilled in the art, the specific meaning of the above-mentioned terms in the present disclosure can be understood according to the specific circumstances.

[0040] In the related art, database servers are deployed in batches according to business requirements for system deployment and network deployment. After configuration according to IP planning, database deployment and business online are performed. When the database is installed on the server and delivered to the business for use, if the database architecture is not planned, the master and slave databases of the same database may not be accessed when the switch fails, thereby causing business interruption. For example, a non-database class database architecture can deploy one master and two slaves for the same business. At this time, if the online server does not perform loose processing at the server level according to different switches according to the database architecture, the master and slave databases of the same business database may be connected under one switch. When this network switch fails, the master and slave databases of the business cannot be accessed, causing business interruption.

[0041] In a database architecture of a database class, multiple databases can be included. Each database can include one master and one slave. For example, in one machine room, as few as three sets of databases can be arranged, and a database with large business volume can be arranged up to 30-50 sets of databases. At this time, if the online server does not perform loose processing at the server level according to different switches according to the database architecture, the master and slave databases of multiple databases of the same business are allocated under the same switch. If the switch fails, the kick-out program detects that the master and slave databases lose contact, and each set of database can be isolated for business. In this case, all databases of the business are isolated, causing business interruption.

[0042] As described above, how to allocate switches for database servers to improve business continuity of the database system becomes a problem to be solved. Therefore, the present disclosure provides a method for allocating switches for database servers. For a database server of a database class architecture, a plurality of groups of database servers are determined according to a business identifier of the database server. Then, for a group of database servers in the plurality of groups of database servers, the number of sets of the group of database servers is determined according to a database server split identifier. If the number of sets of the group of database servers is greater than a preset resource limit value, a kick-out set number threshold is used to allocate a switch for the group of database servers from a plurality of switches, so that for any one of the plurality of switches, the total number of database servers in the group of database servers allocated to the switch is not greater than the kick-out set number threshold. Thus, in the case where any one of the switches fails and less than the kick-out set number threshold number of sets of database servers connected thereto are kicked out, the remaining available number of sets of database servers can meet the business requirements of the group of database servers, and the business continuity of the database system can be improved to a certain extent.

[0043] Figure 1 An exemplary system architecture 10 to which the database server switch allocation method or apparatus of the present disclosure can be applied is shown.

[0044] AsFigure 1 As shown, the system architecture 10 can include a terminal device 102, a network 104, a server 106 and a database 108. The terminal device 102 can be various electronic devices with a display screen and supporting input, output, including but not limited to a smart phone, a tablet computer, a laptop computer, a desktop computer, a wearable device, a virtual reality device, a smart home, etc. The network 104 is a medium for providing a communication link between the terminal device 102 and the server 106. The network 104 can include various connection types, such as wired, wireless communication links or optical fiber cables, etc. The server 106 can be a server or a cluster of servers, etc. that provides various services. The database 108 can be a large database software placed on a server, or a small database software installed on a computer, for storing data.

[0045] The user can use the terminal device 102 to interact with the server 106 and the database 108 through the network 104 to receive or send data, etc. For example, the user views the information of the service identification, the sub-database identification, etc. of the database 108 received from the server 106 through the network 104 on the terminal device 102. The server 106 can also receive data from or send data to the database 108 through the network 104, etc. For example, the server 106 can be a background processing server, which obtains the number of transactions per second (TPS) of the database 108 through the network 104, and then calculates the sub-database threshold for the switch allocation.

[0046] It should be understood that Figure 1 The number of terminal devices, networks and servers in the above system is only illustrative. According to the needs of implementation, there can be any number of terminal devices, networks and servers.

[0047] Figure 2A is a flow chart of a method for allocating a switch for a database server according to an exemplary embodiment. As Figure 2A The method shown can be applied to the server side of the above system, or to the terminal device of the above system.

[0048] Referring to Figure 2A The method 20 provided by the embodiments of the disclosure can include the following steps.

[0049] In step S202, for a database server of a sub-database architecture, a plurality of groups of database servers are determined according to the service identification of the database server.

[0050] In some embodiments, the schema type identifier of a database server can be acquired first, and then it is determined according to the schema type identifier whether the database server is in a split-database schema or in a non-split-database schema, and then the allocation is performed according to the split-database schema and the non-split-database schema respectively. For details, reference can be made to the specific embodiments Figure 4 and Figure 5 .

[0051] For example, the relevant information of the database server can be imported into a pre-loosen module of the database before the database system is put into operation, so as to plan the database schema. The relevant information of the database server can include the database server IP, the service identifier, the schema type identifier, the split-database identifier, the role of the database, and the like. The schema type identifier can be used to determine whether it is a split-database schema, for example, if the "whether split-database schema" of a database server is "yes", it can be determined that the database server is in a split-database schema; if the "whether split-database schema" of a database server is "no", it can be determined that the database server is in a non-split-database schema.

[0052] In some embodiments, the database servers can be grouped according to the service identifier in the relevant information of the database server. Different service identifiers represent different groups of database servers, so that the actual situation of the database servers configured by the same service (such as the preset resource limit value, the kick-out number of database sets threshold, and the like) can be used to allocate the switches.

[0053] In step S204, for a group of database servers in the multiple groups of database servers, the number of sets of the group of database servers is determined according to the split-database identifier of the database server. A set of database servers includes multiple database servers having an association relationship.

[0054] In some embodiments, when the service adopts a split-database schema, multiple sets of database servers can be configured. The multiple database servers in a set of database servers can be a master database server and its corresponding slave database servers, for example, it can be one master database server and one corresponding slave database server, or one master database server and two corresponding slave database servers, and the like. The role of the database mentioned above can be a master database or a slave database. After the kick-out procedure automatically isolates one or several sets of databases, the new transactions will enter other split-databases without affecting the business operation.

[0055] In some embodiments, the database server related information can be used to determine the number of sets of database servers, for example, if the database servers with the business identifier 1 have a total of 30, and if one master database server and one slave database server are set as one set, then there are 15 sets of database servers, and the database servers in the 15 sets have the database set identifiers 1 to 15, wherein each database set identifier includes one master database server and one slave database server. The database servers with the same database set identifier can process multiple businesses, and in this case, the number of sets of database servers with the same business identifier can be obtained first, and the database servers processing the same business can be scattered.

[0056] In step S206, if the number of sets of database servers is greater than the preset resource limit value, the number of kicked database server sets is obtained.

[0057] In some embodiments, the preset resource limit value can be obtained according to the number of available (with free interfaces) switches, for example, for the case of one master database server and one slave database server in one set, the preset resource limit value can be half of the number of available switches, for example, if there are 10 available switches, the preset resource limit value is 5, and if the number of sets of database servers is 4, then all sets of database servers are completely scattered, and each of the 8 database servers is allocated a different switch.

[0058] In some embodiments, when the number of sets of database servers is large and greater than the preset resource limit value, that is, the number of switches is not enough to scatter all sets of database servers, the number of kicked database server sets can be obtained first, and a certain number of database servers are connected to the same switch according to the number of kicked database server sets. The number of kicked database server sets is used to represent the maximum number of database servers that can be kicked (made to fail or go offline), so that the number of database servers connected to the same switch is less than the number of kicked database server sets, and the number of database servers of the same business after the database servers connected to the same switch are kicked off when the switch fails can meet the business processing requirements.

[0059] In some embodiments, the number of kicked database server sets can be calculated according to the rated processing efficiency and the actual processing efficiency of the database servers, and the specific implementation can refer to Figure 3 , which will not be described in detail here.

[0060] In step S208, the switches are allocated to the group of database servers from the multiple switches according to the number of kicked database server sets, so that for any switch in the multiple switches, the total number of database servers allocated to the switch from the group of database servers is not greater than the number of kicked database server sets.

[0061] In some embodiments, for any switch among multiple switches, the total number of database servers allocated to the switch in the group of database servers can be equal to the threshold number of database servers to be kicked out. This can ensure that when the switch fails and the database servers connected to it are kicked out, the remaining available sets of database servers can meet the business needs of the group of database servers and ensure the business continuity of the database system while saving the number of switches as much as possible.

[0062] In some embodiments, for any switch among the multiple switches, the total number of database servers in the group of database servers assigned to the switch is not greater than the threshold number of database servers to be kicked out, and different switches among the multiple switches are assigned to the master database server and its corresponding slave database server. For example, if there are 10 databases processing the same business, each including a master database and a slave database, and the threshold number of database servers to be kicked out is 5, that is, a maximum of 5 databases can be lost at the same time, then in a loose process, the same master and slave databases cannot be on the same switch, and the master or slave databases of a maximum of 5 databases can be on the same switch. Figure 2B An example of a database connected to the same switch in this case is shown in FIG. Figure 2B As shown, five database servers processing the same business are connected under the switch 2002, including 00 database (master database) 2004, 01 database (slave database) 2006, 02 database (slave database) 2008, 03 database (slave database) 2010, and 04 database (slave database) 2012. The other five sets of master databases or slave databases (05 database to 09 database) can be connected to different switches. In this way, if the switch 2002 fails, when the slave database of database 00, the master database of database 01, the master database of database 02, the master database of database 03, and the master database of database 04 fail to detect the corresponding master / slave database 3306 ports respectively, the kick-out program can isolate the business of the five databases of database 00-04, and process all the business through the other databases 05 to 09. At this time, a total of 11 switches need to be configured. Compared with connecting all 10 sets of libraries to 20 different switches, this saves network resources and ensures that business can still be processed normally when one of the switches goes down, thus ensuring business continuity.

[0063] In other embodiments, for example, the number of databases connected to the same switch may be less than the threshold number of databases to be kicked, for example, Figure 2B The middle switch 2002 can be connected to the master or slave database of databases 00-03, and the number of databases connected to the same switch among the other 6 sets of databases shall not exceed 5.

[0064] According to the method for assigning switches to database servers provided by the embodiment of the present disclosure, for a database server of a split database architecture, a plurality of groups of database servers are determined according to the service identifiers of the database servers, and then for a group of database servers in the plurality of groups of database servers, the number of sets of the group of database servers is determined according to the split database identifiers of the database servers. If the number of sets of the group of database servers is greater than a preset resource limit value, a kick-out set number threshold value is used to assign switches to the group of database servers from a plurality of switches, so that for any one of the plurality of switches, the total number of database servers in the group of database servers that are assigned to the switch is not greater than the kick-out set number threshold value. In this way, in the case where any one of the switches fails and less than the kick-out set number threshold value of the database servers connected to the switch are kicked out, the remaining available sets of database servers can meet the service requirements of the group of database servers, and the service continuity of the database system can be improved to a certain extent.

[0065] Figure 3 is a flowchart of a kick-out set number threshold value acquisition method according to an example embodiment. As shown in the method, for example, the method can be applied to the server side of the system described above, or can be applied to the terminal device of the system described above. Figure 3 As shown in the method, for example, the method can be applied to the server side of the system described above, or can be applied to the terminal device of the system described above.

[0066] Referring to Figure 3 , the method 30 provided by the embodiment of the present disclosure can include the following steps.

[0067] In step S302, the rated processing efficiency of each set of database servers in the group of database servers is obtained.

[0068] In step S304, the current processing efficiency of the online database servers in the group of database servers is obtained.

[0069] In step S306, the kick-out set number threshold value is obtained according to the rated processing efficiency, the current processing efficiency, and the number of sets of the group of database servers.

[0070] In step S3062, the rated processing efficiency is subtracted from the current processing efficiency to obtain the difference between the rated processing efficiency and the current processing efficiency.

[0071] In step S3064, the difference between the rated processing efficiency and the current processing efficiency is multiplied by the number of sets of the group of database servers to obtain the remaining processing efficiency.

[0072] In step S3066, the kick-out set number threshold value is obtained according to the ratio of the remaining processing efficiency to the rated processing efficiency.

[0073] In some embodiments, for example, the processing efficiency of a database can be measured by the number of transactions per second (TPS) of the database. The kick-out database suite threshold value calculation function can be configured in a configuration management database (CMDB), the TPS that each database server suite can support, i.e., the rated processing efficiency, can be set in the CMDB, then the current TPS of each database server suite for the same service online is collected, and according to the service identifier, the number of database suites of the service is obtained, the number of database server suites that can be broken at most, i.e., the kick-out database suite threshold value, is calculated. For example, it is set that each database can support 1000 TPS at most, and it is collected that the current TPS of each database of 10 database suites of service A is 500 TPS, then it can be calculated that the maximum number of broken databases is (1000-500)*10 / 1000=5, and when 5 databases are broken, the actual TPS of the remaining 5 databases will reach the maximum value 1000. The CMDB can display that the maximum number of broken databases of the service is 5 in the display interface, for example, the display interface can display the following information of the database: service identifier, number of database suites, maximum supported TPS of each database, maximum number of broken suites, and the like.

[0074] According to the method provided in the embodiments of the present disclosure, the kick-out database suite threshold value is obtained according to the rated processing efficiency, the current processing efficiency of the database server and the number of database server suites, so that when the number of database suites in the database suite architecture is large, a proper number of servers are connected to the same switch according to the kick-out database suite threshold value, which not only saves network resources, but also ensures that the service can be normally processed when one of the switches is down, thereby improving the reliability of the database server system.

[0075] Figure 4 is a flowchart of a database server switch allocation method according to an exemplary embodiment. As shown in the method, for example, the method can be applied to the server side of the system described above, and can also be applied to the terminal device of the system described above. Figure 4

[0076] Referring to Figure 4 , the method 40 provided in the embodiments of the present disclosure can include the following steps.

[0077] In step S402, the architecture category identifier of a database server is obtained.

[0078] ​In some embodiments, the architecture category identifier can include "yes" or "no", and the architecture category identifier "yes" indicates that the database server is in a split database architecture, and the architecture category identifier "no" indicates that the database server is in a non-split database architecture. For the split database architecture, each set of database servers can include one master database server and one slave database server, and the database servers processing the same service include multiple sets of database servers; for the non-split database architecture, the database servers processing the same service include one set of database servers, which can include one master database server and two slave database servers.

[0079] In step S404, it is determined according to the architecture category identifier whether the database server is in a split database architecture or in a non-split database architecture.

[0080] In some embodiments, the architecture category identifier can also be embodied in the form of a "split database architecture" item in the database server related information. If the "split database architecture" item of a database server is "yes", it can be determined that the database server is in a split database architecture; if the "split database architecture" item of a database server is "no", it can be determined that the database server is in a non-split database architecture.

[0081] In step S4062, for the multiple database servers in the non-split database architecture, the service identifiers of the database servers are obtained.

[0082] In step S4064, different switches are allocated to the database servers with the same service identifier.

[0083] In some embodiments, the program determines whether it is a non-split database architecture, and if so, classifies according to the database service identifier. If the service identifiers are consistent, it is considered as one set of database servers, and one master database and two slaves of the three database servers are distributed in different switches with idle interfaces. The CMDB can output the allocated switch name.

[0084] In step S4082, for the database servers in the split database architecture, multiple groups of database servers are determined according to the service identifiers of the database servers, and then for each group of database servers in the multiple groups of database servers, the number of sets of database servers in the group is determined according to the split database identifier of the database servers. The specific implementation can refer to steps S202 and S204, which will not be described here.

[0085] In step S410, it is judged whether the number of the group of database servers is greater than the preset resource limit value. If the number of the databases in the database splitting type database system is large, if all are scattered (i.e., all databases are allocated different switches), a large number of switches are required, and the network resources may not be able to meet the demand. Therefore, the preset resource limit value can be used to connect a proper number of database servers to the same switch.

[0086] In step S4122, if the number of the group of database servers is not greater than the preset resource limit value, different switches are allocated to each database server in the group of database servers, and each database server can be a master database server or a slave database server. For example, if the preset resource limit value is 5, when the database splitting type architecture includes less than 5 databases, such as 4 databases, the master database and the slave database of each database in the 4 databases can be allocated to 8 different switches according to the IP of the database server, i.e., all are scattered.

[0087] In step S4142, if the number of the group of database servers is greater than the preset resource limit value, the number of kicked databases is obtained. The specific implementation can refer to step S206, which will not be described here.

[0088] In step S4144, a predetermined number of target database servers in the group of database servers are allocated to a first switch of a plurality of switches, and each database server in the group of database servers except for the predetermined number of target database servers is allocated to a different switch of the plurality of switches except for the first switch. The predetermined number is the number of kicked databases, the target database server is a master database server or a slave database server, and any two target database servers do not belong to the same database server.

[0089] In some embodiments, after the group of database servers is allocated to the first switch, the remaining database servers can be scattered, i.e., the remaining database servers are allocated to switches except for the first switch.

[0090] According to the method provided by the embodiments of the present disclosure, the databases are scattered according to different database architectures and numbers, the kick-out procedure automatically isolates the business when the switch fails, the master database or the slave database stops processing the business, the corresponding slave database or master database can perform single processing, effectively solving the problem that a master database and a slave database cannot be accessed, avoiding the problem that all databases of a business are isolated when the switch fails in a database splitting type architecture system, and effectively avoiding the risk of operation when the number of databases is large and the switch fails.

[0091] Figure 5is a flow chart for allocating switches for database servers according to an exemplary embodiment. As shown in Figure 5 first, whether it is a split database architecture is acquired (S501); when it is determined to be a non-split database architecture, the databases of the same service are acquired (S5062), and three different switches are allocated for the one master database and two slave databases of the same service (S5064); when it is determined to be a split database architecture, whether the number of sets of databases is more than a preset resource limit value (e.g., 5 sets of databases) is determined (S5042); if it is not more than the preset resource limit value, all of the master databases and slave databases are allocated to different switches (S5082); if it is more than the preset resource limit value, a kick database set threshold value is acquired (S5010), and then idle switches are found by matching existing information (S5012), the master databases or slave databases of the database sets that are not more than the kick database set threshold value are allocated to the same switch, and the master databases and slave databases of the remaining database sets are allocated to different switches.

[0092] In some embodiments, the number of idle interfaces of each switch in the plurality of switches can be acquired first, and then the switches for the group of database servers are allocated from the plurality of switches according to the kick database set threshold value, such that for any switch in the plurality of switches, the total number of database servers in the group of database servers that are allocated to the switch is neither greater than the kick database set threshold value nor greater than the number of idle interfaces of the switch.

[0093] In some embodiments, a development module in the CMDB can collect information on the switches, acquire the switch names and IP addresses of all connected servers, and update the switch names in the CMDB to ensure that the connection status of the servers on line and the switches is accurately fed back in the CMDB. A pre-loose module can be included in the CMDB, and before the database system goes online, the IP, service identification, whether it is a split database architecture, and other information of the database servers are imported into the pre-loose module, and the "loose suggestion" is made according to the above steps, i.e., according to the service identification and the idle interfaces of the switches on line, the switches for the multiple sets of database servers are allocated. The system administrator can perform the loosening when the servers are put on line according to the loose suggestion analysis according to the service identification.

[0094] The system administrator can confirm whether the server loose result according to the rules meets the requirements according to the information in the CMDB. The servers that have been online in the CMDB can include the following information: database IP, database service identifier, database library identifier, whether the database library is classified, the role of the database (master or slave), switch address, and the like, which can be collected by the switch statistics function to the deployed switch address. The database that has been online can be verified according to the above information whether it meets the loose requirement, that is, to perform the loose analysis again, and the configuration of the database server is confirmed to meet the loose of the switch by recalculating through the above steps. When the verification does not meet the requirement, a prompt message can be sent, and the 'loose suggestion' is run again to identify and analyze. That is, the loose condition can be analyzed through the CMDB system to ensure that the switch allocation of the database server can be counted and tracked.

[0095] Figure 6 is a block diagram of an apparatus for allocating a switch to a database server according to an example embodiment. As shown in Figure 6 The apparatus shown in can be applied to the server side of the system described above, or can be applied to the terminal device of the system described above.

[0096] With reference to Figure 6 , the apparatus 60 provided by the embodiment of the disclosure can include a server grouping module 602, a number of sets determining module 604, a kicked-out database threshold obtaining module 606, and a switch allocating module 608.

[0097] The server grouping module 602 can be used to determine a plurality of groups of database servers according to the service identifier of the database server for the database server of the classified database library.

[0098] The number of sets determining module 604 can be used to determine the number of sets of a group of database servers according to the database library identifier of the database server for the group of database servers.

[0099] The kicked-out database threshold obtaining module 606 can be used to obtain a kicked-out database set threshold if the number of sets of the group of database servers is greater than a preset resource limit value.

[0100] The switch allocating module 608 can be used to allocate a switch to the group of database servers from a plurality of switches according to the kicked-out database set threshold, so that for any one of the plurality of switches, the total number of the database servers in the group of database servers allocated to the switch is not greater than the kicked-out database set threshold.

[0101] Figure 7 is a block diagram of another apparatus for allocating a switch to a database server according to an example embodiment. As shown in Figure 7 ​The device shown can be applied to the server side of the system described above, and can also be applied to the terminal device of the system described above.

[0102] Reference Figure 7 The device 70 provided by the embodiments of the present disclosure can include an architecture category identifier obtaining module 701, a server grouping module 702, an architecture determining module 703, a number of sets determining module 704, a kick-out threshold obtaining module 706, and a switch allocation module 708, wherein the kick-out threshold obtaining module 706 can include a processing efficiency obtaining module 7062 and a kick-out threshold calculating module 7064, and the switch allocation module 708 can include a switch interface number obtaining module 7082.

[0103] The architecture category identifier obtaining module 701 can be used to obtain an architecture category identifier of a database server.

[0104] The server grouping module 702 can be used to determine a plurality of groups of database servers according to the service identifiers of the database servers for the database servers in the database server group.

[0105] The architecture determining module 703 can be used to determine that the database server is in the database server group or in the non-database server group according to the architecture category identifier.

[0106] The number of sets determining module 704 can be used to determine the number of sets of a group of database servers according to the database server grouping identifier of the database server for the group of database servers, and one set of database servers includes a plurality of database servers having an association relationship.

[0107] The plurality of database servers having an association relationship can include a master database server and a corresponding slave database server.

[0108] The kick-out threshold obtaining module 706 can be used to obtain a kick-out set threshold if the number of sets of the group of database servers is greater than a preset resource limit value.

[0109] The processing efficiency obtaining module 7062 can be used to obtain the rated processing efficiency of each set of database servers in the group of database servers, and obtain the current processing efficiency of the database servers that have been online in the group of database servers.

[0110] The kick-out threshold calculating module 7064 can be used to obtain the kick-out set threshold according to the rated processing efficiency, the current processing efficiency, and the number of sets of the group of database servers.

[0111] The kick library threshold calculation module 7064 can also be configured to subtract the rated processing efficiency from the current processing efficiency to obtain a difference between the rated processing efficiency and the current processing efficiency; multiply the difference between the rated processing efficiency and the current processing efficiency by the number of groups of database servers to obtain a residual processing efficiency; and obtain the kick library number threshold according to a ratio of the residual processing efficiency to the rated processing efficiency.

[0112] The switch allocation module 708 can be configured to allocate switches for the group of database servers from the plurality of switches according to the kick library number threshold, so that for any one of the plurality of switches, the total number of database servers in the group of database servers allocated to the switch is not greater than the kick library number threshold.

[0113] The plurality of switches can include a first switch.

[0114] The switch allocation module 708 can also be configured to allocate switches for the group of database servers from the plurality of switches according to the kick library number threshold, so that for any one of the plurality of switches, the total number of database servers in the group of database servers allocated to the switch is not greater than the kick library number threshold, and the master database server and the corresponding slave database server are allocated different switches from the plurality of switches.

[0115] The switch allocation module 708 can also be configured to allocate a predetermined number of target database servers in the group of database servers to the first switch, and allocate each database server in the group of database servers except for the predetermined number of target database servers to a different switch from the plurality of switches except for the first switch, the predetermined number being the kick library number threshold, the target database server being a master database server or a slave database server, and any two target database servers not belonging to the same group of database servers.

[0116] The switch allocation module 708 can also be configured to, for a plurality of database servers of a non-library type architecture, obtain a service identifier of each database server, and allocate different switches to database servers with the same service identifier.

[0117] The switch allocation module 708 can also be configured to allocate switches for the group of database servers from the plurality of switches according to the kick library number threshold, so that for any one of the plurality of switches, the total number of database servers in the group of database servers allocated to the switch is neither greater than the kick library number threshold nor greater than the number of idle interfaces of the switch.

[0118] The switch interface number acquisition module 7082 can be configured to obtain the number of idle interfaces of each switch in the plurality of switches.

[0119] Figure 8A structural diagram of an electronic device in an embodiment of the present disclosure is shown. It should be noted that Figure 8 The device shown is merely an example of a computer system and should not be taken as limiting the scope of the functionality or use of embodiments of the present disclosure.

[0120] As Figure 8 shown, the device 800 includes a central processing unit (CPU) 801 that can perform various appropriate actions and processes according to programs stored in a read only memory (ROM) 802 or programs loaded from a storage section 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the device 800 are also stored. The CPU 801, the ROM 802, and the RAM 803 are connected to each other through a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.

[0121] The following components are connected to the I / O interface 805: an input section 806 including a keyboard, a mouse, etc.; an output section 807 including a display such as a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN card, a modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 805 as necessary. A removable media 811 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc. is attached to the drive 810 as necessary, so that a computer program read therefrom is installed into the storage section 808 as necessary.

[0122] In particular, the processes described above with reference to the flowcharts can be implemented as a computer software program according to embodiments of the present disclosure. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a computer readable medium, the computer program containing program code for executing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network by the communication section 809, and / or installed from the removable media 811. When the computer program is executed by the central processing unit (CPU) 801, the above-described functions defined in the system of the present disclosure are performed.

[0123] It should be noted that the computer-readable medium shown in the disclosure can be a computer-readable signal medium or a computer-readable storage medium or any combination thereof. The computer-readable storage medium may, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or apparatus, or any combination thereof. More specific examples of the computer-readable storage medium can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the disclosure, the computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device or apparatus. In the disclosure, the computer-readable signal medium can include a data signal carried in a baseband or as a part of a carrier wave, which carries computer-readable program code. Such a propagated data signal can take various forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable storage medium, which can send, propagate or transmit a program for use by or in conjunction with an instruction execution system, device or apparatus. The program code contained on the computer-readable medium can be transmitted by any suitable medium, including but not limited to wireless, wire, optical cable, RF, etc., or any suitable combination thereof.

[0124] The flowcharts and block diagrams in the drawings illustrate the possible implementation architectures, functions and operations of the systems, methods and computer program products according to various embodiments of the disclosure. In this regard, each block in the flowcharts or block diagrams can represent a module, a program segment, or a part of code containing one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur in different order than that shown in the drawings. For example, two blocks that are shown in succession can actually be executed substantially in parallel, and they can also be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams or flowcharts, and the combination of blocks in the block diagrams or flowcharts, can be implemented by a dedicated hardware-based system that performs the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.

[0125] The modules described in the embodiments of the present disclosure can be implemented in the form of software, or can be implemented in the form of hardware. The described modules can also be arranged in a processor, for example, a processor can be described as including a server grouping module, a number of sets determining module, a kick-out set threshold obtaining module and a switch assigning module. Among them, the names of these modules do not constitute a limitation on the modules themselves in some cases, for example, the server grouping module can also be described as "a module for grouping database servers of a sharding architecture database according to database server information obtained from a connected pre-loose module".

[0126] As another aspect, the present disclosure also provides a computer readable medium, which can be included in the device described in the above embodiments, or can exist independently without being assembled into the device. The computer readable medium carries one or more programs, when the one or more programs are executed by the device, the device includes: determining a plurality of groups of database servers according to service identifiers of the database servers for a database server of a sharding architecture; determining a number of sets of the group of database servers according to sharding identifiers of the database servers, one set of database servers including a plurality of database servers having an association relationship; if the number of sets of the group of database servers is greater than a preset resource limit value, obtaining a kick-out set threshold; and assigning switches for the group of database servers from a plurality of switches according to the kick-out set threshold, so that for any one of the plurality of switches, the total number of database servers in the group of database servers assigned to the switch is not greater than the kick-out set threshold.

[0127] The exemplary embodiments of the present disclosure are specifically shown and described above. It should be understood that the present disclosure is not limited to the detailed structure, arrangement or implementation method described herein; on the contrary, the present disclosure is intended to cover various modifications and equivalent arrangements within the spirit and scope of the appended claims.

Claims

1. A method for allocating switches to database servers, characterized in that: include: For database servers in a distributed database architecture, multiple groups of database servers are determined based on the business identifiers of the database servers. For a group of database servers in the plurality of groups of database servers, the number of sets of database servers in the group is determined according to the sub-library identifiers of the database servers, wherein a set of database servers includes a plurality of database servers having an associated relationship; If the number of database servers in the group is greater than the preset resource limit, the threshold for kicking out the database servers is obtained; According to the kick-out number threshold, switches are allocated to the group of database servers from multiple switches, so that for any switch among the multiple switches, the total number of database servers in the group of database servers allocated to the switch is not greater than the kick-out number threshold.

2. The method according to claim 1, characterized in that The plurality of associated database servers include a master database server and its corresponding slave database servers; Allocating a switch to the group of database servers from multiple switches according to the threshold number of database kick sets includes: Different switches among the multiple switches are allocated to the master database server and its corresponding slave database server.

3. The method according to claim 2, characterized in that The plurality of switches include a first switch; Allocating a switch to the group of database servers from multiple switches according to the threshold number of database kick sets includes: A predetermined number of target database servers in the group of database servers are allocated to the first switch, and each database server in the group of database servers except the predetermined number of target database servers is allocated to a different switch among the multiple switches except the first switch, wherein the predetermined number is the threshold value of the number of database sets to be kicked, the target database servers are master database servers or slave database servers, and any two target database servers do not belong to the same set of database servers.

4. The method according to claim 1, wherein If the number of database servers in the group exceeds the preset resource limit, the threshold for kicking out database servers is obtained, including: Obtaining a rated processing efficiency of each database server in the group of database servers; Obtain the current processing efficiency of the online database servers in the group of database servers; The threshold value of the number of database servers to be kicked is obtained according to the rated processing efficiency, the current processing efficiency and the number of database servers in the group.

5. The method according to claim 4, characterized in that Obtaining the threshold number of database servers to be kicked according to the rated processing efficiency, the current processing efficiency, and the number of database servers in the group includes: subtracting the rated processing efficiency from the current processing efficiency to obtain a difference between the rated processing efficiency and the current processing efficiency; Multiplying the difference between the rated processing efficiency and the current processing efficiency by the number of database servers in the group to obtain a residual processing efficiency; The threshold value of the number of kick-out sets is obtained according to the ratio of the remaining processing efficiency to the rated processing efficiency.

6. The method according to claim 1, characterized in that Also includes: Obtaining a database server architecture category identifier; Determining, according to the architecture category identifier, whether the database server is in a sharding architecture or a non-sharding architecture; For multiple database servers in a non-sharded architecture, obtain the business ID of each database server; Assign different switches to database servers with the same service ID.

7. The method according to any one of claims 1 to 6, characterized in that Also includes: Obtaining the number of idle interfaces of each switch among the multiple switches; Allocating a switch to the group of database servers from multiple switches according to the threshold number of database kick sets includes: According to the threshold number of database kick sets, switches are allocated to the group of database servers from multiple switches, so that for any switch among the multiple switches, the total number of database servers in the group of database servers allocated to the switch is neither greater than the threshold number of database kick sets nor greater than the number of idle interfaces of the switch.

8. A device comprising: A memory, a processor, and executable instructions stored in the memory and executable in the processor, wherein the processor implements the method according to any one of claims 1 to 7 when executing the executable instructions.

9. A computer-readable storage medium having computer-executable instructions stored thereon, characterized in that: When the executable instructions are executed by a processor, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Data storage method and device, data retrieval method and device, electronic equipment and storage medium

    CN113641670A

  • File life cycle management method and system for distributed video storage

    CN113836094A