Server detection method, device, apparatus and storage medium
By identifying and shutting down the servers under test in the database cluster, the problem of data inconsistency caused by the primary and backup database servers simultaneously occupying VIP addresses was resolved, and the high availability service of the database cluster was successfully switched over.
Patent Information
- Application Number
- CN202310284209.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-15
- Publication Date
- 2025-12-19
- Estimated Expiration
- 2043-03-15
AI Technical Summary
In a database cluster, the problem of data inconsistency arises when the primary and backup database servers simultaneously occupy the same VIP address.
By identifying the server under test in the database cluster, collecting its out-of-band address and obtaining the execution data packet, parsing the execution result, and shutting down the server under test if it fails, data inconsistency can be avoided.
It simplifies the server detection process, improves detection efficiency, ensures the normal switching of high-availability services in the database cluster, and avoids data inconsistency.
Smart Images

Figure CN116506336B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of monitoring, in particular to a server detection method, device, equipment and storage medium. BACKGROUND
[0002] In the field of financial technology, in order to provide high-availability services, database cluster services have emerged. In the database cluster service, a master-slave database server is set to provide data services to the client. During the running of the database server, the master-slave database server may not be able to switch normally due to hardware problems in the high-availability architecture, so that the same service starts at the same time in the master-slave database server and occupies the same VIP address, resulting in inconsistent data in the master-slave database server. SUMMARY
[0003] In view of the above, it is necessary to provide a server detection method, device, equipment and storage medium, which can solve the technical problem of inconsistent data caused by the master-slave database server occupying the same VIP address at the same time.
[0004] In one aspect, the present application provides a server detection method, which comprises:
[0005] In response to a server detection request, identifying a to-be-tested server in a database cluster based on the server detection request;
[0006] Collecting an out-of-band address of the to-be-tested server from a configuration management database;
[0007] Obtaining an execution data packet of the to-be-tested server according to the out-of-band address;
[0008] According to the protocol information of the to-be-tested server, the execution data packet is parsed to obtain the execution result of the to-be-tested server on the execution data packet;
[0009] If the execution result indicates that the execution data packet fails to run, the to-be-tested server is closed.
[0010] According to the preferred embodiment of the present application, the server detection method further comprises:
[0011] Counting the number of servers corresponding to the to-be-tested server whose execution result indicates that the execution data packet runs successfully;
[0012] If the number of servers is more than one, the to-be-tested server corresponding to the execution result indicating that the execution data packet runs successfully is determined as a to-be-processed server;
[0013] Obtaining all database servers in the database cluster;
[0014] identifying a target server based on voting results of the plurality of to-be-processed servers on the database server;
[0015] closing all to-be-processed servers except the target server.
[0016] According to the preferred embodiment of the present application, the identifying the to-be-tested server in the database cluster based on the server detection request comprises:
[0017] extracting a cluster identifier from a request message of the server detection request;
[0018] locating the database cluster based on the cluster identifier;
[0019] collecting a request data packet of each database server based on a request time of the server detection request;
[0020] identifying the to-be-tested server from all the database servers based on request information of the request data packet.
[0021] According to the preferred embodiment of the present application, the collecting the out-of-band address of the to-be-tested server from the configuration management database comprises:
[0022] locating an out-of-band management file from the configuration management database based on an out-of-band identifier;
[0023] generating a query statement based on physical information of the to-be-tested server and file information of the out-of-band management file;
[0024] calling an application interface of the configuration management database, running the query statement, and obtaining the out-of-band address.
[0025] According to the preferred embodiment of the present application, before the obtaining the execution data packet of the to-be-tested server according to the out-of-band address, the server detection method further comprises:
[0026] calling a pre-detection program to generate detection information;
[0027] sending the detection information to the to-be-tested server based on the application interface.
[0028] According to the preferred embodiment of the present application, the analyzing the execution data packet according to the protocol information of the to-be-tested server to obtain an execution result of the to-be-tested server on the execution data packet comprises:
[0029] obtaining the protocol information according to the physical information;
[0030] filtering an analysis mode from the protocol information according to a data packet language of the execution data packet;
[0031] performing data packet based on the parsing manner, to obtain parsing data of the execution data packet;
[0032] obtaining information corresponding to a preset field in the parsing data as the execution result.
[0033] According to the preferred embodiment of the present application, the execution data packet of the server to be tested is obtained based on the out-of-band address, comprising:
[0034] obtaining a generated data packet of the server to be tested;
[0035] extracting a response address from the generated data packet;
[0036] comparing the response address with the out-of-band address;
[0037] determining the generated data packet with the response address as the out-of-band address as the execution data packet.
[0038] In another aspect, the present application further provides a server detection device, comprising:
[0039] an identification unit, configured to identify a server to be tested in a database cluster based on a server detection request in response to the server detection request;
[0040] a collection unit, configured to collect an out-of-band address of the server to be tested from a configuration management database;
[0041] an obtaining unit, configured to obtain an execution data packet of the server to be tested according to the out-of-band address;
[0042] a parsing unit, configured to parse the execution data packet according to protocol information of the server to be tested, to obtain an execution result of the execution data packet by the server to be tested;
[0043] a closing unit, configured to close the server to be tested if the execution result indicates that the execution data packet fails to run.
[0044] In another aspect, the present application further provides an electronic device, comprising:
[0045] a memory, configured to store computer readable instructions; and
[0046] a processor, configured to execute the computer readable instructions stored in the memory to implement the server detection method.
[0047] In another aspect, the present application also provides a computer readable storage medium, wherein computer readable instructions are stored in the computer readable storage medium, and the computer readable instructions are executed by a processor in an electronic device to implement the server detection method.
[0048] From the above technical solution can be seen, the present application by collecting the out-of-band address, and through the out-of-band address to obtain the execution data packet, can avoid through the landing pad machine login to the server to be measured to obtain the execution data packet, because of avoiding login operation, therefore, can simplify the operation, thereby improving the detection efficiency of the server to be measured, and then when the execution result indicates that the execution data packet fails to run, the server to be measured is closed, the server to be measured cannot provide service after shutdown, thereby avoiding the occupation of VIP address, at the same time, after the server to be measured is shut down, the high availability service of the database cluster is triggered, the normal switching of data service can be realized, and the problem of inconsistent data of the database cluster is avoided. BRIEF DESCRIPTION OF DRAWINGS
[0049] Figure 1 is a flow chart of a preferred embodiment of the server detection method of the present application.
[0050] Figure 2 is a schematic diagram of an out-of-band management file in the server detection method of the present application.
[0051] Figure 3 is a functional module diagram of a preferred embodiment of the server detection device of the present application.
[0052] Figure 4 is a structural schematic diagram of an electronic device of a preferred embodiment of the present application for implementing the server detection method. DETAILED DESCRIPTION
[0053] In order to make the purpose, technical scheme and advantages of the present application clearer, the present application will be described in detail below with reference to the drawings and specific embodiments.
[0054] As shown in Figure 1 is a flow chart of a preferred embodiment of the server detection method of the present application. According to different needs, the order of steps in the flow chart can be changed, and some steps can be omitted.
[0055] The server detection method is applied to one or more electronic devices, which is a device capable of automatically performing numerical calculation and / or information processing according to pre-set or stored computer readable instructions, and the hardware thereof includes but is not limited to microprocessors, application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.
[0056] The electronic device can be any electronic product capable of human-computer interaction with a user, such as a personal computer, a tablet computer, a smart phone, a personal digital assistant (PDA), a game console, an interactive Internet Protocol Television (IPTV), a smart wearable device, etc.
[0057] The electronic device can include a network device and / or a user device. The network device includes but is not limited to a single network electronic device, an electronic device group composed of multiple network electronic devices, or a cloud composed of a large number of hosts or network electronic devices based on cloud computing.
[0058] The network in which the electronic device is located includes but is not limited to the Internet, a wide area network, a metropolitan area network, a local area network, a virtual private network (VPN), etc.
[0059] 101, in response to a server detection request, identifying a to-be-tested server in a database cluster based on the server detection request.
[0060] In at least one embodiment of the present application, the server detection request can be triggered to be generated within a set time, for example, the set time can be at 6 o'clock in the morning every day, etc. The server detection request can carry information such as the cluster identification of the database cluster, the request time of the server detection request, etc.
[0061] The database cluster refers to a specific cluster that needs to be server-detected. The database cluster usually utilizes at least two or more database servers to constitute a virtual single database logical image, and provides transparent data services to clients.
[0062] The to-be-tested server refers to a database server that needs to be server probed. The to-be-tested server usually refers to a database server in the database cluster that can perform an operation independently completed by a master database server externally, wherein the operation independently completed by the master database server can include, but is not limited to, a write operation, and the like.
[0063] In at least one embodiment of the present application, the electronic device identifies the to-be-tested server in the database cluster based on the server probing request, which includes:
[0064] extracting a cluster identifier from a request message of the server probing request;
[0065] locating the database cluster based on the cluster identifier;
[0066] collecting a request data packet of each database server based on a request time of the server probing request;
[0067] identifying the to-be-tested server from all the database servers based on request information of the request data packet.
[0068] The request message refers to code information stored in a configuration identifier {} in the server probing request.
[0069] The cluster identifier is used to uniquely indicate the database cluster.
[0070] The request time refers to a generation time of the server probing request.
[0071] The request data packet refers to a data packet whose sending time is within a target period, wherein the sending time refers to a time point at which the data packet is sent to the database server. The target period can be generated according to a difference between the request time and a preset period, and the preset period can be set according to actual needs. For example, the request time is 6:00, the preset period is 2 minutes, and the target period is 5:58-6:00.
[0072] The request information refers to specific information in the request data packet.
[0073] Through the request message, the cluster identifier can be quickly extracted, thereby improving the positioning efficiency of the database cluster. Through the request time, the request data packet can be reasonably screened, so as to avoid the identification failure of the to-be-tested server caused by obtaining irrelevant request data packets, thereby improving the identification accuracy of the to-be-tested server.
[0074] Specifically, the electronic device identifies the to-be-tested server from all the database servers based on the request information of the request data packet, which includes:
[0075] If the request information is a write request, the database server corresponding to the request data packet is determined as the server to be tested.
[0076] The write request has a specific identifier, for example, the identifier corresponding to the write request can be write.
[0077] According to the above embodiment, since the write request is an operation completed independently by the master database server, the server to be tested can be accurately identified by comparing the request information and the write request.
[0078] In other embodiments, if the request information is operation information completed independently by the master database server, the database server corresponding to the request data packet is determined as the server to be tested.
[0079] According to the above embodiment, the server to be tested can be comprehensively obtained.
[0080] 102. Collecting an out-of-band address of the server to be tested from a configuration management database (CMDB).
[0081] In at least one embodiment of the present application, the configuration management database contains all relevant information of components in an information system and the relationship between a plurality of components, wherein the information system is usually a system used by IT services in an enterprise, etc.
[0082] The out-of-band address refers to the IP (Internet Protocol) address of the dedicated network (local area network) where the physical machine of the server to be tested is located on the Internet.
[0083] In at least one embodiment of the present application, the electronic device collects the out-of-band address of the server to be tested from the configuration management database, comprising:
[0084] Based on the out-of-band identifier, the out-of-band management file is located from the configuration management database;
[0085] Based on the physical information of the server to be tested and the file information of the out-of-band management file, a query statement is generated;
[0086] The application interface of the configuration management database is called, the query statement is run, and the out-of-band address is obtained.
[0087] The out-of-band identifier is used to indicate the out-of-band management file.
[0088] The out-of-band management file refers to a specified file where the out-of-band address is located.
[0089] As Figure 2 shown, it is the schematic diagram of out-of-band management file in the server detection method of the present application. In Figure 2 the out-of-band management file includes the mapping relationship of physical information A and out-of-band address 1, the mapping relationship of physical information B and out-of-band address 2, the mapping relationship of physical information C and out-of-band address 3, and the mapping relationship of physical information D and out-of-band address 4.
[0090] The physical information can include, but is not limited to, the physical address of the server to be tested and the like.
[0091] The file information can include, but is not limited to, the path information of the out-of-band management file in the configuration management database.
[0092] The application interface refers to the interface for the configuration management database to communicate with the outside world.
[0093] Through the out-of-band identifier, the out-of-band management file can be quickly located, and then combined with the physical information and the file information, the query statement can be reasonably generated, and then through the calling of the application interface, the operation of the query statement can be directly realized, thereby improving the collection accuracy and collection efficiency of the out-of-band address.
[0094] 103, obtaining an execution data packet of the server to be tested according to the out-of-band address.
[0095] In at least one embodiment of the present application, the execution data packet can be a response data packet generated by the server to be tested based on the detection information. The execution data packet can also be a response data packet generated by the server to be tested based on the data request of the client.
[0096] In at least one embodiment of the present application, before obtaining the execution data packet of the server to be tested according to the out-of-band address, the server detection method further comprises:
[0097] calling a pre-detection program to generate detection information;
[0098] sending the detection information to the server to be tested based on the application interface.
[0099] Wherein, the pre-detection program refers to a code program for detecting the server to be tested.
[0100] The detection information refers to a data packet containing the pre-detection program.
[0101] The detection information can be quickly generated through the pre-detection procedure, and the sending efficiency of the detection information can be improved through the application interface. In addition, the detection information can be generated to avoid the problem that the execution data packet cannot be obtained due to that the client does not send the data request.
[0102] In at least one embodiment of the present application, the electronic device obtains the execution data packet of the to-be-tested server according to the out-of-band address, comprising:
[0103] Obtain the generated data packet of the to-be-tested server;
[0104] Extract the response address from the generated data packet;
[0105] Compare the response address with the out-of-band address;
[0106] Determine the generated data packet with the response address as the out-of-band address as the execution data packet.
[0107] The generated data packet refers to the response data packet generated by the to-be-tested server.
[0108] The response address refers to the specific address information of the generated data packet.
[0109] By comparing the response address with the out-of-band address, the execution data packet can be accurately screened from the generated data packet, thereby improving the detection accuracy of the to-be-tested server.
[0110] 104, according to the protocol information of the to-be-tested server, the execution data packet is parsed to obtain the execution result of the to-be-tested server to the execution data packet.
[0111] It should be emphasized that, in order to further ensure the privacy and security of the above execution result, the above execution result can also be stored in a node of a block chain.
[0112] In at least one embodiment of the present application, the protocol information refers to the rules and agreements that the to-be-tested server must comply with.
[0113] The execution result is used to indicate the processing result of the to-be-tested server to the execution data packet, and the execution result can include: true, fail, etc.
[0114] In at least one embodiment of the present application, the electronic device obtains the execution result of the to-be-tested server to the execution data packet according to the protocol information of the to-be-tested server, comprising:
[0115] Obtain the protocol information according to the physical information;
[0116] According to a data packet language of the execution data packet, a parsing manner is screened from the protocol information;
[0117] The execution data packet is parsed based on the parsing manner, and parsed data of the execution data packet is obtained;
[0118] Information corresponding to a preset field in the parsed data is obtained as the execution result.
[0119] The data packet language refers to a code language of the execution data packet, for example, the data packet language can be a java language, the data packet language can also be a python language, the data packet language can also be a c language, and the like.
[0120] The parsing manner refers to protocol information corresponding to the data packet language.
[0121] The parsed data refers to data information carried in a subject message in the execution data packet.
[0122] The preset field can be set as a data field, and the like.
[0123] The protocol information can be comprehensively obtained through the physical information, and the parsing manner can be reasonably screened from the protocol information through the data packet language. Further, the execution data packet can be reasonably parsed through the parsing manner, so that the generation accuracy and efficiency of the parsed data are improved. The execution result can be accurately obtained from the parsed data through the preset field.
[0124] 105, if the execution result indicates that the execution data packet fails, the to-be-tested server is closed.
[0125] In the embodiment, when the execution result indicates that the execution data packet fails, it is indicated that the to-be-tested server cannot normally operate, and the to-be-tested server occupies a VIP address. Therefore, by closing the to-be-tested server, the high-availability service of the database cluster can be triggered, so that normal switching of data service is realized, and the problem of inconsistent data of the database cluster is avoided.
[0126] In at least one embodiment of the application, the server detection method further comprises:
[0127] The number of servers of the to-be-tested server corresponding to the execution result indicating that the execution data packet succeeds is counted;
[0128] If the server quantity is more than one, the to-be-tested server corresponding to the execution result indicating that the execution data packet runs successfully is determined as a to-be-processed server;
[0129] All database servers in the database cluster are acquired;
[0130] Based on the voting results of the all database servers on the multiple to-be-processed servers, a target server is identified.
[0131] All to-be-processed servers except the target server are closed.
[0132] The voting result refers to a result of the all database servers filtering out a master database server from the multiple to-be-processed servers.
[0133] The target server refers to a to-be-processed server with the highest number of votes.
[0134] In the embodiment, when the server quantity is more than one, it indicates that the multiple to-be-processed servers all serve as master database servers to communicate externally. When the multiple to-be-processed servers all serve as master database servers to communicate externally, it is easy to cause the multiple to-be-processed servers to occupy the same VIP address. Therefore, by the voting result, the target server can be reasonably filtered out, and all to-be-processed servers except the target server can be closed. In this way, the target server can participate in external communication as a master database server, and occupation of the VIP address by other database servers can be avoided.
[0135] As can be seen from the above technical solution, the out-of-band address is acquired, and the execution data packet is acquired through the out-of-band address. In this way, it is avoided to log in to the to-be-tested server through a jump machine to acquire the execution data packet. Since the login operation is avoided, the operation can be simplified, the detection efficiency of the to-be-tested server is improved, and when the execution result indicates that the execution data packet runs unsuccessfully, the to-be-tested server is closed. After the to-be-tested server is shut down, it cannot provide services, so that occupation of the VIP address can be avoided. After the to-be-tested server is shut down, the high-availability service of the database cluster is triggered, the normal switching of data services can be realized, and the problem of inconsistent data of the database cluster is avoided.
[0136] As Figure 3As shown is a functional module diagram of a preferred embodiment of the server detection device of the present application. The server detection device 11 comprises an identification unit 110, a collection unit 111, an acquisition unit 112, an analysis unit 113, a closing unit 114, a statistical unit 115, a determination unit 116, a generation unit 117, and a sending unit 118. The module / unit referred to in the present application refers to a series of computer readable instruction segments capable of being acquired by the processor 13 and capable of completing a fixed function, which is stored in the memory 12. In the present embodiment, the functions of each module / unit will be described in detail in subsequent embodiments.
[0137] The identification unit 110 is configured to identify a to-be-tested server in a database cluster based on a server detection request in response to the server detection request.
[0138] The collection unit 111 is configured to collect an out-of-band address of the to-be-tested server from a configuration management database.
[0139] The acquisition unit 112 is configured to acquire an execution data packet of the to-be-tested server according to the out-of-band address.
[0140] The analysis unit 113 is configured to analyze the execution data packet according to protocol information of the to-be-tested server to obtain an execution result of the to-be-tested server on the execution data packet.
[0141] The closing unit 114 is configured to close the to-be-tested server if the execution result indicates that the execution data packet fails to run.
[0142] In at least one embodiment of the present application, the statistical unit 115 is configured to count a number of servers corresponding to the to-be-tested servers whose execution results indicate that the execution data packet runs successfully.
[0143] The determination unit 116 is configured to determine the to-be-tested servers corresponding to the execution results indicating that the execution data packet runs successfully as to-be-processed servers if the number of servers is greater than one.
[0144] The acquisition unit 112 is further configured to acquire all database servers in the database cluster.
[0145] The identification unit 110 is further configured to identify a target server based on voting results of the all database servers on the to-be-processed servers.
[0146] The closing unit 114 is further configured to close all to-be-processed servers except the target server.
[0147] In the embodiment, when the number of the servers is multiple, it indicates that the multiple to-be-processed servers all perform external communication as master database servers, and when the multiple to-be-processed servers all perform external communication as master database servers, it is easy to cause the multiple to-be-processed servers to occupy a same VIP address. Therefore, by using the voting result, the target server can be reasonably screened out, and all to-be-processed servers except the target server can be closed, so that the target server can participate in external communication as a master database server, and occupation of the VIP address by other database servers can be avoided.
[0148] In at least one embodiment of the present application, the identification unit 110 is further configured to extract a cluster identifier from a request message of the server detection request;
[0149] Based on the cluster identifier, the database cluster is located;
[0150] Based on a request time of the server detection request, request data packets of each database server are collected;
[0151] Based on request information of the request data packets, the to-be-tested server is identified from the all database servers.
[0152] By using the request message, the cluster identifier can be quickly extracted, so that the positioning efficiency of the database cluster is improved. By using the request time, the request data packets can be reasonably screened out, so that the identification of the to-be-tested server is not failed due to irrelevant request data packets, and the identification accuracy of the to-be-tested server is improved.
[0153] Specifically, the identification unit 110 is further configured to, if the request information is a write request, determine a database server corresponding to the request data packet as the to-be-tested server.
[0154] According to the above embodiment, since the write request belongs to an operation independently completed by the master database server, by comparing the request information with the write request, the to-be-tested server can be accurately identified.
[0155] In other embodiments, the identification unit 110 is further configured to, if the request information is operation information independently completed by the master database server, determine a database server corresponding to the request data packet as the to-be-tested server.
[0156] According to the above embodiment, the to-be-tested server can be comprehensively obtained.
[0157] In at least one embodiment of the present application, the collection unit 111 is further configured to locate an out-of-band management file from the configuration management database based on the out-of-band identifier;
[0158] Generate a query statement based on the physical information of the to-be-tested server and the file information of the out-of-band management file;
[0159] Call an application interface of the configuration management database to run the query statement and obtain the out-of-band address.
[0160] The out-of-band identifier can be used to quickly locate the out-of-band management file, and the query statement can be reasonably generated in combination with the physical information and the file information, and the running of the query statement can be directly implemented through the calling of the application interface, thereby improving the collection accuracy and efficiency of the out-of-band address.
[0161] In at least one embodiment of the present application, before the execution data packet of the to-be-tested server is acquired according to the out-of-band address, a generation unit 117 is configured to call a pre-detection program to generate detection information;
[0162] A sending unit is configured to send the detection information to the to-be-tested server based on the application interface.
[0163] The pre-detection program can be used to quickly generate the detection information, and the application interface can be used to improve the sending efficiency of the detection information. In addition, the generation of the detection information can avoid the problem that the execution data packet cannot be acquired due to the fact that the client does not send the data request.
[0164] In at least one embodiment of the present application, the analysis unit 113 is further configured to acquire the protocol information according to the physical information;
[0165] Filter an analysis mode from the protocol information according to the data packet language of the execution data packet;
[0166] Perform analysis processing on the execution data packet based on the analysis mode to obtain analysis data of the execution data packet;
[0167] Obtain information corresponding to a preset field from the analysis data as the execution result.
[0168] The protocol information can be comprehensively acquired through the physical information, and the analysis manner can be reasonably filtered from the protocol information through the data packet language, further, the execution data packet can be reasonably analyzed and processed through the analysis manner, so that the generation accuracy and generation efficiency of the analysis data are improved, and the execution result can be accurately acquired from the analysis data through the preset field.
[0169] In at least one embodiment of the present application, the acquisition unit 112 is further configured to acquire a generated data packet of the server to be tested.
[0170] Extracting a response address from the generated data packet.
[0171] Comparing the response address with the out-of-band address.
[0172] Determining the generated data packet with the response address as the out-of-band address as the execution data packet.
[0173] By comparing the response address with the out-of-band address, the execution data packet can be accurately filtered from the generated data packet, so that the detection accuracy of the server to be tested is improved.
[0174] As can be seen from the above technical solutions, the present application can avoid logging into the server to be tested through a jump machine to acquire the execution data packet by acquiring the out-of-band address and acquiring the execution data packet through the out-of-band address. Since the login operation is avoided, the operation is simplified, so that the detection efficiency of the server to be tested is improved, and further, when the execution result indicates that the execution data packet fails to run, the server to be tested is closed. After the server to be tested is shut down, it cannot provide services, so that the occupation of the VIP address can be avoided. At the same time, after the server to be tested is shut down, the high-availability service of the database cluster is triggered, so that the normal switching of data services can be realized, and the problem of inconsistent data of the database cluster is avoided.
[0175] As shown in Figure 4 FIG. 1 is a structural schematic diagram of an electronic device according to a preferred embodiment of the present application.
[0176] In one embodiment of the present application, the electronic device 1 includes, but is not limited to, a memory 12, a processor 13, and computer readable instructions stored in the memory 12 and executable on the processor 13, such as a server detection program.
[0177] Those skilled in the art can understand that the schematic diagram is only an example of the electronic device 1, and does not constitute a limitation on the electronic device 1, and can include more or less components than the diagram, or combine certain components, or different components, for example, the electronic device 1 can also include an input / output device, a network access device, a bus, etc.
[0178] The processor 13 can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor. The processor 13 is the operation core and control center of the electronic device 1, and connects various parts of the entire electronic device 1 through various interfaces and lines, and executes the operating system and various installed application programs, program codes, etc. of the electronic device 1.
[0179] For example, the computer readable instructions can be divided into one or more modules / units, which are stored in the memory 12 and executed by the processor 13 to complete the present application. The one or more modules / units can be a series of computer readable instruction segments capable of completing a specific function, which are used to describe the execution process of the computer readable instructions in the electronic device 1. For example, the computer readable instructions can be divided into an identification unit 110, an acquisition unit 111, an obtaining unit 112, an analysis unit 113, a closing unit 114, a statistics unit 115, a determination unit 116, a generation unit 117 and a sending unit 118.
[0180] The memory 12 can be used to store the computer readable instructions and / or modules, and the processor 13 realizes various functions of the electronic device 1 by running or executing the computer readable instructions and / or modules stored in the memory 12, and calling the data stored in the memory 12. The memory 12 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application program required by a function (such as a sound playing function, an image playing function, etc.), and the like; and the data storage area can store data created according to the use of the electronic device, etc. The memory 12 can include non-volatile and volatile memories, for example: a hard disk, a memory, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, at least one disk storage device, a flash storage device, or other storage devices.
[0181] The memory 12 can be an external memory and / or an internal memory of the electronic device 1. Further, the memory 12 can be a memory having a physical form, such as a memory stick, a TF card (Trans-flash Card), and the like.
[0182] The modules / units integrated in the electronic device 1, if implemented in the form of software functional units and sold or used as independent products, can be stored in a computer readable storage medium. Based on such understanding, all or part of the processes in the above-mentioned embodiment methods can also be completed by computer readable instructions instructing related hardware, and the computer readable instructions can be stored in a computer readable storage medium. When the computer readable instructions are executed by a processor, the steps of the above-mentioned various method embodiments can be implemented.
[0183] The computer readable instructions include computer readable instruction codes, which can be in the form of source code, object code, executable files, or some intermediate forms, etc. The computer readable medium can include any entity or device capable of carrying the computer readable instruction codes, recording media, U disks, mobile hard disks, magnetic disks, optical disks, computer memories, read-only memories (ROMs), random access memories (RAMs).
[0184] The blockchain is a new application mode of distributed server detection, peer-to-peer transmission, consensus mechanism, encryption algorithm and other computer technologies. The blockchain is essentially a decentralized database, which is a series of data blocks associated using cryptography. Each data block contains information of a batch of network transactions, and is used to verify the validity (anti-fake) of the information and generate the next block. The blockchain can include a blockchain underlying platform, a platform product service layer, and an application service layer.
[0185] In combination Figure 1 The memory 12 in the electronic device 1 stores computer readable instructions to implement a server detection method. The processor 13 can execute the computer readable instructions to implement:
[0186] In response to a server detection request, identifying a to-be-tested server in a database cluster based on the server detection request;
[0187] Collecting an out-of-band address of the to-be-tested server from a configuration management database;
[0188] Obtaining an execution data packet of the to-be-tested server according to the out-of-band address;
[0189] According to the protocol information of the to-be-tested server, the execution data packet is parsed to obtain an execution result of the to-be-tested server on the execution data packet;
[0190] If the execution result indicates that the execution data packet fails to run, the to-be-tested server is closed.
[0191] Specifically, the specific implementation method of the processor 13 on the above computer readable instructions can refer to the description of related steps in the corresponding embodiment, which will not be repeated here. Figure 1
[0192] In several embodiments provided by the present application, it should be understood that the disclosed system, device and method can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules is only a logical function division. There can be another division way in actual implementation.
[0193] The computer readable storage medium stores computer readable instructions, wherein the computer readable instructions are executed by the processor 13 to implement the following steps:
[0194] In response to a server detection request, identifying a to-be-tested server in a database cluster based on the server detection request;
[0195] Collecting an out-of-band address of the to-be-tested server from a configuration management database;
[0196] According to the out-of-band address, an execution data packet of the server to be tested is acquired;
[0197] According to the protocol information of the server to be tested, the execution data packet is parsed to obtain an execution result of the server to be tested on the execution data packet;
[0198] If the execution result indicates that the execution data packet fails to run, the server to be tested is closed.
[0199] The modules described as separated components may or may not be physically separated, and the components displayed as modules may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the embodiment.
[0200] In addition, each functional module in each embodiment of the present application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware, or in the form of hardware plus software functional modules.
[0201] Therefore, from any point of view, the embodiments should be regarded as exemplary and non-limiting, and the scope of the present application is defined by the appended claims rather than the above description, and therefore all changes falling within the meaning and scope of the equivalent elements of the claims are intended to be included in the present application. Any additional reference signs in the claims should not be considered as limiting the claims involved.
[0202] In addition, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. The plurality of units or devices mentioned can also be implemented by one unit or device through software or hardware. The words first, second, etc. are used to indicate names and not to indicate any particular order.
[0203] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application and not to limit it. Although the present application has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present application can be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present application.
Claims
1. A server probing method, characterized by, The server detection method comprises: In response to a server detection request, identifying a to-be-tested server in a database cluster based on the server detection request, comprising: extracting a cluster identifier from a request message of the server detection request; locating the database cluster based on the cluster identifier; collecting a request data packet of each database server in the database cluster based on a request time of the server detection request, the request data packet being a data packet with a target time period, the target time period being generated according to a difference between the request time and a preset time period; identifying the to-be-tested server from all database servers of the database cluster based on request information of the request data packet; Collecting an out-of-band address of the to-be-tested server from a configuration management database; Obtaining an execution data packet of the to-be-tested server according to the out-of-band address; According to the protocol information of the to-be-tested server, the execution data packet is parsed to obtain the execution result of the to-be-tested server on the execution data packet; If the execution result indicates that the execution data packet fails to run, the to-be-tested server is closed.
2. The server probing method of claim 1, wherein, The server detection method further comprises: Counting the number of servers corresponding to the to-be-tested servers indicated by the execution result that the execution data packet runs successfully; If the number of servers is more than one, the to-be-tested server corresponding to the execution result that the execution data packet runs successfully is determined as a to-be-processed server; Obtaining all database servers in the database cluster; Based on the voting results of the all database servers on the multiple to-be-processed servers, a target server is identified; All to-be-processed servers except the target server are closed.
3. The server probing method of claim 1, wherein, The collecting of the out-of-band address of the to-be-tested server from the configuration management database comprises: Based on the out-of-band identifier, an out-of-band management file is located from the configuration management database; Based on the physical information of the to-be-tested server and the file information of the out-of-band management file, a query statement is generated; The application interface of the configuration management database is called to run the query statement to obtain the out-of-band address.
4. The server probing method of claim 3, wherein, Before obtaining the execution data packet of the to-be-tested server according to the out-of-band address, the server detection method further comprises: Calling a pre-detection program to generate detection information; Based on the application interface, the detection information is sent to the to-be-tested server.
5. The server probing method of claim 3, wherein, The parsing of the execution data packet according to the protocol information of the to-be-tested server to obtain the execution result of the to-be-tested server on the execution data packet comprises: The protocol information is obtained according to the physical information; The parsing method is filtered from the protocol information according to the data packet language of the execution data packet; The execution data packet is parsed based on the parsing method to obtain parsed data of the execution data packet; The information corresponding to the preset field is obtained from the parsed data as the execution result.
6. The server probing method of claim 1, wherein, The obtaining of the execution data packet of the to-be-tested server according to the out-of-band address comprises: Obtaining a generated data packet of the to-be-tested server; Extracting a response address from the generated data packet; Comparing the response address with the out-of-band address; The generated data packet with the response address being the out-of-band address is determined as the execution data packet.
7. A server probe apparatus, characterized by comprising: The server detection device comprises: The identification unit is configured to, in response to a server detection request, identify a to-be-tested server in a database cluster based on the server detection request, including: extracting a cluster identifier from a request message of the server detection request; locating the database cluster based on the cluster identifier; collecting a request data packet of each database server in the database cluster based on a request time of the server detection request, the request data packet being a data packet with a target time period, the target time period being generated according to a difference between the request time and a preset time period; and identifying the to-be-tested server from all database servers in the database cluster based on request information of the request data packet; The collection unit is configured to collect an out-of-band address of the to-be-tested server from a configuration management database; The acquisition unit is configured to acquire an execution data packet of the to-be-tested server according to the out-of-band address; The analysis unit is configured to analyze the execution data packet according to protocol information of the to-be-tested server to obtain an execution result of the to-be-tested server on the execution data packet; The closing unit is configured to close the to-be-tested server if the execution result indicates that the execution data packet fails to run.
8. An electronic device, comprising: The electronic device comprises: a memory storing computer readable instructions; and a processor executing the computer readable instructions stored in the memory to implement the server detection method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer readable storage medium stores computer readable instructions, and the computer readable instructions are executed by a processor in an electronic device to implement the server detection method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Server monitoring method and system and computer device
CN113986667A
Method for realizing high availability of database based on Keepalived
CN114116912A
Database switching method and device, electronic equipment and storage medium
CN115344555A