A customer group data query method, device, equipment and storage medium

By employing a multi-level bypass and circuit breaker mechanism, and utilizing Redis, ElasticSearch, and ClickHouse databases, the system switches to the next-level database when Redis is interrupted, thus solving the problem of low query reliability in extreme cases and achieving high-concurrency and automatic recovery query services.

CN117573723BActive Publication Date: 2026-07-21BANK OF NINGBO

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BANK OF NINGBO
Filing Date
2023-12-12
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

Existing technologies cannot verify eligibility through the customer group authentication interface in situations such as Redis node offset, Redis shutdown during system emergency drills, and changes to network department switches. This results in low reliability of querying customer group data and fails to meet the 24/7 high availability requirements.

Method used

A multi-level bypass and circuit breaker mechanism is adopted, utilizing three databases: Redis, ElasticSearch, and ClickHouse. By judging the circuit breaker status of each database, the system switches to the next-level database for querying when the circuit breaker status is broken, ensuring that high-concurrency requests can still be provided even in extreme cases.

Benefits of technology

It improves the reliability of querying customer group data, enabling the authentication service to still provide high-concurrency requests in extreme cases such as Redis outage, and quickly restores the service after Redis is restored through an automatic recovery mechanism.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117573723B_ABST
    Figure CN117573723B_ABST
Patent Text Reader

Abstract

Embodiments of the application disclose a customer group data query method, device and equipment and a storage medium. The method comprises the following steps: a multistage bypass is constructed by using three databases of Redis, ElasticSearch and ClickHouse; on the basis, whether the Redis, ElasticSearch and ClickHouse are in a fuse state is judged by a fuse mechanism; when the upper database is fused, the next database is automatically entered to query the ID of the group in which the customer ID is located based on the customer ID. Based on the three databases for storing data in different data formats, the query function of the customer group ID is provided by the multistage bypass and the fuse mechanism, the reliability of querying the customer group can be greatly improved, and the authentication service can still provide support for high-concurrency requests in the case of Redis shutdown and other extreme cases.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, and in particular to a method, apparatus, device and storage medium for querying customer group data. Background Technology

[0002] In banking scenarios, the Magic Cube system and intelligent marketing system can configure participating customer groups during activity configuration. When customers participate in activities, they need to be verified through the customer group authentication interface to determine their eligibility. Therefore, the qualification authentication interface needs to meet high concurrency and 24 / 7 high availability requirements. Currently, due to the need to use Redis to achieve high concurrency in the initial stage of system construction, a Redis bypass mechanism is not provided for the authentication interface. In cases where Redis is inaccessible due to Redis node offset, Redis outage during system emergency drills, or changes in network department switches, qualification verification cannot be performed through the customer group authentication interface, customer group data cannot be queried, and the authentication service cannot meet the 24 / 7 high availability requirement, resulting in low reliability.

[0003] Therefore, improving the reliability of querying customer group data has become a technical problem that urgently needs to be solved in this field. Summary of the Invention

[0004] To address the aforementioned issues, this application provides a method, apparatus, device, and storage medium for querying customer group data, which can improve the reliability of querying customer group data.

[0005] The embodiments of this application disclose the following technical solutions:

[0006] Firstly, this application provides a method for querying customer group data, the method comprising:

[0007] Determine if Redis is in a circuit breaker state;

[0008] When Redis is not in a circuit breaker state, use Redis to query the ID of the group to which the customer ID belongs based on the customer ID;

[0009] If Redis is in a circuit breaker state or if the ID query result of the group to which the customer ID belongs is empty when using Redis, determine whether ElasticSearch is in a circuit breaker state.

[0010] When Elasticsearch is in a non-circuit-breaker state, use Elasticsearch to query the ID of the group to which the customer ID belongs based on the customer ID;

[0011] When ElasticSearch is in a circuit breaker state, determine whether ClickHouse is in a circuit breaker state.

[0012] When ClickHouse is in a circuit breaker state, display the query error results;

[0013] When ClickHouse is in a non-circuit-breaker state, the ID of the group to which the customer ID belongs is queried using ClickHouse based on the customer ID;

[0014] The ID of the group to which the customer ID belongs will be displayed as the group data query result.

[0015] Optionally, determining whether Redis is in a circuit breaker state includes:

