[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

WO2023185071A1 - Data query method, data writing method, related apparatus and system - Google Patents

Data query method, data writing method, related apparatus and system Download PDF

Info

Publication number
WO2023185071A1
WO2023185071A1 PCT/CN2022/136753 CN2022136753W WO2023185071A1 WO 2023185071 A1 WO2023185071 A1 WO 2023185071A1 CN 2022136753 W CN2022136753 W CN 2022136753W WO 2023185071 A1 WO2023185071 A1 WO 2023185071A1
Authority
WO
WIPO (PCT)
Prior art keywords
storage cluster
cluster
data query
available storage
data
Prior art date
Application number
PCT/CN2022/136753
Other languages
French (fr)
Chinese (zh)
Inventor
张进
Original Assignee
北京沃东天骏信息技术有限公司
北京京东世纪贸易有限公司
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 北京沃东天骏信息技术有限公司, 北京京东世纪贸易有限公司 filed Critical 北京沃东天骏信息技术有限公司
Publication of WO2023185071A1 publication Critical patent/WO2023185071A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/008Reliability or availability analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/16Error detection or correction of the data by redundancy in hardware
    • G06F11/20Error detection or correction of the data by redundancy in hardware using active fault-masking, e.g. by switching out faulty elements or by switching in spare elements
    • G06F11/202Error detection or correction of the data by redundancy in hardware using active fault-masking, e.g. by switching out faulty elements or by switching in spare elements where processing functionality is redundant
    • G06F11/2023Failover techniques
    • G06F11/2025Failover techniques using centralised failover control functionality
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/16Error detection or correction of the data by redundancy in hardware
    • G06F11/20Error detection or correction of the data by redundancy in hardware using active fault-masking, e.g. by switching out faulty elements or by switching in spare elements
    • G06F11/202Error detection or correction of the data by redundancy in hardware using active fault-masking, e.g. by switching out faulty elements or by switching in spare elements where processing functionality is redundant
    • G06F11/2035Error detection or correction of the data by redundancy in hardware using active fault-masking, e.g. by switching out faulty elements or by switching in spare elements where processing functionality is redundant without idle spare hardware
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/16Error detection or correction of the data by redundancy in hardware
    • G06F11/20Error detection or correction of the data by redundancy in hardware using active fault-masking, e.g. by switching out faulty elements or by switching in spare elements
    • G06F11/2053Error detection or correction of the data by redundancy in hardware using active fault-masking, e.g. by switching out faulty elements or by switching in spare elements where persistent mass storage functionality or persistent mass storage control functionality is redundant
    • G06F11/2094Redundant storage or storage space
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2365Ensuring data consistency and integrity
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/24569Query processing with adaptation to specific hardware, e.g. adapted for using GPUs or SSDs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2201/00Indexing scheme relating to error detection, to error correction, and to monitoring
    • G06F2201/80Database-specific techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2201/00Indexing scheme relating to error detection, to error correction, and to monitoring
    • G06F2201/82Solving problems relating to consistency
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • the present disclosure relates to the field of computer technology, and in particular, to a data query method and device, a data writing method and device, and a data query system.
  • Option 1 is a cluster deployment based on ElasticSearch (a full-text retrieval framework, a search engine written in Java language), with one cluster limited to the same computer room;
  • Option 2 is a cluster deployment across computer rooms, to When the cluster writes data or reads data, communication needs to occur within the cluster.
  • Option 1 cannot achieve disaster recovery deployment between computer rooms. Once a computer room-level failure occurs, the entire cluster will be unavailable, and eventually the service will be unavailable. Option 2 will reduce the efficiency of communication within the cluster. When writing data to the cluster or reading data, When fetching data, it takes a lot of time due to the need for communication within the cluster.
  • embodiments of the present disclosure provide a data query method, a data writing method, related devices and systems, which can achieve consistency in writing data to multiple clusters, automatically switch clusters, and improve the disaster tolerance of cluster deployment. , which solves the problem of unavailability of the entire cluster when a computer room level failure occurs, and at the same time overcomes the time-consuming drawback of communication within the cluster.
  • a data query method is provided.
  • a data query method including: in response to a received data query request, obtaining an activity detection result for each storage cluster, the activity detection result indicating whether the corresponding storage cluster is currently available; according to the activity detection result for each storage cluster, Determine a list of available storage clusters; select a target available storage cluster from the list of available storage clusters according to the cluster selection settings, and send the data query request to the target available storage cluster, so that the corresponding target available storage cluster is returned data query results.
  • obtaining the live detection results for each storage cluster includes: obtaining the live detection results for each storage cluster from a configuration center or a local cache, where , the configuration center, through a dynamic listening mechanism, after listening to the detection results of the storage cluster by the detection node cluster, caches the corresponding detection results into the local cache.
  • the active detection node cluster includes one or more active detection nodes, and the active detection nodes are used to send health degree requests to each storage cluster respectively to determine the health status according to the The storage cluster's response to the health request determines whether the corresponding storage cluster is available.
  • determining the list of available storage clusters based on the detection results of each storage cluster includes: for each storage cluster, determining the activity of each detection node for the storage cluster. In the detection result, it is indicated whether the ratio of the number of detection nodes available to the storage cluster to the total number of detection nodes exceeds the proportion threshold. If so, it is determined that the storage cluster is available and added to the list of available storage clusters.
  • a target available storage cluster is selected from the list of available storage clusters, and the data query request is sent to the target available storage cluster to be sent by
  • the target available storage cluster returns corresponding data query results, including: taking all available storage clusters in the available storage cluster list as the target available storage clusters, and receiving the data query results returned by one of the target available storage clusters. Finally, output the data query results.
  • a target available storage cluster is selected from the list of available storage clusters, and the data query request is sent to the target available storage cluster to be sent by
  • the target available storage cluster returns corresponding data query results, including: selecting an available storage cluster currently polled from the list of available storage clusters according to the polling strategy as the target available storage cluster. After the target can store the data query results returned by the cluster, it outputs the data query results.
  • a target available storage cluster is selected from the list of available storage clusters, and the data query request is sent to the target available storage cluster to be sent by The target available storage cluster returns corresponding data query results, including: randomly selecting an available storage cluster from the list of available storage clusters as the target available storage cluster, and receiving the returned data from the target available storage cluster. After the data query results are obtained, the data query results are output.
  • a data writing method is provided.
  • a data writing method includes: initiating multiple monitoring of message middleware topics according to the number of storage clusters, each monitoring corresponding to a storage cluster, the message middleware topic includes data to be written; in response to the Each listener of the message middleware topic writes the data to be written to the corresponding storage cluster.
  • a data query device is provided.
  • a data query device including: a detection result acquisition module, configured to obtain the detection results of each storage cluster in response to a received data query request, the detection results indicating whether the corresponding storage cluster is currently available; available storage
  • the cluster determination module is used to determine the available storage cluster list based on the detection results of each storage cluster; the data query module is used to select the target available storage cluster from the available storage cluster list according to the cluster selection settings, and add the The data query request is sent to the target available storage cluster, so that the corresponding data query result is returned by the target available storage cluster.
  • a data writing device is provided.
  • a data writing device includes: a monitoring module, configured to initiate multiple monitoring of message middleware topics according to the number of storage clusters. Each monitoring corresponds to a storage cluster, and the message middleware topic includes data to be written. ; A data writing module, configured to write the data to be written to the corresponding storage cluster in response to each monitoring of the message middleware topic.
  • a data query system is provided.
  • a data query system includes: the data query device provided by the embodiment of the present disclosure, and also includes each storage cluster, a configuration center and a live detection node cluster, wherein: the live detection node cluster includes one or more live detection nodes, so The health detection node is used to send health request to each storage cluster respectively, so as to determine the health detection result of the storage cluster according to the response of the storage cluster to the health request.
  • the health detection result indicates Whether the corresponding storage cluster is currently available; the configuration center is configured to receive the detection results reported by each of the detection nodes, and provide the detection results to the data query device.
  • an electronic device is provided.
  • An electronic device including: one or more processors; a memory for storing one or more programs, when the one or more programs are executed by the one or more processors, such that the one or more programs
  • Multiple processors implement the data query method or data writing method provided by the embodiments of the present disclosure.
  • a computer-readable medium is provided.
  • the computer program is executed by a processor, the data query method or the data writing method provided by the embodiment of the present disclosure is implemented.
  • Figure 1 is a schematic diagram of the main steps of a data query method according to one or more embodiments of the present disclosure
  • Figure 2 is a schematic diagram of the main steps of a data writing method according to one or more embodiments of the present disclosure
  • Figure 3 is a flow diagram of data query and data writing according to one or more embodiments of the present disclosure
  • Figure 4 is a schematic diagram of the main modules of a data query device according to one or more embodiments of the present disclosure
  • Figure 5 is a schematic diagram of the main modules of a data writing device according to one or more embodiments of the present disclosure
  • Figure 6 is a schematic diagram of the main architecture of a data query system according to one or more embodiments of the present disclosure
  • Figure 7 is an exemplary system architecture diagram to which one or more embodiments of the present disclosure may be applied;
  • Figure 8 is a schematic structural diagram of a computer system suitable for implementing a terminal device or server in one or more embodiments of the present disclosure.
  • Figure 1 is a schematic diagram of the main steps of a data query method according to one or more embodiments of the present disclosure.
  • the data query method in one or more embodiments of the present disclosure mainly includes the following steps S101 to S103.
  • Step S101 In response to the received data query request, obtain the activity detection results of each storage cluster.
  • the activity detection results indicate whether the corresponding storage cluster is currently available.
  • Obtaining the live detection results of each storage cluster may include: obtaining the live detection results of each storage cluster from the configuration center or the local cache.
  • the configuration center uses a dynamic monitoring mechanism to detect the live node cluster. After storing the cluster's liveness detection results, cache the corresponding liveness detection results in the local cache.
  • the live detection node cluster may include one or more live detection nodes.
  • the live detection nodes are used to send health status requests to each storage cluster respectively to determine whether the corresponding storage cluster is available based on the storage cluster's response to the health status request.
  • the storage cluster is such as an ES (Elastic Search) cluster.
  • ES Elastic Search
  • Step S102 Determine the list of available storage clusters based on the detection results of each storage cluster.
  • Determining the list of available storage clusters based on the detection results of each storage cluster may include: for each storage cluster, determining the detection results of each detection node for the storage cluster to indicate the number of detection nodes available for the storage cluster. Whether the proportion of the total number of active nodes exceeds the proportion threshold, if so, the storage cluster is determined to be available and added to the list of available storage clusters.
  • Step S103 According to the cluster selection settings, select the target available storage cluster from the available storage cluster list, and send the data query request to the target available storage cluster, so that the target available storage cluster returns the corresponding data query result.
  • select the target available storage cluster from the available storage cluster list send the data query request to the target available storage cluster, so that the target available storage cluster returns the corresponding data query result, which may include: Use all available storage clusters in the available storage cluster list as the target available storage cluster, and after receiving the data query result returned by one of the target available storage clusters, output the data query result.
  • select the target available storage cluster from the available storage cluster list send the data query request to the target available storage cluster, so that the target available storage cluster returns the corresponding data query result, which may include :
  • select the target available storage cluster from the available storage cluster list send the data query request to the target available storage cluster, so that the target available storage cluster returns the corresponding data query result, which may include : Randomly select an available storage cluster from the list of available storage clusters as the target available storage cluster. After receiving the data query results returned by the target available storage cluster, output the data query results.
  • FIG. 2 is a schematic diagram of the main steps of a data writing method according to one or more embodiments of the present disclosure.
  • the data writing method mainly includes the following steps S201 to S202.
  • Step S201 According to the number of storage clusters, initiate multiple monitoring of the message middleware topic. Each monitoring corresponds to a storage cluster.
  • the message middleware topic includes data to be written.
  • Step S202 In response to each monitoring of the message middleware topic, write the data to be written into the corresponding storage cluster.
  • Message middleware such as Message Queuing (MQ).
  • writing the data to be written to the corresponding storage cluster may include: in response to each monitoring of the message middleware topic, writing the data to be written through the preset writing interface.
  • the data is written to the corresponding storage cluster.
  • the parameters of the preset writing interface include the identification (ID) of each storage cluster. If the data to be written in any storage cluster fails to be written, the storage cluster will be retried. The operation to write the data to be written.
  • the data when the business needs to write data to the ES, the data is sent to a message queue topic, and the data is written to the ES by monitoring the message queue topic. In this way, the writing operation and the final The write action is decoupled, and multiple storage clusters will listen to this message queue topic multiple times when writing. If a storage cluster fails to write, it only needs to be retried by the storage cluster.
  • most message queue middleware Final consistency can be achieved, and this feature can be applied to achieve final consistency of multi-storage cluster data and greatly enhance scalability.
  • Figure 3 is a schematic flowchart of data query and data writing according to one or more embodiments of the present disclosure.
  • the client may be a device used for data query and/or data writing.
  • the configuration center uses a dynamic monitoring mechanism to listen to the detection results of the storage cluster by the detection node cluster, and caches the corresponding detection results into the local cache, and the client responds
  • the received data query request obtains the live detection results of each storage cluster by the active node cluster from the configuration center or local cache.
  • the storage cluster can be an ES (ElasticSearch) cluster, and ES clusters (clusters for short) are deployed in multiple computer rooms.
  • Each cluster can be named cluster1, cluster2..., and all clusters can be collectively called es-cluster;
  • build a configuration center the configuration center can be zookeeper (a high-availability distributed configuration center);
  • build a live detection node cluster the live detection node cluster can include at least 3 live detection nodes, and the live detection nodes can be named node1, node2, node3...( As shown in Figure 3, three nodes are used as an example, namely node 1, node 2, and node 3).
  • Each active node is connected to each ES cluster; build a client for data query, and establish a client for each ES. Connection to the cluster and connection to the configuration center. Start the liveness detection program.
  • Each liveness detection node in the liveness detection node cluster periodically initiates a health request to each ES cluster.
  • the ES cluster responds to the health request to generate a liveness detection result and stores it in the es-cluster directory.
  • the configuration center dynamically monitors the es-cluster directory. When the directory changes, the configuration center modifies the client's local cache and saves the detection results to the client's local cache.
  • the client obtains the live detection results from the configuration center or local cache.
  • local caching can be implemented through Map (an object that maps keys to values).
  • each storage cluster it is determined whether the ratio of the number of active detection nodes available to the storage cluster to the total number of active detection nodes in the detection result of each active detection node for the storage cluster exceeds the proportion threshold. If so, , it is determined that the storage cluster is available and added to the list of available storage clusters. For example, there are two storage clusters (a, b), the number of active detection nodes is 3, and the detection results of the three active detection nodes on the storage cluster are (1, 1), (0, 1), (0 , 0), where 1 means available and 0 means unavailable. The first number in the detection result is the available status of the first cluster, and the second number is the available status of the second cluster. Then there is a detection result.
  • the activity detection results of nodes indicate that cluster a is available, and the activity detection results of two active nodes indicate that cluster b is available. If the proportion threshold is set to 0.5, then for cluster a, the proportion of the number of active detection nodes available in the cluster to the total number of active detection nodes is 1/3. If the proportion threshold of 0.5 is not exceeded, cluster a will be unavailable and cluster a will not be used. Add to the list of available storage clusters; for cluster b, the ratio of the number of active active nodes indicating that the cluster is available to the total number of active active nodes is 2/3, exceeding the proportion threshold of 0.5, then cluster b is available, and cluster b is added to the available storage Cluster list. Unavailable storage clusters can be reported for repair.
  • the target available storage cluster is selected from the available storage cluster list, and the data query request is sent to the target available storage cluster, so that the target available storage cluster returns the corresponding data query result.
  • the load balancing strategy is determined according to the load size of the cluster to perform cluster selection settings.
  • the load balancing strategy can include all request strategies, polling strategies, and random strategies. Among them, the all request strategy uses all available storage clusters in the available storage cluster list as the target available storage cluster. After receiving the data query result returned by one of the target available storage clusters, the data query result is output. This strategy can flatten the network.
  • Polling strategy that is, according to the polling strategy, select an available storage cluster currently polled from the list of available storage clusters as the target available storage cluster. After receiving the data query results returned by the target available storage cluster, output the data query result.
  • the random strategy uses a random algorithm to randomly select an available storage cluster from the list of available storage clusters each time as the target available storage cluster. After receiving the data query results returned by the target available storage cluster, the data query results are output.
  • multiple monitoring of the message middleware topic is initiated according to the number of storage clusters.
  • Each monitoring corresponds to a storage cluster.
  • the preset writing interface Write the data to be written into the corresponding storage cluster.
  • the parameters of the preset writing interface include the identification of each storage cluster. Specifically, when there is a writing action, the data to be written is sent to the message middleware topic. According to the identification of each storage cluster to be written included in the writing interface parameters, the data to be written is established by mapping.
  • Each storage cluster subscribes to the message middleware topic to monitor the message middleware topic. The number of subscriptions is the same as the number of storage clusters to be written.
  • Each storage cluster writes the data to be written to each storage cluster by listening to this message middleware topic multiple times. If a storage cluster fails to write, you only need to retry the storage cluster. Based on the message middleware, the disclosed embodiment can achieve the ultimate consistency of each storage cluster and greatly enhance the scalability.
  • Figure 4 is a schematic diagram of the main modules of a data query device according to one or more embodiments of the present disclosure.
  • a data query device 400 mainly includes: a life detection result acquisition module 401, an available storage cluster determination module 402, and a data query module 403.
  • the activity detection result acquisition module 401 is used to obtain the activity detection results of each storage cluster in response to the received data query request, and the activity detection results indicate whether the corresponding storage cluster is currently available.
  • the available storage cluster determination module 402 is used to determine a list of available storage clusters based on the detection results of each storage cluster.
  • the data query module 403 is used to select a target available storage cluster from the available storage cluster list according to the cluster selection settings, and send a data query request to the target available storage cluster, so that the target available storage cluster returns the corresponding data query result.
  • the active detection result acquisition module 401 is specifically used to: obtain the active detection result of each storage cluster by the active detection node cluster from the configuration center or the local cache, wherein the configuration center uses a dynamic monitoring mechanism to detect the active detection result. After the live node cluster stores the liveness detection results of the cluster, it caches the corresponding liveness detection results into the local cache.
  • the available storage cluster determination module 402 is specifically configured to: for each storage cluster, determine the active detection results of each active node for the storage cluster, and indicate the number of active active nodes available for the storage cluster. Whether the proportion of the total number of nodes exceeds the proportion threshold, if so, the storage cluster is determined to be available and added to the list of available storage clusters.
  • the data query module 403 is specifically configured to: use all available storage clusters in the available storage cluster list as target available storage clusters, and output the data query after receiving the data query result returned by one of the target available storage clusters. result.
  • the data query module 403 is specifically configured to: select an available storage cluster that is currently polled from the list of available storage clusters according to the polling policy, as the target available storage cluster, and return after receiving the target available storage cluster. After the data query results, output the data query results.
  • the data query module 403 is specifically configured to: randomly select an available storage cluster from the list of available storage clusters as the target available storage cluster, and output the data after receiving the data query results returned by the target available storage cluster. search result.
  • Figure 5 is a schematic diagram of the main modules of a data writing device according to one or more embodiments of the present disclosure.
  • a data writing device 500 mainly includes: a monitoring module 501 and a data writing module 502.
  • the monitoring module 501 is used to initiate multiple monitoring of message middleware topics according to the number of storage clusters. Each monitoring corresponds to a storage cluster, and the message middleware topic includes data to be written.
  • the data writing module 502 is configured to respond to each monitoring of the message middleware topic and write the data to be written into the corresponding storage cluster.
  • the data writing module 502 is specifically configured to: in response to each monitoring of the message middleware topic, write the data to be written to the corresponding storage cluster through the preset writing interface.
  • the preset writing interface The parameters of the incoming interface include the identification of each storage cluster. If the writing of the data to be written in any storage cluster fails, the operation of writing the data to be written to the storage cluster is retried.
  • Figure 6 is a schematic diagram of the main architecture of a data query system according to one or more embodiments of the present disclosure.
  • a data query system 600 mainly includes: a data query device 601, and also includes a storage cluster 602, a configuration center 603, and a live detection node cluster 604.
  • the number of storage clusters 602 is multiple.
  • the data query device 601 has the same functional modules as the data query device 400 in the above embodiment.
  • the live detection node cluster 604 includes one or more live detection nodes.
  • the live detection nodes are used to send health request to each storage cluster respectively to determine the live detection result of the storage cluster based on the response of the storage cluster to the health request.
  • the live result indicates whether the corresponding storage cluster is currently available.
  • the configuration center 603 is configured to receive the activity detection results reported by each activity detection node, and provide the activity detection results to the data query device.
  • the configuration center 603 is specifically configured to provide the data query device 601 with a probe result in response to the probe result acquisition request of the data query device 601 .
  • the configuration center 603 is specifically configured to: use a dynamic listening mechanism to, after listening to the detection results of the storage cluster by the detection node cluster, cache the corresponding detection results to the local cache corresponding to the data query device 601 .
  • FIG. 7 shows an exemplary system architecture 700 to which the data query method, data writing method, data query device, data writing device or data query system in one or more embodiments of the present disclosure can be applied.
  • the system architecture 700 may include terminal devices 701, 702, 703, a network 704 and a server 705.
  • Network 704 is a medium used to provide communication links between terminal devices 701, 702, 703 and server 705.
  • Network 704 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
  • Terminal devices 701, 702, 703 Users can use terminal devices 701, 702, 703 to interact with the server 705 through the network 704 to receive or send messages, etc.
  • Various communication client applications can be installed on the terminal devices 701, 702, and 703, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only examples).
  • the terminal devices 701, 702, and 703 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and so on.
  • the server 705 may be a server that provides various services, such as a backend management server that provides support for shopping websites browsed by users using the terminal devices 701, 702, and 703 (example only).
  • the background management server can analyze and process the received product information query request and other data, and feed back the processing results (such as target push information, product information - only examples) to the terminal device.
  • the data query method provided by the embodiment of the present disclosure is generally executed by the server 705 or the terminal devices 701, 702, and 703.
  • the data query device is generally provided on the server 705 or the terminal device 701. , 702, 703.
  • the data writing method provided by the embodiment of the present disclosure is generally executed by the server 705 or the terminal devices 701, 702, 703.
  • the data writing device is generally provided on the server 705 or the terminal devices 701, 702. , 703.
  • FIG. 8 a schematic structural diagram of a computer system 800 suitable for implementing a terminal device or server in one or more embodiments of the present disclosure is shown.
  • the terminal device or server shown in FIG. 8 is only an example and should not impose any restrictions on the functions and usage scope of the embodiments of the present disclosure.
  • computer system 800 includes a central processing unit (CPU) 801 that can operate according to a program stored in a read-only memory (ROM) 802 or loaded from a storage portion 808 into a random access memory (RAM) 803. And perform various appropriate actions and processing.
  • ROM read-only memory
  • RAM random access memory
  • CPU 801, ROM 802 and RAM 803 are connected to each other via bus 804.
  • I/O input/output
  • the following components are connected to the I/O interface 805: an input section 806 including a keyboard, a mouse, etc.; an output section 807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., speakers, etc.; and a storage section 808 including a hard disk, etc. ; and a communication section 809 including a network interface card such as a LAN card, a modem, etc.
  • the communication section 809 performs communication processing via a network such as the Internet.
  • Driver 810 is also connected to I/O interface 805 as needed.
  • Removable media 811 such as magnetic disks, optical disks, magneto-optical disks, semiconductor memories, etc., are installed on the drive 810 as needed, so that a computer program read therefrom is installed into the storage portion 808 as needed.
  • embodiments of the present disclosure include a computer program product including a computer program carried on a computer-readable medium, the computer program containing program code for performing the method illustrated in the flowchart.
  • the computer program may be downloaded and installed from the network via communications portion 809 and/or installed from removable media 811 .
  • the central processing unit (CPU) 801 the above-described functions defined in the system of the present disclosure are performed.
  • the computer-readable medium shown in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the above two.
  • the computer-readable storage medium may be, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus or device, or any combination thereof. More specific examples of computer readable storage media may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard drive, random access memory (RAM), read only memory (ROM), removable Programmd read-only memory (EPROM or flash memory), fiber optics, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above.
  • a computer-readable storage medium may be any tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device.
  • a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code therein. Such propagated data signals may take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above.
  • a computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device .
  • Program code embodied on a computer-readable medium may be transmitted using any suitable medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the foregoing.
  • each block in the flowchart or block diagrams may represent a module, segment, or portion of code that contains one or more logic functions that implement the specified executable instructions.
  • the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown one after another may actually execute substantially in parallel, or they may sometimes execute in the reverse order, depending on the functionality involved.
  • each block in the block diagram or flowchart illustration, and combinations of blocks in the block diagram or flowchart illustration can be implemented by special purpose hardware-based systems that perform the specified functions or operations, or may be implemented by special purpose hardware-based systems that perform the specified functions or operations. Achieved by a combination of specialized hardware and computer instructions.
  • the modules involved in the embodiments of the present disclosure can be implemented in software or hardware.
  • the described module can also be provided in a processor.
  • a processor includes a detection result acquisition module, an available storage cluster determination module, and a data query module.
  • the names of these modules do not constitute a limitation on the module itself under certain circumstances.
  • the detection result acquisition module can also be described as "used to obtain data about each storage cluster in response to the received data query request.” Module for detecting live results”.
  • the present disclosure also provides a computer-readable medium.
  • the computer-readable medium may be included in the device described in the above embodiments; it may also exist separately without being assembled into the device.
  • the above-mentioned computer-readable medium carries one or more programs.
  • the device includes: in response to the received data query request, obtain the detection results of each storage cluster, The detection result indicates whether the corresponding storage cluster is currently available; according to the detection result of each storage cluster, the list of available storage clusters is determined; according to the cluster selection settings, the target available storage cluster is selected from the list of available storage clusters, and the data query request is sent Go to the target available storage cluster to return the corresponding data query results from the target available storage cluster.
  • the detection results of each storage cluster are obtained, and the detection results indicate whether the corresponding storage cluster is currently available; according to the detection results of each storage cluster, it is determined List of available storage clusters; according to the cluster selection settings, select the target available storage cluster from the list of available storage clusters, send the data query request to the target available storage cluster, and return the corresponding data query results from the target available storage cluster.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Quality & Reliability (AREA)
  • Data Mining & Analysis (AREA)
  • Computational Linguistics (AREA)
  • Computer Security & Cryptography (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

Disclosed are a data query method, a data writing method, a related apparatus and a system. A specific embodiment comprises: in response to a received data query request, obtaining a liveness probe result for each storage cluster, the liveness probe result indicating whether a corresponding storage cluster is currently available; according to the liveness probe result for each storage cluster, determining an available storage cluster list; and selecting a target available storage cluster from the available storage cluster list according to a cluster selection setting, and sending the data query request to the target available storage cluster, so that the target available storage cluster returns a corresponding data query result.

Description

数据查询方法、数据写入方法、相关装置和系统Data query method, data writing method, related devices and systems
相关申请的交叉引用Cross-references to related applications
本申请要求享有2022年3月31日提交的名称为“一种数据查询方法、数据写入方法、相关装置和系统”的中国专利申请No.202210331107.9的优先权,在此全文引用上述中国专利申请公开的内容以作为本申请的一部分或全部。This application claims priority to Chinese patent application No. 202210331107.9 titled "A data query method, data writing method, related devices and systems" submitted on March 31, 2022. The above Chinese patent application is cited in full here. The disclosed content shall be included as part or all of this application.
技术领域Technical field
本公开涉及计算机技术领域,尤其涉及一种数据查询方法和装置、数据写入方法和装置、以及数据查询系统。The present disclosure relates to the field of computer technology, and in particular, to a data query method and device, a data writing method and device, and a data query system.
背景技术Background technique
目前集群部署有两种方案:方案一为基于ElasticSearch(一种全文检索框架,是一个java语言编写的搜索引擎)的集群部署,一个集群局限于同一个机房;方案二为跨机房部署集群,向集群写入数据,或者读取数据时,集群内部需要进行通信。There are currently two options for cluster deployment: Option 1 is a cluster deployment based on ElasticSearch (a full-text retrieval framework, a search engine written in Java language), with one cluster limited to the same computer room; Option 2 is a cluster deployment across computer rooms, to When the cluster writes data or reads data, communication needs to occur within the cluster.
在实现本公开过程中,发明人发现现有技术中至少存在如下问题:In the process of realizing the present disclosure, the inventor found that there are at least the following problems in the prior art:
方案一无法实现机房之间的容灾部署,一旦出现机房级别的故障,将会导致整个集群不可用,最终导致服务不可用;方案二集群内通信的效率降低,在向集群写入数据或者读取数据时,由于集群内部需要进行通信,耗费时间大。Option 1 cannot achieve disaster recovery deployment between computer rooms. Once a computer room-level failure occurs, the entire cluster will be unavailable, and eventually the service will be unavailable. Option 2 will reduce the efficiency of communication within the cluster. When writing data to the cluster or reading data, When fetching data, it takes a lot of time due to the need for communication within the cluster.
发明内容Contents of the invention
有鉴于此,本公开实施例提供一种数据查询方法、数据写入方法、相关装置和系统,能够实现向多个集群写入数据的一致性,可自动切换集群,提高集群部署的容灾能力,解决了在机房级别故障时导致整个集群不可用的问题,同时克服了由于集群内部需要进行通信而耗费 时间大的缺陷。In view of this, embodiments of the present disclosure provide a data query method, a data writing method, related devices and systems, which can achieve consistency in writing data to multiple clusters, automatically switch clusters, and improve the disaster tolerance of cluster deployment. , which solves the problem of unavailability of the entire cluster when a computer room level failure occurs, and at the same time overcomes the time-consuming drawback of communication within the cluster.
为实现上述目的,根据本公开实施例的一个方面,提供了一种数据查询方法。To achieve the above object, according to one aspect of an embodiment of the present disclosure, a data query method is provided.
一种数据查询方法,包括:响应于接收的数据查询请求,获取对各存储集群的探活结果,所述探活结果指示对应的存储集群当前是否可用;根据对各存储集群的探活结果,确定可用存储集群列表;按照集群选取设置,从所述可用存储集群列表中选取目标可用存储集群,将所述数据查询请求发送到所述目标可用存储集群,以由所述目标可用存储集群返回对应的数据查询结果。A data query method, including: in response to a received data query request, obtaining an activity detection result for each storage cluster, the activity detection result indicating whether the corresponding storage cluster is currently available; according to the activity detection result for each storage cluster, Determine a list of available storage clusters; select a target available storage cluster from the list of available storage clusters according to the cluster selection settings, and send the data query request to the target available storage cluster, so that the corresponding target available storage cluster is returned data query results.
在本公开的一个或多个实施例中,所述获取对各存储集群的探活结果,包括:从配置中心或本地缓存中获取探活节点集群对所述各存储集群的探活结果,其中,所述配置中心通过动态监听机制,在监听到所述探活节点集群对所述存储集群的探活结果后,将对应的所述探活结果缓存到所述本地缓存。In one or more embodiments of the present disclosure, obtaining the live detection results for each storage cluster includes: obtaining the live detection results for each storage cluster from a configuration center or a local cache, where , the configuration center, through a dynamic listening mechanism, after listening to the detection results of the storage cluster by the detection node cluster, caches the corresponding detection results into the local cache.
在本公开的一个或多个实施例中,所述探活节点集群包括一个或多个探活节点,所述探活节点用于向所述各存储集群分别发送健康度请求,以根据所述存储集群对所述健康度请求的响应情况,确定对应的所述存储集群是否可用。In one or more embodiments of the present disclosure, the active detection node cluster includes one or more active detection nodes, and the active detection nodes are used to send health degree requests to each storage cluster respectively to determine the health status according to the The storage cluster's response to the health request determines whether the corresponding storage cluster is available.
在本公开的一个或多个实施例中,所述根据对各存储集群的探活结果,确定可用存储集群列表,包括:对于每一存储集群,判断各所述探活节点对该存储集群的探活结果中,指示该存储集群可用的探活节点数量占探活节点总数的比例是否超过比例阈值,若是,则确定该存储集群可用,并添加到所述可用存储集群列表。In one or more embodiments of the present disclosure, determining the list of available storage clusters based on the detection results of each storage cluster includes: for each storage cluster, determining the activity of each detection node for the storage cluster. In the detection result, it is indicated whether the ratio of the number of detection nodes available to the storage cluster to the total number of detection nodes exceeds the proportion threshold. If so, it is determined that the storage cluster is available and added to the list of available storage clusters.
在本公开的一个或多个实施例中,所述按照集群选取设置,从所 述可用存储集群列表中选取目标可用存储集群,将所述数据查询请求发送到所述目标可用存储集群,以由所述目标可用存储集群返回对应的数据查询结果,包括:以所述可用存储集群列表中的所有可用存储集群作为所述目标可用存储集群,在收到其中一个目标可用存储集群返回的数据查询结果后,输出所述数据查询结果。In one or more embodiments of the present disclosure, according to the cluster selection setting, a target available storage cluster is selected from the list of available storage clusters, and the data query request is sent to the target available storage cluster to be sent by The target available storage cluster returns corresponding data query results, including: taking all available storage clusters in the available storage cluster list as the target available storage clusters, and receiving the data query results returned by one of the target available storage clusters. Finally, output the data query results.
在本公开的一个或多个实施例中,所述按照集群选取设置,从所述可用存储集群列表中选取目标可用存储集群,将所述数据查询请求发送到所述目标可用存储集群,以由所述目标可用存储集群返回对应的数据查询结果,包括:按照轮询策略从所述可用存储集群列表中选出当前轮询到的一个可用存储集群,作为所述目标可用存储集群,在收到所述目标可用存储集群返回的数据查询结果后,输出所述数据查询结果。In one or more embodiments of the present disclosure, according to the cluster selection setting, a target available storage cluster is selected from the list of available storage clusters, and the data query request is sent to the target available storage cluster to be sent by The target available storage cluster returns corresponding data query results, including: selecting an available storage cluster currently polled from the list of available storage clusters according to the polling strategy as the target available storage cluster. After the target can store the data query results returned by the cluster, it outputs the data query results.
在本公开的一个或多个实施例中,所述按照集群选取设置,从所述可用存储集群列表中选取目标可用存储集群,将所述数据查询请求发送到所述目标可用存储集群,以由所述目标可用存储集群返回对应的数据查询结果,包括:从所述可用存储集群列表中随机选出一个可用存储集群,作为所述目标可用存储集群,在收到所述目标可用存储集群返回的数据查询结果后,输出所述数据查询结果。In one or more embodiments of the present disclosure, according to the cluster selection setting, a target available storage cluster is selected from the list of available storage clusters, and the data query request is sent to the target available storage cluster to be sent by The target available storage cluster returns corresponding data query results, including: randomly selecting an available storage cluster from the list of available storage clusters as the target available storage cluster, and receiving the returned data from the target available storage cluster. After the data query results are obtained, the data query results are output.
根据本公开实施例的另一方面,提供了一种数据写入方法。According to another aspect of an embodiment of the present disclosure, a data writing method is provided.
一种数据写入方法,包括:根据存储集群的数量,发起对消息中间件主题的多个监听,每一监听对应一个存储集群,所述消息中间件主题包括待写入数据;响应于对所述消息中间件主题的每一监听,将所述待写入数据写入对应的存储集群。A data writing method includes: initiating multiple monitoring of message middleware topics according to the number of storage clusters, each monitoring corresponding to a storage cluster, the message middleware topic includes data to be written; in response to the Each listener of the message middleware topic writes the data to be written to the corresponding storage cluster.
根据本公开实施例的又一方面,提供了一种数据查询装置。According to another aspect of the embodiments of the present disclosure, a data query device is provided.
一种数据查询装置,包括:探活结果获取模块,用于响应于接收的数据查询请求,获取对各存储集群的探活结果,所述探活结果指示对应的存储集群当前是否可用;可用存储集群确定模块,用于根据对各存储集群的探活结果,确定可用存储集群列表;数据查询模块,用于按照集群选取设置,从所述可用存储集群列表中选取目标可用存储集群,将所述数据查询请求发送到所述目标可用存储集群,以由所述目标可用存储集群返回对应的数据查询结果。A data query device, including: a detection result acquisition module, configured to obtain the detection results of each storage cluster in response to a received data query request, the detection results indicating whether the corresponding storage cluster is currently available; available storage The cluster determination module is used to determine the available storage cluster list based on the detection results of each storage cluster; the data query module is used to select the target available storage cluster from the available storage cluster list according to the cluster selection settings, and add the The data query request is sent to the target available storage cluster, so that the corresponding data query result is returned by the target available storage cluster.
根据本公开实施例的又一方面,提供了一种数据写入装置。According to yet another aspect of an embodiment of the present disclosure, a data writing device is provided.
一种数据写入装置,包括:监听模块,用于根据存储集群的数量,发起对消息中间件主题的多个监听,每一监听对应一个存储集群,所述消息中间件主题包括待写入数据;数据写入模块,用于响应于对所述消息中间件主题的每一监听,将所述待写入数据写入对应的存储集群。A data writing device includes: a monitoring module, configured to initiate multiple monitoring of message middleware topics according to the number of storage clusters. Each monitoring corresponds to a storage cluster, and the message middleware topic includes data to be written. ; A data writing module, configured to write the data to be written to the corresponding storage cluster in response to each monitoring of the message middleware topic.
根据本公开实施例的又一方面,提供了一种数据查询系统。According to yet another aspect of the embodiments of the present disclosure, a data query system is provided.
一种数据查询系统,包括:本公开实施例提供的数据查询装置,还包括各存储集群、配置中心和探活节点集群,其中:所述探活节点集群包括一个或多个探活节点,所述探活节点用于向所述各存储集群分别发送健康度请求,以根据所述存储集群对所述健康度请求的响应情况,确定所述存储集群的探活结果,所述探活结果指示对应的所述存储集群当前是否可用;所述配置中心用于接收各所述探活节点上报的所述探活结果,并向所述数据查询装置提供所述探活结果。A data query system includes: the data query device provided by the embodiment of the present disclosure, and also includes each storage cluster, a configuration center and a live detection node cluster, wherein: the live detection node cluster includes one or more live detection nodes, so The health detection node is used to send health request to each storage cluster respectively, so as to determine the health detection result of the storage cluster according to the response of the storage cluster to the health request. The health detection result indicates Whether the corresponding storage cluster is currently available; the configuration center is configured to receive the detection results reported by each of the detection nodes, and provide the detection results to the data query device.
根据本公开实施例的又一方面,提供了一种电子设备。According to yet another aspect of embodiments of the present disclosure, an electronic device is provided.
一种电子设备,包括:一个或多个处理器;存储器,用于存储一个或多个程序,当所述一个或多个程序被所述一个或多个处理器执行 时,使得所述一个或多个处理器实现本公开实施例所提供的数据查询方法或数据写入方法。An electronic device, including: one or more processors; a memory for storing one or more programs, when the one or more programs are executed by the one or more processors, such that the one or more programs Multiple processors implement the data query method or data writing method provided by the embodiments of the present disclosure.
根据本公开实施例的又一方面,提供了一种计算机可读介质。According to yet another aspect of embodiments of the present disclosure, a computer-readable medium is provided.
一种计算机可读介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现本公开实施例所提供的数据查询方法或数据写入方法。A computer-readable medium on which a computer program is stored. When the computer program is executed by a processor, the data query method or the data writing method provided by the embodiment of the present disclosure is implemented.
上述的非惯用的可选方式所具有的进一步效果将在下文中结合具体实施方式加以说明。Further effects of the above-mentioned non-conventional optional methods will be described below in conjunction with specific implementations.
附图说明Description of drawings
附图用于更好地理解本公开,不构成对本公开的不当限定。其中:The accompanying drawings are used for a better understanding of the present disclosure and do not constitute an improper limitation of the present disclosure. in:
图1是根据本公开一个或多个实施例中的数据查询方法的主要步骤示意图;Figure 1 is a schematic diagram of the main steps of a data query method according to one or more embodiments of the present disclosure;
图2是根据本公开一个或多个实施例中的数据写入方法的主要步骤示意图;Figure 2 is a schematic diagram of the main steps of a data writing method according to one or more embodiments of the present disclosure;
图3是根据本公开一个或多个实施例中的数据查询和数据写入的流程示意图;Figure 3 is a flow diagram of data query and data writing according to one or more embodiments of the present disclosure;
图4是根据本公开一个或多个实施例中的数据查询装置的主要模块示意图;Figure 4 is a schematic diagram of the main modules of a data query device according to one or more embodiments of the present disclosure;
图5是根据本公开一个或多个实施例中的数据写入装置的主要模块示意图;Figure 5 is a schematic diagram of the main modules of a data writing device according to one or more embodiments of the present disclosure;
图6是根据本公开一个或多个实施例中的数据查询系统的主要架构示意图;Figure 6 is a schematic diagram of the main architecture of a data query system according to one or more embodiments of the present disclosure;
图7是本公开一个或多个实施例中可以应用于其中的示例性系统架构图;Figure 7 is an exemplary system architecture diagram to which one or more embodiments of the present disclosure may be applied;
图8是适于用来实现本公开一个或多个实施例中的终端设备或服务器的计算机系统的结构示意图。Figure 8 is a schematic structural diagram of a computer system suitable for implementing a terminal device or server in one or more embodiments of the present disclosure.
具体实施方式Detailed ways
以下结合附图对本公开的示范性实施例做出说明,其中包括本公开实施例的各种细节以助于理解,应当将它们认为仅仅是示范性的。因此,本领域普通技术人员应当认识到,可以对这里描述的实施例做出各种改变和修改,而不会背离本公开的范围和精神。同样,为了清楚和简明,以下的描述中省略了对公知功能和结构的描述。Exemplary embodiments of the present disclosure are described below with reference to the accompanying drawings, in which various details of the embodiments of the present disclosure are included to facilitate understanding and should be considered to be exemplary only. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the disclosure. Also, descriptions of well-known functions and constructions are omitted from the following description for clarity and conciseness.
图1是根据本公开一个或多个实施例中的数据查询方法的主要步骤示意图。Figure 1 is a schematic diagram of the main steps of a data query method according to one or more embodiments of the present disclosure.
如图1所示,本公开一个或多个实施例中的数据查询方法主要包括如下的步骤S101至步骤S103。As shown in Figure 1, the data query method in one or more embodiments of the present disclosure mainly includes the following steps S101 to S103.
步骤S101:响应于接收的数据查询请求,获取对各存储集群的探活结果,探活结果指示对应的存储集群当前是否可用。Step S101: In response to the received data query request, obtain the activity detection results of each storage cluster. The activity detection results indicate whether the corresponding storage cluster is currently available.
获取对各存储集群的探活结果,可以包括:从配置中心或本地缓存中获取探活节点集群对各存储集群的探活结果,其中,配置中心通过动态监听机制,在监听到探活节点集群对存储集群的探活结果后,将对应的探活结果缓存到本地缓存。Obtaining the live detection results of each storage cluster may include: obtaining the live detection results of each storage cluster from the configuration center or the local cache. Among them, the configuration center uses a dynamic monitoring mechanism to detect the live node cluster. After storing the cluster's liveness detection results, cache the corresponding liveness detection results in the local cache.
探活节点集群可以包括一个或多个探活节点,探活节点用于向各存储集群分别发送健康度请求,以根据存储集群对健康度请求的响应情况,确定对应的存储集群是否可用。本公开存储集群的数量为多个,存储集群例如ES(ElasticSearch)集群,探活节点向各存储集群分别发送健康度请求时,可以利用ES集群提供的专用于获取健康度的命令去获取集群的健康度(cluster health)。The live detection node cluster may include one or more live detection nodes. The live detection nodes are used to send health status requests to each storage cluster respectively to determine whether the corresponding storage cluster is available based on the storage cluster's response to the health status request. There are multiple storage clusters in this disclosure. The storage cluster is such as an ES (Elastic Search) cluster. When the active node sends a health request to each storage cluster, the command provided by the ES cluster specifically for obtaining health can be used to obtain the health status of the cluster. Cluster health.
步骤S102:根据对各存储集群的探活结果,确定可用存储集群列 表。Step S102: Determine the list of available storage clusters based on the detection results of each storage cluster.
根据对各存储集群的探活结果,确定可用存储集群列表,可以包括:对于每一存储集群,判断各探活节点对该存储集群的探活结果中,指示该存储集群可用的探活节点数量占探活节点总数的比例是否超过比例阈值,若是,则确定该存储集群可用,并添加到可用存储集群列表。探活结果可包括timeout字段,进行健康度请求时,需要规定一个存储集群响应的时间,比如1s(秒),存储集群在1s之内返回了结果,就认为该存储集群是存活的,探活结果中的timeout=false表示存储集群存活,如果超时,认为该存储集群已经故障。对于多个探活节点,比例阈值可根据需要设定,例如,如果半数(比例阈值=50%)以上探活节点返回的对应某个存储集群的探活结果都为该存储集群存活,即指示该存储集群可用,则根据各探活结果确定出该存储集群可用。Determining the list of available storage clusters based on the detection results of each storage cluster may include: for each storage cluster, determining the detection results of each detection node for the storage cluster to indicate the number of detection nodes available for the storage cluster. Whether the proportion of the total number of active nodes exceeds the proportion threshold, if so, the storage cluster is determined to be available and added to the list of available storage clusters. The liveness detection result can include a timeout field. When making a health request, you need to specify a storage cluster response time, such as 1s (seconds). If the storage cluster returns the result within 1s, the storage cluster is considered alive. Timeout=false in the result indicates that the storage cluster is alive. If it times out, the storage cluster is considered to have failed. For multiple live detection nodes, the proportion threshold can be set as needed. For example, if the detection results corresponding to a storage cluster returned by more than half (proportion threshold = 50%) of the live detection nodes are that the storage cluster is alive, it indicates that the storage cluster is alive. If the storage cluster is available, it is determined that the storage cluster is available based on the detection results.
步骤S103:按照集群选取设置,从可用存储集群列表中选取目标可用存储集群,将数据查询请求发送到目标可用存储集群,以由目标可用存储集群返回对应的数据查询结果。Step S103: According to the cluster selection settings, select the target available storage cluster from the available storage cluster list, and send the data query request to the target available storage cluster, so that the target available storage cluster returns the corresponding data query result.
在一个实施例中,按照集群选取设置,从可用存储集群列表中选取目标可用存储集群,将数据查询请求发送到目标可用存储集群,以由目标可用存储集群返回对应的数据查询结果,可以包括:以可用存储集群列表中的所有可用存储集群作为目标可用存储集群,在收到其中一个目标可用存储集群返回的数据查询结果后,输出数据查询结果。In one embodiment, according to the cluster selection settings, select the target available storage cluster from the available storage cluster list, send the data query request to the target available storage cluster, so that the target available storage cluster returns the corresponding data query result, which may include: Use all available storage clusters in the available storage cluster list as the target available storage cluster, and after receiving the data query result returned by one of the target available storage clusters, output the data query result.
在另一个实施例中,按照集群选取设置,从可用存储集群列表中选取目标可用存储集群,将数据查询请求发送到目标可用存储集群,以由目标可用存储集群返回对应的数据查询结果,可以包括:按照轮询策略从可用存储集群列表中选出当前轮询到的一个可用存储集群,作为目标可用存储集群,在收到目标可用存储集群返回的数据查询结果后,输出数据查询结果。In another embodiment, according to the cluster selection settings, select the target available storage cluster from the available storage cluster list, send the data query request to the target available storage cluster, so that the target available storage cluster returns the corresponding data query result, which may include : According to the polling policy, select an available storage cluster currently polled from the list of available storage clusters as the target available storage cluster. After receiving the data query results returned by the target available storage cluster, output the data query results.
在又一个实施例中,按照集群选取设置,从可用存储集群列表中选取目标可用存储集群,将数据查询请求发送到目标可用存储集群,以由目标可用存储集群返回对应的数据查询结果,可以包括:从可用存储集群列表中随机选出一个可用存储集群,作为目标可用存储集群,在收到目标可用存储集群返回的数据查询结果后,输出数据查询结果。In another embodiment, according to the cluster selection settings, select the target available storage cluster from the available storage cluster list, send the data query request to the target available storage cluster, so that the target available storage cluster returns the corresponding data query result, which may include : Randomly select an available storage cluster from the list of available storage clusters as the target available storage cluster. After receiving the data query results returned by the target available storage cluster, output the data query results.
图2是根据本公开一个或多个实施例中的数据写入方法的主要步骤示意图。FIG. 2 is a schematic diagram of the main steps of a data writing method according to one or more embodiments of the present disclosure.
如图2所示,本公开一个实施例的数据写入方法主要包括如下的步骤S201至步骤S202。As shown in Figure 2, the data writing method according to one embodiment of the present disclosure mainly includes the following steps S201 to S202.
步骤S201:根据存储集群的数量,发起对消息中间件主题的多个监听,每一监听对应一个存储集群,消息中间件主题包括待写入数据。Step S201: According to the number of storage clusters, initiate multiple monitoring of the message middleware topic. Each monitoring corresponds to a storage cluster. The message middleware topic includes data to be written.
步骤S202:响应于对消息中间件主题的每一监听,将待写入数据写入对应的存储集群。Step S202: In response to each monitoring of the message middleware topic, write the data to be written into the corresponding storage cluster.
消息中间件例如消息队列(MQ)。Message middleware such as Message Queuing (MQ).
响应于对消息中间件主题的每一监听,将待写入数据写入对应的存储集群,可以包括:响应于对消息中间件主题的每一监听,通过预设的写入接口将待写入数据写入对应的存储集群,预设的写入接口的参数包括各存储集群的标识(ID),其中,若任一存储集群中待写入数据写入失败,则重试对该存储集群的待写入数据写入的操作。In response to each monitoring of the message middleware topic, writing the data to be written to the corresponding storage cluster may include: in response to each monitoring of the message middleware topic, writing the data to be written through the preset writing interface. The data is written to the corresponding storage cluster. The parameters of the preset writing interface include the identification (ID) of each storage cluster. If the data to be written in any storage cluster fails to be written, the storage cluster will be retried. The operation to write the data to be written.
本公开实施例在业务需要将数据写入ES的时候,将数据发送到一个消息队列主题中,通过监听此消息队列主题,以将数据写入到ES中,这种方式将写入操作和最终写入动作解耦开来,多个存储集群写入则 多次监听此消息队列主题,若某个存储集群写入失败只需该存储集群重试即可,目前大部分的消息队列中间件都可以实现最终一致性,应用此特性来达到多存储集群数据的最终一致性,并大大增强了扩展性。In this disclosed embodiment, when the business needs to write data to the ES, the data is sent to a message queue topic, and the data is written to the ES by monitoring the message queue topic. In this way, the writing operation and the final The write action is decoupled, and multiple storage clusters will listen to this message queue topic multiple times when writing. If a storage cluster fails to write, it only needs to be retried by the storage cluster. Currently, most message queue middleware Final consistency can be achieved, and this feature can be applied to achieve final consistency of multi-storage cluster data and greatly enhance scalability.
图3是根据本公开一个或多个实施例中的数据查询和数据写入的流程示意图。其中,客户端可以为用于数据查询和/或用于数据写入的装置。Figure 3 is a schematic flowchart of data query and data writing according to one or more embodiments of the present disclosure. The client may be a device used for data query and/or data writing.
如图3所示,在一个实施例中,配置中心通过动态监听机制,在监听到探活节点集群对存储集群的探活结果后,将对应的探活结果缓存到本地缓存,客户端响应于接收的数据查询请求,从配置中心或本地缓存中获取探活节点集群对各存储集群的探活结果。As shown in Figure 3, in one embodiment, the configuration center uses a dynamic monitoring mechanism to listen to the detection results of the storage cluster by the detection node cluster, and caches the corresponding detection results into the local cache, and the client responds The received data query request obtains the live detection results of each storage cluster by the active node cluster from the configuration center or local cache.
具体地,存储集群可以为ES(ElasticSearch)集群,在多个机房分别部署ES集群(简称集群),每个集群命名可以为cluster1、cluster2…,所有集群可以总称为es-cluster;搭建一个配置中心,配置中心可以为zookeeper(一种高可用分布式配置中心);搭建探活节点集群,探活节点集群可包括至少3个探活节点,探活节点可以分别命名为node1、node2、node3…(如图3以三个节点为例,即节点1、节点2、节点3),每个探活节点连接到每个ES集群;搭建一个用于数据查询的客户端,建立客户端对每个ES集群的连接以及对配置中心的连接。启动探活程序,探活节点集群中的每个探活节点定时对每个ES集群发起健康度请求,ES集群响应健康度请求生成探活结果并存放到es-cluster目录中。配置中心动态监听es-cluster目录,在该目录发生变化时,配置中心修改客户端的本地缓存,将探活结果保存至客户端的本地缓存中。客户端从配置中心或者本地缓存中获取探活结果。其中,本地缓存可以通过Map(将键映射到值的对象)实现。Specifically, the storage cluster can be an ES (ElasticSearch) cluster, and ES clusters (clusters for short) are deployed in multiple computer rooms. Each cluster can be named cluster1, cluster2..., and all clusters can be collectively called es-cluster; build a configuration center , the configuration center can be zookeeper (a high-availability distributed configuration center); build a live detection node cluster, the live detection node cluster can include at least 3 live detection nodes, and the live detection nodes can be named node1, node2, node3...( As shown in Figure 3, three nodes are used as an example, namely node 1, node 2, and node 3). Each active node is connected to each ES cluster; build a client for data query, and establish a client for each ES. Connection to the cluster and connection to the configuration center. Start the liveness detection program. Each liveness detection node in the liveness detection node cluster periodically initiates a health request to each ES cluster. The ES cluster responds to the health request to generate a liveness detection result and stores it in the es-cluster directory. The configuration center dynamically monitors the es-cluster directory. When the directory changes, the configuration center modifies the client's local cache and saves the detection results to the client's local cache. The client obtains the live detection results from the configuration center or local cache. Among them, local caching can be implemented through Map (an object that maps keys to values).
在一个实施例中,对于每一存储集群,判断各探活节点对该存储集群的探活结果中,指示该存储集群可用的探活节点数量占探活节点 总数的比例是否超过比例阈值,若是,则确定该存储集群可用,并添加到可用存储集群列表。例如,存在两个存储集群(a,b),探活节点的数量为3个,3个探活节点对存储集群的探活结果分别为(1,1)、(0,1)、(0,0),其中1表示可用,0表示不可用,探活结果中的第一个数字为第一个集群的可用状态,第二个数字为第二个集群的可用状态,那么有一个探活节点的探活结果指示a集群可用,有两个探活节点的探活结果指示b集群可用。若将比例阈值设置为0.5,则对于a集群,指示该集群可用的探活节点数量占探活节点总数的比例为1/3,没有超过比例阈值0.5,则a集群不可用,不将a集群添加到可用存储集群列表;对于b集群,指示该集群可用的探活节点数量占探活节点总数的比例为2/3,超过了比例阈值0.5,则b集群可用,将b集群添加到可用存储集群列表。对于不可用的存储集群,可以进行上报处理,以进行修复。In one embodiment, for each storage cluster, it is determined whether the ratio of the number of active detection nodes available to the storage cluster to the total number of active detection nodes in the detection result of each active detection node for the storage cluster exceeds the proportion threshold. If so, , it is determined that the storage cluster is available and added to the list of available storage clusters. For example, there are two storage clusters (a, b), the number of active detection nodes is 3, and the detection results of the three active detection nodes on the storage cluster are (1, 1), (0, 1), (0 , 0), where 1 means available and 0 means unavailable. The first number in the detection result is the available status of the first cluster, and the second number is the available status of the second cluster. Then there is a detection result. The activity detection results of nodes indicate that cluster a is available, and the activity detection results of two active nodes indicate that cluster b is available. If the proportion threshold is set to 0.5, then for cluster a, the proportion of the number of active detection nodes available in the cluster to the total number of active detection nodes is 1/3. If the proportion threshold of 0.5 is not exceeded, cluster a will be unavailable and cluster a will not be used. Add to the list of available storage clusters; for cluster b, the ratio of the number of active active nodes indicating that the cluster is available to the total number of active active nodes is 2/3, exceeding the proportion threshold of 0.5, then cluster b is available, and cluster b is added to the available storage Cluster list. Unavailable storage clusters can be reported for repair.
在一个实施例中,按照集群选取设置,从可用存储集群列表中选取目标可用存储集群,将数据查询请求发送到目标可用存储集群,以由目标可用存储集群返回对应的数据查询结果。具体地,根据集群的负载大小确定负载均衡策略,从而进行集群选取设置,负载均衡策略可以包括全部请求策略、轮询策略和随机策略。其中,全部请求策略,即以可用存储集群列表中的所有可用存储集群作为目标可用存储集群,在收到其中一个目标可用存储集群返回的数据查询结果后,输出数据查询结果,该策略可以削平网络的波动和某一个存储集群的抖动对整个集群的影响,只要有一个存储集群正常,就可以正常提供服务,适用于集群整体压力不是很大的情况。轮询策略,即按照轮询策略从可用存储集群列表中选出当前轮询到的一个可用存储集群,作为目标可用存储集群,在收到目标可用存储集群返回的数据查询结果后,输出数据查询结果。随机策略,即每次使用随机的算法从可用存储集群列表中随机选出一个可用存储集群,作为目标可用存储集群,在收到目标可用存储集群返回的数据查询结果后,输出数据查询结果。In one embodiment, according to the cluster selection settings, the target available storage cluster is selected from the available storage cluster list, and the data query request is sent to the target available storage cluster, so that the target available storage cluster returns the corresponding data query result. Specifically, the load balancing strategy is determined according to the load size of the cluster to perform cluster selection settings. The load balancing strategy can include all request strategies, polling strategies, and random strategies. Among them, the all request strategy uses all available storage clusters in the available storage cluster list as the target available storage cluster. After receiving the data query result returned by one of the target available storage clusters, the data query result is output. This strategy can flatten the network. The impact of fluctuations and jitter of a certain storage cluster on the entire cluster is that as long as one storage cluster is normal, services can be provided normally, which is suitable for situations where the overall pressure on the cluster is not very high. Polling strategy, that is, according to the polling strategy, select an available storage cluster currently polled from the list of available storage clusters as the target available storage cluster. After receiving the data query results returned by the target available storage cluster, output the data query result. The random strategy uses a random algorithm to randomly select an available storage cluster from the list of available storage clusters each time as the target available storage cluster. After receiving the data query results returned by the target available storage cluster, the data query results are output.
在一个实施例中,根据存储集群的数量,发起对消息中间件主题的多个监听,每一监听对应一个存储集群,响应于对消息中间件主题的每一监听,通过预设的写入接口将待写入数据写入对应的存储集群,预设的写入接口的参数包括各存储集群的标识。具体地,在有写入动作时,将待写入数据发送到消息中间件主题,按照写入接口参数中包括的待写入的各存储集群的标识,通过建立映射的方式,待写入的各存储集群订阅消息中间件主题,实现对消息中间件主题的监听,其中,订阅的数量与待写入的存储集群的数量相同。各存储集群通过多次监听此消息中间件主题,将待写入数据写入到各存储集群中。若某个存储集群写入失败,则只需该存储集群重试即可。本公开实施例基于消息中间件可以实现各存储集群的最终一致性,同时大大增强了扩展性。In one embodiment, multiple monitoring of the message middleware topic is initiated according to the number of storage clusters. Each monitoring corresponds to a storage cluster. In response to each monitoring of the message middleware topic, through the preset writing interface Write the data to be written into the corresponding storage cluster. The parameters of the preset writing interface include the identification of each storage cluster. Specifically, when there is a writing action, the data to be written is sent to the message middleware topic. According to the identification of each storage cluster to be written included in the writing interface parameters, the data to be written is established by mapping. Each storage cluster subscribes to the message middleware topic to monitor the message middleware topic. The number of subscriptions is the same as the number of storage clusters to be written. Each storage cluster writes the data to be written to each storage cluster by listening to this message middleware topic multiple times. If a storage cluster fails to write, you only need to retry the storage cluster. Based on the message middleware, the disclosed embodiment can achieve the ultimate consistency of each storage cluster and greatly enhance the scalability.
图4是根据本公开一个或多个实施例中的数据查询装置的主要模块示意图。Figure 4 is a schematic diagram of the main modules of a data query device according to one or more embodiments of the present disclosure.
如图4所示,本公开一个实施例的数据查询装置400主要包括:探活结果获取模块401、可用存储集群确定模块402、数据查询模块403。As shown in Figure 4, a data query device 400 according to an embodiment of the present disclosure mainly includes: a life detection result acquisition module 401, an available storage cluster determination module 402, and a data query module 403.
探活结果获取模块401,用于响应于接收的数据查询请求,获取对各存储集群的探活结果,探活结果指示对应的存储集群当前是否可用。The activity detection result acquisition module 401 is used to obtain the activity detection results of each storage cluster in response to the received data query request, and the activity detection results indicate whether the corresponding storage cluster is currently available.
可用存储集群确定模块402,用于根据对各存储集群的探活结果,确定可用存储集群列表。The available storage cluster determination module 402 is used to determine a list of available storage clusters based on the detection results of each storage cluster.
数据查询模块403,用于按照集群选取设置,从可用存储集群列表中选取目标可用存储集群,将数据查询请求发送到目标可用存储集群,以由目标可用存储集群返回对应的数据查询结果。The data query module 403 is used to select a target available storage cluster from the available storage cluster list according to the cluster selection settings, and send a data query request to the target available storage cluster, so that the target available storage cluster returns the corresponding data query result.
在一个实施例中,探活结果获取模块401具体用于:从配置中心或本地缓存中获取探活节点集群对各存储集群的探活结果,其中,配 置中心通过动态监听机制,在监听到探活节点集群对存储集群的探活结果后,将对应的探活结果缓存到本地缓存。In one embodiment, the active detection result acquisition module 401 is specifically used to: obtain the active detection result of each storage cluster by the active detection node cluster from the configuration center or the local cache, wherein the configuration center uses a dynamic monitoring mechanism to detect the active detection result. After the live node cluster stores the liveness detection results of the cluster, it caches the corresponding liveness detection results into the local cache.
在一个实施例中,可用存储集群确定模块402具体用于:对于每一存储集群,判断各探活节点对该存储集群的探活结果中,指示该存储集群可用的探活节点数量占探活节点总数的比例是否超过比例阈值,若是,则确定该存储集群可用,并添加到可用存储集群列表。In one embodiment, the available storage cluster determination module 402 is specifically configured to: for each storage cluster, determine the active detection results of each active node for the storage cluster, and indicate the number of active active nodes available for the storage cluster. Whether the proportion of the total number of nodes exceeds the proportion threshold, if so, the storage cluster is determined to be available and added to the list of available storage clusters.
在一个实施例中,数据查询模块403具体用于:以可用存储集群列表中的所有可用存储集群作为目标可用存储集群,在收到其中一个目标可用存储集群返回的数据查询结果后,输出数据查询结果。In one embodiment, the data query module 403 is specifically configured to: use all available storage clusters in the available storage cluster list as target available storage clusters, and output the data query after receiving the data query result returned by one of the target available storage clusters. result.
在一个实施例中,数据查询模块403具体用于:按照轮询策略从可用存储集群列表中选出当前轮询到的一个可用存储集群,作为目标可用存储集群,在收到目标可用存储集群返回的数据查询结果后,输出数据查询结果。In one embodiment, the data query module 403 is specifically configured to: select an available storage cluster that is currently polled from the list of available storage clusters according to the polling policy, as the target available storage cluster, and return after receiving the target available storage cluster. After the data query results, output the data query results.
在一个实施例中,数据查询模块403具体用于:从可用存储集群列表中随机选出一个可用存储集群,作为目标可用存储集群,在收到目标可用存储集群返回的数据查询结果后,输出数据查询结果。In one embodiment, the data query module 403 is specifically configured to: randomly select an available storage cluster from the list of available storage clusters as the target available storage cluster, and output the data after receiving the data query results returned by the target available storage cluster. search result.
另外,在本公开实施例中数据查询装置的具体实施内容,在上面数据查询方法中已经详细说明了,故在此重复内容不再说明。In addition, the specific implementation content of the data query device in the embodiment of the present disclosure has been described in detail in the above data query method, so the repeated content will not be described here.
图5是根据本公开一个或多个实施例中的数据写入装置的主要模块示意图。Figure 5 is a schematic diagram of the main modules of a data writing device according to one or more embodiments of the present disclosure.
如图5所示,本公开一个实施例的数据写入装置500主要包括:监听模块501、数据写入模块502。As shown in Figure 5, a data writing device 500 according to an embodiment of the present disclosure mainly includes: a monitoring module 501 and a data writing module 502.
监听模块501,用于根据存储集群的数量,发起对消息中间件主题的多个监听,每一监听对应一个存储集群,消息中间件主题包括待写入数据。The monitoring module 501 is used to initiate multiple monitoring of message middleware topics according to the number of storage clusters. Each monitoring corresponds to a storage cluster, and the message middleware topic includes data to be written.
数据写入模块502,用于响应于对消息中间件主题的每一监听,将待写入数据写入对应的存储集群。The data writing module 502 is configured to respond to each monitoring of the message middleware topic and write the data to be written into the corresponding storage cluster.
在一个实施例中,数据写入模块502具体用于:响应于对消息中间件主题的每一监听,通过预设的写入接口将待写入数据写入对应的存储集群,预设的写入接口的参数包括各存储集群的标识,其中,若任一存储集群中待写入数据写入失败,则重试对该存储集群的待写入数据写入的操作。In one embodiment, the data writing module 502 is specifically configured to: in response to each monitoring of the message middleware topic, write the data to be written to the corresponding storage cluster through the preset writing interface. The preset writing interface The parameters of the incoming interface include the identification of each storage cluster. If the writing of the data to be written in any storage cluster fails, the operation of writing the data to be written to the storage cluster is retried.
另外,在本公开实施例中数据写入装置的具体实施内容,在上面数据写入方法中已经详细说明了,故在此重复内容不再说明。In addition, the specific implementation content of the data writing device in the embodiment of the present disclosure has been described in detail in the above data writing method, so the repeated content will not be described here.
图6是根据本公开一个或多个实施例中的数据查询系统的主要架构示意图。Figure 6 is a schematic diagram of the main architecture of a data query system according to one or more embodiments of the present disclosure.
如图6所示,本公开一个实施例的数据查询系统600主要包括:数据查询装置601,还包括存储集群602、配置中心603和探活节点集群604。存储集群602的数量为多个。As shown in Figure 6, a data query system 600 according to an embodiment of the present disclosure mainly includes: a data query device 601, and also includes a storage cluster 602, a configuration center 603, and a live detection node cluster 604. The number of storage clusters 602 is multiple.
数据查询装置601与上文实施例中的数据查询装置400所含的功能模块相同。The data query device 601 has the same functional modules as the data query device 400 in the above embodiment.
探活节点集群604包括一个或多个探活节点,探活节点用于向各存储集群分别发送健康度请求,以根据存储集群对健康度请求的响应情况,确定存储集群的探活结果,探活结果指示对应的存储集群当前是否可用。The live detection node cluster 604 includes one or more live detection nodes. The live detection nodes are used to send health request to each storage cluster respectively to determine the live detection result of the storage cluster based on the response of the storage cluster to the health request. The live result indicates whether the corresponding storage cluster is currently available.
配置中心603用于接收各探活节点上报的探活结果,并向数据查询装置提供探活结果。The configuration center 603 is configured to receive the activity detection results reported by each activity detection node, and provide the activity detection results to the data query device.
在一个实施例中,配置中心603具体用于:响应于数据查询装置601的探活结果获取请求,向数据查询装置601提供探活结果。In one embodiment, the configuration center 603 is specifically configured to provide the data query device 601 with a probe result in response to the probe result acquisition request of the data query device 601 .
在一个实施例中,配置中心603具体用于:通过动态监听机制,在监听到探活节点集群对存储集群的探活结果后,将对应的探活结果缓存到数据查询装置601对应的本地缓存。In one embodiment, the configuration center 603 is specifically configured to: use a dynamic listening mechanism to, after listening to the detection results of the storage cluster by the detection node cluster, cache the corresponding detection results to the local cache corresponding to the data query device 601 .
对于上文实施例已经介绍过的内容,本实施例不再赘述。The content that has been introduced in the above embodiment will not be described again in this embodiment.
图7示出了可以应用本公开一个或多个实施例中的数据查询方法、数据写入方法、数据查询装置、数据写入装置或数据查询系统的示例性系统架构700。FIG. 7 shows an exemplary system architecture 700 to which the data query method, data writing method, data query device, data writing device or data query system in one or more embodiments of the present disclosure can be applied.
如图7所示,系统架构700可以包括终端设备701、702、703,网络704和服务器705。网络704用以在终端设备701、702、703和服务器705之间提供通信链路的介质。网络704可以包括各种连接类型,例如有线、无线通信链路或者光纤电缆等等。As shown in Figure 7, the system architecture 700 may include terminal devices 701, 702, 703, a network 704 and a server 705. Network 704 is a medium used to provide communication links between terminal devices 701, 702, 703 and server 705. Network 704 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
用户可以使用终端设备701、702、703通过网络704与服务器705交互,以接收或发送消息等。终端设备701、702、703上可以安装有各种通讯客户端应用,例如购物类应用、网页浏览器应用、搜索类应用、即时通信工具、邮箱客户端、社交平台软件等(仅为示例)。Users can use terminal devices 701, 702, 703 to interact with the server 705 through the network 704 to receive or send messages, etc. Various communication client applications can be installed on the terminal devices 701, 702, and 703, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only examples).
终端设备701、702、703可以是具有显示屏并且支持网页浏览的各种电子设备,包括但不限于智能手机、平板电脑、膝上型便携计算机和台式计算机等等。The terminal devices 701, 702, and 703 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and so on.
服务器705可以是提供各种服务的服务器,例如对用户利用终端设备701、702、703所浏览的购物类网站提供支持的后台管理服务器(仅为示例)。后台管理服务器可以对接收到的产品信息查询请求等数据进行分析等处理,并将处理结果(例如目标推送信息、产品信息--仅为示例)反馈给终端设备。The server 705 may be a server that provides various services, such as a backend management server that provides support for shopping websites browsed by users using the terminal devices 701, 702, and 703 (example only). The background management server can analyze and process the received product information query request and other data, and feed back the processing results (such as target push information, product information - only examples) to the terminal device.
需要说明的是,在一个实施例中,本公开实施例所提供的数据查询方法一般由服务器705或终端设备701、702、703执行,相应地,数据查询装置一般设置于服务器705或终端设备701、702、703中。It should be noted that, in one embodiment, the data query method provided by the embodiment of the present disclosure is generally executed by the server 705 or the terminal devices 701, 702, and 703. Correspondingly, the data query device is generally provided on the server 705 or the terminal device 701. , 702, 703.
在另一个实施例中,本公开实施例所提供的数据写入方法一般由服务器705或终端设备701、702、703执行,相应地,数据写入装置一般设置于服务器705或终端设备701、702、703中。In another embodiment, the data writing method provided by the embodiment of the present disclosure is generally executed by the server 705 or the terminal devices 701, 702, 703. Correspondingly, the data writing device is generally provided on the server 705 or the terminal devices 701, 702. , 703.
应该理解,图7中的终端设备、网络和服务器的数目仅仅是示意性的。根据实现需要,可以具有任意数目的终端设备、网络和服务器。It should be understood that the number of terminal devices, networks and servers in Figure 7 is only illustrative. Depending on implementation needs, there can be any number of end devices, networks, and servers.
下面参考图8,其示出了适于用来实现本公开一个或多个实施例中的终端设备或服务器的计算机系统800的结构示意图。图8示出的终端设备或服务器仅仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。Referring now to FIG. 8 , a schematic structural diagram of a computer system 800 suitable for implementing a terminal device or server in one or more embodiments of the present disclosure is shown. The terminal device or server shown in FIG. 8 is only an example and should not impose any restrictions on the functions and usage scope of the embodiments of the present disclosure.
如图8所示,计算机系统800包括中央处理单元(CPU)801,其可以根据存储在只读存储器(ROM)802中的程序或者从存储部分808加载到随机访问存储器(RAM)803中的程序而执行各种适当的动作和处理。在RAM 803中,还存储有系统800操作所需的各种程序和数据。CPU 801、ROM 802以及RAM 803通过总线804彼此相连。输入/输出(I/O)接口805也连接至总线804。As shown in FIG. 8, computer system 800 includes a central processing unit (CPU) 801 that can operate according to a program stored in a read-only memory (ROM) 802 or loaded from a storage portion 808 into a random access memory (RAM) 803. And perform various appropriate actions and processing. In the RAM 803, various programs and data required for the operation of the system 800 are also stored. CPU 801, ROM 802 and RAM 803 are connected to each other via bus 804. An input/output (I/O) interface 805 is also connected to bus 804.
以下部件连接至I/O接口805:包括键盘、鼠标等的输入部分806;包括诸如阴极射线管(CRT)、液晶显示器(LCD)等以及扬声器等的输出部分807;包括硬盘等的存储部分808;以及包括诸如LAN卡、调制解调器等的网络接口卡的通信部分809。通信部分809经由诸如因特网的网络执行通信处理。驱动器810也根据需要连接至I/O接口805。可拆卸介质811,诸如磁盘、光盘、磁光盘、半导体存储器等等,根据需要安装在驱动器810上,以便于从其上读出的计算机程序根据需要被安装入存储部分808。The following components are connected to the I/O interface 805: an input section 806 including a keyboard, a mouse, etc.; an output section 807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., speakers, etc.; and a storage section 808 including a hard disk, etc. ; and a communication section 809 including a network interface card such as a LAN card, a modem, etc. The communication section 809 performs communication processing via a network such as the Internet. Driver 810 is also connected to I/O interface 805 as needed. Removable media 811, such as magnetic disks, optical disks, magneto-optical disks, semiconductor memories, etc., are installed on the drive 810 as needed, so that a computer program read therefrom is installed into the storage portion 808 as needed.
特别地,根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信部分809从网络上被下载和安装,和/或从可拆卸介质811被安装。在该计算机程序被中央处理单元(CPU)801执行时,执行本公开的系统中限定的上述功能。In particular, according to embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product including a computer program carried on a computer-readable medium, the computer program containing program code for performing the method illustrated in the flowchart. In such embodiments, the computer program may be downloaded and installed from the network via communications portion 809 and/or installed from removable media 811 . When the computer program is executed by the central processing unit (CPU) 801, the above-described functions defined in the system of the present disclosure are performed.
需要说明的是,本公开所示的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本公开中,计算机可读的信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采 用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读的信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:无线、电线、光缆、RF等等,或者上述的任意合适的组合。It should be noted that the computer-readable medium shown in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the above two. The computer-readable storage medium may be, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus or device, or any combination thereof. More specific examples of computer readable storage media may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard drive, random access memory (RAM), read only memory (ROM), removable Programmed read-only memory (EPROM or flash memory), fiber optics, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above. In this disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code therein. Such propagated data signals may take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device . Program code embodied on a computer-readable medium may be transmitted using any suitable medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the foregoing.
附图中的流程图和框图,图示了按照本公开各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,上述模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图或流程图中的每个方框、以及框图或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operations of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code that contains one or more logic functions that implement the specified executable instructions. It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown one after another may actually execute substantially in parallel, or they may sometimes execute in the reverse order, depending on the functionality involved. It will also be noted that each block in the block diagram or flowchart illustration, and combinations of blocks in the block diagram or flowchart illustration, can be implemented by special purpose hardware-based systems that perform the specified functions or operations, or may be implemented by special purpose hardware-based systems that perform the specified functions or operations. Achieved by a combination of specialized hardware and computer instructions.
描述于本公开实施例中所涉及到的模块可以通过软件的方式实现,也可以通过硬件的方式来实现。所描述的模块也可以设置在处理器中,例如,可以描述为:一种处理器包括探活结果获取模块、可用存储集群确定模块、数据查询模块。其中,这些模块的名称在某种情况下并不构成对该模块本身的限定,例如,探活结果获取模块还可以被描述为“用于响应于接收的数据查询请求,获取对各存储集群的探活结果的模块”。The modules involved in the embodiments of the present disclosure can be implemented in software or hardware. The described module can also be provided in a processor. For example, it can be described as follows: a processor includes a detection result acquisition module, an available storage cluster determination module, and a data query module. Among them, the names of these modules do not constitute a limitation on the module itself under certain circumstances. For example, the detection result acquisition module can also be described as "used to obtain data about each storage cluster in response to the received data query request." Module for detecting live results".
作为另一方面,本公开还提供了一种计算机可读介质,该计算机可读介质可以是上述实施例中描述的设备中所包含的;也可以是单独存在,而未装配入该设备中。上述计算机可读介质承载有一个或者多 个程序,当上述一个或者多个程序被一个该设备执行时,使得该设备包括:响应于接收的数据查询请求,获取对各存储集群的探活结果,探活结果指示对应的存储集群当前是否可用;根据对各存储集群的探活结果,确定可用存储集群列表;按照集群选取设置,从可用存储集群列表中选取目标可用存储集群,将数据查询请求发送到目标可用存储集群,以由目标可用存储集群返回对应的数据查询结果。As another aspect, the present disclosure also provides a computer-readable medium. The computer-readable medium may be included in the device described in the above embodiments; it may also exist separately without being assembled into the device. The above-mentioned computer-readable medium carries one or more programs. When the above-mentioned one or more programs are executed by a device, the device includes: in response to the received data query request, obtain the detection results of each storage cluster, The detection result indicates whether the corresponding storage cluster is currently available; according to the detection result of each storage cluster, the list of available storage clusters is determined; according to the cluster selection settings, the target available storage cluster is selected from the list of available storage clusters, and the data query request is sent Go to the target available storage cluster to return the corresponding data query results from the target available storage cluster.
根据本公开实施例的技术方案,响应于接收的数据查询请求,获取对各存储集群的探活结果,探活结果指示对应的存储集群当前是否可用;根据对各存储集群的探活结果,确定可用存储集群列表;按照集群选取设置,从可用存储集群列表中选取目标可用存储集群,将数据查询请求发送到目标可用存储集群,以由目标可用存储集群返回对应的数据查询结果。能够实现向多个集群写入数据的一致性,可自动切换集群,提高集群部署的容灾能力,解决了在机房级别故障时导致整个集群不可用的问题,同时克服了由于集群内部需要进行通信而耗费时间大的缺陷。According to the technical solution of the embodiment of the present disclosure, in response to the received data query request, the detection results of each storage cluster are obtained, and the detection results indicate whether the corresponding storage cluster is currently available; according to the detection results of each storage cluster, it is determined List of available storage clusters; according to the cluster selection settings, select the target available storage cluster from the list of available storage clusters, send the data query request to the target available storage cluster, and return the corresponding data query results from the target available storage cluster. It can realize the consistency of writing data to multiple clusters, automatically switch clusters, improve the disaster recovery capability of cluster deployment, solve the problem of unavailability of the entire cluster in the event of a computer room level failure, and overcome the need for communication within the cluster. The disadvantage is that it takes a lot of time.
上述具体实施方式,并不构成对本公开保护范围的限制。本领域技术人员应该明白的是,取决于设计要求和其他因素,可以发生各种各样的修改、组合、子组合和替代。任何在本公开的精神和原则之内所作的修改、等同替换和改进等,均应包含在本公开保护范围之内。The above-mentioned specific embodiments do not constitute a limitation on the scope of the present disclosure. It will be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of this disclosure shall be included in the protection scope of this disclosure.

