Micro-service access method, micro-service fault judgment method, micro-service fault judgment device, micro-service equipment and medium

By obtaining access tokens and response results, the single-unit microservices that are faulty are accurately located, and the problem of microservices that are difficult to locate faults in the prior art is solved, and fault location and maintenance of microservice clusters are realized.

CN118890171APending Publication Date: 2024-11-01深圳开鸿数字产业发展有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410871264.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-01
Publication Date
2024-11-01

AI Technical Summary

Technical Problem

The existing technology is difficult to locate faulty microservices, resulting in the inability to effectively repair.

Method used

By obtaining the access token sent by the user terminal, determining its corresponding access address, accessing the single-unit microservice and obtaining response results, and generating business access results to filter out the failed single-unit microservice.

Benefits of technology

The single-unit microservice that failed was accurately positioned, thereby performing maintenance, solving the problem of microservices that are difficult to locate faults in the prior art.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118890171A_ABST
    Figure CN118890171A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of micro-service clusters, in particular to a micro-service access method, a fault judgment method, a device, equipment and a medium. The method comprises the following steps: firstly, acquiring an access token sent by a user terminal by a gateway, and then finding an access address corresponding to the access token by the gateway; then the gateway sends an access request to the single micro-service corresponding to the access address, the single micro-service sends a response result to the gateway based on the request, and the gateway generates a service access result based on the response result. Once the business access result is abnormal, the faulty single micro-service can be positioned according to the abnormal business access result, and in conclusion, the fault single micro-service can be positioned, so that the fault single micro-service can be maintained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of microservice cluster technology, and in particular to a microservice access method and a fault determination method, device, equipment and medium. Background Art

[0002] A microservice cluster is to deploy multiple microservices to multiple servers. The individual service functions of the microservices on each server are combined to form the overall service function of the microservice cluster. When a client requests to call a microservice cluster to obtain the overall service function, the client first sends the request to the load balancer, which assigns each server to complete the client's request. However, once the client's request cannot be completed, it is difficult to locate which microservice on which server has a fault that causes the failure to complete the client request.

[0003] In summary, it is difficult to locate faulty microservices using existing technologies.

[0004] Therefore, the prior art still needs to be improved and enhanced. Summary of the invention

[0005] To solve the above technical problems, the present invention provides a microservice access method and a fault determination method, device, equipment and medium, which solve the problem that it is difficult to locate faulty microservices in the prior art.

[0006] To achieve the above object, the present invention adopts the following technical solutions:

[0007] In a first aspect, the present invention provides a microservice access method, which includes:

[0008] Obtaining an access token sent by a user terminal, and determining an access address corresponding to the access token;

[0009] Access the single microservice through the access address and obtain the response result of the single microservice;

[0010] A service access result is generated according to the response result, and the service access result is used to filter out a single microservice with a fault from the microservice cluster.

[0011] In one implementation, determining the access address corresponding to the access token includes:

[0012] Verifying the access rights of the user terminal and obtaining a verification result of the access rights;

[0013] When the verification result is that the verification is passed, obtaining the service list sent by the registration center server;

[0014] An access address corresponding to the access token is determined according to the service list.

[0015] In one implementation, the verifying the access permission of the user terminal and obtaining a verification result of the access permission includes:

[0016] Parsing the access token to obtain the user name of the user terminal, the user role to which the user terminal belongs, and the user authority possessed by the user terminal;

[0017] The user name, the user role and the user authority are verified according to a preset access control matrix to obtain a verification result of the access authority, wherein the access control matrix is ​​used to record the corresponding relationship between the user name, the user role and the user authority.

[0018] In one implementation, the single microservice is a microservice obtained by splitting the microservice cluster according to business type or service type.

[0019] In one implementation, generating a service access result according to the response result includes:

[0020] Generate a status code according to the response result, wherein the status code is used to characterize the fault type;

[0021] A message is generated according to the response result and the status code, and the message is used as the service access result.

[0022] In a second aspect, an embodiment of the present invention further provides a microservice fault determination method, which includes:

[0023] Obtaining a service access result sent by the gateway, where the service access result is generated by the gateway based on the microservice access method described above;

[0024] Parse the service access result to obtain a status code and a response result of a single microservice, wherein the status code is used to characterize the fault type;

[0025] A fault determination result of the single microservice is obtained according to the status code and the response result.

[0026] In one implementation, obtaining the fault determination result of the single microservice according to the status code and the response result includes:

