Method, device, equipment, medium and program product for selecting es cluster

By selecting the ES cluster based on the request time and data time period, and switching to the peer cluster when it is unavailable, the resource waste and performance bottleneck problems of Tribe nodes managing multiple ES clusters are solved, and efficient and reliable cluster management is achieved.

CN114218330BActive Publication Date: 2025-12-19CCB FINTECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111607341.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-24
Publication Date
2025-12-19
Estimated Expiration
2041-12-24

AI Technical Summary

Technical Problem

In existing technologies, Tribe nodes face issues such as resource waste, performance bottlenecks, duplicate request and response, and complex downtime handling when managing multiple Elasticsearch clusters, which limits their widespread use in enterprise applications.

Method used

By obtaining the relationship between the request time of the access request and the data time period within the Elasticsearch cluster, a suitable Elasticsearch cluster can be selected, its availability can be tested, and requests can be redirected to peer clusters when necessary, thereby achieving efficient cluster management.

Benefits of technology

It improves resource utilization, reduces duplicate requests, ensures data consistency, automatically switches over when the cluster fails, simplifies management processes, and enhances system performance and reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114218330B_ABST
    Figure CN114218330B_ABST
Patent Text Reader

Abstract

The present disclosure provides a method, device, equipment, medium and program product for selecting an ES cluster, relating to the technical field of big data. The method for selecting an ES cluster comprises the following steps: obtaining a request time of a previous access corresponding to an access request; obtaining data time periods of data saved in a plurality of ES clusters respectively; selecting a corresponding ES cluster according to a relationship between the request time and the data time periods; detecting availability of the selected ES cluster; and when the ES cluster is marked as unavailable, redirecting the access request to a peer cluster corresponding to the ES cluster, wherein the peer cluster and the ES cluster save the same data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of big data technology, and in particular to a method, apparatus, device, medium, and program product for selecting an ES cluster. Background Technology

[0002] Elasticsearch (ES) is an excellent real-time distributed storage, search, and analytics engine with a very comprehensive ecosystem, widely used in enterprise applications. For application services, a pressing issue is how to conveniently manage multiple ES clusters.

[0003] In existing technologies, in a multi-ES cluster environment, Tribe nodes can be used to organize multiple ES clusters into a federated cluster, and application services only need to access a single Tribe node. In this mode, the Tribe node broadcasts requests to every cluster, and each cluster must execute the request regardless of whether the target is itself, resulting in significant resource waste. Tribe transforms a single upstream request into multiple downstream requests, which can become a performance bottleneck as QPS increases. Furthermore, peer clusters are not allowed under a Tribe; otherwise, multiple identical response data will be returned for a single request. When a cluster in the Tribe fails, automatic failover is not possible and manual handling is required. Therefore, while Tribe clusters can simplify application service configuration and invocation, their practical application is not widespread. Summary of the Invention

[0004] In view of the above problems, this disclosure provides a method, apparatus, device, media and program product for selecting an ES cluster, which aims to solve the management problems of ES clusters.

[0005] According to a first aspect of this disclosure, a method for selecting an Elasticsearch cluster is provided, comprising the following steps:

[0006] Get the request time of the previous access corresponding to the access request;

[0007] Retrieve data time periods from multiple Elasticsearch clusters, and select the appropriate Elasticsearch cluster based on the relationship between the request time and the data time period;

[0008] The availability of the selected Elasticsearch cluster is checked, and when the Elasticsearch cluster is marked as unavailable, the access request is redirected to the peer cluster of the corresponding Elasticsearch cluster.

[0009] In this case, the peer cluster and the Elasticsearch cluster store the same data.

[0010] According to embodiments of this disclosure, the data time periods satisfy the following relationship:

[0011] Data time period = current time - preset time difference

[0012] The plurality of ES clusters sequentially comprise a hot cluster, a warm cluster, and a cold cluster, and the preset time difference gradually increases from the hot cluster to the cold cluster.

[0013] According to an embodiment of the present disclosure, the step of selecting the corresponding ES cluster according to the relationship between the request time and the data time period comprises:

[0014] sequentially comparing the request time with the plurality of data time periods corresponding to the plurality of ES clusters from the hot cluster to the cold cluster;

[0015] When the request time is less than the data time period, the corresponding ES cluster is selected.

[0016] According to an embodiment of the present disclosure, the plurality of ES clusters further comprise a bottom cluster, and all data is saved in the bottom cluster.

