CN110839068A - Service request processing method and device, electronic equipment and readable storage medium - Google Patents

Service request processing method and device, electronic equipment and readable storage medium Download PDF

Info

Publication number
CN110839068A
CN110839068A CN201911065564.2A CN201911065564A CN110839068A CN 110839068 A CN110839068 A CN 110839068A CN 201911065564 A CN201911065564 A CN 201911065564A CN 110839068 A CN110839068 A CN 110839068A
Authority
CN
China
Prior art keywords
service request
cluster
processing node
nodes
processing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201911065564.2A
Other languages
Chinese (zh)
Other versions
CN110839068B (en
Inventor
吴业亮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Anchao Cloud Software Co Ltd
Original Assignee
Anchao Cloud Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Anchao Cloud Software Co Ltd filed Critical Anchao Cloud Software Co Ltd
Priority to CN201911065564.2A priority Critical patent/CN110839068B/en
Publication of CN110839068A publication Critical patent/CN110839068A/en
Application granted granted Critical
Publication of CN110839068B publication Critical patent/CN110839068B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0805Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
    • H04L43/0817Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability by checking functioning
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Environmental & Geological Engineering (AREA)
  • Multi Processors (AREA)
  • Hardware Redundancy (AREA)

Abstract

The application provides a service request processing method, a service request processing device, an electronic device and a readable storage medium, wherein when a service distribution device receives a service request, an effective processing node is determined, and the effective processing node is a node which can perform data synchronization with other nodes in a cluster to which the service request needs to access. And further sending the service request to the active processing node. Therefore, through regulation and control management of the service distribution equipment, the service request is processed by the effective processing nodes in the cluster, and the data among the effective processing nodes are always kept synchronous, so that the consistency of the service provided by the cluster can be improved, and the cluster can normally operate.

Description

Service request processing method and device, electronic equipment and readable storage medium
Technical Field
The present application relates to the field of data processing technologies, and in particular, to a method and an apparatus for processing a service request, an electronic device, and a readable storage medium.
Background
The internet technology is changing day by day, and the life of people is greatly enriched. With the increase of the access amount, most of internet services adopt a distributed cluster mode to provide services to the outside, so that the concurrency performance and the service reliability are improved.
However, in a cluster, there may be a case where a certain node is separated from other nodes in the cluster due to a network disconnection or other split scenes. At present, after the situation occurs, the detached node can still provide data service for the user, but since the detached node cannot perform normal data synchronization with the rest of nodes, the service provided for the user is inconsistent, and thus normal operation of the whole cluster is affected.
Disclosure of Invention
An object of the embodiments of the present application is to provide a method and an apparatus for processing a service request, an electronic device, and a readable storage medium, so as to solve the problem that, in the related art, services provided to a user may be inconsistent, thereby affecting normal operation of a whole cluster.
The embodiment of the application provides a service request processing method, which is applied to service distribution equipment and comprises the following steps:
when a service request is received, determining an effective processing node; the effective processing node is a node which can perform data synchronization with other nodes in the cluster in which the service request needs to access;
and sending the service request to the effective processing node.
In the implementation process, the service request first arrives at the service distribution device, the service distribution device determines an effective processing node for the service request (i.e., determines a processing node in the cluster that can keep data synchronization with other nodes in the cluster and is not separated from other nodes in the cluster), and at this time, the service request is sent to the effective processing node. Therefore, through regulation and control management of the service distribution equipment, the service requests are processed by the effective processing nodes in the cluster, and because the data among the effective processing nodes are always kept synchronous, the consistency of the service provided by the cluster can be improved, and the cluster can normally operate.
Further, the determining the valid processing node when receiving the service request includes: when a service request is received, allocating a processing node for the service request; determining whether a preset validity flag can be detected from the processing node; the validity identification is an identification generated when the processing node can perform data synchronization with the rest of the nodes in the cluster; when the preset validity identification can be detected, determining the processing node as the valid processing node; and when the preset validity identification cannot be detected, reallocating the processing node for the service request, and determining whether the preset validity identification can be detected from the reallocated processing node.
In the implementation process, the service request first arrives at the service distribution device, the service distribution device distributes a processing node for the service request, and after the processing node is distributed, before the service request is sent to the processing node, whether a preset validity flag can be detected in the processing node (i.e., whether the processing node can keep data synchronization with other nodes in the same cluster is determined), when the validity flag is confirmed, the processing node can keep data synchronization with other nodes in the same cluster is indicated, and at this time, the processing node is taken as a valid processing node, so that the service request is sent to the processing node. And once the validity identification does not exist, the processing node is indicated to be incapable of keeping data synchronization with other nodes in the same cluster, the processing node is separated from other nodes in the cluster, and at the moment, if the processing node processes the service request, the consistency of the service provided for the user cannot be ensured, so that the processing node can be allocated to the service request again, and whether the preset validity identification can be detected from the allocated processing node or not can be determined again. Therefore, through regulation and control management of the service distribution equipment, the service requests are processed by the effective processing nodes in the cluster, and because the data among the effective processing nodes are always kept synchronous, the consistency of the service provided by the cluster can be improved, and the cluster can normally operate.
Further, the validity mark indicates that a preset port of the processing node is in an enabled state; the determining whether a preset validity flag can be detected from the processing node comprises: requesting the processing node to call the preset port; when the response of the preset port is received, determining that the preset validity identification can be detected; otherwise, determining that the preset validity mark cannot be detected.
In the implementation process, by setting the processing nodes in the cluster, when the processing nodes can keep data synchronization with other nodes in the cluster, even if the preset port is in the enabled state. Therefore, the service distribution equipment can easily determine the starting state of the preset port in the processing node by requesting to call the corresponding preset port, so as to determine whether the processing node can be used as an effective processing node. The whole scheme is simple to realize and has higher practical application value.
Further, the determining the valid processing node when receiving the service request includes: when a service request is received, acquiring a processing node which currently has a preset validity identifier in the cluster; the validity identification is an identification generated when the processing node can perform data synchronization with the rest of the nodes in the cluster; selecting one processing node from the processing nodes with the validity identification as the valid processing node.
In the implementation process, the service request first reaches the service distribution device, the service distribution device first acquires the processing nodes currently having the preset validity identifier in the cluster, and then selects one processing node from the processing nodes having the validity identifier as an effective processing node, and sends the service request to the effective processing node. Therefore, the processing nodes for processing the service request are guaranteed to be processed by the effective processing nodes in the cluster, and the data among the effective processing nodes are always kept synchronous, so that the consistency of the service provided by the cluster can be improved, and the cluster can normally operate.
The embodiment of the present application further provides a service request processing method, which is applied to a processing node of a cluster, and includes:
detecting whether data synchronization can be carried out with other nodes in the cluster;
when the data synchronization with other nodes in the cluster can be carried out, a preset validity identification is kept, and when the data synchronization with other nodes in the cluster cannot be carried out, the preset validity identification is eliminated, so that the service distribution equipment sends the received service request to other nodes with the validity identification in the cluster when the preset validity identification is not detected.
In the implementation process, the processing node in the cluster may detect whether the processing node can perform data synchronization with other nodes in the cluster, and if not, it indicates that the processing node has separated from other nodes in the cluster, and there may be a split brain. At this time, the preset validity flag is removed, so that the service allocation device allocates the service request to other nodes having validity flags in the cluster when allocating the service request, so that the service request can be processed by valid processing nodes (i.e., processing nodes having validity flags) in the cluster, and since data between the valid processing nodes are always synchronized, the consistency of the service provided by the cluster can be improved, and the cluster can normally operate.
Further, the validity flag indicates that a preset port of the processing node is in an enabled state.
In the implementation process, when the processing node can keep data synchronization with other nodes in the cluster, even if the preset port is in the enabled state. Therefore, the service distribution equipment can easily determine the state of the preset port in the processing node by requesting to call the corresponding preset port, so as to determine whether the processing node can be used as an effective processing node, thereby the whole scheme is simple to realize and has higher practical application value.
Further, when data synchronization with other nodes in the cluster is not possible, the service request processing method further includes: and restarting the processing node.
In the implementation process, when detecting that the processing node cannot perform data synchronization with other nodes in the cluster, the processing node automatically restarts to attempt to re-establish contact with other nodes in the cluster so as to re-implement data synchronization. Therefore, self-healing of the processing nodes can be achieved to a certain extent, and reliability of the whole cluster is improved.
The embodiment of the present application further provides a service request processing apparatus, which is applied to a service distribution device, and includes: the receiving module, the determining module and the sending module;
the receiving module is used for receiving a service request;
the determining module is used for determining an effective processing node when the receiving module receives the service request; the effective processing node is a node which can perform data synchronization with other nodes in the cluster in which the service request needs to access;
the sending module is configured to send the service request to the active processing node.
In the implementation process, the service request first arrives at the service request processing device, the service request processing device determines an effective processing node for the service request (i.e., determines a processing node in the cluster that can keep data synchronization with other nodes in the cluster and is not separated from other nodes in the cluster), and at this time, the service request is sent to the effective processing node. Therefore, through regulation and control management of the service request processing device, the service requests are processed by the effective processing nodes in the cluster, and data among the effective processing nodes are kept synchronous all the time, so that the consistency of the service provided by the cluster can be improved, and the cluster can normally operate.
The embodiment of the present application further provides a service request processing apparatus, which is applied to a processing node of a cluster, and includes: the device comprises a detection module and a control module;
the detection module is used for detecting whether data synchronization can be carried out with other nodes in the cluster;
the control module is used for keeping a preset validity mark when the control module can perform data synchronization with other nodes in the cluster, and eliminating the preset validity mark when the control module cannot perform data synchronization with other nodes in the cluster, so that the service distribution equipment sends the received service request to other nodes with the validity marks in the cluster when the service distribution equipment does not detect the preset validity mark.
In the implementation process, the processing node in the cluster can detect whether the processing node can perform data synchronization with other nodes in the cluster, and if the processing node cannot perform data synchronization with other nodes in the cluster, the processing node indicates that the processing node is separated from other nodes in the cluster, and split brains and other situations may exist. At this time, the preset validity flag is removed, so that the service allocation device allocates the service request to other nodes having validity flags in the cluster when allocating the service request, so that the service request can be processed by valid processing nodes (i.e., processing nodes having validity flags) in the cluster, and since data between the valid processing nodes are always synchronized, the consistency of the service provided by the cluster can be improved, and the cluster can normally operate.
The embodiment of the application also provides electronic equipment, which comprises a processor, a memory and a communication bus; the communication bus is used for realizing connection communication between the processor and the memory; the processor is used for executing one or more first programs stored in the memory so as to realize the service request processing method applied to any service distribution equipment; or the processor is configured to execute one or more second programs stored in the memory, so as to implement any service request processing method applied to the processing nodes of the cluster.
The embodiment of the present application further provides a readable storage medium, where one or more programs are stored, and the one or more programs are executable by one or more processors to implement the service request processing method applied to any one of the service distribution devices; or implementing the service request processing method applied to any one of the processing nodes of the cluster.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments of the present application will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and that those skilled in the art can also obtain other related drawings based on the drawings without inventive efforts.
Fig. 1 is a schematic view of a service process in the related art;
fig. 2 is a schematic flowchart of a service request handler applied to a processing node according to an embodiment of the present disclosure;
fig. 3 is a schematic flowchart of a service request handler applied to a service distribution device according to an embodiment of the present application;
fig. 4 is a schematic flowchart of determining valid processing nodes according to an embodiment of the present application;
fig. 5 is a schematic view of a service process provided in an embodiment of the present application;
fig. 6 is a schematic structural diagram of a service request processing apparatus applied to a service distribution device according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of a determining module according to an embodiment of the present disclosure;
fig. 8 is a schematic structural diagram of a service request processing apparatus applied in a processing node according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of a more specific service request processing apparatus applied in a processing node according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.
The first embodiment is as follows:
it should be understood that in practical applications, a processing node in a cluster may be disconnected from the rest of the nodes in the cluster due to a network disconnection, etc., and at this time, the node cannot synchronize data with the rest of the nodes in the cluster. For example, referring to fig. 1, assuming that the processing node 3 is disconnected (the circle at the data synchronization position in the figure is marked with an exclamation mark to indicate that the processing node 3 is disconnected), but at this time, the processing node 3 may still provide service for the user, which may cause that, since the processing node 3 cannot perform data synchronization with the processing nodes 1 and 2, after respective data operations are performed, the data in the processing node 3 is inconsistent with the data in the processing nodes 1 and 2, in this case, for a service request, the processing result of the processing node 3 may be inconsistent with the processing results of the processing nodes 1 and 2, that is, the service provided to the user is inconsistent, so that the reliability of the cluster is reduced, and the normal operation of the cluster is affected.
In order to solve the problem, an embodiment of the present application provides a service request processing method. As shown in fig. 2 and fig. 3, fig. 2 is a schematic flow chart of a service request processing method applied to a processing node of a cluster provided in this embodiment, and fig. 3 is a schematic flow chart of a service request processing method applied to a service distribution device provided in this embodiment.
S201: the processing node detects whether the processing node can perform data synchronization with other nodes in the cluster.
It should be noted that the processing node described in this embodiment of the present application is a node that can perform service processing (e.g., perform operations such as data reading and writing) in a cluster. The node may be a server or other device capable of performing service processing.
In this embodiment of the present application, a cluster detection program may be configured in advance in each service processing node in a cluster, and the cluster detection program automatically performs detection on whether the cluster detection program can perform data synchronization with other nodes in the cluster. In this embodiment of the present application, the cluster detection program may continuously run from the time when the processing node is started, and the manner of detecting whether or not it can perform data synchronization with other nodes in the cluster includes, but is not limited to, detecting whether or not it can normally communicate with other nodes in the cluster, and when it cannot normally communicate with other nodes in the cluster, it is considered that it cannot perform data synchronization with other nodes in the cluster.
S202: and when the data synchronization with other nodes in the cluster can be carried out, keeping the preset validity identification, and when the data synchronization with other nodes in the cluster cannot be carried out, eliminating the preset validity identification.
In the embodiment of the present application, the validity flag is a predefined flag generated when the processing node can perform data synchronization with the other nodes in the cluster.
In the embodiment of the present application, a port may be pre-designated, and whether the processing node itself can perform data synchronization with other nodes in the cluster is characterized by the state of whether the port is enabled or not. For example, the port may be controlled to remain in the enabled transition state when the processing node itself can synchronize data with other nodes in the cluster, and to remain in the closed state when it is detected that the processing node itself cannot synchronize data with other nodes in the cluster. It should be understood that, in an actual application process, the range of the port numbers of the system is 0 to 65535, wherein some of the ports have special system definitions, if such ports are selected to characterize whether the processing node itself can perform data synchronization with other nodes in the cluster, a system conflict may be caused, otherwise, the original protocol definition of the port needs to be modified. To avoid the foregoing situation, the ports pre-designated in the embodiment of the present application may be selected from ports that can be freely allocated by the processing node, for example, ports 5000 to 65535. It should be further noted that, in the embodiment of the present application, the control of enabling or closing the pre-specified port may be implemented by calling an extended internet daemon (a new generation of network daemon service program).
It should be noted that, in the embodiment of the present application, in addition to the above-mentioned enabled state through the port as the validity flag, the validity flag may also be implemented in other ways. For example, when the processing node initially detects that data synchronization with other nodes in the cluster can be performed, a specific identifier may be generated in the node and stored at a specified location, so that when the service distribution device needs to determine whether the processing node can be used as a valid processing node (the valid processing node needs to be a processing node that can perform data synchronization with other nodes in the cluster), the service distribution device can obtain the specific identifier from the specified location; and when the processing node detects that data synchronization with other nodes in the cluster cannot be carried out, the specific identifier is cleared from the designated position, so that the service distribution equipment cannot acquire the specific identifier from the designated position. It should be understood that, in the embodiment of the present application, as long as the processing node can be characterized to perform data synchronization with other nodes in the cluster, and the validity identifier that can be acquired by the service distribution device can be adopted by the application.
It should be noted that, in this embodiment of the present application, the service allocating apparatus may receive a service request, and determine whether to allocate the received service request to each processing node for processing according to whether the valid identifier exists in the processing node. The operations performed by the service distribution equipment can be seen in fig. 3:
s301: upon receiving a service request, a valid processing node is determined.
It should be understood that, in the present application and embodiment, in the cluster to which the active processing node needs to access for the service request, the node may perform data synchronization with the rest of the nodes in the cluster. As can be seen from the above description of fig. 2, each processing node in the cluster maintains the preset validity flag when the processing node can perform data synchronization with other nodes in the cluster, and eliminates the preset validity flag when the processing node cannot perform data synchronization with other nodes in the cluster. Therefore, in the embodiment of the present application, whether a processing node can be a valid processing node can be determined by determining whether a preset validity flag exists in each processing node.
Illustratively, in a possible implementation of the embodiment of the present application, as shown in fig. 4, the method includes:
s401: and allocating a processing node for the service request.
The service allocation device may allocate a processing node for the service request when receiving the service request.
S402: it is determined whether a preset validity flag can be detected from the assigned processing node. When the validity flag can be detected, go to step S403; when the validity flag cannot be detected, the process goes to step S401 to re-assign the processing node to the service request.
It should be noted that, in this possible embodiment, the service allocating apparatus may mark the processing node when the validity flag in the allocated processing node cannot be detected, so that when the processing node is newly allocated to the service request, the service allocating apparatus reallocates the processing node from the processing nodes that are not marked in the cluster. It will be appreciated that the flag may be cleared after a valid processing node is determined.
S403: the allocated processing node is determined to be a valid processing node.
In the embodiment of the present application, after determining the valid processing node, the process goes to step S302.
In another possible implementation manner of the embodiment of the present application, when receiving a service request, the service distribution device may also try to detect, for each processing node in sequence, an validity flag of each processing node, so as to obtain a set of processing nodes currently having a preset validity flag in a cluster. And then selecting one processing node from the processing nodes with the preset validity identification as a valid processing node. It should be noted that, in this possible embodiment, one processing node may be randomly selected from the processing nodes currently having the preset validity flag as a valid processing node; or, the selection may be performed according to the current remaining processing amount of each processing node, for example, when the service distribution device detects the validity identifier of each processing node, the service distribution device may simultaneously obtain the remaining processing amount of each processing node (e.g., a CPU (central processing Unit/Processor) idle rate, a memory idle amount, and the like), and then select the processing node with the largest remaining processing amount and the preset validity identifier as the valid processing node. It should be understood that, in the present possible embodiment, the selection manner is not limited, as long as one processing node can be selected as a valid processing node from the processing nodes currently having the preset validity flag.
In another possible implementation manner of the embodiment of the present application, before receiving the service request, the service distribution device may also detect, in real time, the validity identifier of each processing node in the cluster, so as to obtain, in real time, a set of processing nodes currently having a preset validity identifier in the cluster. When a service request is received, namely one processing node is selected from the processing nodes with preset validity identification currently, the processing node is used as a valid processing node.
It should be noted that, in a possible example of the embodiment of the present application, the validity flag in each of the above possible implementations may be that a preset port of the processing node is in an enabled state. At this time, when the service distribution device obtains the validity identifier, it may request the processing node to call the preset port. And when the response of the preset port is received, determining that the preset validity identification can be detected, otherwise, determining that the preset validity identification cannot be detected.
S302: the service request is sent to the active processing node.
It should be noted that, in the embodiment of the present application, the service distribution device may be a device having a function capable of implementing the service request distribution, for example, may be a load balancer, or an electronic device (such as a server or the like) loaded with load balancing software.
Through the scheme, the service distribution equipment can distribute the received service request to the effective processing nodes for processing, and the data among the effective processing nodes are always kept synchronous, so that the consistency of the service provided by the cluster can be improved, and the cluster can normally operate.
It is worth noting that in the embodiment of the present application, when each processing node in the cluster detects that it cannot perform data synchronization with other nodes in the cluster, it may also control itself to restart, so as to try to establish contact with other nodes in the cluster again, so as to achieve data synchronization again. Therefore, self-healing of the processing nodes is realized to a certain extent, and the reliability of the whole cluster is improved.
It should be further noted that, in a feasible implementation manner of the embodiment of the present application, if a processing node cannot perform data synchronization with other nodes in the cluster after being restarted for n times continuously, a fault notification may be performed according to a preset manner, for example, an operation and maintenance person is notified in a manner of WeChat, short message, mail, or the like, so that the operation and maintenance person can perform manual repair as long as the processing node has a fault that cannot be self-healed.
To sum up, in the service request processing method provided in this embodiment of the present application, a service request first arrives at a service distribution device, and the service distribution device determines an effective processing node for the service request (i.e., determines a processing node in a cluster that can maintain data synchronization with other nodes in the cluster and is not detached from other nodes in the cluster), and then sends the service request to the effective processing node. Therefore, through regulation and control management of the service distribution equipment, the service requests are processed by the effective processing nodes in the cluster, and because the data among the effective processing nodes are always kept synchronous, the consistency of the service provided by the cluster can be improved, and the cluster can normally operate.
In addition, by the service request processing method provided by the embodiment of the application, the processing node which is separated from other nodes in the cluster can keep the separated data, and after recovery, data synchronization with other nodes can be easily realized only by normally acquiring data from other processing nodes, so that the data consistency in each processing node is ensured.
In addition, when detecting that the processing node cannot synchronize data with other nodes in the cluster, the processing node may automatically restart to attempt to re-establish contact with other nodes in the cluster to re-implement data synchronization. Therefore, self-healing of the processing nodes can be achieved to a certain extent, and reliability of the whole cluster is improved.
Example two:
in this embodiment, on the basis of the first embodiment, a case that a service request is a data read-write request, a processing node is a server, a service distribution device is a load balancer, and an effectiveness identifier is that an 8080 port of the server is in an enabled state is taken as an example, which is further exemplified by the present application.
Referring to fig. 5, the cluster has 3 processing nodes, i.e., server 1 to server 3, and each of the server 1 to server 3 runs a cluster detection program to detect whether it can perform data synchronization with the other processing nodes in the cluster. When the detection result of the cluster detection program is that the cluster detection program can perform data synchronization with the other processing nodes in the cluster, the 8080 port is controlled to be in an enabled state, for example, in the case of the server 1 and the server 2 in fig. 5, and when the detection result of the cluster detection program is that the cluster detection program cannot perform data synchronization with the other processing nodes in the cluster, the 8080 port is controlled to be in a closed state, for example, in the case of the server 3 in fig. 5. It should be noted that, for the activation and the deactivation of the 8080 port, the activation and the deactivation can be realized by calling xinetd. It should be noted that, when detecting that the cluster detection program in the server 3 cannot perform data synchronization with the other processing nodes in the cluster, the cluster detection program simultaneously controls itself to restart so as to attempt to recover data synchronization with the other processing nodes in the cluster.
Referring to fig. 5, a user accesses load balancing first, and the load balancer requests the 8080 ports of the servers 1 to 3, respectively, and at this time, the obtained request result is that the 8080 port in the server 3 does not respond, so that the load balancer distributes the data read-write request of the user to the server 1 or the server 2, but not to the server 3.
By the scheme, the consistency of the service provided by the cluster can be improved, the cluster can normally run, and meanwhile, the processing node separated from other processing nodes in the cluster can try to self-heal, so that the reliability of the cluster is improved.
Example three:
based on the same inventive concept, the embodiment of the present application further provides a service request processing device 100 and a service request processing device 200. Referring to fig. 6 and 8, fig. 6 shows a service request processing apparatus adopting the method shown in fig. 3, and fig. 8 shows a service request processing apparatus adopting the method shown in fig. 2. It should be understood that the specific functions of the apparatus 100 and the apparatus 200 can be referred to the above description, and the detailed description is omitted here as appropriate to avoid redundancy. The devices 100 and 200 include at least one software functional module that can be stored in memory in the form of software or firmware or solidified in the operating system of the devices 100 and 200. Specifically, the method comprises the following steps:
referring to fig. 6, the apparatus 100 is applied to a service distribution device, and includes: a receiving module 101, a determining module 102 and a sending module 103;
the receiving module 101 is configured to receive a service request;
the determining module 102 is configured to determine an effective processing node when the receiving module 101 receives the service request; the effective processing node is a node which can perform data synchronization with other nodes in the cluster in which the service request needs to be accessed;
the sending module 103 is configured to send a service request to an active processing node.
In a possible implementation of the embodiment of the present application, referring to fig. 7, the determining module 102 includes an allocating subunit 1021 and a determining subunit 1022. The allocating subunit 1021 is configured to allocate a processing node to the service request when the receiving module 101 receives the service request; the determining subunit 1022 is configured to determine whether a preset validity flag can be detected from the processing node; when the preset validity identification can be detected, determining the processing node as a valid processing node; the validity flag is a flag generated when a processing node can synchronize data with the rest of the nodes within the cluster.
The distribution subunit 1021 is further configured to redistribute the processing node for the service request when the preset validity flag cannot be detected; the determining subunit 1022 is further configured to determine whether a preset validity flag can be detected from the reallocated processing nodes.
In this embodiment of the present application, the determining subunit 1022 is specifically configured to request the processing node to invoke a preset port; when a response of a preset port is received, determining that a preset validity identification can be detected; otherwise, determining that the preset validity identification cannot be detected.
In a feasible implementation manner of the embodiment of the present application, the determining module 102 is specifically configured to, when receiving a service request, obtain a processing node currently having a preset validity flag in a cluster; the validity identification is an identification generated when the processing node can perform data synchronization with the rest nodes in the cluster; and selecting one processing node from the processing nodes with the validity identification as a valid processing node.
Referring to fig. 8, the apparatus 200 is applied in a processing node of a cluster, and includes: a detection module 201 and a control module 202;
the detection module 201 is configured to detect whether data synchronization with other nodes in the cluster is possible;
the control module 202 is configured to maintain a preset validity flag when data synchronization can be performed with other nodes in the cluster, and eliminate the preset validity flag when data synchronization cannot be performed with other nodes in the cluster, so that the service distribution device sends the received service request to other nodes with validity flags in the cluster when the preset validity flag is not detected.
In the embodiment of the present application, the validity flag indicates that the preset port of the processing node is in an enabled state.
In the embodiment of the present application, referring to fig. 9, the apparatus 200 further includes a restart module 203. The restart module 203 is used for restarting the processing node when data synchronization with other nodes in the cluster is not possible.
It should be understood that, for the sake of brevity, the contents described in some embodiments are not repeated in this embodiment.
Example four:
the present embodiment provides an electronic device, which is shown in fig. 10 and includes a processor 1001, a memory 1002, and a communication bus 1003. Wherein:
the communication bus 1003 is used for realizing connection communication between the processor 1001 and the memory 1002.
The processor 1001 is configured to execute one or more first programs stored in the memory 1002 to implement the steps of the service request processing method executed by the service distribution apparatus in the first embodiment and/or the second embodiment;
or, the processor 1001 is configured to execute one or more second programs stored in the memory 1002 to implement the steps of the service request processing method executed by the processing node in the first embodiment and/or the second embodiment.
It will be appreciated that the configuration shown in fig. 10 is merely illustrative and that the electronic device may include more or fewer components than shown in fig. 10 or have a different configuration than shown in fig. 10. For example, the electronic device may be a load balancer to implement the steps performed by the service distribution device; or may be a server implementing the steps performed by the processing node. In addition, it can be understood that the electronic device should have a data communication interface, which can realize data interaction between different devices, and also have components such as storage media, and also have functions of automatically sending out mails, WeChat, short messages, and the like.
The present embodiment further provides a readable storage medium, such as a floppy disk, an optical disk, a hard disk, a flash Memory, a usb (secure digital Card) Card, an MMC (Multimedia Card) Card, etc., where one or more programs for implementing the above steps are stored in the readable storage medium, and the one or more programs can be executed by one or more processors to implement the steps of the service request processing method executed by the service distribution device in the first embodiment and/or the second embodiment, or to implement the steps of the service request processing method executed by the processing node in the first embodiment and/or the second embodiment. And will not be described in detail herein.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, and for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some communication interfaces, and may be in an electrical, mechanical or other form.
In addition, units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
Furthermore, the functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
In this document, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions.
In this context, a plurality means two or more.
The above description is only an example of the present application and is not intended to limit the scope of the present application, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims (11)

1. A service request processing method is applied to service distribution equipment, and comprises the following steps:
when a service request is received, determining an effective processing node; the effective processing node is a node which can perform data synchronization with other nodes in the cluster in which the service request needs to access;
and sending the service request to the effective processing node.
2. The service request processing method of claim 1, wherein said determining an active processing node upon receiving a service request comprises:
when a service request is received, allocating a processing node for the service request;
determining whether a preset validity flag can be detected from the processing node; the validity identification is an identification generated when the processing node can perform data synchronization with the rest of the nodes in the cluster;
when the preset validity identification can be detected, determining the processing node as the valid processing node;
and when the preset validity identification cannot be detected, reallocating the processing node for the service request, and determining whether the preset validity identification can be detected from the reallocated processing node.
3. The service request processing method according to claim 2, wherein the validity flag indicates that a predetermined port of the processing node is in an enabled state;
the determining whether a preset validity flag can be detected from the processing node comprises:
requesting the processing node to call the preset port;
when the response of the preset port is received, determining that the preset validity identification can be detected;
otherwise, determining that the preset validity mark cannot be detected.
4. The service request processing method of claim 1, wherein said determining an active processing node upon receiving a service request comprises:
when a service request is received, acquiring a processing node which currently has a preset validity identifier in the cluster; the validity identification is an identification generated when the processing node can perform data synchronization with the rest of the nodes in the cluster;
selecting one processing node from the processing nodes with the validity identification as the valid processing node.
5. A service request processing method is applied to a processing node of a cluster, and comprises the following steps:
detecting whether data synchronization can be carried out with other nodes in the cluster;
when the data synchronization with other nodes in the cluster can be carried out, a preset validity identification is kept, and when the data synchronization with other nodes in the cluster cannot be carried out, the preset validity identification is eliminated, so that the service distribution equipment sends the received service request to other nodes with the validity identification in the cluster when the preset validity identification is not detected.
6. The service request processing method according to claim 5, wherein said validity flag indicates that a predetermined port of said processing node is in an enabled state.
7. The service request processing method according to claim 5 or 6, wherein when data synchronization with other nodes in the cluster is not possible, the service request processing method further comprises: and restarting the processing node.
8. A service request processing device, applied to a service distribution device, includes: the receiving module, the determining module and the sending module;
the receiving module is used for receiving a service request;
the determining module is used for determining an effective processing node when the receiving module receives the service request; the effective processing node is a node which can perform data synchronization with other nodes in the cluster in which the service request needs to access;
the sending module is configured to send the service request to the active processing node.
9. A service request processing apparatus, applied to a processing node of a cluster, includes: the device comprises a detection module and a control module;
the detection module is used for detecting whether data synchronization can be carried out with other nodes in the cluster;
the control module is used for keeping a preset validity mark when the control module can perform data synchronization with other nodes in the cluster, and eliminating the preset validity mark when the control module cannot perform data synchronization with other nodes in the cluster, so that the service distribution equipment sends the received service request to other nodes with the validity marks in the cluster when the service distribution equipment does not detect the preset validity mark.
10. An electronic device comprising a processor, a memory, and a communication bus;
the communication bus is used for realizing connection communication between the processor and the memory;
the processor is configured to execute one or more first programs stored in the memory to implement the service request processing method according to any one of claims 1 to 4;
or, the processor is configured to execute one or more second programs stored in the memory to implement the service request processing method according to any one of claims 5 to 7.
11. A readable storage medium, storing one or more programs, which are executable by one or more processors to implement the service request processing method of any one of claims 1-4, or to implement the service request processing method of any one of claims 5-7.
CN201911065564.2A 2019-11-04 2019-11-04 Service request processing method and device, electronic equipment and readable storage medium Active CN110839068B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911065564.2A CN110839068B (en) 2019-11-04 2019-11-04 Service request processing method and device, electronic equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911065564.2A CN110839068B (en) 2019-11-04 2019-11-04 Service request processing method and device, electronic equipment and readable storage medium

Publications (2)

Publication Number Publication Date
CN110839068A true CN110839068A (en) 2020-02-25
CN110839068B CN110839068B (en) 2022-02-18

Family

ID=69576055

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911065564.2A Active CN110839068B (en) 2019-11-04 2019-11-04 Service request processing method and device, electronic equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN110839068B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111865722A (en) * 2020-07-20 2020-10-30 深圳市活力天汇科技股份有限公司 Node health state detection and processing method

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100077249A1 (en) * 2008-09-19 2010-03-25 Microsoft Corporation Resource arbitration for shared-write access via persistent reservation
US20130046983A1 (en) * 2010-04-27 2013-02-21 China Mobile Communications Corporation Authentication method and device, authentication centre and system
CN104158707A (en) * 2014-08-29 2014-11-19 杭州华三通信技术有限公司 Method and device of detecting and processing brain split in cluster
CN107094182A (en) * 2017-06-01 2017-08-25 云南电网有限责任公司信息中心 A kind of load-balancing method of use SSO Single Sign Ons system detectio service node health degree
CN108055159A (en) * 2017-12-21 2018-05-18 郑州云海信息技术有限公司 A kind of clustered node operation synchronous method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100077249A1 (en) * 2008-09-19 2010-03-25 Microsoft Corporation Resource arbitration for shared-write access via persistent reservation
US20130046983A1 (en) * 2010-04-27 2013-02-21 China Mobile Communications Corporation Authentication method and device, authentication centre and system
CN104158707A (en) * 2014-08-29 2014-11-19 杭州华三通信技术有限公司 Method and device of detecting and processing brain split in cluster
CN107094182A (en) * 2017-06-01 2017-08-25 云南电网有限责任公司信息中心 A kind of load-balancing method of use SSO Single Sign Ons system detectio service node health degree
CN108055159A (en) * 2017-12-21 2018-05-18 郑州云海信息技术有限公司 A kind of clustered node operation synchronous method and device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111865722A (en) * 2020-07-20 2020-10-30 深圳市活力天汇科技股份有限公司 Node health state detection and processing method
CN111865722B (en) * 2020-07-20 2022-07-05 深圳市活力天汇科技股份有限公司 Node health state detection and processing method

Also Published As

Publication number Publication date
CN110839068B (en) 2022-02-18

Similar Documents

Publication Publication Date Title
WO2020177533A1 (en) Electronic invoice identifier allocation method, and electronic ticket generating method, device and system
US10983880B2 (en) Role designation in a high availability node
US10609159B2 (en) Providing higher workload resiliency in clustered systems based on health heuristics
US9208029B2 (en) Computer system to switch logical group of virtual computers
WO2017067484A1 (en) Virtualization data center scheduling system and method
CN106817432B (en) Method, system and equipment for elastically stretching virtual resources in cloud computing environment
CN111176888B (en) Disaster recovery method, device and system for cloud storage
CN113067850A (en) Cluster arrangement system under multi-cloud scene
CN111147274B (en) System and method for creating a highly available arbitration set for a cluster solution
CN113206877A (en) Session keeping method and device
US9092396B2 (en) Standby system device, a control method, and a program thereof
CN113467873A (en) Virtual machine scheduling method and device, electronic equipment and storage medium
CN110839068B (en) Service request processing method and device, electronic equipment and readable storage medium
CN114143175B (en) Main and standby cluster realization method and system
CN111274022A (en) Server resource allocation method and system
CN114124812A (en) Method and device for maintaining consistency of table items and electronic equipment
CN112631756A (en) Distributed regulation and control method and device applied to space flight measurement and control software
CN109284169B (en) Big data platform process management method based on process virtualization and computer equipment
CN109614242B (en) Computing capacity sharing method, device, equipment and medium
CN113259975A (en) Network game connection method, electronic device and computer readable medium
CN112822792A (en) Distribution method, device, equipment and storage medium of bearing identification
CN108959170B (en) Virtual device management method, device, stacking system and readable storage medium
CN112559185B (en) Chip resource allocation method, device, network equipment and computer storage medium
CN114338535B (en) Zookeeper-based cluster current limiting method, system, equipment and storage medium
JP2011248737A (en) Task takeover program, processing device and computer system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant