HK40042498A - Data management method, device, electronic equipment and storage medium for database cluster - Google Patents
Data management method, device, electronic equipment and storage medium for database cluster Download PDFInfo
- Publication number
- HK40042498A HK40042498A HK42021032614.6A HK42021032614A HK40042498A HK 40042498 A HK40042498 A HK 40042498A HK 42021032614 A HK42021032614 A HK 42021032614A HK 40042498 A HK40042498 A HK 40042498A
- Authority
- HK
- Hong Kong
- Prior art keywords
- database
- target
- domain name
- standby machine
- read
- Prior art date
Links
Description
Technical Field
The present disclosure relates to the field of database clusters, and in particular, to a data management method and apparatus for a database cluster, an electronic device, and a storage medium.
Background
In the field of database clustering, it is necessary to ensure high availability of database services, that is, to ensure fast switching and short downtime of machines in a database cluster. In the prior art, a widely used service high-availability technology for database cluster management is the lvs (linux Virtual server) technology.
The LVS is a high-availability technology based on an IP layer, is transparent to applications and has universality. However, due to the universality of the application transparency, the LVS cannot support any service logic, and in practical use, a specific service logic is often required to be implemented.
The LVS needs to occupy a considerable amount of hardware resources and has high requirement on network bandwidth of the hardware resources; in addition, to ensure high availability of the database cluster, the LVS itself needs to be highly available, thereby occupying more hardware resources.
Although the LVS realizes application transparency through the IP layer, it requires that its server and backend services are in the same physical network under the working condition of the mode with the best performance. Once the physical network is physically broken (e.g., power failure, network cable breakage), the database cluster service is unavailable. I.e. without cross-room disaster recovery capability.
Disclosure of Invention
An object of the present disclosure is to provide a data management method and apparatus for a database cluster, an electronic device, and a storage medium, which can support a read operation of a service on the database cluster, and simultaneously meet customized service requirements, reduce consumption of hardware resources, and implement cross-machine-room disaster tolerance.
According to an aspect of the disclosed embodiments, a data management method for a database cluster is disclosed, the method comprising:
monitoring the working state of each database standby machine, wherein the database standby machines are contained in the same database cluster;
screening out target standby machines meeting preset service requirements from the database standby machines based on the working state of each database standby machine;
and updating the target IP address corresponding to the read-only domain name of the database cluster in a domain name resolution server according to the IP address of each target standby machine, so that the read-only domain name sent by the service is resolved by the domain name resolution server, and the service can only operate the target standby machine of the target IP address.
According to an aspect of the disclosed embodiments, a data management apparatus for a database cluster is disclosed, the apparatus including:
the monitoring module is configured to monitor the working state of each database standby machine, wherein the database standby machines form the same database cluster;
the screening module is configured to screen a target standby machine meeting preset service requirements from the database standby machines based on the working state of each database standby machine;
and the updating module is configured to update a target IP address corresponding to a read-only domain name of the database cluster in a domain name resolution server according to the IP address of each target standby machine, so that the read-only domain name sent by a service is resolved by the domain name resolution server, and the service can only operate the target standby machine of the target IP address, wherein the read-only domain name is used for the service to perform read-only operation on the database cluster.
In an exemplary embodiment of the disclosure, the apparatus is configured to:
receiving real-time attribute data of each database backup machine from the proxy service;
and monitoring the working state of each database standby machine based on the real-time attribute data of each database standby machine.
In an exemplary embodiment of the disclosure, the apparatus is configured to:
determining whether each database standby machine has a fault or not based on the working state of each database standby machine;
and taking the database standby machine without faults as the target standby machine.
In an exemplary embodiment of the disclosure, the apparatus is configured to:
determining the replication delay of the database backup machines for respectively replicating data from the database host based on the working state of each database backup machine;
and taking the database standby machine with the copying delay lower than a preset time threshold value as the target standby machine.
In an exemplary embodiment of the disclosure, the apparatus is configured to:
determining the conformity of each target standby machine and the service requirement based on the working state of each target standby machine;
and sequencing the target standby machines based on the conformity, and updating the IP address of the target standby machine with the highest sequencing in the domain name resolution server as the target IP address.
In an exemplary embodiment of the disclosure, the apparatus is configured to:
responding to the fault of the standby machine of the current read-only operation of the service, removing the fault standby machine from the target standby machine, and updating a target IP address corresponding to the read-only domain name of the database cluster in a domain name resolution server according to the IP address of each target standby machine;
and responding to the service to send the read-only domain name again, and resolving the read-only domain name again through the domain name resolution server, so that the service continues to read only the database cluster.
In an exemplary embodiment of the disclosure, the apparatus is configured to:
receiving a configuration request aiming at the read-only domain name through a configuration page, and configuring the read-only domain name required to be configured according to the configuration request.
According to an aspect of the disclosed embodiments, an electronic device for data management of a database cluster is disclosed, which includes: a memory storing computer readable instructions; a processor reading computer readable instructions stored by the memory to perform the method of any of the preceding claims.
According to an aspect of an embodiment of the present disclosure, a computer program medium is disclosed, having computer readable instructions stored thereon, which, when executed by a processor of a computer, cause the computer to perform the method of any of the preceding claims.
According to an aspect of an embodiment of the present disclosure, there is provided a computer program product or a computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to cause the computer device to perform the method provided in the various alternative implementations described above.
In the embodiment of the disclosure, by configuring the interactive structure among the database standby machine, the domain name resolution server and the service, the service can read the database cluster by only sending the read-only domain name. Because the database backup machine serving as a communication interface between the service and the database cluster is screened out according to service requirements, the embodiment of the disclosure can meet customized service requirements while supporting the reading operation of the service on the database cluster; because the domain name resolution server belongs to a common public component and only occupies few hardware resources, the embodiment of the disclosure can reduce the consumption of hardware resources while supporting the reading operation of the service on the database cluster; and because the read-only domain name is only a configured parameter for the domain name resolution server to resolve the IP address, and there is no physical limitation, the embodiment of the disclosure can support the reading operation of the service on the database cluster, and simultaneously, implement cross-machine room disaster recovery or cross-city disaster recovery.
Additional features and advantages of the disclosure will be set forth in the detailed description which follows, or in part will be obvious from the description, or may be learned by practice of the disclosure.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The above and other objects, features and advantages of the present disclosure will become more apparent by describing in detail exemplary embodiments thereof with reference to the attached drawings.
FIG. 1 illustrates an architecture of a data management platform for managing a database cluster according to one embodiment of the present disclosure.
FIG. 2 shows a flow diagram of a method of data management for a database cluster according to one embodiment of the present disclosure.
Fig. 3A illustrates the components of a blockchain system according to one embodiment of the present disclosure.
Fig. 3B illustrates the structure of a tile in a tile chain system according to one embodiment of the present disclosure.
Fig. 3C illustrates a process of new block generation according to one embodiment of the present disclosure.
FIG. 4 shows a block diagram of a data management apparatus of a database cluster according to one embodiment of the present disclosure.
FIG. 5 illustrates a hardware diagram of data management electronics of a database cluster according to one embodiment of the present disclosure.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these example embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art. The drawings are merely schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus their repetitive description will be omitted.
Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in one or more example embodiments. In the following description, numerous specific details are provided to give a thorough understanding of example embodiments of the disclosure. One skilled in the relevant art will recognize, however, that the subject matter of the present disclosure can be practiced without one or more of the specific details, or with other methods, components, steps, and so forth. In other instances, well-known structures, methods, implementations, or operations are not shown or described in detail to avoid obscuring aspects of the disclosure.
Some of the block diagrams shown in the figures are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor devices and/or microcontroller devices.
The basic architecture of an embodiment of the present disclosure is described below with reference first to fig. 1.
FIG. 1 illustrates an architecture of a data management platform for managing a database cluster according to an embodiment of the present disclosure. In short, the Database (Database) can be regarded as an electronic file cabinet, i.e., a place for storing electronic files, and a user can add, query, update, delete, etc. data in the files. A "database" is a collection of data that is stored together in a manner that can be shared by multiple users, has as little redundancy as possible, and is independent of the application.
The data management platform provided by the embodiment of the disclosure can be a database management system. Specifically, a Database Management System (DBMS) is a computer software System designed for managing a Database, and generally has basic functions of storage, interception, security assurance, backup, and the like. The database management system may classify the database according to the database model it supports, such as relational, XML (Extensible Markup Language); or classified according to the type of computer supported, e.g., server cluster, mobile phone; or sorted according to the Query Language used, such as SQL (Structured Query Language), XQuery, or sorted according to performance impulse emphasis, such as max size, maximum operating speed, or other sorting.
In this embodiment, the data management platform mainly includes: an administrator, and a domain name service. The administrator refers to a management process for uniformly managing the database cluster; the domain name service refers to a service process for resolving a domain name into an IP (Internet Protocol) address, and a carrier of the domain name service is generally a domain name resolution server.
The database cluster managed by the administrator is composed of a database host M, a database standby S1, a database standby S2, and a database standby S3. The data stored in each database standby machine is synchronous with the data stored in the database host machine M; the database backup machines S1, S2, S3 are only exemplary to show that there are multiple database backup machines in the database cluster, and do not represent only three database backup machines in the database reference.
The database host M and the database backup are generally independent servers, and are generally used for storing data collected from the terminal. The server may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud computing services. The terminal may be, but is not limited to, a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, and the like. The terminal and the server may be directly or indirectly connected through wired or wireless communication, and the application is not limited herein.
The service is a process which is located outside the data management platform, can communicate with the data management platform and is used for realizing specific service operation. And the service performs read-only operation on the database cluster through the read-only domain name of the database cluster.
Specifically, the service sends the read-only domain name of the database cluster to the domain name service, and the domain name service resolves the read-only domain name and returns the resolved target IP address to the service. The target IP address is used to indicate a database backup where the traffic should establish communication to read the database cluster. After receiving the target IP address, the service establishes communication with the database standby machine of the target IP address and performs reading operation on the database standby machine of the target IP address, thereby realizing the reading operation on the database cluster.
And the agent service is used as an extension of an administrator in the database standby machine, is responsible for monitoring the database standby machine, acquiring and processing relevant data of the database standby machine and sending the acquired and processed data to the administrator so that the administrator can monitor each database standby machine. And the administrator takes the IP address of one database standby machine as a target IP address associated with the read-only domain name according to the monitoring of the database standby machines, and updates the target IP address in the domain name service.
It should be noted that the embodiment is only an exemplary illustration, and should not limit the function and the scope of the disclosure.
Before describing in detail the specific implementation of the embodiments of the present disclosure, a brief explanation will be given to some concepts related to the embodiments of the present disclosure.
The database backup machine refers to a machine mainly used for synchronous backup in a database cluster. The synchronous backup refers to that the database backup machine backs up data in the database host machine so as to be synchronous with the database host machine; the database standby machine and the database host machine jointly form the same database cluster, and the database cluster is logically represented as a database on an application layer; the data stored in each database backup machine should eventually be consistent.
The operation of the service on the database cluster is divided into two categories, namely a read operation and an update operation. Wherein, the updating, inserting and deleting all belong to updating operation, and all can cause actual change to the data stored in the database cluster; read-only refers to that the business only reads the data in the database cluster, and the content in the database cluster cannot be updated.
In the embodiment of the disclosure, the updating operation of the database cluster is routed to the database host, and the service updates the database cluster through the updating operation of the database host; and routing the read-only operation on the database cluster to the database standby machine, and enabling the service to pass through the read-only operation database cluster of the read-only operation database standby machine.
In the embodiment of the disclosure, the read-only domain name is a domain name provided for the service, and the service can only read the database cluster through the read-only domain name and cannot update the database cluster.
Replication latency refers to the latency of a synchronization process in which the database backup synchronizes backup data from the database master. It can be understood that, because the hardware conditions of the machine are different between each database backup machine, and the load of the machine is also different, the replication delay of different database backup machines is also different.
Fig. 2 shows a flowchart of a data management method of a database cluster according to an embodiment of the present disclosure, which is exemplary to execute a principal in a data management platform that manages database clusters in a unified manner, and the method includes:
step S110, monitoring the working state of each database standby machine, wherein the database standby machines are contained in the same database cluster;
step S120, screening out target standby machines meeting preset service requirements from the database standby machines based on the working states of the database standby machines;
step S130, according to the IP address of each target backup machine, updating the target IP address corresponding to the read-only domain name of the database cluster in a domain name resolution server, so as to resolve the read-only domain name sent by the service through the domain name resolution server, so that the service only operates the target backup machine of the target IP address.
In the embodiment of the present disclosure, in a state where a service of an application layer initiates a read-only operation: the service sends the read-only domain name of the database cluster to be read-only operated to the database management platform. After receiving the read-only domain name, the database management platform analyzes the read-only domain name through a domain name resolution server where the domain name service is located, and resolves a target IP address corresponding to the read-only domain name. The target IP address points to a target standby in the database cluster. Therefore, after the service receives the target IP address, the service performs read-only operation on the target standby machine of the target IP address. In the database cluster, the data stored in each database standby machine is the same as the database host, so that the service only operates the target standby machine of the target IP address, namely, the database cluster is operated only.
Therefore, when the state of the standby machine of the database is stable, the service only needs to interact with the domain name resolution server when being connected with the database management platform for the first time; under a normal state, the service can directly communicate with the database standby machine to perform reading operation, so that the intermediate interaction between the service and the database management platform is simplified, and the service performance of the database management platform is improved.
In the embodiment of the present disclosure, in a normal operating state of the data management platform: and aiming at each database cluster, the data management platform monitors the working state of each database standby machine in the database cluster. The working state of the database backup machine mainly reflects various expressions (such as CPU load, data transmission speed, etc.) of the database backup machine during current working. It can be understood that the hardware conditions of the machine are different between the standby machines of each database, and the load of the machine is also different; and as time goes on, the hardware condition of the machine and the cluster load of the standby machine of the same database are changed. In the embodiment of the disclosure, the working state of the database standby machine is monitored, and the database standby machine is mainly used for screening out a target standby machine meeting business requirements, and specifically, screening out a target standby machine meeting business requirements related to read operation. Therefore, when the business only reads the target standby machine, the performance of the target standby machine can meet the business requirement.
Therefore, in the embodiment of the disclosure, by configuring the interactive structure among the database standby machine, the domain name resolution server and the service, the service can read the database cluster by only sending the read-only domain name. Because the database backup machine serving as a communication interface between the service and the database cluster is screened out according to service requirements, the embodiment of the disclosure can meet customized service requirements while supporting the reading operation of the service on the database cluster; because the domain name resolution server belongs to a common public component and only occupies few hardware resources, the embodiment of the disclosure can reduce the consumption of hardware resources while supporting the reading operation of the service on the database cluster; and because the read-only domain name is only a configured parameter for the domain name resolution server to resolve the IP address, and there is no physical limitation, the embodiment of the disclosure can support the reading operation of the service on the database cluster, and simultaneously, implement cross-machine room disaster recovery or cross-city disaster recovery.
It should be noted that, if the function of the database management platform is weak enough to support the implementation of the method provided by the embodiment of the present disclosure, the function module for monitoring the standby machine of the database may be transplanted into a database driver (for example, MySQL driver), and the database driver is used to monitor whether the standby machine of the database fails or whether the replication delay occurs.
In one embodiment, the data management platform monitors the working state of each backup database through the blockchain system. Specifically, in this embodiment, each database backup machine is respectively used as a blockchain node in the blockchain system, and periodically performs common identification on the working states of each database backup machine based on a preset common identification algorithm, packages the working states into a data block, and chains up the data block (links the data block into a blockchain). Therefore, the data management platform can monitor the working states corresponding to the standby machines of the databases by inquiring the latest data block in the block chain.
The blockchain system refers to a system for performing data sharing between nodes. Referring to the blockchain system 20 shown in fig. 3A, the blockchain system may include a plurality of nodes 201, and the plurality of nodes 201 may refer to respective clients in the blockchain system. Each node 201 may receive input information and maintain shared data within the blockchain system based on the received input information while operating normally. In order to ensure the information intercommunication in the blockchain system, information connection can exist between each node in the blockchain system, and the nodes can transmit information through the information connection. For example, when an arbitrary node in the blockchain system receives input information, other nodes in the blockchain system acquire the input information according to a consensus algorithm, and store the input information as data in shared data, so that the data stored on all nodes in the blockchain system are consistent.
Each node in the blockchain system has a corresponding node identifier, and each node in the blockchain system can store node identifiers of other nodes in the blockchain system, so that the generated block can be broadcast to other nodes in the blockchain system according to the node identifiers of other nodes. Each node may maintain a node identifier list as shown in the following table, and store the node name and the node identifier in the node identifier list correspondingly. The node identifier may be an IP address or any other information that can be used to identify the node, and table 1 only illustrates the IP address as an example.
Node name | Node identification |
Node 1 | 117.114.151.174 |
Node 2 | 117.116.189.145 |
... | ... |
Node N | 119.123.789.258 |
TABLE 1 node identification List
Each node in the blockchain system stores one identical blockchain. The block chain is composed of a plurality of blocks, as shown in fig. 3B, the block chain is composed of a plurality of blocks, the starting block includes a block header and a block main body, the block header stores an input information characteristic value, a version number, a timestamp and a difficulty value, and the block main body stores input information; the next block of the starting block takes the starting block as a parent block, the next block also comprises a block head and a block main body, the block head stores the input information characteristic value of the current block, the block head characteristic value of the parent block, the version number, the timestamp and the difficulty value, and the like, so that the block data stored in each block in the block chain is associated with the block data stored in the parent block, and the safety of the input information in the block is ensured.
When each block in the block chain is generated, referring to fig. 3C, when the node where the block chain is located receives the input information, the input information is verified, after the verification is completed, the input information is stored in the memory pool, and the hash tree for recording the input information is updated; and then, updating the updating time stamp to the time when the input information is received, trying different random numbers, and calculating the characteristic value for multiple times, so that the calculated characteristic value can meet the following formula:
SHA256(SHA256(version+prev_hash+merkle_root+ntime+nbits+x))<TARGET
wherein, SHA256 is a characteristic value algorithm used for calculating a characteristic value; version is version information of the relevant block protocol in the block chain; prev _ hash is a block head characteristic value of a parent block of the current block; merkle _ root is a characteristic value of the input information; ntime is the update time of the update timestamp; nbits is the current difficulty, is a fixed value within a period of time, and is determined again after exceeding a fixed time period; x is a random number; TARGET is a feature threshold, which can be determined from nbits.
Therefore, when the random number meeting the formula is obtained through calculation, the information can be correspondingly stored, and the block head and the block main body are generated to obtain the current block. And then, the node where the block chain is located respectively sends the newly generated blocks to other nodes in the block chain system where the newly generated blocks are located according to the node identifications of the other nodes in the block chain system, the newly generated blocks are verified by the other nodes, and the newly generated blocks are added to the block chain stored in the newly generated blocks after the verification is completed.
The embodiment has the advantages that the working state of each database standby machine is managed through the block chain system, the transparency and the safety of working state management are improved, and meanwhile, the data management platform can acquire the working state of each database standby machine more conveniently.
It should be noted that the embodiment is only an exemplary illustration, and should not limit the function and the scope of the disclosure.
In one embodiment, the monitoring the working state of each database standby machine by setting the proxy service in advance of each database standby machine comprises:
receiving real-time attribute data of each database standby machine from the proxy service;
and monitoring the working state of each database standby machine based on the real-time attribute data of each database standby machine.
In this embodiment, the database management platform sets an agent service in advance in each database backup machine in the database cluster, so as to monitor the working state of the database backup machine through the agent service. The Agent service refers to an Agent of an autonomous Agent, and the Agent can be regarded as an extension of a database management platform on a database standby machine. Generally, the Agent executes an operation flow of a preset algorithm by using a state machine model to complete information acquisition and processing and communicate with a database management platform.
Specifically, the Agent monitors the attribute performance of the database standby machine in real time in the database standby machine, and sends the real-time attribute data of the database standby machine to the database management platform. Specifically, the Agent can send the real-time attribute data of the standby machine of the database to the database management platform regularly (for example, every 5 seconds); the Agent can also send the real-time attribute data of the standby machine of the database to the database management platform after receiving the instruction of the database management platform.
After the database management platform receives the real-time attribute data of each database standby machine, the working state of each database standby machine can be monitored on the basis.
The embodiment has the advantage that the real-time performance of the standby monitoring of the database is ensured through the setting of the proxy service.
It is to be understood that this embodiment is merely illustrative and not restrictive of the scope of the disclosure, as it may be used with other embodiments. Besides monitoring the working state of each database standby machine in a mode of setting proxy service, the database management platform can also enable the database standby machines to report respective real-time attribute data by self through a protocol between the database management platform and the database standby machines, so that the database management platform can monitor the working state of each database standby machine in the mode.
In an embodiment, screening out a target standby machine meeting a preset service requirement from the database standby machines based on the working state of each database standby machine includes:
determining whether each database standby machine has a fault or not based on the working state of each database standby machine;
and taking the database standby machine without faults as the target standby machine.
In this embodiment, the database management platform uses whether the failure occurs as a criterion for screening the target standby machine.
Specifically, on the basis of the monitored working state of each database standby machine, the database management platform determines whether each database standby machine has a fault. It can be understood that if a database standby machine fails, the multiple items of attribute data of the database standby machine are obviously abnormal (for example, the data transmission speed is too slow, communication cannot be established, and the like), so that it can be determined that the database standby machine fails.
And then, the database management platform takes the database standby machine without faults as a target standby machine.
The embodiment has the advantages that by taking whether the fault is taken as the standard for screening the target standby machine, the condition that the service inefficiently reads the failed database standby machine is avoided, and the usability of the database cluster is ensured.
In an embodiment, screening out a target standby machine meeting a preset service requirement from the database standby machines based on the working state of each database standby machine includes:
determining the replication delay of the database backup machines for respectively replicating data from the database host machine based on the working state of each database backup machine;
and taking the database standby machine with the copying delay lower than a preset time threshold value as the target standby machine.
In this embodiment, the database management platform uses the replication delay as a criterion for screening the target backup machines.
Specifically, on the basis of the monitored working state of each database backup machine, the database management platform determines the replication delay of data replication of each database backup machine from the database host. The database management platform can determine the copying delay of the database standby machine according to the time stamp of the data updated by the database host and the time stamp of the same data copied by the database standby machine. For example: image data a updates the timestamp T0 in the database host. When the database host updates the image data A, each database backup machine will copy the image data A from the database host to synchronously backup with the database host. If the time stamp of the image data a copied by the database backup machine 1 is T1 and the time stamp of the image data a copied by the database backup machine 2 is T2, the copy delay of the database backup machine 1 is (T1 to T0) and the copy delay of the database backup machine 2 is (T2 to T0).
And then, the database management platform takes the database standby machine with the copying delay lower than the preset time threshold value as a target standby machine.
The advantage of this embodiment is that by using the replication delay as a criterion for screening the target standby machines, it is guaranteed that the business can read the latest data in the database cluster.
In an embodiment, updating, in a domain name resolution server, a target IP address corresponding to a read-only domain name of the database cluster according to an IP address of each target standby machine includes:
determining the conformity of each target standby machine and the service requirement based on the working state of each target standby machine;
and sequencing the target standby machines based on the conformity, and updating the IP address of the target standby machine with the highest sequencing in the domain name resolution server as the target IP address.
In this embodiment, the database management platform updates the target IP address based on the conformity between the target backup machine and the service requirement.
Specifically, on the basis of the monitored working state of each database standby machine, the database management platform determines the conformity of each target standby machine with the service requirement. The process of determining the conformity is equivalent to the quantification of the process of screening a target standby machine, namely quantifying the basic service requirement serving as a measurement standard according to the parameters of the basic service requirement (for example, quantifying according to a speed parameter or quantifying according to a throughput parameter) in advance to obtain a reference value of the service requirement; according to the mode of quantifying the basic service requirement, quantifying the working state of the target standby machine according to the parameters of the target standby machine to obtain an expression value of the target standby machine; and then according to the higher or lower of the performance value and the reference value, or according to the position of the performance value in a preset interval taking the reference value as an interval boundary, obtaining the conformity between the target standby machine and the service requirement.
The higher the conformity is, the more the target standby machine conforms to the business requirement, and the more the forward sorting is required. And then, the database management platform takes the IP address of the target standby machine with the top sequence as the target IP address to be updated in the domain name resolution server.
Therefore, after the service sends the read-only domain name, the domain name resolution server resolves the read-only domain name to resolve the IP address of the target standby machine with the top rank. Therefore, the service only operates the target standby machine with the top sequence, and the database cluster where the target standby machine with the top sequence is located is read only.
For example: if the service requirement is related to the read-only operation speed, the speed of the service read-only operation database cluster is required to be as fast as possible. The compliance of each target backup with the service requirements can be determined by quantifying the replication delay.
The preset time threshold for the replication delay is 30 ms. The database standby machines with the copying delay higher than or equal to 30ms are eliminated; the database backup machine with the copying delay lower than 30ms is taken as the target backup machine.
Further, the target standby machines with the replication delay lower than 30ms and higher than or equal to 20ms are determined to have the conformity degree with the service requirement of 80%; a target backup machine with a replication delay lower than 20ms and higher than or equal to 10ms is determined to have a 90% compliance with the service requirement; the target backup with a replication delay below 10ms is determined to be 100% compliant with the traffic demand.
If in a database cluster, the IP address of the target standby machine 1 is IP1, and the conformity degree with the service requirement is 100%; the IP address of the target standby machine 2 is IP2, and the conformity degree with the service requirement is 80%; the IP address of the destination standby 3 is IP3, and the conformity with the service requirement is 90%. Then the target standby machines are sequenced in sequence to obtain a target standby machine 1, a target standby machine 3 and a target standby machine 2, and the target IP address corresponding to the read-only domain name is updated to IP1 in the domain name resolution server. Therefore, after the service sends the read-only domain name of the database cluster, the domain name resolution server resolves the read-only domain name to resolve the IP1, and then the service read-only operation target standby machine 1 achieves read-only operation of the database cluster.
The embodiment has the advantage that the target standby machines are sequenced according to the conformity degree to update the target IP address, so that the target standby machines of the target IP address are ensured to be in accordance with the service requirement.
In an embodiment, the method further comprises:
responding to the fault of the standby machine of the current read-only operation of the service, removing the standby machine with the fault from the target standby machine, and updating a target IP address corresponding to the read-only domain name of the database cluster in a domain name resolution server according to the IP address of each target standby machine;
and responding to the service to send the read-only domain name again, and resolving the read-only domain name again through the domain name resolution server so that the service continues to operate the database cluster only.
In this embodiment, if the standby machine in which the service is currently in read-only operation fails, the database management platform removes the standby machine from the target standby machine, and then renews the target IP address corresponding to the read-only domain name in the domain name resolution server according to the IP address of the target standby machine.
Then, after the service sends the read-only domain name again, the domain name resolution server resolves the read-only domain name again, and resolves the updated target IP address; and after receiving the updated target IP address, the service only operates the target standby machine of the updated target IP address, and then continuously only operates the database cluster.
For example: sequentially ordering the target standby machines in a database cluster to obtain a target standby machine 1, a target standby machine 3 and a target standby machine 2; the IP address of the destination standby 1 is IP1, the IP address of the destination standby 2 is IP2, and the IP address of the destination standby 3 is IP 3.
The read-only domain name for the database cluster in the domain name resolution server corresponds to IP 1. Therefore, the business read-only operation target standby machine 1 realizes the read-only operation database cluster.
And if the target standby machine 1 breaks down in the process of the business read-only operation of the target standby machine 1, the database management platform eliminates the target standby machine 1. The target standby machines remaining after the elimination are the target standby machine 3 and the target standby machine 2 in sequence. And the database management platform updates the IP address corresponding to the read-only domain name of the database cluster in the domain name resolution server to IP 3. Furthermore, after the service sends the read-only domain name again, the domain name resolution server will resolve the IP 3; after the service receives the IP3, the target standby machine 3 is read only, and the database cluster continues to be read only.
The advantage of this embodiment is that by timely troubleshooting of the failure, downtime of the database cluster is reduced, ensuring high availability of the database cluster.
In an embodiment, the method further comprises:
and receiving a configuration request aiming at the read-only domain name through a configuration page, and configuring the read-only domain name required to be configured according to the configuration request.
In this embodiment, the database management platform provides a configuration page for configuring the read-only domain name. Wherein configuring the read-only domain name comprises: view, add, modify read-only domain names.
The user can manually operate the configuration of the read-only domain name on the configuration page, and the manual operation of the user triggers the generation and sending of the configuration request. Therefore, through the configuration page, the database management platform receives a configuration request for the read-only domain name, and then configures the read-only domain name (namely, the read-only domain name manually operated by the user) requested to be configured according to the configuration request.
This embodiment has the advantage that the user is enabled to flexibly configure the read-only domain name by the provision of the configuration page.
Fig. 4 illustrates a data management apparatus of a database cluster according to an embodiment of the present disclosure, the apparatus including:
the monitoring module 310 is configured to monitor the working state of each database backup machine, wherein the database backup machines form a same database cluster;
the screening module 320 is configured to screen out a target standby machine meeting preset service requirements from the database standby machines based on the working state of each database standby machine;
the updating module 330 is configured to update a target IP address corresponding to a read-only domain name of the database cluster in a domain name resolution server according to the IP address of each target backup machine, so that the read-only domain name sent by a service is resolved by the domain name resolution server, so that the service only operates the target backup machine of the target IP address, where the read-only domain name is used for the service to perform read-only operation on the database cluster.
In an exemplary embodiment of the disclosure, the apparatus is configured to:
receiving real-time attribute data of each database backup machine from the proxy service;
and monitoring the working state of each database standby machine based on the real-time attribute data of each database standby machine.
In an exemplary embodiment of the disclosure, the apparatus is configured to:
determining whether each database standby machine has a fault or not based on the working state of each database standby machine;
and taking the database standby machine without faults as the target standby machine.
In an exemplary embodiment of the disclosure, the apparatus is configured to:
determining the replication delay of the database backup machines for respectively replicating data from the database host based on the working state of each database backup machine;
and taking the database standby machine with the copying delay lower than a preset time threshold value as the target standby machine.
In an exemplary embodiment of the disclosure, the apparatus is configured to:
determining the conformity of each target standby machine and the service requirement based on the working state of each target standby machine;
and sequencing the target standby machines based on the conformity, and updating the IP address of the target standby machine with the highest sequencing in the domain name resolution server as the target IP address.
In an exemplary embodiment of the disclosure, the apparatus is configured to:
responding to the fault of the standby machine of the current read-only operation of the service, removing the fault standby machine from the target standby machine, and updating a target IP address corresponding to the read-only domain name of the database cluster in a domain name resolution server according to the IP address of each target standby machine;
and responding to the service to send the read-only domain name again, and resolving the read-only domain name again through the domain name resolution server, so that the service continues to read only the database cluster.
In an exemplary embodiment of the disclosure, the apparatus is configured to:
receiving a configuration request aiming at the read-only domain name through a configuration page, and configuring the read-only domain name required to be configured according to the configuration request.
The data management electronics 40 of a database cluster according to an embodiment of the present disclosure is described below with reference to FIG. 5. The data management electronics 40 of the database cluster shown in FIG. 5 is only one example and should not impose any limitations on the functionality or scope of use of embodiments of the disclosure.
As shown in fig. 5, the data management electronics 40 of the database cluster are in the form of a general purpose computing device. The components of the data management electronics 40 of the database cluster may include, but are not limited to: the at least one processing unit 410, the at least one memory unit 420, and a bus 430 that couples various system components including the memory unit 420 and the processing unit 410.
Wherein the storage unit stores program code executable by the processing unit 410 to cause the processing unit 410 to perform steps according to various exemplary embodiments of the present invention as described in the description part of the above exemplary methods of the present specification. For example, the processing unit 410 may perform the various steps as shown in fig. 2.
The storage unit 420 may include readable media in the form of volatile storage units, such as a random access memory unit (RAM)4201 and/or a cache memory unit 4202, and may further include a read only memory unit (ROM) 4203.
The storage unit 420 may also include a program/utility 4204 having a set (at least one) of program modules 4205, such program modules 4205 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
Bus 430 may be any bus representing one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
The database cluster's data management electronics 40 may also communicate with one or more external devices 500 (e.g., keyboard, pointing device, bluetooth device, etc.), with one or more devices that enable a user to interact with the database cluster's data management electronics 40, and/or with any devices (e.g., router, modem, etc.) that enable the database cluster's data management electronics 40 to communicate with one or more other computing devices. Such communication may occur via input/output (I/O) interfaces 450. An input/output (I/O) interface 450 is connected to the display unit 440. Also, the data management electronics 40 of the database cluster may also communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the internet) through the network adapter 460. As shown, network adapter 460 communicates with the other modules of data management electronics 40 of the database cluster via bus 430. It should be understood that although not shown in the figures, other hardware and/or software modules may be used in conjunction with the data management electronics 40 of the database cluster, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which may be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the embodiments of the present disclosure.
In an exemplary embodiment of the present disclosure, there is also provided a computer-readable storage medium having stored thereon computer-readable instructions which, when executed by a processor of a computer, cause the computer to perform the method described in the above method embodiment section.
According to an embodiment of the present disclosure, there is also provided a program product for implementing the method in the above method embodiment, which may employ a portable compact disc read only memory (CD-ROM) and include program code, and may be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited in this regard and, in the present document, a readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
A computer readable signal medium may include a propagated data signal with readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A readable signal medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as JAVA, C + +, or the like, as well as conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
It should be noted that although in the above detailed description several modules or units of the device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit, according to embodiments of the present disclosure. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.
Moreover, although the steps of the methods of the present disclosure are depicted in the drawings in a particular order, this does not require or imply that the steps must be performed in this particular order, or that all of the depicted steps must be performed, to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step execution, and/or one step broken down into multiple step executions, etc.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which may be a personal computer, a server, a mobile terminal, or a network device, etc.) to execute the method according to the embodiments of the present disclosure.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
Claims (10)
1. A method for managing data of a database cluster, the method comprising:
monitoring the working state of each database standby machine, wherein the database standby machines are contained in the same database cluster;
screening out target standby machines meeting preset service requirements from the database standby machines based on the working state of each database standby machine;
and updating the target IP address corresponding to the read-only domain name of the database cluster in a domain name resolution server according to the IP address of each target standby machine, so that the read-only domain name sent by the service is resolved by the domain name resolution server, and the service can only operate the target standby machine of the target IP address.
2. The method of claim 1, wherein the step of providing a proxy service for each database backup machine in advance comprises:
receiving real-time attribute data of each database backup machine from the proxy service;
and monitoring the working state of each database standby machine based on the real-time attribute data of each database standby machine.
3. The method of claim 1, wherein the screening out the target backup machines meeting preset service requirements from the database backup machines based on the working state of each database backup machine comprises:
determining whether each database standby machine has a fault or not based on the working state of each database standby machine;
and taking the database standby machine without faults as the target standby machine.
4. The method of claim 1, wherein the screening out the target backup machines meeting preset service requirements from the database backup machines based on the working state of each database backup machine comprises:
determining the replication delay of the database backup machines for respectively replicating data from the database host based on the working state of each database backup machine;
and taking the database standby machine with the copying delay lower than a preset time threshold value as the target standby machine.
5. The method of claim 1, wherein updating the target IP address corresponding to the read-only domain name of the database cluster in a domain name resolution server according to the IP address of each target standby machine comprises:
determining the conformity of each target standby machine and the service requirement based on the working state of each target standby machine;
and sequencing the target standby machines based on the conformity, and updating the IP address of the target standby machine with the highest sequencing in the domain name resolution server as the target IP address.
6. The method of claim 1, further comprising:
responding to the fault of the standby machine of the current read-only operation of the service, removing the fault standby machine from the target standby machine, and updating a target IP address corresponding to the read-only domain name of the database cluster in a domain name resolution server according to the IP address of each target standby machine;
and responding to the service to send the read-only domain name again, and resolving the read-only domain name again through the domain name resolution server, so that the service continues to read only the database cluster.
7. The method of claim 1, further comprising:
receiving a configuration request aiming at the read-only domain name through a configuration page, and configuring the read-only domain name required to be configured according to the configuration request.
8. An apparatus for data management of a database cluster, the apparatus comprising:
the monitoring module is configured to monitor the working state of each database standby machine, wherein the database standby machines form the same database cluster;
the screening module is configured to screen a target standby machine meeting preset service requirements from the database standby machines based on the working state of each database standby machine;
and the updating module is configured to update a target IP address corresponding to a read-only domain name of the database cluster in a domain name resolution server according to the IP address of each target standby machine, so that the read-only domain name sent by a service is resolved by the domain name resolution server, and the service can only operate the target standby machine of the target IP address, wherein the read-only domain name is used for the service to perform read-only operation on the database cluster.
9. A data management electronic device of a database cluster, comprising:
a memory storing computer readable instructions;
a processor reading computer readable instructions stored by the memory to perform the method of any of claims 1-7.
10. A computer-readable storage medium having stored thereon computer-readable instructions which, when executed by a processor of a computer, cause the computer to perform the method of any one of claims 1-7.
Publications (2)
Publication Number | Publication Date |
---|---|
HK40042498A true HK40042498A (en) | 2021-09-03 |
HK40042498B HK40042498B (en) | 2023-12-29 |
Family
ID=
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US12373311B2 (en) | Failover and recovery for replicated data instances | |
US11477105B2 (en) | Monitoring of replicated data instances | |
CN108234170B (en) | Monitoring method and device for server cluster | |
US9847907B2 (en) | Distributed caching cluster management | |
JP6325001B2 (en) | Method and system using recursive event listeners in nodes of hierarchical data structures | |
CN107368369B (en) | Distributed container management method and system | |
CN110795503A (en) | Multi-cluster data synchronization method and related device of distributed storage system | |
US20150263909A1 (en) | System and method for monitoring a large number of information processing devices in a communication network | |
CN102254031A (en) | Batch processing request-based Microsoft SQL server database cluster | |
US9529772B1 (en) | Distributed caching cluster configuration | |
GB2544389A (en) | System for dynamically varying traffic routing modes in a distributed cluster and method therefor | |
CN110851471A (en) | Distributed log data processing method, device and system | |
CN112685486B (en) | Data management method and device for database cluster, electronic equipment and storage medium | |
CN116028577B (en) | Data synchronization method and device, electronic device and storage medium | |
WO2023029485A1 (en) | Data processing method and apparatus, computer device, and computer-readable storage medium | |
CN119520522A (en) | Network equipment index collection method, device, equipment, storage medium and product | |
CN112231399A (en) | A method and device applied to a graph database | |
CN113965582A (en) | Mode conversion method and system, and storage medium | |
HK40042498A (en) | Data management method, device, electronic equipment and storage medium for database cluster | |
CN113312351B (en) | Data processing method and device | |
CN120011433A (en) | Database scheduling method, device, equipment, storage medium and program product | |
CN113312351A (en) | Data processing method and device | |
CN119420630A (en) | Cloud network, cloud network fault determination method, device, equipment, medium and product | |
CN120343025A (en) | Access method and device of distributed data service cluster, electronic device and storage medium | |
CN115114376A (en) | A method, device, server and medium for distributed data storage |