[0017] The step of selecting the corresponding ES cluster according to the relationship between the request time and the data time period further comprises:

[0018] When the request time is greater than the data time period corresponding to the cold cluster, the bottom cluster is selected.

[0019] According to an embodiment of the present disclosure, the step of detecting the availability of the selected ES cluster comprises:

[0020] sending a health check request to the ES cluster;

[0021] When no health response is received within a first preset time period, the ES cluster is marked as unavailable.

[0022] According to an embodiment of the present disclosure, when no health response is received within the first preset time period, the step of marking the ES cluster as unavailable further comprises:

[0023] When no health response is received within a second preset time period, the health check request is repeatedly sent;

[0024] The second preset time period is less than the first preset time period.

[0025] According to an embodiment of the present disclosure, the selection method of the ES cluster further comprises the following steps:

[0026] obtaining a current time;

[0027] pulling an update time of a previous update, and calculating a time difference between the current time and the update time;

[0028] When the time difference is greater than a preset period, a configuration information table is obtained, and the content in the configuration information table is updated to the ES cluster in an incremental pulling manner.

[0029] A second aspect of the present disclosure provides a selection apparatus of an ES cluster, comprising:

[0030] a time module configured to acquire a request time of a previous access corresponding to the access request;

[0031] a cluster selection module configured to acquire a data time period of data saved in each of the plurality of ES clusters respectively, and select a corresponding ES cluster according to a relationship between the request time and the data time period; and

[0032] an availability detection module configured to detect availability of the selected ES cluster, and re-direct the access request to a peer cluster corresponding to the ES cluster when the ES cluster is marked as unavailable;

[0033] wherein the peer cluster and the ES cluster save the same data.

[0034] A third aspect of the present disclosure provides an electronic device, comprising: one or more processors; a storage apparatus configured to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors perform the above-mentioned ES cluster selection method.

[0035] A fourth aspect of the present disclosure further provides a computer-readable storage medium having stored thereon executable instructions that, when executed by a processor, cause the processor to perform the above-mentioned ES cluster selection method.

[0036] A fifth aspect of the present disclosure further provides a computer program product comprising a computer program, wherein the computer program is executed by a processor to implement the above-mentioned ES cluster selection method. BRIEF DESCRIPTION OF DRAWINGS

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

[0038] Figure 1 A scenario diagram of application of the ES cluster selection method, apparatus, device, medium and program product according to an embodiment of the present disclosure is schematically shown;

[0039] Figure 2 A flowchart of the ES cluster selection method according to an embodiment of the present disclosure is schematically shown;

[0040] Figure 3 A schematic diagram of cluster selection according to an embodiment of the present disclosure is schematically shown;

[0041] Figure 4 A schematic diagram of cluster update according to an embodiment of the present disclosure is schematically shown;

[0042] Figure 5 a design flowchart of a method for selecting an ES cluster according to an embodiment of the present disclosure is shown schematically;

[0043] Figure 6 a structural block diagram of an apparatus for selecting an ES cluster according to an embodiment of the present disclosure is shown schematically; and

[0044] Figure 7 a block diagram of an electronic device adapted to implement the method for selecting an ES cluster according to an embodiment of the present disclosure is shown schematically. DETAILED DESCRIPTION

[0045] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It is to be understood, however, that the description is merely exemplary and is intended to provide a thorough understanding of the present disclosure. The following description, given together with the accompanying drawings, is intended to provide a thorough understanding of the present disclosure. However, it is apparent that the one or more embodiments can be implemented without the specific details given below. Furthermore, in the following description, descriptions of well-known structures and techniques have been omitted to avoid unnecessarily obscuring the concept of the present disclosure.

[0046] The terms used herein are merely used to describe specific embodiments and are not intended to limit the present disclosure. The terms "include", "comprise" and the like used herein indicate the presence of the features, steps, operations and / or components, but do not exclude the presence or addition of one or more other features, steps, operations or components.

[0047] All terms used herein, including technical and scientific terms, have the meanings commonly understood by one of ordinary skill in the art, unless otherwise defined. It should be noted that the terms used herein should be interpreted in a manner consistent with the context of the present specification, and should not be interpreted in an idealized or overly formal manner.