Claims (22)

  1. 一种数据查询方法,包括:A data query method, including:
    响应于接收的数据查询请求,获取对各存储集群的探活结果,所述探活结果指示对应的存储集群当前是否可用;In response to the received data query request, obtain the activity detection results for each storage cluster, and the activity detection results indicate whether the corresponding storage cluster is currently available;
    根据对各存储集群的探活结果,确定可用存储集群列表;Determine the list of available storage clusters based on the detection results of each storage cluster;
    按照集群选取设置,从所述可用存储集群列表中选取目标可用存储集群,将所述数据查询请求发送到所述目标可用存储集群,以由所述目标可用存储集群返回对应的数据查询结果。According to the cluster selection setting, a target available storage cluster is selected from the available storage cluster list, and the data query request is sent to the target available storage cluster, so that the corresponding data query result is returned by the target available storage cluster.
  2. 根据权利要求1所述的方法,其中,所述获取对各存储集群的探活结果,包括:The method according to claim 1, wherein said obtaining the detection results of each storage cluster includes:
    从配置中心或本地缓存中获取探活节点集群对所述各存储集群的探活结果,其中,所述配置中心通过动态监听机制,在监听到所述探活节点集群对所述存储集群的探活结果后,将对应的所述探活结果缓存到所述本地缓存。Obtain the detection results of each storage cluster by the detection node cluster from the configuration center or the local cache, wherein the configuration center uses a dynamic monitoring mechanism to detect the detection of the storage cluster by the detection node cluster. After the activation result is obtained, the corresponding detection result is cached in the local cache.
  3. 根据权利要求2所述的方法,其中,所述探活节点集群包括一个或多个探活节点,所述探活节点用于向所述各存储集群分别发送健康度请求,以根据所述存储集群对所述健康度请求的响应情况,确定对应的所述存储集群是否可用。The method according to claim 2, wherein the active detecting node cluster includes one or more active detecting nodes, and the active detecting nodes are used to send health degree requests to each storage cluster respectively to determine the health status according to the storage cluster. The cluster's response to the health request determines whether the corresponding storage cluster is available.
  4. 根据权利要求2所述的方法,其中,所述根据对各存储集群的探活结果,确定可用存储集群列表,包括:The method according to claim 2, wherein determining the list of available storage clusters based on the detection results of each storage cluster includes:
    对于每一存储集群,判断各所述探活节点对该存储集群的探活结果中,指示该存储集群可用的探活节点数量占探活节点总数的比例是否超过比例阈值,若是,则确定该存储集群可用,并添加到所述可用存储集群列表。For each storage cluster, determine whether the ratio of the number of active detection nodes available to the storage cluster to the total number of active detection nodes in the detection result of each active detection node for the storage cluster exceeds the proportion threshold, and if so, determine the The storage cluster is available and added to the list of available storage clusters.
  5. 根据权利要求1所述的方法,其中,所述按照集群选取设置,从所述可用存储集群列表中选取目标可用存储集群,将所述数据查询请求发送到所述目标可用存储集群,以由所述目标可用存储集群返回对应的数据查询结果,包括:The method according to claim 1, wherein according to the cluster selection setting, a target available storage cluster is selected from the available storage cluster list, and the data query request is sent to the target available storage cluster to obtain the information from the target available storage cluster. The above target can use the storage cluster to return the corresponding data query results, including:
    以所述可用存储集群列表中的所有可用存储集群作为所述目标可用存储集群,在收到其中一个目标可用存储集群返回的数据查询结果后,输出所述数据查询结果。All available storage clusters in the available storage cluster list are used as the target available storage clusters, and after receiving the data query result returned by one of the target available storage clusters, the data query result is output.
  6. 根据权利要求1所述的方法,其中,所述按照集群选取设置,从所述可用存储集群列表中选取目标可用存储集群,将所述数据查询请求发送到所述目标可用存储集群,以由所述目标可用存储集群返回对应的数据查询结果,包括:The method according to claim 1, wherein according to the cluster selection setting, a target available storage cluster is selected from the available storage cluster list, and the data query request is sent to the target available storage cluster to obtain the information from the target available storage cluster. The above target can use the storage cluster to return the corresponding data query results, including:
    按照轮询策略从所述可用存储集群列表中选出当前轮询到的一个可用存储集群,作为所述目标可用存储集群,在收到所述目标可用存储集群返回的数据查询结果后,输出所述数据查询结果。Select an available storage cluster that is currently polled from the list of available storage clusters according to the polling strategy as the target available storage cluster, and after receiving the data query results returned by the target available storage cluster, output the Describe the data query results.
  7. 根据权利要求1所述的方法,其中,所述按照集群选取设置,从所述可用存储集群列表中选取目标可用存储集群,将所述数据查询请求发送到所述目标可用存储集群,以由所述目标可用存储集群返回对应的数据查询结果,包括:The method according to claim 1, wherein according to the cluster selection setting, a target available storage cluster is selected from the available storage cluster list, and the data query request is sent to the target available storage cluster to obtain the information from the target available storage cluster. The above target can use the storage cluster to return the corresponding data query results, including:
    从所述可用存储集群列表中随机选出一个可用存储集群,作为所述目标可用存储集群,在收到所述目标可用存储集群返回的数据查询结果后,输出所述数据查询结果。An available storage cluster is randomly selected from the available storage cluster list as the target available storage cluster, and after receiving the data query result returned by the target available storage cluster, the data query result is output.
  8. 一种数据写入方法,包括:A data writing method including:
    根据存储集群的数量,发起对消息中间件主题的多个监听,每一监听对应一个存储集群,所述消息中间件主题包括待写入数据;According to the number of storage clusters, initiate multiple monitoring of message middleware topics, each monitoring corresponds to a storage cluster, and the message middleware topic includes data to be written;
    响应于对所述消息中间件主题的每一监听,将所述待写入数据写入对应的存储集群。In response to each monitoring of the message middleware topic, the data to be written is written to the corresponding storage cluster.
  9. 根据权利要求8所述的方法,其中,所述响应于对所述消息中间件主题的每一监听,将所述待写入数据写入对应的存储集群,包括:The method according to claim 8, wherein in response to each monitoring of the message middleware topic, writing the data to be written to the corresponding storage cluster includes:
    响应于对所述消息中间件主题的每一监听,通过预设的写入接口将所述待写入数据写入对应的存储集群,所述预设的写入接口的参数包括各存储集群的标识,其中,若任一存储集群中所述待写入数据写入失败,则重试对该存储集群的所述待写入数据写入的操作。In response to each monitoring of the message middleware topic, the data to be written is written to the corresponding storage cluster through the preset writing interface. The parameters of the preset writing interface include the parameters of each storage cluster. Identification, wherein if the writing of the data to be written in any storage cluster fails, the operation of writing the data to be written to the storage cluster is retried.
  10. 一种数据查询装置,包括:A data query device, including:
    探活结果获取模块,用于响应于接收的数据查询请求,获取对各存储集群的探活结果,所述探活结果指示对应的存储集群当前是否可用;The activity detection result acquisition module is used to obtain the activity detection results of each storage cluster in response to the received data query request, and the activity detection results indicate whether the corresponding storage cluster is currently available;
    可用存储集群确定模块,用于根据对各存储集群的探活结果,确定可用存储集群列表;The available storage cluster determination module is used to determine the list of available storage clusters based on the detection results of each storage cluster;
    数据查询模块,用于按照集群选取设置,从所述可用存储集群列表中选取目标可用存储集群,将所述数据查询请求发送到所述目标可用存储集群,以由所述目标可用存储集群返回对应的数据查询结果。A data query module, configured to select a target available storage cluster from the available storage cluster list according to the cluster selection setting, and send the data query request to the target available storage cluster, so that the target available storage cluster returns the corresponding data query results.
  11. 根据权利要求10所述的装置,其中,所述探活结果获取模块还用于:The device according to claim 10, wherein the detection result acquisition module is also used to:
    从配置中心或本地缓存中获取探活节点集群对所述各存储集群的探活结果,其中,所述配置中心通过动态监听机制,在监听到所述探活节点集群对所述存储集群的探活结果后,将对应的所述探活结果缓存到所述本地缓存。Obtain the detection results of each storage cluster by the detection node cluster from the configuration center or the local cache, wherein the configuration center uses a dynamic monitoring mechanism to detect the detection of the storage cluster by the detection node cluster. After the activation result is obtained, the corresponding detection result is cached in the local cache.
  12. 根据权利要求11所述的装置,其中,所述可用存储集群确定模块还用于:The device according to claim 11, wherein the available storage cluster determination module is further configured to:
    对于每一存储集群,判断各所述探活节点对该存储集群的探活结果中,指示该存储集群可用的探活节点数量占探活节点总数的比例是否超过比例阈值,若是,则确定该存储集群可用,并添加到所述可用存储集群列表。For each storage cluster, determine whether the ratio of the number of active detection nodes available to the storage cluster to the total number of active detection nodes in the detection result of each active detection node for the storage cluster exceeds the proportion threshold, and if so, determine the The storage cluster is available and added to the list of available storage clusters.
  13. 根据权利要求10所述的装置,其中,所述数据查询模块还用于:The device according to claim 10, wherein the data query module is also used for:
    以所述可用存储集群列表中的所有可用存储集群作为所述目标可用存储集群,在收到其中一个目标可用存储集群返回的数据查询结果后,输出所述数据查询结果。All available storage clusters in the available storage cluster list are used as the target available storage clusters, and after receiving the data query result returned by one of the target available storage clusters, the data query result is output.
  14. 根据权利要求10所述的装置,其中,所述数据查询模块还用于:The device according to claim 10, wherein the data query module is also used for:
    按照轮询策略从所述可用存储集群列表中选出当前轮询到的一个可用存储集群,作为所述目标可用存储集群,在收到所述目标可用存储集群返回的数据查询结果后,输出所述数据查询结果。Select an available storage cluster that is currently polled from the list of available storage clusters according to the polling strategy as the target available storage cluster, and after receiving the data query results returned by the target available storage cluster, output the Describe the data query results.
  15. 根据权利要求10所述的装置,其中,所述数据查询模块还用于:The device according to claim 10, wherein the data query module is also used for:
    从所述可用存储集群列表中随机选出一个可用存储集群,作为所述目标可用存储集群,在收到所述目标可用存储集群返回的数据查询结果后,输出所述数据查询结果。An available storage cluster is randomly selected from the available storage cluster list as the target available storage cluster, and after receiving the data query result returned by the target available storage cluster, the data query result is output.
  16. 一种数据写入装置,包括:A data writing device including:
    监听模块,用于根据存储集群的数量,发起对消息中间件主题的多个监听,每一监听对应一个存储集群,所述消息中间件主题包括待写入数据;A monitoring module, configured to initiate multiple monitoring of message middleware topics according to the number of storage clusters. Each monitoring corresponds to a storage cluster, and the message middleware topic includes data to be written;
    数据写入模块,用于响应于对所述消息中间件主题的每一监听,将所述待写入数据写入对应的存储集群。A data writing module is configured to write the data to be written to the corresponding storage cluster in response to each monitoring of the message middleware topic.
  17. 根据权利要求16所述的装置,其中,所述数据写入模块还用于:The device according to claim 16, wherein the data writing module is also used for:
    响应于对所述消息中间件主题的每一监听,通过预设的写入接口将所述待写入数据写入对应的存储集群,所述预设的写入接口的参数 包括各存储集群的标识,其中,若任一存储集群中所述待写入数据写入失败,则重试对该存储集群的所述待写入数据写入的操作。In response to each monitoring of the message middleware topic, the data to be written is written to the corresponding storage cluster through the preset writing interface. The parameters of the preset writing interface include the parameters of each storage cluster. Identification, wherein if the writing of the data to be written in any storage cluster fails, the operation of writing the data to be written to the storage cluster is retried.
  18. 一种数据查询系统,包括:如权利要求10至15中任一项所述的数据查询装置,还包括各存储集群、配置中心和探活节点集群,其中:A data query system, including: the data query device according to any one of claims 10 to 15, and further including each storage cluster, a configuration center and a detection node cluster, wherein:
    所述探活节点集群包括一个或多个探活节点,所述探活节点用于向所述各存储集群分别发送健康度请求,以根据所述存储集群对所述健康度请求的响应情况,确定所述存储集群的探活结果,所述探活结果指示对应的所述存储集群当前是否可用;The active detection node cluster includes one or more active detection nodes, and the active detection nodes are used to send health degree requests to each storage cluster respectively, so as to determine the response of the storage cluster to the health degree request. Determine the liveness detection result of the storage cluster, and the liveness detection result indicates whether the corresponding storage cluster is currently available;
    所述配置中心用于接收各所述探活节点上报的所述探活结果,并向所述数据查询装置提供所述探活结果。The configuration center is configured to receive the activity detection results reported by each activity detection node, and provide the activity detection results to the data query device.
  19. 根据权利要求18所述的系统,其中,所述配置中心还用于:响应于所述数据查询装置的探活结果获取请求,向所述数据查询装置提供所述探活结果。The system according to claim 18, wherein the configuration center is further configured to provide the data query device with the probe result in response to a probe result acquisition request from the data query device.
  20. 根据权利要求18所述的系统,其中,所述配置中心还用于:通过动态监听机制,在监听到所述探活节点集群对所述存储集群的探活结果后,将对应的所述探活结果缓存到所述数据查询装置对应的本地缓存。The system according to claim 18, wherein the configuration center is further configured to: through a dynamic monitoring mechanism, after monitoring the detection result of the storage cluster by the detection node cluster, the corresponding detection result The live results are cached in the local cache corresponding to the data query device.
  21. 一种电子设备,包括:An electronic device including:
    一个或多个处理器;one or more processors;
    存储装置,用于存储一个或多个程序,a storage device for storing one or more programs,
    当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如权利要求1-9中任一所述的方法。When the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the method as described in any one of claims 1-9.
  22. 一种计算机可读介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现如权利要求1-9中任一所述的方法。A computer-readable medium having a computer program stored thereon, which implements the method according to any one of claims 1-9 when executed by a processor.