[0016] Determine if there are any anomalies in Redis by querying data in Redis;

[0017] If an anomaly is detected in the Redis instance, the Redis instance will be set to a circuit breaker state.

[0018] Optionally, the method further includes:

[0019] When Redis is in a circuit breaker state, a timed thread is used to check the status of Redis at preset time intervals;

[0020] If the detection result is not abnormal, the Redis state is set to non-circuit breaker state.

[0021] Optionally, the method further includes:

[0022] After retrieving the ID of the group to which the customer ID belongs using ElasticSearch based on the customer ID, check whether Redis is in a non-circuit-breaker state;

[0023] When Redis is not in a circuit breaker state, the ID of the group to which the queried customer ID belongs is stored in the cache.

[0024] Optionally, the method further includes:

[0025] After using ClickHouse to query the ID of the group rental where the customer ID belongs based on the customer ID, check whether Redis is in a non-circuit break state.

[0026] When Redis is not in a circuit breaker state, the ID of the group to which the queried customer ID belongs is stored in the cache.

[0027] Secondly, embodiments of this application provide a customer group data query device, the device comprising:

[0028] The Redis circuit breaker status detection module is used to determine whether Redis is in a circuit breaker state.

[0029] The first query module is used to query the ID of the group to which the customer ID belongs, based on the customer ID, when Redis is in a non-circuit-break state.

[0030] The ElasticSearch circuit breaker status determination module is used to determine whether ElasticSearch is in a circuit breaker state when Redis is in a circuit breaker state or when the result of querying the group ID of the customer ID using Redis is empty.

[0031] The second query module is used to query the ID of the group to which the customer ID belongs based on the customer ID when the ElasticSearch is in a non-circuit-breaker state.

[0032] The ClickHouse circuit breaker status determination module is used to determine whether ClickHouse is in a circuit breaker state when ElasticSearch is in a circuit breaker state.

[0033] The first display module is used to display the error result when the ClickHouse is in a circuit breaker state;

[0034] The third query module is used to query the ID of the group to which the customer ID belongs based on the customer ID when the ClickHouse is in a non-circuit-breaker state.

[0035] The second display module is used to display the ID of the group to which the queried customer ID belongs as the group data query result.

[0036] Optionally, the Redis circuit breaker status determination module includes:

[0037] The data judgment submodule is used to determine whether there are any anomalies in Redis by querying data in Redis.

[0038] The status setting submodule is used to set the Redis to a circuit breaker state when an anomaly is found in the query.

[0039] Optionally, the device further includes:

[0040] The status detection module is used to detect the status of Redis at preset time intervals using a timed thread when Redis is in a circuit breaker state.

[0041] The status setting module is used to set the Redis status to a non-circuit breaker state when the detection result is non-abnormal.

[0042] Thirdly, embodiments of this application provide an electronic device, including:

[0043] Memory, used to store computer programs;

[0044] A processor is used to implement the steps of the above-described customer group data query method when executing the computer program.

[0045] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the above-described customer group data query method.

[0046] Compared with the prior art, this application has the following beneficial effects:

[0047] This application provides a method for querying customer group data, comprising: determining whether Redis is in a circuit breaker state; when Redis is not in a circuit breaker state, querying the ID of the group to which the customer ID belongs using Redis based on the customer ID; when Redis is in a circuit breaker state or the result of querying the ID of the group to which the customer ID belongs using Redis is empty, determining whether ElasticSearch is in a circuit breaker state; when ElasticSearch is not in a circuit breaker state, querying the ID of the group to which the customer ID belongs using ElasticSearch based on the customer ID; when ElasticSearch is in a circuit breaker state, determining whether ClickHouse is in a circuit breaker state; when ClickHouse is in a circuit breaker state, displaying the query error result; when ClickHouse is not in a circuit breaker state, querying the ID of the group to which the customer ID belongs using ClickHouse based on the customer ID, and displaying the queried ID of the group to which the customer ID belongs as the group data query result. Based on three databases that store data in different data formats, the reliability of query customer groups can be greatly improved through multi-level bypass and circuit breaker mechanisms, enabling the authentication service to still support high-concurrency requests even in extreme cases such as Redis outages.