[0027] The standard data format of the single microservice is obtained, and when the data format of the response result matches the standard data format, the single microservice is obtained as a non-faulty microservice, and the non-faulty microservice is used as a fault determination result;

[0028] When the data format of the response result is different from the standard data format, and the status code is a status code corresponding to the fault, it is obtained that the single microservice is a faulty microservice, and the faulty microservice is used as the fault determination result.

[0029] In a third aspect, an embodiment of the present invention further provides a microservice access device, wherein the device includes the following components:

[0030] An address reading module, used to obtain an access token sent by a user terminal and determine an access address corresponding to the access token;

[0031] An access module, used to access the single microservice through the access address and obtain a response result of the single microservice;

[0032] The access result generation module is used to generate a business access result according to the response result, and the business access result is used to screen out a single microservice with a fault from the microservice cluster.

[0033] In a fourth aspect, an embodiment of the present invention further provides a terminal device, wherein the terminal device includes a memory, a processor, and a microservice access program stored in the memory and executable on the processor, and when the processor executes the microservice access program, the steps of the microservice access method described above are implemented;

[0034] Alternatively, the terminal device includes a memory, a processor, and a microservice fault determination program stored in the memory and executable on the processor, and when the processor executes the microservice fault determination program, the steps of the above-described microservice fault determination method are implemented.

[0035] In a fifth aspect, an embodiment of the present invention further provides a computer-readable storage medium, on which a microservice access program is stored, and when the microservice access program is executed by a processor, the steps of the microservice access method described above are implemented;

[0036] Alternatively, a microservice fault determination program is stored on the computer-readable storage medium, and when the microservice fault determination program is executed by the processor, the steps of the microservice fault determination method described above are implemented.

[0037] Beneficial effect: The gateway of the present invention first obtains the access token sent by the user terminal, and then the gateway finds the access address corresponding to the access token; then the gateway sends an access request to the single microservice corresponding to the access address, and the single microservice sends a response result to the gateway based on the request, and the gateway generates a business access result based on the response result. Since there is a corresponding relationship between the business access result and the single microservice and the access address, once the business access result is abnormal, the faulty single microservice can be located according to the abnormal business access result. In summary, the present invention can locate the faulty single microservice so as to repair the faulty single microservice. That is, once one or several single microservices in the microservice cluster fail, the single microservice can be located by the access method of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 It is the overall flow chart of the present invention;

[0039] Figure 2 A structural diagram of a microservice access device provided by the present invention;

[0040] Figure 3 This is a block diagram of the internal structure principle of the terminal device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0041] The following is a clear and complete description of the technical solution of the present invention in combination with the embodiments and the accompanying drawings. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0042] According to research, a microservice cluster is to deploy multiple microservices to multiple servers. The individual service functions of the microservices on each server are combined to form the overall service function of the microservice cluster. When a client requests to call a microservice cluster to obtain the overall service function, the client first sends the request to the load balancer, which assigns each server to complete the client's request. However, once the client's request cannot be completed, it is difficult to locate which microservice on which server has a fault that causes the failure to complete the client request.

[0043] In order to solve the above technical problems, the present invention provides a microservice access method and a fault determination method, device, equipment and medium, which solves the problem that it is difficult to locate faulty microservices in the prior art. In specific implementation, first obtain the access token sent by the user terminal, and determine the access address corresponding to the access token; then access the monomer microservice through the access address, and obtain the response result of the monomer microservice; finally, based on the response result, generate a business access result, and the business access result is used to filter out the faulty monomer microservice from the microservice cluster. The present invention can locate the faulty monomer microservice.

[0044] For example, a microservice cluster consists of five single microservices, which are single microservice A, single microservice B, single microservice C, single microservice D, and single microservice E. These five single microservices are deployed on servers a, b, c, d, and e, respectively. The access addresses of the single servers on the five servers are IP address, IP address, IP address, IP address, IP address, and IP address. When the user terminal accesses the token to the gateway, if the gateway determines that the address corresponding to the access token is IP address, the gateway knows that the user terminal needs to request single microservice A on server a, so the gateway sends a request to single microservice A. After receiving the request, single microservice A sends a response result to the gateway. The gateway generates a business access result based on the response result. The business access result is used to represent whether the response result is abnormal and what causes the abnormal response result if it is abnormal. The gateway sends the business access result to the user terminal, so the user terminal determines whether the single microservice A has a fault based on the business access result. Similarly, if the gateway determines that the address corresponding to the access token is IP address, it can determine whether the single microservice B has a fault. The same method is used to determine whether the single microservice C, single microservice D, and single microservice E have failed. Therefore, this application establishes a corresponding relationship between the access token and the access address of each single microservice, and the access address can be used to know which single microservice in the microservice cluster has failed.