[0048] In the case of using expressions similar to "at least one of A, B, and C, etc.", in general, it should be interpreted to mean one or more of the items enumerated in the expression (e.g., "a system having at least one of A, B, and C" should include, but not be limited to, a system having A alone, a system having B alone, a system having C alone, a system having A and B together, a system having A and C together, a system having B and C together, and / or a system having A, B, and C together, etc.).

[0049] In the technical solutions of the present disclosure, the acquisition, storage and application of user personal information involved comply with relevant legal regulations, necessary security measures are taken, and do not violate public order and good customs.

[0050] In the technical solutions of the present disclosure, the authorization or consent of the user is obtained before acquiring or collecting user personal information.

[0051] The present disclosure provides a method for selecting an ES cluster, comprising the following steps:

[0052] obtaining a request time of a previous access corresponding to the access request;

[0053] obtaining data time periods of data saved in the plurality of ES clusters respectively, and selecting a corresponding ES cluster according to a relationship between the request time and the data time periods; and

[0054] detecting availability of the selected ES cluster, and redirecting the access request to a peer cluster of the corresponding ES cluster when the ES cluster is marked as unavailable;

[0055] wherein the peer cluster and the ES cluster save the same data.

[0056] Figure 1 An application scenario diagram of a method for selecting an ES cluster and an apparatus according to an embodiment of the present disclosure is schematically shown.

[0057] As shown in Figure 1 , the application scenario according to the embodiment can include the field of financial services. Network 102 is a medium for providing a communication link between terminal device 101 and server 103. Network 102 can include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.

[0058] A user can use terminal device 101 to interact with server 103 through network 102 to receive or send messages, etc. Various communication client applications can be installed on terminal device 101, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).

[0059] Terminal device 101 can be various electronic devices with a display screen and supporting web browsing, including but not limited to smartphones, tablet computers, laptop computers, desktop computers, etc.

[0060] Server 103 can be a server providing various services, such as a background management server supporting websites browsed by users using terminal device 101 (only as an example). The background management server can analyze and process received user requests and other data, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests, etc.) to the terminal device.

[0061] It should be noted that the ES cluster selection method provided by the embodiments of the present disclosure can be generally executed by the server 103. Accordingly, the information prompting apparatus provided by the embodiments of the present disclosure can be generally arranged in the server 103. The ES cluster selection method provided by the embodiments of the present disclosure can also be executed by a server or a server cluster different from the server 103 and capable of communicating with the terminal device 101 and / or the server 103. Accordingly, the information prompting apparatus provided by the embodiments of the present disclosure can also be arranged in a server or a server cluster different from the server 103 and capable of communicating with the terminal device 101 and / or the server 103.

[0062] It should be understood that Figure 1 The number of terminal devices, networks and servers in the above scenario is only illustrative. Any number of terminal devices, networks and servers can be provided according to implementation needs.

[0063] The ES cluster selection method of the embodiments of the present disclosure will be described in detail below based on the scenario described above. Figure 1 Figures 2 to 7 The ES cluster selection method of the embodiments of the present disclosure will be described in detail below based on the scenario described above.

[0064] Figure 2 An illustrative flowchart of an ES cluster selection method according to an embodiment of the present disclosure is shown.

[0065] As shown in Figure 2 The ES cluster selection method of this embodiment includes steps S10 to S30, and the ES cluster selection method can be executed by an ES cluster selection apparatus.

[0066] In operation S10, the request time of the previous access corresponding to the access request is obtained.

[0067] In operation S20, the data time period of the data saved in each of the plurality of ES clusters is obtained respectively, and the corresponding ES cluster is selected according to the relationship between the request time and the data time period; and

[0068] In operation S30, the availability of the selected ES cluster is detected, and when the ES cluster is marked as unavailable, the access request is redirected to a peer cluster corresponding to the ES cluster.

[0069] The peer cluster and the ES cluster save the same data.

[0070] ​In the technical solution provided in the present disclosure, according to the request time, the preliminary selection of the ES cluster is performed, so that the access request does not need to access each cluster, and the target is focused on one ES cluster, and at the same time, after obtaining the ES cluster, it is detected whether it is available, and when it is available, it can be directly accessed, but when it is not available, the access request is directed to the peer cluster, so as to be applicable to multiple data centers, prevent the peer cluster from being unable to be set, or the data from being unable to be correctly obtained from the peer cluster. In the present disclosure, cluster positioning is performed first, and then availability detection is performed, that is, the calculation resources are saved, and the management under the setting of the peer cluster is facilitated.