[0048] The customer group data query device, electronic device, and computer-readable storage medium provided in this application embodiment can implement the steps of the above-described customer group data query method, and thus also have the above-described beneficial effects. Attached Figure Description

[0049] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0050] Figure 1 This application provides a schematic flowchart of a customer group data query method.

[0051] Figure 2 This is a schematic flowchart of an automatic recovery detection method for a fuse-broken state provided in an embodiment of this application;

[0052] Figure 3 A schematic diagram of another customer group data query method provided in this application embodiment;

[0053] Figure 4 A schematic diagram of a customer group data query device provided in this application embodiment;

[0054] Figure 5 This is a schematic diagram of an electronic device structure provided in an embodiment of this application. Detailed Implementation

[0055] As described above, the system currently requires Redis to handle high concurrency in the early stages of construction. However, no Redis bypass mechanism is provided for the authentication interface. In cases where Redis is inaccessible due to Redis node offset, Redis shutdown during system emergency drills, or changes to network department switches, the authentication interface for customer groups cannot be used for qualification verification, and customer group data cannot be queried. The authentication service cannot meet the 24 / 7 high availability scenario and has low reliability.

[0056] Through research, the inventors have developed a method, device, equipment, and storage medium for querying customer group data, which can improve the reliability of querying customer group data.

[0057] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present application.

[0058] Method embodiments

[0059] See Figure 1The figure is a schematic diagram of a customer group data query method provided in an embodiment of this application, including the following steps:

[0060] S101, determine if Redis is in a circuit breaker state.

[0061] It's important to note that Redis is an in-memory NoSQL database that provides some persistence capabilities and supports configurations such as clustering, distributed systems, and master-slave replication. In principle, it can be infinitely scaled to store more data in memory. Furthermore, Redis is an open-source, ANSI C-written, network-enabled, in-memory or persistent log-structured key-value database that offers APIs for multiple languages. It supports a wider range of value types, including strings, lists, sets, sorted sets (zsets), and hashes. To ensure efficiency, data is cached in memory.

[0062] Specifically, you can determine if there are any anomalies in Redis by querying the data; if an anomaly is found, the Redis instance is set to a circuit breaker state. The circuit breaker mechanism reduces the time spent accessing the faulty Redis instance, thereby increasing the interface response speed.

[0063] S102, when Redis is in a non-circuit-breaker state, use Redis to query the ID of the group to which the customer ID belongs based on the customer ID.

[0064] It should be noted that the customer ID is the customer number. Based on the customer ID, the system searches Redis to see if there is corresponding group data. That is, it checks if the customer ID exists in a group stored in Redis. If it does, the ID of that group is provided. Since Redis is a cached data, there may be cases where the Redis query result is empty. If the query result is empty, step S103 is executed.

[0065] S103, when Redis is in a circuit breaker state or when the ID query result of the group to which the customer ID belongs is empty when using Redis, determine whether ElasticSearch is in a circuit breaker state.

[0066] It's worth noting that Elasticsearch, abbreviated as ES, is an open-source, highly scalable, distributed full-text search engine capable of storing and retrieving data in near real-time. It boasts excellent scalability, capable of scaling to hundreds of servers and handling petabytes of data. While ES is developed in Java and uses Lucene as its core for all indexing and search functionality, its aim is to simplify full-text search by hiding the complexities of Lucene through a simple RESTful API.

[0067] In other words, when Redis is in a circuit breaker state or when the query result obtained from step S102 is empty, the query will be performed in Elasticsearch. First, it will be determined whether Elasticsearch is in a circuit breaker state. If Elasticsearch is in a circuit breaker state, step S105 will be executed, and if Elasticsearch is not in a circuit breaker state, step S104 will be executed.

[0068] S104, when ElasticSearch is in a non-circuit-breaker state, use ElasticSearch to query the ID of the group to which the customer ID belongs based on the customer ID.

[0069] It should be noted that when Elasticsearch is not in a circuit breaker state, you can use the data stored in Elasticsearch to query the ID of the group to which the customer ID belongs, based on the customer ID.

[0070] S105, when ElasticSearch is in a circuit breaker state, determine whether ClickHouse is in a circuit breaker state.