[0045] The microservice access method of this embodiment can be applied to a terminal device, which can be a terminal product with data processing function, such as a computer. Figure 1 As shown in , the microservice access method specifically includes the following steps:

[0046] S100, obtaining an access token sent by a user terminal, and determining an access address corresponding to the access token;

[0047] S200, accessing the single microservice through the access address, and obtaining a response result of the single microservice;

[0048] S300, generating a service access result according to the response result, wherein the service access result is used to filter out a single microservice with a fault from a microservice cluster.

[0049] The access method of the present invention can be applied to an education platform, which is an education microservice cluster. The education microservice cluster includes a microservice for querying students' grades over the years, a microservice for publishing teaching activities, and a microservice for teaching evaluation. Among them, the three monomer microservices of the microservice for querying students' grades over the years, the microservice for publishing teaching activities, and the microservice for teaching evaluation are deployed on three servers respectively. The gateway records the access address of the server where each monomer microservice is located. When the user terminal sends an access token to the gateway, the access token represents the access address that the user terminal can access, that is, the access token represents the monomer microservice that the user terminal can access. When the gateway determines that the access token corresponds to the access address of the grade query microservice, the gateway sends an access request to the server where the grade query microservice is located according to the access address. The server sends a response result to the gateway based on the access request. The gateway generates a business access result according to the response result. The business access result represents whether the response result is abnormal. If it is abnormal, it means that the monomer microservice of the grade query microservice has a fault. At the same time, the type of fault can be judged according to the business access result.

[0050] In the first embodiment, the gateway in step S100 receives the access address sent by the user terminal, and queries the corresponding single microservice in the following manner, including the following specific steps S101, S102, S103, and S104:

[0051] S101, parsing the access token to obtain the user name of the user terminal, the user role to which the user terminal belongs, and the user authority possessed by the user terminal.

[0052] When a user logs in to a user terminal, the system of the user terminal will create an access token, which includes the user name (that is, the SID of the user account) and the user role and the user's permissions.

[0053] A username can be assigned one or more roles, and permissions describe the individual microservices that the user can access.

[0054] S102, verifying the user name, the user role and the user authority according to a preset access control matrix to obtain a verification result of the access authority, wherein the access control matrix is ​​used to record the correspondence between the user name, the user role and the user authority.

[0055] The gateway stores an access control matrix inside, which records several user names, as well as the user roles and user permissions corresponding to each user name, where the user role represents the user's function, position or responsibility. In other words, the access control matrix records the correspondence between the user name, user role and user permission. If the correspondence between the user name, user role and user permission sent by the user terminal does not match the correspondence on the access control matrix, it means that the access permission verification of the user terminal has failed, that is, the user cannot access any single microservice in the microservice cluster. If the correspondence between the user name, user role and user permission sent by the user terminal matches the correspondence on the access control matrix, it means that the user's access permission verification has passed.

[0056] In this embodiment, after the gateway verification, the gateway can send the access token to the single microservice again, and the single microservice can perform a second verification. The second verification can improve the accuracy of the permission verification.

[0057] S103: When the verification result is that the verification is passed, obtain the service list sent by the registration center server.

[0058] The service list is used to record the access address of each single microservice, as well as the correspondence between the access address and the user name, user role, and user permission. The access address on the service list is not open to the public. The access address of the single microservice is registered on the registration center server in advance to form a service list.

[0059] When the user terminal is authenticated by the gateway, the gateway first selects the access address corresponding to the user authority from several access addresses inside it according to the user authority, and records it as the pre-selected access address. The reason why the access address is selected first according to the user authority is that one user authority can correspond to multiple user names and user roles. Therefore, selecting the access address first according to the user authority can improve the screening speed. Since the user name and user role are represented by numbers, the number of the user name and the number of the user role corresponding to the pre-selected access address can be added to obtain the addition result S corresponding to each pair of user name and user role, and the numbers corresponding to the user name and user role sent by the user terminal are added to obtain the addition result s, and then the addition result S equal to the addition result s is selected from several addition results S, and the user name and user role corresponding to the equal addition result S are extracted. Finally, the final user name is selected from the user name and user role corresponding to the above addition result S according to the user name sent by the user terminal. The access address corresponding to the final user name (the user name on the service list) is the access address that the user terminal can access.