[0071] It should be noted that the peer cluster and the ES cluster save the same data, and when designing multiple data centers, multiple data centers deployed in multiple places simultaneously provide services to the outside, and in order to ensure the safety and accuracy of the data, the data is often saved in multiple servers in the same way. In the present embodiment, the ES cluster is commonly used, and the peer cluster saves the same data.

[0072] Specifically, in the present embodiment, the data time period satisfies the following relationship:

[0073] Data time period = current time - preset time difference

[0074] Among them, the multiple ES clusters include, in sequence, a hot cluster, a warm cluster and a cold cluster, and the preset time difference gradually increases from the hot cluster to the cold cluster.

[0075] The data time period indicates how long the ES cluster can save the data, for example, data time period = T-1, wherein T is the current time, that is, the data time period can save data within one day.

[0076] In the present embodiment, by setting the preset time difference, the multiple ES clusters save the data in different time periods, and the greater the preset time period, the more distant the data in the data time period can be saved. From near to far, the hot cluster, the warm cluster and the cold cluster form, indicating that the use and query frequency of the data decreases in turn. By setting the hot cluster, the warm cluster and the cold cluster, the response speed of the data is accelerated, and the cluster containing the access request is positioned.

[0077] It should be noted that the hot cluster is composed of machines with high hardware configuration, and stores high-frequency hot data. Generally, the amount of stored data is small, and the real-time query is high. The warm cluster is composed of machines with medium hardware configuration, and stores medium-frequency data. Generally, the amount of stored data is medium, and the real-time query is medium. The cold cluster is composed of machines with general hardware configuration, and stores low-frequency data. Generally, the amount of stored data is large, and the real-time query is low.

[0078] Further, please refer to Figure 3 In order to facilitate positioning the ES cluster, step S20 comprises:

[0079] S21, from hot cluster to cold cluster, comparing the request time with the corresponding plurality of data time periods in turn;

[0080] S22, when the request time is less than the data time period, selecting the corresponding ES cluster.

[0081] By comparing the data time periods of the hot cluster to the cold cluster in turn, the fastest cluster containing data can be found, for example, when the request time is less than the data time period of the hot cluster, it is not necessary to continue to compare with the warm cluster, and the hot cluster can be directly requested, without the need for further comparison, the response speed is improved, and it is ensured that the responding cluster is the smallest and fastest cluster.

[0082] Further, since only the data in the time period is not enough to contain all the data, in the embodiment, the plurality of ES clusters further comprises a bottom-up cluster, and all the data is saved in the bottom-up cluster;

[0083] Step S20 further comprises:

[0084] S23, when the request time is greater than the data time period corresponding to the cold cluster, selecting the bottom-up cluster.

[0085] When the request time is greater than the data time period corresponding to the cold cluster, for example, the cold cluster saves data within one month, and the request time is greater than one month, at this time, there is no data that can be responded to in any cluster, at this time, by saving all the data in the bottom-up cluster, the access request is directed to the bottom-up cluster, so as to query the required data, and prevent data loss and query failure due to the data time period.

[0086] On the other hand, it should be noted that there are various ways to check the availability of the ES cluster, for example, manually marking the availability of the ES cluster by artificial, and directly checking the availability mark, in the embodiment, step S30 comprises:

[0087] S31, sending a health check request to the ES cluster;

[0088] S32, when no health response is received within the first preset time period, marking the ES cluster as unavailable.

[0089] In the embodiment, by sending a health check request and receiving a health response, real-time availability checking is performed, and the checking is automatic by machine, without human intervention, ensuring real-time and accuracy.

[0090] Further, in order to improve the accuracy of the availability check, step S32 further comprises:

[0091] S321, when no health response is received within the second preset time period, then repeat sending the health check request;

[0092] The second preset time period is less than the first preset time period.

[0093] In this way, multiple availability checks are performed within the first preset time period to ensure the accuracy of the check. By controlling the second preset time period, multiple checks can be performed within the first preset time period, which can be set according to requirements and is not specifically limited here.

[0094] On the other hand, referring to Figure 4 The method for selecting an ES cluster further comprises the following steps:

[0095] S01, obtaining the current time;

[0096] S02, pulling the update time of the previous update, and calculating the time difference between the current time and the update time;

[0097] S03, when the time difference is greater than the preset period, obtaining the configuration information table, and updating the content in the configuration information table to the ES cluster by incremental pulling.