[0071] It should be noted that ClickHouse is a columnar database management system for online analytical processing (OLAP). It is primarily used for online analytical processing queries and can generate analytical data reports in real time using SQL queries. It features high reliability, fault tolerance, and high throughput write capabilities. It adopts an LSM tree-like structure, and data is periodically compacted in the background after being written. It is a fully columnar distributed database management system (DBMS) that allows tables and databases to be created, data to be loaded, and queries to be run at runtime without reconfiguration and server restart.

[0072] When Elasticsearch is in a circuit breaker state, it cannot provide query services, so it will enter ClickHouse for querying. First, it is necessary to determine whether ClickHouse is in a circuit breaker state. If ClickHouse is in a circuit breaker state, proceed to step S106. If ClickHouse is not in a circuit breaker state, proceed to step S107.

[0073] S106, when the ClickHouse is in a circuit breaker state, display the query error results.

[0074] It should be noted that if ClickHouse is also in a circuit breaker state, it means that the query service is currently unavailable, so the query error result will be displayed.

[0075] S107, when the ClickHouse is in a non-circuit-breaker state, use ClickHouse to query the ID of the group to which the customer ID belongs based on the customer ID.

[0076] It should be noted that when ClickHouse is not in a circuit breaker state, it means that ClickHouse can provide query services. At this time, you can use the customer ID to find the ID of the group to which the customer ID belongs in ClickHouse.

[0077] S108, the ID of the group to which the queried customer ID belongs is displayed as the group data query result.

[0078] It should be noted that the query result displayed in step S108 is the ID of the group to which the customer ID found in steps S102, S104 or S107 belongs.

[0079] This application provides a method for querying customer group data, comprising: determining whether Redis is in a circuit breaker state; when Redis is not in a circuit breaker state, querying the ID of the group to which the customer ID belongs using Redis based on the customer ID; when Redis is in a circuit breaker state or the result of querying the ID of the group to which the customer ID belongs using Redis is empty, determining whether ElasticSearch is in a circuit breaker state; when ElasticSearch is not in a circuit breaker state, querying the ID of the group to which the customer ID belongs using ElasticSearch based on the customer ID; when ElasticSearch is in a circuit breaker state, determining whether ClickHouse is in a circuit breaker state; when ClickHouse is in a circuit breaker state, displaying the query error result; when ClickHouse is not in a circuit breaker state, querying the ID of the group to which the customer ID belongs using ClickHouse based on the customer ID, and displaying the queried ID of the group to which the customer ID belongs as the group data query result. Based on three databases that store data in different data formats, the reliability of query customer groups can be greatly improved through multi-level bypass and circuit breaker mechanisms, enabling the authentication service to still support high-concurrency requests even in extreme cases such as Redis outages.

[0080] To enable automatic application recovery after Redis recovery, this application incorporates an automatic recovery check mechanism, as detailed in [link to details]. Figure 2 This figure is a schematic flowchart of an automatic recovery detection method for circuit breaker status provided in an embodiment of this application. When Redis is in a circuit breaker state, a timed thread checks the state of Redis at preset time intervals. If the detection result is not abnormal, the state of Redis is set to a non-circuit breaker state. As an example, the preset time interval can be 30 seconds. In the circuit breaker state, the timed thread checks whether the state of Redis has returned to normal every 30 seconds. If it has recovered, the circuit breaker state is canceled, that is, the state of Redis is set to a non-circuit breaker state. At this time, the application can start using the Redis cache for query services normally.

[0081] At this point, after retrieving the ID of the group containing the customer ID using Elasticsearch, it's also possible to check if Redis is in a non-circuit-breaker state. If Redis is in a non-circuit-breaker state, the retrieved ID of the group containing the customer ID is stored in the cache. In other words, after retrieving the ID of the group containing the customer ID using Elasticsearch, if Redis's state changes to a non-circuit-breaker state, the obtained customer ID and its group ID can be stored in the cache. Subsequent queries can then directly retrieve the corresponding results from Redis.

[0082] Similarly, after retrieving the ID of the group containing the customer ID using ClickHouse based on the customer ID, it's also possible to check if Redis is in a non-circuit-breaker state. If Redis is in a non-circuit-breaker state, the retrieved ID of the group containing the customer ID is stored in the cache. In other words, after retrieving the ID of the group containing the customer ID using ClickHouse, as above, if the Redis state changes to a non-circuit-breaker state, the obtained customer ID and its group ID can be stored in the cache. Subsequent queries can then directly retrieve the corresponding results from Redis.