[0060] S104: Determine an access address corresponding to the access token according to the service list.

[0061] When the access address that the user terminal can access is found on the service list, the gateway will delete the service list to prevent the access address of the service list from being leaked, thereby ensuring that the single microservice will not be maliciously changed. When a user terminal sends an access token to the gateway again, the gateway will send the service list to the registration center server again.

[0062] In this embodiment, the gateway deletes the service list after using it. When the user terminal sends the access token again, the gateway requests the service list from the registration center server again, which has the following beneficial effects:

[0063] The individual microservices that make up the microservice cluster are constantly updated and expanded, so the corresponding service list is also constantly updated. Therefore, every time a user terminal requests the gateway, the gateway re-requests the service list from the registration center server to ensure the accuracy of the service list downloaded to the gateway each time.

[0064] In this embodiment, the microservice cluster is split into a single microservice in the following manner:

[0065] First, split the microservice cluster into two major service categories: business services and basic services. Then, independently split the business services into two types of single microservices: application business services and system business services. Independently split the basic services into two types of single microservices: file management services and cache management services. The above splitting method makes each single microservice have the characteristics of single responsibility, high cohesion, and low coupling, and the single microservices do not affect each other. That is, if one of the single microservices fails, the other single microservices can still work normally. That is, while repairing the failed single microservice, it does not affect the work of other single microservices.

[0066] In the second embodiment, step S200 is that the gateway accesses the server where the single microservice is located through the access address to access the single microservice. Before accessing the single microservice, the gateway needs to check the stability of the communication link between the gateway and the server, including the following specific steps:

[0067] First, perform an eye diagram test on the gateway and server. After the gateway and server pass the eye diagram test, perform a stability test on the communication link between the gateway and the server. If the stability is within the set threshold value, it means that the communication stability between the gateway and the server is relatively high, so the gateway can access the address to access the single microservice.

[0068] The reason why this embodiment first checks the stability of the communication link between the gateway and the server and then the gateway accesses the server is to eliminate the possibility that the faulty single microservice is incorrectly located due to the stability of the communication link, that is, to prevent the single microservice without fault from being mistakenly determined as a faulty single microservice when the communication link is unstable.

[0069] Embodiment 3, based on embodiment 1, step S300 includes the following specific steps S301 and S302:

[0070] S301, generating a status code according to the response result, wherein the status code is used to characterize the fault type.

[0071] S302: Generate a message according to the response result and the status code, and use the message as a service access result.

[0072] The response result is that the gateway sends a request to the single microservice, and the single microservice performs corresponding operations based on the request to generate a response result, that is, the single microservice responds to the request to generate a response result. The single microservice sends the response result to the gateway. If the response result is correct, the gateway will generate a corresponding status code. If the response result is wrong, the gateway will check what caused the response result to be wrong and generate a corresponding status code. The response result and status code are combined to form a message.

[0073] The message format can be {code:zh,data:sj}, where code represents the status code, zh represents the specific value of the status code, data represents the response result, and sj represents the specific value of the response result.

[0074] The value of zh is 200, which means that the single microservice can be accessed normally, that is, the single microservice has no faults.

[0075] The value of zh is 404, which means that the access address sent by the gateway is incorrect. In other words, when the value of zh is 404, it does not necessarily mean that the single microservice has failed. It may be that the access address sent by the gateway is incorrect, resulting in the single microservice not feeding back the correct result.

[0076] The value of zh is 403, which means that the user terminal does not have access rights. That is, when the value of zh is 403, it is impossible to determine whether the single microservice has a fault.

[0077] The value of zh is 401, which means that the user terminal is not logged in, which means that it is impossible to determine whether the single microservice has a fault.

[0078] The value of zh is 500, which means that a single microservice has failed. That is, when 500 appears in the message generated by the gateway, it can be determined that a single microservice accessed by the gateway has failed.

[0079] In this embodiment, the service access result can also be {code: "status code", data: response result, msg: message}, where the status code can customize the valid value range according to business needs. The user terminal determines whether the service is processed normally by parsing the status code. When expanding the service subsequently, it only needs to increase the customized valid value range.

[0080] Embodiment 4, based on embodiment 3, in this embodiment, the user terminal determines whether the single microservice accessed by it fails according to the received service access result. This embodiment includes the following specific steps S401, S402, and S403:

[0081] S401, the user terminal parses the service access result to obtain a status code and a response result of the single microservice, wherein the status code is used to characterize the fault type.