[0098] It should be noted that the data in the ES cluster is constantly updated. In the technical solution provided in the present disclosure, the time difference between the current time and the update time of the previous update is calculated. When the time difference is greater than the preset period, it means that the update period has been reached. At this time, the update content is written to the ES cluster by incremental pulling, without the need for shutdown and restart, and online real-time updating can be realized.

[0099] It should be noted that incremental pulling only updates the changed content, avoiding reloading of unchanged data and improving efficiency. In addition, in the present embodiment, the configuration information table includes cluster ID, cluster name, cluster host, port and update time fields.

[0100] Based on the above method for selecting an ES cluster, referring to Figure 5 The present disclosure provides a specific embodiment.

[0101] 1. Select the cluster by the request time, which includes the selection of hot, warm and cold clusters, and the selection is made by the time difference between the request time and the data time period to obtain the ID of the cluster.

[0102] 2. failover check, i.e. checking the availability of the cluster; the availability is checked by keepalive, i.e. by sending a signal and checking whether a response signal is received.

[0103] Based on the above ES cluster selection method, the present disclosure further provides an ES cluster selection apparatus. The following will be described in combination with Figure 6 The apparatus is described in detail.

[0104] Figure 6 A structural block diagram of an abnormal data detection apparatus according to an embodiment of the present disclosure is schematically shown.

[0105] As shown in Figure 6 The abnormal data detection apparatus 200 includes a time obtaining module 1, a cluster selection module 2 and an availability detection module 3; the time obtaining module 1 is configured to obtain a request time of a previous access corresponding to an access request; the cluster selection module 2 is configured to obtain data time periods of data saved in a plurality of ES clusters respectively, and select a corresponding ES cluster according to a relationship between the request time and the data time periods; the availability detection module 3 is configured to detect the availability of the selected ES cluster, and when the ES cluster is marked as unavailable, re-direct the access request to a peer cluster corresponding to the ES cluster; wherein the peer cluster and the ES cluster save the same data.

[0106] Any one or more of the modules, sub-modules, units, sub-units according to the embodiments of the present disclosure, or at least part of the functions of any one or more of the modules, sub-modules, units, sub-units can be implemented in one module. Any one or more of the modules, sub-modules, units, sub-units according to the embodiments of the present disclosure can be split into multiple modules for implementation. Any one or more of the modules, sub-modules, units, sub-units according to the embodiments of the present disclosure can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on chip, a system on substrate, a system on package, an application specific integrated circuit (ASIC), or any other reasonable way of hardware or firmware by integrating or packaging the circuit, or in any one of software, hardware and firmware or in a proper combination of any one or more of them. Alternatively, one or more of the modules, sub-modules, units, sub-units according to the embodiments of the present disclosure can be at least partially implemented as computer program modules which can perform corresponding functions when the computer program modules are run.

[0107] Figure 6 A block diagram of an electronic device adapted to the ES cluster selection method according to an embodiment of the present disclosure is schematically shown.

[0108] As shown in Figure 6As shown, the electronic device 300 according to an embodiment of the present disclosure includes a processor 3001 which can perform various appropriate actions and processes according to a program stored in a read only memory (ROM) 3002 or a program loaded from a storage section 3008 into a random access memory (RAM) 3003. The processor 3001 can include, for example, a general purpose microprocessor (e.g., a CPU), an instruction set processor, and / or a related chipset, and / or a special purpose microprocessor (e.g., an application specific integrated circuit (ASIC)), and so on. The processor 3001 can also include an on-board memory for cache use. The processor 3001 can include a single processing unit or multiple processing units for executing different actions of the method processes according to embodiments of the present disclosure.

[0109] In the RAM 3003, various programs and data required for the operation of the electronic device 300 are stored. The processor 3001, the ROM 3002, and the RAM 3003 are connected to each other via a bus 3004. The processor 3001 performs various operations of the method processes according to embodiments of the present disclosure by executing the programs in the ROM 3002 and / or the RAM 3003. Note that the programs can also be stored in one or more memories other than the ROM 3002 and the RAM 3003. The processor 3001 can also perform various operations of the method processes according to embodiments of the present disclosure by executing the programs stored in the one or more memories.