[0083] This application provides an automatic recovery detection method for circuit breaker status, which uses a timed thread to periodically detect whether Redis has recovered to normal. When Redis recovers to normal, its status is set to non-circuit breaker state, thereby enabling Redis to provide relatively fast query services when it recovers.

[0084] This application also provides another method for querying customer group data, see [link to relevant documentation]. Figure 3 The figure is a schematic diagram of another customer group data query method provided in an embodiment of this application.

[0085] First, when querying the group ID by customer ID, the input parameters are validated. If the parameters are valid, proceed to the next step; otherwise, if the parameters are invalid, an error message is displayed.

[0086] Then, a Redis bypass loop is executed. This loop has three levels. The first level is Redis itself. First, it checks if Redis is currently in a circuit breaker state. If it is, it proceeds directly to the next level. The circuit breaker mechanism reduces the time spent accessing the abnormal Redis, increasing the interface response speed. Next, it queries data through Redis and checks if there are any exceptions. If the current query encounters an exception indicating that Redis is unavailable, it sets Redis to a circuit breaker state, and all subsequent requests will no longer enter Redis, directly using the second-level Elasticsearch for querying. Since Redis is a cached data, there may be cases where the Redis query result is empty. In this case, the query will also proceed to the second-level Elasticsearch for querying.

[0087] The second level, Elasticsearch, is used when Redis experiences a circuit breaker failure or when Redis returns an empty result. Elasticsearch stores the complete data, and if Redis has not experienced a circuit breaker failure after obtaining the result, the data is added to the cache to improve the performance of subsequent queries.

[0088] The third level, ClickHouse, is entered when ElasticSearch circuit breakers fail. ClickHouse stores the complete data in a different data format, and the specific process is the same as ElasticSearch.

[0089] This application provides an alternative customer group data query method that, through multi-level bypass and circuit breaker mechanisms, significantly improves the authentication service's ability to support high-concurrency requests even under extreme conditions such as Redis outages. It also enables automatic checking and recovery, reducing manual intervention. During system emergency drills, service continued even when a single Redis node or all Redis nodes failed, and even when Redis virtual host migration required a one-hour Redis outage. Furthermore, the circuit breaker and recovery mechanisms ensured automatic recovery after a Redis restart, fully demonstrating the high reliability of this application.

[0090] Device embodiments

[0091] See Figure 4 The figure is a schematic diagram of a customer group data query device provided in an embodiment of this application, including: a Redis circuit breaker status judgment module 401, a first query module 402, an ElasticSearch circuit breaker status judgment module 403, a second query module 404, a ClickHouse circuit breaker status judgment module 405, a first display module 406, a third query module 407, and a second display module 408.

[0092] Among them, the Redis circuit breaker status judgment module 401 is used to determine whether Redis is in a circuit breaker state;

[0093] The first query module 402 is used to query the ID of the group to which the customer ID belongs, based on the customer ID, when Redis is in a non-circuit-breaker state.

[0094] The ElasticSearch circuit breaker status determination module 403 is used to determine whether ElasticSearch is in a circuit breaker state when Redis is in a circuit breaker state or when the result of querying the group ID of the customer ID using Redis is empty.

[0095] The second query module 404 is used to query the ID of the group to which the customer ID belongs based on the customer ID when the ElasticSearch is in a non-circuit-breaker state.

[0096] The ClickHouse circuit breaker status determination module 405 is used to determine whether ClickHouse is in a circuit breaker state when ElasticSearch is in a circuit breaker state.

[0097] The first display module 406 is used to display the error result when the ClickHouse is in a circuit-free state;

[0098] The third query module 407 is used to query the ID of the group to which the customer ID belongs based on the customer ID when the ClickHouse is in a non-circuit-breaker state.

[0099] The second display module 408 is used to display the ID of the group to which the queried customer ID belongs as the group data query result.

[0100] Optionally, the Redis circuit breaker status determination module 401 includes:

[0101] The data judgment submodule is used to determine whether there are any anomalies in Redis by querying data in Redis.