PCT/CN2022/136753 2022-03-31 2022-12-06 Data query method, data writing method, related apparatus and system WO2023185071A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210331107.9 2022-03-31
CN202210331107.9A CN116932505A (en) 2022-03-31 2022-03-31 Data query method, data writing method, related device and system

Publications (1)

Publication Number Publication Date
WO2023185071A1 true WO2023185071A1 (en) 2023-10-05

Family

ID=88198940

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/136753 WO2023185071A1 (en) 2022-03-31 2022-12-06 Data query method, data writing method, related apparatus and system

Country Status (2)

Country Link
CN (1) CN116932505A (en)
WO (1) WO2023185071A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117331970A (en) * 2023-10-31 2024-01-02 中科驭数(北京)科技有限公司 Data query method, device, computer storage medium and acceleration card
CN118170737A (en) * 2024-05-11 2024-06-11 中移(苏州)软件技术有限公司 Data processing method and device and related equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9645628B1 (en) * 2011-05-09 2017-05-09 EMC IP Holding Company LLC Combined data storage and computing appliance that provides scalable storage in a clustered computing environment
CN108241469A (en) * 2016-12-27 2018-07-03 北京金山云网络技术有限公司 A kind of date storage method, apparatus and system
CN112583760A (en) * 2019-09-27 2021-03-30 中移(苏州)软件技术有限公司 Object storage access method, device, equipment and computer storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9645628B1 (en) * 2011-05-09 2017-05-09 EMC IP Holding Company LLC Combined data storage and computing appliance that provides scalable storage in a clustered computing environment
CN108241469A (en) * 2016-12-27 2018-07-03 北京金山云网络技术有限公司 A kind of date storage method, apparatus and system
CN112583760A (en) * 2019-09-27 2021-03-30 中移(苏州)软件技术有限公司 Object storage access method, device, equipment and computer storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117331970A (en) * 2023-10-31 2024-01-02 中科驭数(北京)科技有限公司 Data query method, device, computer storage medium and acceleration card
CN118170737A (en) * 2024-05-11 2024-06-11 中移(苏州)软件技术有限公司 Data processing method and device and related equipment