[0110] According to an embodiment of the present disclosure, the electronic device 300 can further include an input / output (I / O) interface 3005 which is also connected to the bus 3004. The electronic device 300 can further include one or more of the following components connected to the I / O interface 3005: an input section 3006 including a keyboard, a mouse, etc.; an output section 3007 including a display such as a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 3008 including a hard disk, etc.; and a communication section 3009 including a network interface card such as a LAN card, a modem, etc. The communication section 3009 performs communication processing via a network such as the Internet. A drive 3010 is also connected to the I / O interface 3005 as necessary. A removable medium 3011 such as a magnetic disk, a magneto-optical disk, a semiconductor memory, etc. is attached to the drive 3010 as necessary, so that a computer program read out therefrom is installed into the storage section 3008 as necessary.

[0111] The present disclosure also provides a computer readable storage medium, which can be included in the device / apparatus / system described in the above embodiments, or can exist independently without being assembled into the device / apparatus / system. The above computer readable storage medium carries one or more programs, which, when executed, implement the method according to the embodiments of the present disclosure.

[0112] According to embodiments of the present disclosure, the computer readable storage medium can be a non-volatile computer readable storage medium, which can include, but is not limited to, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any appropriate combination thereof. In the present disclosure, the computer readable storage medium can be any tangible medium that contains or stores a program, which can be used by or in connection with an instruction execution system, apparatus, or device. For example, according to embodiments of the present disclosure, the computer readable storage medium can include one or more memories such as the ROM 3002 and / or the RAM 3003 described above and / or one or more memory other than the ROM 3002 and the RAM 3003.

[0113] Embodiments of the present disclosure also include a computer program product, which includes a computer program containing program codes for executing the methods shown in the flowcharts. When the computer program product is run in a computer system, the program codes are used to make the computer system implement the selection method of the ES cluster provided by the embodiments of the present disclosure.

[0114] The above functions defined in the system / apparatus of the embodiments of the present disclosure are performed when the computer program is executed by the processor 3001. According to embodiments of the present disclosure, the system, apparatus, module, unit, etc. described above can be implemented by computer program modules.

[0115] In one embodiment, the computer program can rely on a tangible storage medium such as an optical storage device, a magnetic storage device, etc. In another embodiment, the computer program can also be transmitted, distributed, and downloaded in the form of a signal via a network medium, and be installed and executed through the communication part 3009 and / or the detachable medium 3011. The program codes contained in the computer program can be transmitted via any appropriate network medium, including but not limited to wireless, wired, etc., or any appropriate combination thereof.

[0116] In such embodiments, the computer program can be downloaded and installed from the network through the communication section 3009, and / or installed from the removable media 3011. When the computer program is executed by the processor 3001, the above-described functions defined in the system of the embodiments of the present disclosure are executed. According to the embodiments of the present disclosure, the system, device, apparatus, module, unit, and the like described above can be implemented by computer program modules.

[0117] According to the embodiments of the present disclosure, the program code for executing the computer program provided by the embodiments of the present disclosure can be written in any combination of one or more programming languages, and specifically, these computer programs can be implemented using high-level procedural and / or object-oriented programming language, and / or assembly / machine language. The programming language includes, but is not limited to, such as Java, C++, python, "C" language, or similar programming language. The program code can be executed entirely on the user computing device, partially on the user device, partially on a remote computing device, or entirely on a remote computing device or server. In the case involving a remote computing device, the remote computing device can be connected to the user computing device through any kind of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, connected through the Internet by using an Internet service provider).

[0118] The flowcharts and block diagrams in the drawings illustrate the possible architectural, functional, and operational scenarios of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowcharts or block diagrams can represent a module, a program segment, or a portion of code that contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur in different orders than that shown in the figures. For example, two blocks that are shown in succession can actually be executed substantially concurrently, or they can sometimes be executed in reverse order, depending on the functionality involved. It should also be noted that each block in the flowcharts or block diagrams, and combinations of blocks in the flowcharts or block diagrams, can be implemented by dedicated hardware-based systems that perform the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.

[0119] Those skilled in the art can understand that the features described in various embodiments of the present disclosure and / or claims can be combined or / and integrated, even if such combinations or integrations are not explicitly described in the present disclosure. In particular, the features described in various embodiments of the present disclosure and / or claims can be combined and / or integrated in various combinations, without departing from the spirit and teachings of the present disclosure. All such combinations and / or integrations are within the scope of the present disclosure.