[0102] The status setting submodule is used to set the Redis to a circuit breaker state when an anomaly is found in the query.

[0103] Optionally, the device further includes:

[0104] The status detection module is used to detect the status of Redis at preset time intervals using a timed thread when Redis is in a circuit breaker state.

[0105] The status setting module is used to set the Redis status to a non-circuit breaker state when the detection result is non-abnormal.

[0106] Optionally, the device further includes:

[0107] The first Redis status detection module is used to detect whether Redis is in a non-circuit-breaker state after querying the ID of the group to which the customer ID belongs using ElasticSearch based on the customer ID.

[0108] The first data storage module is used to store the ID of the group to which the queried customer ID belongs to the cache when Redis is in a non-circuit-breaker state.

[0109] Optionally, the device further includes:

[0110] The second Redis status detection module is used to detect whether Redis is in a non-circuit-breaker state after querying the ID of the group rental where the customer ID is located using ClickHouse based on the customer ID.

[0111] The second data storage module is used to store the ID of the group to which the queried customer ID belongs to the cache when Redis is in a non-circuit-breaker state.

[0112] This application provides a customer group data query device that utilizes a Redis circuit breaker status judgment module, a first query module, an Elasticsearch circuit breaker status judgment module, a second query module, a ClickHouse circuit breaker status judgment module, a first display module, a third query module, and a second display module. The device determines whether Redis is in a circuit breaker state; when Redis is not in a circuit breaker state, it queries the ID of the group to which the customer ID belongs based on the customer ID; when Redis is in a circuit breaker state or the query result for the ID of the group to which the customer ID belongs is empty, it determines whether Elasticsearch is in a circuit breaker state; when Elasticsearch is not in a circuit breaker state, it queries the ID of the group to which the customer ID belongs based on the customer ID; when Elasticsearch is in a circuit breaker state, it determines whether ClickHouse is in a circuit breaker state; when ClickHouse is in a circuit breaker state, it displays query error results; when ClickHouse is not in a circuit breaker state, it queries the ID of the group to which the customer ID belongs based on the customer ID; and displays the queried ID of the group to which the customer ID belongs as the group data query result. Based on three databases that store data in different data formats, the reliability of query customer groups can be greatly improved through multi-level bypass and circuit breaker mechanisms, enabling the authentication service to still support high-concurrency requests even in extreme cases such as Redis outages.

[0113] Electronic device embodiments

[0114] See Figure 5 The figure is a schematic diagram of an electronic device structure provided in an embodiment of this application, including:

[0115] Memory 11 is used to store computer programs;

[0116] The processor 12 is used to implement the steps of the customer group data query method described in any of the above method embodiments when executing the computer program.

[0117] In this embodiment, the device can be an in-vehicle computer, a PC (Personal Computer), or a terminal device such as a smartphone, tablet computer, handheld computer, or portable computer.

[0118] The device may include a memory 11, a processor 12, and a bus 13.

[0119] The memory 11 includes at least one type of readable storage medium, such as flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 11 can be an internal storage unit of the device, such as the hard disk of the device. In other embodiments, the memory 11 can also be an external storage device of the device, such as a plug-in hard disk, SmartMedia Card (SMC), Secure Digital (SD) card, Flash Card, etc. Furthermore, the memory 11 can include both internal and external storage units of the device. The memory 11 can be used not only to store application software and various types of data installed on the device, such as program code executing customer group data query methods, but also to temporarily store data that has been output or will be output.

[0120] In some embodiments, processor 12 may be a central processing unit (CPU), controller, microcontroller, microprocessor or other data processing chip, used to run program code stored in memory 11 or process data, such as program code for executing a customer group data query method.

[0121] This bus 13 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 5 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.

[0122] Furthermore, the device may also include a network interface 14, which may optionally include a wired interface and / or a wireless interface (such as a Wi-Fi interface, a Bluetooth interface, etc.), typically used to establish communication connections between the device and other electronic devices.

[0123] Optionally, the device may further include a user interface 15, which may include a display, an input unit such as a keyboard, and optionally, a standard wired interface or a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen, etc. The display may also be appropriately referred to as a screen or display unit, used to display information processed in the device and to display a visual user interface.