[0082] S402, the user terminal obtains the standard data format of the single microservice, and when the data format of the response result matches the standard data format, it is determined that the single microservice is a non-faulty microservice, and the non-faulty microservice is used as a fault determination result.

[0083] The gateway stores the standard data format of each single microservice, and when the gateway sends the service access result to the user terminal, the standard data format will be sent at the same time. The user terminal receives the service access result, uses the character recognition algorithm to identify the data, and then identifies the response result of the data, and then the user terminal parses the data format of the response result. If the data format is the same as the standard data format, it can be preliminarily determined that the single microservice has not failed, and combined with the status code to further confirm whether the single microservice has failed. If the data format is different from the standard data format, it means that the single microservice cannot provide services to the user terminal normally. What is the specific reason that the single microservice cannot provide services normally? Step S403 needs to be executed to determine the specific reason.

[0084] S403: When the data format of the response result is different from the standard data format and the status code is a status code corresponding to the fault, it is determined that the single microservice is a faulty microservice, and the faulty microservice is used as a fault determination result.

[0085] If the status code is 500, it means that the single microservice itself has a fault; if the status code is 404, it means that the access address of the gateway is incorrect, resulting in the single microservice being unable to provide services normally; if the status code is 403, it means that the user terminal has no access rights and the single microservice cannot provide services to the user terminal; if the status code is 401, it means that the user has not logged in and the single microservice cannot provide services to him.

[0086] The single microservice fault location method of this embodiment can be used to detect microservice cluster failures on the Internet platform, microservice cluster failures on the Internet of Things platform, microservice cluster failures on the education platform Hassan, microservice cluster failures on the financial platform, and microservice cluster failures on the enterprise platform.

[0087] In the fifth embodiment, the server where the single microservice is located encrypts the response result and sends the encrypted response result to the user terminal through the gateway. The specific encryption method includes:

[0088] The server generates its own identity tag and then sends it to the user terminal. The server randomly generates a key and also sends it to the user terminal. At the same time, the server uses the key and identity tag to encrypt the response result and sends the encrypted response result to the user terminal. The user terminal receives the encrypted response result and verifies the encrypted response result using the identity tag and key. If the verification is successful, the user terminal decrypts the encrypted response result.

[0089] In the sixth embodiment, a single microservice without faults has been selected based on the first embodiment. In this embodiment, the number of single microservices without faults that can provide the same service is several, and the single microservices are deployed on different servers. When the user terminal requests a service, the gateway selects a target server from these servers to provide the user terminal with a single microservice on the target server, including:

[0090] Obtaining the environment scenario information of each server, including the environment temperature, etc., and obtaining the parameter information of each server at the current moment, including the remaining computing power of the server and the network stability of the server;

[0091] According to the environment scenario information and parameter information, the target server is selected from the servers that have not failed. The single microservice on the target server is used to provide services to the user terminal.

[0092] In summary, the gateway of the present invention first obtains the access token sent by the user terminal, and then the gateway finds the access address corresponding to the access token; then the gateway sends an access request to the monomer microservice corresponding to the access address, and the monomer microservice sends a response result to the gateway based on the request, and the gateway generates a business access result based on the response result. Since there is a corresponding relationship between the business access result and the monomer microservice and the access address, once the business access result is abnormal, the faulty monomer microservice can be located according to the abnormal business access result. In summary, the present invention can locate the faulty monomer microservice so as to repair the faulty monomer microservice.

[0093] This embodiment also provides a microservice access device, such as Figure 2 As shown, the device comprises the following components:

[0094] The address reading module 01 is used to obtain the access token sent by the user terminal and determine the access address corresponding to the access token;

[0095] Access module 02, used to access the single microservice through the access address and obtain the response result of the single microservice;

[0096] The access result generating module 03 is used to generate a service access result according to the response result, and the service access result is used to filter out the single microservice with fault from the microservice cluster.

[0097] Based on the above embodiments, the present invention further provides a terminal device, whose principle block diagram can be shown as follows: Figure 3 As shown. The terminal device includes a processor, a memory, a network interface, and a display screen connected through a system bus. Among them, the processor of the terminal device is used to provide computing and control capabilities. The memory of the terminal device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the terminal device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a microservice access method is implemented. The display screen of the terminal device can be a liquid crystal display screen or an electronic ink display screen.