[0120] The above describes embodiments of the present disclosure. However, these embodiments are merely for illustrative purposes, and are not intended to limit the scope of the present disclosure. Although each embodiment is described above separately, this does not mean that the measures in each embodiment cannot be used advantageously in combination. The scope of the present disclosure is defined by the appended claims and their equivalents. Those skilled in the art can make various substitutions and modifications without departing from the scope of the present disclosure, and these substitutions and modifications shall all fall within the scope of the present disclosure.

[0121] The specific embodiments described above further illustrate the purposes, technical solutions and beneficial effects of the present disclosure. It should be understood that the above description is merely for specific embodiments of the present disclosure and is not intended to limit the present disclosure. Any modification, equivalent replacement, improvement, etc. made within the spirit and principles of the present disclosure shall be included in the protection scope of the present disclosure.

Claims

1. A method for selecting an ES cluster, characterized in that, The method comprises the following steps: obtaining the request time of the previous access corresponding to the access request; obtaining the data time period of the data saved in each of the plurality of ES clusters respectively, and selecting the corresponding ES cluster according to the relationship between the request time and the data time period; and detecting the availability of the selected ES cluster, and redirecting the access request to the peer cluster corresponding to the ES cluster when the ES cluster is marked as unavailable; wherein the peer cluster and the ES cluster save the same data; the step of selecting the corresponding ES cluster according to the relationship between the request time and the data time period comprises: comparing the request time with the corresponding plurality of data time periods in turn from the hot cluster to the cold cluster; selecting the corresponding ES cluster when the request time is less than the data time period; wherein when the request time is less than the data time period of the hot cluster, the corresponding ES cluster is determined as the hot cluster.

2. The method of claim 1, wherein the ES cluster is selected based on a load of the ES cluster. The data time period satisfies the following relationship: data time period = current time - preset time difference wherein the plurality of ES clusters comprise a hot cluster, a warm cluster and a cold cluster in turn, and the preset time difference gradually increases from the hot cluster to the cold cluster.

3. The method of claim 1, wherein the ES cluster is selected based on a load of the ES cluster. The plurality of ES clusters further comprise a bottom cluster, and all data is saved in the bottom cluster; the step of selecting the corresponding ES cluster according to the relationship between the request time and the data time period further comprises: selecting the bottom cluster when the request time is greater than the data time period corresponding to the cold cluster.

4. The method of claim 1, wherein the ES cluster is selected based on a load of the ES cluster. The step of detecting the availability of the selected ES cluster comprises: sending a health check request to the ES cluster; marking the ES cluster as unavailable when no health response is received within a first preset time period.

5. The method of claim 4, wherein the ES cluster is selected based on a load of the ES cluster. The step of marking the ES cluster as unavailable when no health response is received within a first preset time period further comprises: repeating the sending of the health check request when no health response is received within a second preset time period; wherein the second preset time period is less than the first preset time period.

6. The method of claim 1, wherein the ES cluster is selected based on a load of the ES cluster. The selection method of the ES cluster further comprises the following steps: obtaining the current time; pulling the update time of the previous update, and calculating the time difference between the current time and the update time; when the time difference is greater than a preset period, obtaining the configuration information table, and updating the content in the configuration information table to the ES cluster by incremental pulling.

7. An apparatus for selecting an ES cluster, the apparatus comprising: It comprises: a time acquisition module for obtaining the request time of the previous access corresponding to the access request; a cluster selection module for obtaining the data time period of the data saved in each of the plurality of ES clusters respectively, and selecting the corresponding ES cluster according to the relationship between the request time and the data time period; and an availability detection module for detecting the availability of the selected ES cluster, and redirecting the access request to the peer cluster corresponding to the ES cluster when the ES cluster is marked as unavailable; wherein the peer cluster and the ES cluster save the same data; the step of selecting the corresponding ES cluster according to the relationship between the request time and the data time period comprises: comparing the request time with a plurality of data time periods corresponding to the hot cluster, the warm cluster and the cold cluster in sequence; selecting a corresponding ES cluster when the request time is less than the data time period; wherein the corresponding ES cluster is determined as the hot cluster when the request time is less than the data time period of the hot cluster.

8. An electronic device, comprising: comprising: one or more processors; a storage device for storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, a non-transitory computer-readable medium having stored thereon executable instructions that, when executed by a processor, cause the processor to perform the method according to any one of claims 1 to 6.

10. A computer program product, characterised in that, a computer program that, when executed by a processor, implements the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Cluster management method, device and equipment and computer readable storage medium

    CN113076212A

  • Distributed real-time data query method, cluster, system and storage medium

    CN113157777A