[0124] Figure 5 Only devices with components 11-15 are shown; those skilled in the art will understand that... Figure 5 The structure shown does not constitute a limitation on the device and may include fewer or more components than shown, or combine certain components, or have different component arrangements.

[0125] Readable storage medium embodiments

[0126] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the customer group data query method described in any of the above method embodiments.

[0127] The storage medium may include various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0128] It should be noted that the various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, for the embodiments of apparatus, electronic devices, and readable storage media, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiments. The apparatus, electronic devices, and readable storage media embodiments described above are merely illustrative. The modules described as separate components may or may not be physically separate, and the components indicated as modules may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of the solution in this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.

[0129] The above description is merely one specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A method for querying customer group data, characterized in that, The method includes: Determine if Redis is in a circuit breaker state; When Redis is not in a circuit breaker state, use Redis to query the ID of the group to which the customer ID belongs based on the customer ID; If Redis is in a circuit breaker state or if the ID query result of the group to which the customer ID belongs is empty when using Redis, determine whether ElasticSearch is in a circuit breaker state. When Elasticsearch is in a non-circuit-breaker state, use Elasticsearch to query the ID of the group to which the customer ID belongs based on the customer ID; When ElasticSearch is in a circuit breaker state, determine whether ClickHouse is in a circuit breaker state. When ClickHouse is in a circuit breaker state, display the query error results; When ClickHouse is in a non-circuit-breaker state, the ID of the group to which the customer ID belongs is queried using ClickHouse based on the customer ID; The ID of the group to which the customer ID belongs will be displayed as the group data query result; The method further includes: When Redis is in a circuit breaker state, a timed thread is used to check the status of Redis at preset time intervals; If the detection result is not abnormal, the Redis state is set to non-circuit breaker state.

2. The method according to claim 1, characterized in that, The determination of whether Redis is in a circuit breaker state includes: Determine if there are any anomalies in Redis by querying data in Redis; If an anomaly is detected in the Redis instance, the Redis instance will be set to a circuit breaker state.

3. The method according to claim 1, characterized in that, The method further includes: After retrieving the ID of the group to which the customer ID belongs using ElasticSearch based on the customer ID, check whether Redis is in a non-circuit-breaker state; When Redis is not in a circuit breaker state, the ID of the group to which the queried customer ID belongs is stored in the cache.

4. The method according to claim 1, characterized in that, The method further includes: After using ClickHouse to query the ID of the group rental where the customer ID belongs based on the customer ID, check whether Redis is in a non-circuit break state. When Redis is not in a circuit breaker state, the ID of the group to which the queried customer ID belongs is stored in the cache.

5. A customer group data query device, characterized in that, The device includes: The Redis circuit breaker status detection module is used to determine whether Redis is in a circuit breaker state. The first query module is used to query the ID of the group to which the customer ID belongs, based on the customer ID, when Redis is in a non-circuit-break state. The ElasticSearch circuit breaker status determination module is used to determine whether ElasticSearch is in a circuit breaker state when Redis is in a circuit breaker state or when the result of querying the group ID of the customer ID using Redis is empty. The second query module is used to query the ID of the group to which the customer ID belongs based on the customer ID when the ElasticSearch is in a non-circuit-breaker state. The ClickHouse circuit breaker status determination module is used to determine whether ClickHouse is in a circuit breaker state when ElasticSearch is in a circuit breaker state. The first display module is used to display the error result when the ClickHouse is in a circuit breaker state; The third query module is used to query the ID of the group to which the customer ID belongs based on the customer ID when the ClickHouse is in a non-circuit-breaker state. The second display module is used to display the ID of the group to which the queried customer ID belongs as the group data query result; The device further includes: The status detection module is used to detect the status of Redis at preset time intervals using a timed thread when Redis is in a circuit breaker state. The status setting module is used to set the Redis status to a non-circuit breaker state when the detection result is non-abnormal.

6. The apparatus according to claim 5, characterized in that, The Redis circuit breaker status determination module includes: The data judgment submodule is used to determine whether there are any anomalies in Redis by querying data in Redis. The status setting submodule is used to set the Redis to a circuit breaker state when an anomaly is found in the query.

7. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the steps of the customer group data query method as described in any one of claims 1-4.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the customer group data query method as described in any one of claims 1-4.