[0098] Those skilled in the art will understand that Figure 3 The principle block diagram shown in the figure is only a block diagram of a partial structure related to the scheme of the present invention, and does not constitute a limitation on the terminal device to which the scheme of the present invention is applied. The specific terminal device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0099] In one embodiment, a terminal device is provided. The terminal device includes a memory, a processor, and a microservice access program stored in the memory and executable on the processor. When the processor executes the microservice access program, the following operation instructions are implemented:

[0100] Obtaining an access token sent by a user terminal, and determining an access address corresponding to the access token;

[0101] Access the single microservice through the access address and obtain the response result of the single microservice;

[0102] A service access result is generated according to the response result, and the service access result is used to filter out a single microservice with a fault from the microservice cluster.

[0103] In another embodiment, only the following operation instructions can be implemented:

[0104] Obtaining a service access result sent by the gateway, where the service access result is generated by the gateway based on the above-mentioned microservice access method;

[0105] Parse the service access result to obtain a status code and a response result of a single microservice, wherein the status code is used to characterize the fault type;

[0106] A fault determination result of the single microservice is obtained according to the status code and the response result.

[0107] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided by the present invention can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0108] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A microservice access method, characterized in that: include: Obtaining an access token sent by a user terminal, and determining an access address corresponding to the access token; Access the single microservice through the access address and obtain the response result of the single microservice; A service access result is generated according to the response result, and the service access result is used to filter out a single microservice with a fault from the microservice cluster.

2. The microservice access method according to claim 1, characterized in that: The determining an access address corresponding to the access token includes: Verifying the access rights of the user terminal and obtaining a verification result of the access rights; When the verification result is that the verification is passed, obtaining the service list sent by the registration center server; An access address corresponding to the access token is determined according to the service list.

3. The microservice access method according to claim 2, characterized in that: The verifying the access right of the user terminal and obtaining a verification result of the access right includes: Parsing the access token to obtain the user name of the user terminal, the user role to which the user terminal belongs, and the user authority possessed by the user terminal; The user name, the user role and the user authority are verified according to a preset access control matrix to obtain a verification result of the access authority, wherein the access control matrix is ​​used to record the corresponding relationship between the user name, the user role and the user authority.

4. The microservice access method according to any one of claims 1 to 3, characterized in that: The single microservice is a microservice obtained by splitting the microservice cluster according to business type or service type.

5. The microservice access method according to any one of claims 1 to 3, characterized in that: Generating a service access result according to the response result includes: Generate a status code according to the response result, wherein the status code is used to characterize the fault type; A message is generated according to the response result and the status code, and the message is used as the service access result.

6. A microservice fault determination method, characterized in that: include: Obtaining a service access result sent by the gateway, wherein the service access result is generated by the gateway based on the microservice access method according to claim 1; Parse the service access result to obtain a status code and a response result of a single microservice, wherein the status code is used to characterize the fault type; A fault determination result of the single microservice is obtained according to the status code and the response result.

7. The microservice fault determination method according to claim 6, characterized in that: Obtaining a fault determination result of the single microservice according to the status code and the response result includes: The standard data format of the single microservice is obtained, and when the data format of the response result matches the standard data format, the single microservice is obtained as a non-faulty microservice, and the non-faulty microservice is used as a fault determination result; When the data format of the response result is different from the standard data format, and the status code is a status code corresponding to the fault, it is obtained that the single microservice is a faulty microservice, and the faulty microservice is used as the fault determination result.

8. A microservice access device, characterized in that: The device comprises the following components: An address reading module, used to obtain an access token sent by a user terminal and determine an access address corresponding to the access token; An access module, used to access the single microservice through the access address and obtain a response result of the single microservice; The access result generation module is used to generate a business access result according to the response result, and the business access result is used to screen out a single microservice with a fault from the microservice cluster.

9. A terminal device, characterized in that: The terminal device includes a memory, a processor, and a microservice access program stored in the memory and executable on the processor, and when the processor executes the microservice access program, the steps of the microservice access method according to any one of claims 1 to 5 are implemented; Alternatively, the terminal device includes a memory, a processor, and a microservice fault determination program stored in the memory and executable on the processor. When the processor executes the microservice fault determination program, the steps of the microservice fault determination method as described in any one of claims 6-7 are implemented.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a microservice access program, and when the microservice access program is executed by the processor, the steps of the microservice access method according to any one of claims 1 to 5 are implemented; Alternatively, a microservice fault determination program is stored on the computer-readable storage medium, and when the microservice fault determination program is executed by the processor, the steps of the microservice fault determination method according to any one of claims 6 to 7 are implemented.