Also Published As

Publication number Publication date
CN116932505A (en) 2023-10-24

Similar Documents

Publication Publication Date Title
US9838375B2 (en) RESTlike API that supports a resilient and scalable distributed application
WO2023185071A1 (en) Data query method, data writing method, related apparatus and system
US9306825B2 (en) Providing a witness service
CN108712457B (en) Method and device for adjusting dynamic load of back-end server based on Nginx reverse proxy
WO2021237433A1 (en) Message pushing method and apparatus, and electronic device and computer-readable medium
CN106790629A (en) Data synchronization unit and its realize the method for data syn-chronization, client access system
US9390156B2 (en) Distributed directory environment using clustered LDAP servers
US20200057714A1 (en) Testing data changes in production systems
US20140372534A1 (en) Using status inquiry and status response messages to exchange management information
US8930518B2 (en) Processing of write requests in application server clusters
US20160337467A1 (en) Method and system for information exchange utilizing an asynchronous persistent store protocol
CN110798495B (en) Method and server for end-to-end message push in cluster architecture mode
CN111193778A (en) Method, device, equipment and medium for WEB service load balancing
CN115190125B (en) Monitoring method and device for cache cluster
CN110247847B (en) Method and device for back source routing between nodes
CN112769960B (en) Active flow control method and system based on Nginx server
CN114374657B (en) Data processing method and device
CA2879654C (en) Method, apparatus, and system for managing information in mobile device
CN111327511B (en) Instant messaging method, system, terminal equipment and storage medium
US9596199B2 (en) Enabling and supporting a presence server cache
CN107193989B (en) NAS cluster cache processing method and system
CN113515411B (en) Disaster recovery backup method, device, electronic equipment, storage medium and program product
CN113364615B (en) Method, device, equipment and computer readable medium for rolling upgrade
CN108600025B (en) Method and device for automatic disaster recovery of system
CN112948430B (en) Date data query method and device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22934889

Country of ref document: EP

Kind code of ref document: A1