CN106844405B - Data query method and apparatus - Google Patents
Data query method and apparatus Download PDFInfo
- Publication number
- CN106844405B CN106844405B CN201510894044.8A CN201510894044A CN106844405B CN 106844405 B CN106844405 B CN 106844405B CN 201510894044 A CN201510894044 A CN 201510894044A CN 106844405 B CN106844405 B CN 106844405B
- Authority
- CN
- China
- Prior art keywords
- node server
- query result
- query
- data
- spare
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/951—Indexing; Web crawling techniques
Landscapes
- Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The embodiment of the invention discloses data query method and apparatus, which comprises after obtaining data inquiry request, parsing obtains the index mark and query condition information of at least one data directory entrained by the data inquiry request;Determine at least one described respective corresponding second node server of index mark;The corresponding aggregate request of respectively each second node server construction, the aggregate request carry all indexes marks corresponding to the query condition information and the second node server;Constructed aggregate request is sent to corresponding second node server, so that spare query result corresponding to second node screening server and the determining aggregate request, feeds back to first node server for spare query result;First node screening server obtains target query result corresponding to the data inquiry request.Using the embodiment of the present invention, system performance and stability can be improved with equalization data processing pressure.
Description
Technical field
The present invention relates to computer communication technology fields, in particular to data query method and apparatus.
Background technique
Belonging to the current of big data era, for data query, usually using based on Solr's and Zookeeper
Distributed search scheme SolrCloud, so-called Solr are high-performance and the full-text search server based on Lucene, so-called
Zookeeper is that the functional software of Consistency service is provided for Distributed Application.
In the prior art, using including: node server cluster in the data query system of SolrCloud, wherein node
Each node server in server cluster for Solr and is stored at least one data directory for data query,
In, data directory is the basic unit of inquiry;Also, during data query, each node server all can be conduct
Receive the destination server of data inquiry request.Specifically, for the data query system using SolrCloud, tool
The data query method of body includes: to obtain the data inquiry request after first node server receives data inquiry request
Entrained query condition information and n index mark determine the n respective corresponding second node service of index mark
Device constructs the corresponding sub- request Concurrency of inquiry of each index mark respectively and send to corresponding second node server, wherein looks into
It askes son request and carries respective index mark and query condition information;And second node server is receiving inquiry son request
Afterwards, the data directory that entrained index mark can be requested inquiry corresponding, is inquired according to query condition information,
The corresponding spare query result of m item of inquiry request is obtained, and feeds back to first node server;In turn, first node
Server will eventually get the spare query result of n*m item, and to the spare query result Screening Treatment of n*m item, screening obtains data
M query result corresponding to inquiry request.
Although above-mentioned data query method can be realized the accurate inquiry of data, since each index mark can
Corresponding a certain number of query results, first node server need the query result corresponding to all index marks to sieve
Choosing processing, therefore, after the data volume of inquiry reaches certain scale, the data volume handled needed for first node server can be suitable
Greatly, at this moment query performance will be decreased obviously, and frequently can lead to the collapse of first node server, and then lead to node server
Cluster crash.
Summary of the invention
The embodiment of the invention discloses data query method and apparatus, can effectively share the data inquiry request received
Node server calculating pressure, improve node server cluster performance and stability.Specific technical solution is as follows:
In a first aspect, it is applied to first node server the embodiment of the invention provides a kind of data query method, it is described
First node server is any node server in node server cluster included by data query system, the method packet
It includes:
After obtaining data inquiry request, parsing obtains at least one data directory entrained by the data inquiry request
Index mark and query condition information;
Determine at least one described respective corresponding second node server of index mark, the second node server
For any node server in node server cluster included by the data query system;
The corresponding aggregate request of respectively each second node server construction, the aggregate request carry the inquiry
All index marks corresponding to conditional information and the second node server;
Constructed aggregate request is sent to corresponding second node server, so that second node server determines
All respective corresponding data directories of index mark entrained by the aggregate request, based on entrained by the aggregate request
The query condition information executes inquiry operation to each data directory determined, obtains initial query as a result, from gained
To initial query result in, screening obtains spare query result corresponding to the aggregate request, and by the spare inquiry
As a result the first node server is fed back to;
Receive the spare query result of all second node server feedbacks;
From the spare query result of received all second node server feedbacks, screening obtains the data and looks into
Ask the corresponding target query result of request.
Preferably, at least one respective corresponding second node server of index mark described in the determination, comprising:
It is identified in the corresponding relationship with node server from the index of pre-stored data directory, determines described at least one
A respective corresponding second node server of index mark.
Preferably, it is described from the spare query result of received all second node server feedbacks, it screens
To target query result corresponding to the data inquiry request, comprising:
According to predetermined order mode corresponding with the query condition information, to received all second node services
The spare query result of device feedback is ranked up processing;
It is handled in resulting sequencing queue from sequence, selection meets the spare inquiry knot in part of the query condition information
Fruit;
Using the selected spare query result in obtained part as target query knot corresponding to the data inquiry request
Fruit.
Preferably, described from the spare query result of received all second node server feedbacks, screening
After obtaining target query result corresponding to the data inquiry request, the method also includes:
The target query result is returned to sender corresponding to the data inquiry request.
Preferably, described return to the target query result to sender corresponding to the data inquiry request, comprising:
In a manner of predetermined order corresponding with the query condition information, sending corresponding to Xiang Suoshu data inquiry request
Side returns to the target query result.
Second aspect, the embodiment of the invention provides a kind of data query methods, are applied to second node server, described
Second node server is any node server in node server cluster included by data query system, the method packet
It includes:
After the aggregate request for receiving the transmission of first node server, all ropes entrained by the aggregate request are determined
Respectively corresponding data directory is known in tendering, and the aggregate request carries at least one number in acquisition for first node server
According to constructed and transmission after the index mark of index and the data inquiry request of query condition information, wherein the polymerization is asked
It asks and carries all index marks corresponding to query condition information and the second node server, the first node clothes
Device be engaged in as any node server in node server cluster included by data query system;
Based on the query condition information entrained by the aggregate request, each data directory determined is executed
Inquiry operation obtains initial query result;
From obtained initial query result, screening obtains spare query result corresponding to the aggregate request;
The spare query result is fed back into the first node server so that the first node server from
In the spare query result of received all second node server feedbacks, it is right that screening obtains the data inquiry request institute
The target query result answered.
Preferably, described from obtained initial query result, screening obtains spare corresponding to the aggregate request
Query result, comprising:
According to predetermined order mode corresponding with the query condition information, obtained initial query result is arranged
Sequence processing;
It is handled in resulting sequencing queue from sequence, selection meets the part initial query knot of the query condition information
Fruit;
Using selected obtained part initial query result as the spare query result to first node server feedback.
The third aspect, the embodiment of the invention provides a kind of data query devices, are applied to first node server, described
First node server is any node server in node server cluster included by data query system, described device packet
It includes:
Parsing module: for after obtaining data inquiry request, parsing to be obtained entrained by the data inquiry request extremely
The index mark and query condition information of a few data directory;
Determining module: described for determining at least one described respective corresponding second node server of index mark
Second node server is any node server in node server cluster included by the data query system;
Aggregate request constructs module: described for being respectively the corresponding aggregate request of each second node server construction
Aggregate request carries all index marks corresponding to the query condition information and the second node server;
Aggregate request sending module: being sent to corresponding second node server for constructed aggregate request, so that
Second node server determines all respective corresponding data directories of index mark entrained by the aggregate request, is based on institute
The query condition information entrained by aggregate request is stated, inquiry operation is executed to each data directory determined, is obtained
For initial query as a result, from obtained initial query result, screening obtains spare inquiry knot corresponding to the aggregate request
Fruit, and the spare query result is fed back into the first node server;
Target query result receiving module: for receiving the spare query result of all second node server feedbacks;
Target query result screens determining module: for from the spare of received all second node server feedbacks
In query result, screening obtains target query result corresponding to the data inquiry request.
Preferably, the determining module is specifically used for:
It is identified in the corresponding relationship with node server from the index of pre-stored data directory, determines described at least one
A respective corresponding second node server of index mark.
Preferably, the target query result screening module includes: that sequencing unit, screening unit and target query result are true
Order member;
The sequencing unit: it is used for according to predetermined order mode corresponding with the query condition information, to received
The spare query results of all second node server feedbacks be ranked up processing;
The screening unit: for handling in resulting sequencing queue from sequence, selection meets the query condition information
The spare query result in part;
The target query result determination unit: for using the selected spare query result in obtained part as the number
According to target query result corresponding to inquiry request.
Preferably, data query device provided by the embodiment of the present invention further includes target query result return module;
The target query result return module: for described from received all second node server feedbacks
Spare query result in, screening obtain target query result corresponding to the data inquiry request after, Xiang Suoshu data
Sender corresponding to inquiry request returns to the target query result.
Preferably, the target query result return module is specifically used for:
In a manner of predetermined order corresponding with the query condition information, sending corresponding to Xiang Suoshu data inquiry request
Side returns to the target query result.
Fourth aspect, the embodiment of the invention provides a kind of data query devices, are applied to second node server, described
Second node server is any node server in node server cluster included by data query system, described device packet
It includes:
Data directory determining module: described poly- for determining after receiving first node server and sending aggregate request
The entrained respective corresponding data directory of all indexes mark of request is closed, the aggregate request is that first node server exists
It obtains constructed concurrent after the data inquiry request of the index mark and query condition information that carry at least one data directory
It send, wherein the aggregate request carries all ropes corresponding to query condition information and the second node server
Tendering is known, and the first node server is any node service in node server cluster included by data query system
Device;
Initial query result determining module: right for based on the query condition information entrained by the aggregate request
The each data directory determined executes inquiry operation, obtains initial query result;
Spare query result screens determining module: for from obtained initial query result, screening to obtain described poly-
Close the corresponding spare query result of request;
Spare query result feedback module: for the spare query result to be fed back to the first node server,
So that the first node server from the spare query result of received all second node server feedbacks, sieves
Choosing obtains target query result corresponding to the data inquiry request.
Preferably, the spare query result screening determining module includes: sequence processing unit, the selection of initial query result
Unit and spare query result determination unit;
The sequence processing unit: it is used for according to predetermined order mode corresponding with the query condition information, to gained
To initial query result be ranked up processing;
The initial query result selecting unit: for handling in resulting sequencing queue from sequence, selection meets described
The part initial query result of query condition information;
The spare query result determination unit: for using selected obtained part initial query result as to first
The spare query result of node server feedback.
Compared with prior art, in the present solution, aggregate request corresponding for each second node server construction, this is poly-
Closing request includes all index marks corresponding to corresponding second node server, and not as unit of independent data directory
Construct the request of data query, so that second node server can be right at least one data directory institute inquired
The query result answered carries out summarizing screening, and then the less the selection result that summarizes of data volume is sent to first node server,
And only the summarize the selection result less to data volume is summarized screening to first node server again, therefore, is realized
The calculating pressure of the node server of the data inquiry request received is effectively shared, the performance of node server cluster is improved
With the purpose of stability.
Certainly, it implements any of the products of the present invention or method must be not necessarily required to reach all the above excellent simultaneously
Point.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below
There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this
Some embodiments of invention for those of ordinary skill in the art without creative efforts, can be with
It obtains other drawings based on these drawings.
Fig. 1 is a kind of flow diagram of data query method provided in an embodiment of the present invention;
Fig. 2 is the flow diagram of the method provided in an embodiment of the present invention for obtaining target query result;
Fig. 3 is the flow diagram of another data query method provided in an embodiment of the present invention;
Fig. 4 is a kind of structural schematic diagram of data query device provided in an embodiment of the present invention;
Fig. 5 is the structural schematic diagram of another data query device provided in an embodiment of the present invention.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on
Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other
Embodiment shall fall within the protection scope of the present invention.
In order to effectively share the data inquiry request received node server calculating pressure, improve node server
The performance and stability of cluster, the embodiment of the invention provides data query method and apparatus.
In a first aspect, the embodiment of the present invention is provided from the angle for the first node server for receiving data inquiry request
A kind of data query method.It should be noted that a kind of data query method provided by the present embodiment is applied to first segment
Point server, the first node server are any node service in node server cluster included by data query system
Device, i.e., each node server can execute data query method provided by the present embodiment;Also, in practical applications,
The data query system is the system using distributed search scheme SolrCloud.
As shown in Figure 1, a kind of data query method provided by the present embodiment, may include steps of:
S101: after obtaining data inquiry request, parsing obtains at least one data entrained by the data inquiry request
The index of index identifies and query condition information;
First node server, for subsequent data query, can parse this after obtaining data inquiry request
The index of at least one data directory entrained by data inquiry request identifies and query condition information.Wherein, parsing is somebody's turn to do
The index mark of at least one data directory entrained by data inquiry request and the specific implementation of query condition information can
To use the prior art, it is not limited here.
It is understood that the data inquiry request can be based on query interface by user and issue in practical application,
Can be automatically generated for first node server when meeting predetermined conditions, etc., this is all reasonable.
Also, the index is identified as unique information for referring to data directory, such as: index mark can be data directory
Title, alternatively, the information, etc. determined based on data directory title and content;And the query condition information is existing
Query condition information, may include: the combination of data content to be checked and the required result item number as query argument, or
The combination, etc. of query context corresponding to person, data content to be checked and data content to be checked as query argument.
S102: the second node server corresponding to determining at least one index mark respectively;
Since data directory distribution is stored in node server and each node server stores at least one data rope
Draw, therefore, obtains the index mark and querying condition of at least one data directory entrained by the data inquiry request in parsing
After information, at least one respective corresponding second node server of index mark can be determined, wherein the second node service
Device is any node server in node server cluster included by data query system.
Specifically, it is built with the corresponding relationship of the index mark and node server of data directory in advance in practical application,
Therefore, at least one index of the determination identifies respectively corresponding second node server, may include:
It is identified in the corresponding relationship with node server from the index of pre-stored data directory, determines at least one rope
Respectively corresponding second node server is known in tendering.
It should be noted that the index mark at least one data directory may be included in the first node server
Know referred to data directory, it is also possible to identify referred to data rope not comprising the index at least one data directory
Draw;Further, when including that index mark at least one data directory is referred in the first node server
When data directory, first node server can serve as the role of second node server, complete the work of second node server
Make.
For example, first node server obtains data inquiry request A, and parsing obtains entrained by inquiry request A
The index mark of data directory is respectively a, b, c, d, e;Also, parsing obtains query condition information and includes inquiry content first and look into
Ask parameter start, row, wherein start be query context starting point, row be using start as starting point after inquiry knot
Fruit quantity;From the index mark of pre-stored data directory in the corresponding relationship of node server, obtain index mark with
The correspondence situation of second node server is respectively as follows: a and corresponds to second node server 1, and b, c, d correspond to second node server 2,
E corresponds to second node server 3, at this time, wherein second node server 1 is the first node for receiving data inquiry request
Server.
S103: being respectively the corresponding aggregate request of each second node server construction, and the aggregate request carries
State all index marks corresponding to query condition information and the second node server;
After second node server corresponding to determining at least one index mark respectively, not using in the prior art
Identified based on each index to construct inquiry son request, but, respectively each second node server construction is corresponding poly-
Request is closed, which carries all index marks corresponding to the query condition information and the second node server
Know.
For example: according to step S101 and step S102, obtains a and correspond to second node server 1, b, c, d corresponding the
Two node servers 2, e correspond to second node server 3, then construct aggregate request 1 for first node server 1, are the second section
Point server 2 constructs aggregate request 2, constructs aggregate request 3 for second node server 3, wherein the aggregate request 1 carries
Index mark a and including inquire content first and query argument query condition information, the aggregate request 2 carry index mark b,
C, d and including inquire content first and query argument query condition information, the aggregate request 3 carry index mark e and
Query condition information including inquiring content first and query argument;Wherein, since each aggregate request is carried including in inquiry
Hold the query condition information of first and query argument, wherein query argument start and row, in that case it can be decided that each data directory obtains
Query result number, can also determine that second node server returns to the query result number of first node server, also
It can determine the query result number that first node server finally returns that.
S104: constructed aggregate request is sent to corresponding second node server, so that second node service
Device determines all respective corresponding data directories of index mark entrained by the aggregate request, based on entrained by the aggregate request
The query condition information, inquiry operation is executed to each data directory for being determined, obtains initial query as a result, from institute
In obtained initial query result, screening obtains spare query result corresponding to the aggregate request, and the spare inquiry is tied
Fruit feeds back to the first node server;
It, can be by constructed aggregate request after the corresponding aggregate request of respectively each second node server construction
It is sent to corresponding second node server, so that second node server determines all indexes entrained by the aggregate request
The respective corresponding data directory of mark, based on the query condition information entrained by the aggregate request, to what is determined
Each data directory executes inquiry operation, obtains initial query as a result, screening is somebody's turn to do from obtained initial query result
Spare query result corresponding to aggregate request, and the spare query result is fed back into the first node server.Citing and
Speech: the aggregate request 1,2 and 3 that step S103 is constructed is respectively sent to second node server 1, second node server 2, the
Two node servers 3, so that second node server 1 is wrapped based on the index mark a in aggregate request 1, query condition information
The inquiry content first and query argument start, row included, screening obtain spare query result corresponding to the aggregate request 1, and
The spare query result is fed back into the first node server, second node server 2 is similar with second node server 3,
No longer repeated.
Specifically, screening obtains spare inquiry knot corresponding to the aggregate request from obtained initial query result
Fruit, and the spare query result is fed back into the first node server, it may include: according to corresponding with the query condition information
Predetermined order mode, processing is ranked up to obtained initial query result;It is handled in resulting sequencing queue from sequence,
Selection meets the part initial query result of the query condition information;Using selected obtained part initial query result as to
The spare query result of first node server feedback.Wherein, predetermined order mode is determined based on query condition information, example
Such as: according to the sequence of similarity size, or, other pre-defined rules, etc.;Also, it is determined based on query condition information default
Sortord can be achieved by the prior art, and this will not be repeated here.
For example, for query argument start and row, each data directory can obtain [start+row] item primary
Query result, and each aggregate request will return to [start+row] query result.
By taking second node server 2 as an example, the cluster corresponding to second node server 2 requests to carry b, c, d tri- in 2
A index mark, then could be aware that there are three data directories of corresponding b, c, d in second node server 2, because of every number
[start+row] query result will be obtained according to index, then at the beginning of second node server 2 will obtain 3* [start+row] item
Grade query result, demonstrated the need for first node server feedback [start+row] initial query due to aggregate request as a result,
Therefore, second node server 2 carries out initial query result according to predetermined order mode corresponding with the query condition information
Sequence processing, it is assumed that [start+row] initial query result is relative to other primary before query condition information shows in queue
Query result more meets the requirements, and therefore, [start+row] query result is as spare inquiry before selecting in the sequencing queue
As a result;Certainly, if query condition information shows that the status of each initial query result is impartial, it is possible to the sequencing queue
Middle random selection [start+row] initial query result is as spare query result.As it can be seen that in the present solution, second node takes
Device 2 be engaged in finally to first node server feedback [start+row] initial query as a result, and feedback not in the prior art
3* [start+row] initial query is as a result, the data volume handled needed for greatly reducing first node server.
S105: the spare query result of all second node server feedbacks is received;
S106: from the spare query result of received all second node server feedbacks, screening obtains the number
According to target query result corresponding to inquiry request.
Wherein, since each second node server has fed back certain amount of spare query result, and data query
The corresponding target query result of request is only the specific quantity, therefore, is receiving all second node server feedbacks
It, can be by certain way, from the spare inquiry of received all second node server feedbacks after spare query result
As a result in, screening obtains target query result corresponding to the data inquiry request.
Specifically, it is described from the spare query result of received all second node server feedbacks, it screens
To target query corresponding to the data inquiry request as a result, as shown in Fig. 2, may include steps of:
S201: according to predetermined order mode corresponding with the query condition information, to received all second nodes
The spare query result of server feedback is ranked up processing;
S202: being handled in resulting sequencing queue from sequence, and selection meets the spare inquiry in part of the query condition information
As a result;
S203: using the selected spare query result in obtained part as target query corresponding to the data inquiry request
As a result.
Wherein, determine that the mode of predetermined order mode can use the prior art based on query condition information, also, right
In query condition information with determining situation, the spare query result in part for meeting the query condition information can also be determined.
For example: passing through step S101 to step S105, first node server (i.e. second node server 1) can
To receive the spare query result of [start+row] item of the feedback of second node server 2, second node server 3 is fed back
The spare query result of [start+row] item and the spare query result of [start+row] item of itself should according to step S106
First node server it is only necessary to the spare query result of 3* [start+row] item carry out it is secondary summarize screening, and simultaneously
Screening once is summarized to the progress of 5* [start+row] item spare query result in non-existing technology, greatly reduces data volume.
Further, described from the spare query result of received all second node server feedbacks,
It, can also be to corresponding to the data inquiry request after screening obtains target query result corresponding to the data inquiry request
Sender return to the target query result.Also, it, can be with corresponding with the query condition information for preferable user experience
Predetermined order mode, return to the target query result to sender corresponding to the data inquiry request.
It requires emphasis, this programme identifies more, query condition information institute for the requested index of inquiry request of data
In the case that corresponding query context is more compared with query result item number corresponding to wide or query condition information, it can embody
The advantage of sharing embodies to become apparent.
Compared with prior art, in the present solution, aggregate request corresponding for each second node server construction, this is poly-
Closing request includes all index marks corresponding to corresponding second node server, and not as unit of independent data directory
Construct the request of data query, so that second node server can be right at least one data directory institute inquired
The query result answered carries out summarizing screening, and then the less the selection result that summarizes of data volume is sent to first node server,
And only the summarize the selection result less to data volume is summarized screening to first node server again, therefore, is realized
The calculating pressure of the node server of the data inquiry request received is effectively shared, the performance of node server cluster is improved
With the purpose of stability.
Second aspect, the embodiment of the present invention provide a kind of data query method from the angle of second node server.
It should be noted that a kind of data query method provided by this is applied to second node server, second section
Point server is any node server in node server cluster included by data query system, i.e., each node server
Data query method provided by the present embodiment can be executed;Also, in practical applications, which is to utilize
The system of distributed search scheme SolrCloud.
As shown in figure 3, a kind of data query method provided by the present embodiment, may include steps of:
S301: after the aggregate request for receiving the transmission of first node server, institute entrained by the aggregate request is determined
There is the respective corresponding data directory of index mark, which carries at least one in acquisition for first node server
It is constructed and transmission after the index mark of data directory and the data inquiry request of query condition information, wherein the polymerization is asked
It asks and carries all index marks, the first node server corresponding to query condition information and the second node server
For any node server in node server cluster included by data query system;
It should be noted that second node server receive first node server transmission aggregate request after, meeting
The aggregate request is first handled, all indexes mark and query condition information carried in the aggregate request is parsed, according to this
All index marks determine the data directory corresponding to all index marks are respectively entrained by the aggregate request, and recycling should
Corresponding data directory is inquired according to the query condition information.Wherein, parse the aggregate request be can use it is existing
Technology, details are not described herein.
For example, after second node server 1 receives the aggregate request 1 that first node server is sent, parsing should
Aggregate request 1 obtains 3 index marks, and respectively A, B, C, obtained query condition information include first and and query argument
start、row。
Wherein, the detailed process about first node server construction aggregate request is referred to above-mentioned from first node clothes
Corresponding description content in data query mode provided by device angle of being engaged in, this will not be repeated here.
S302: based on the query condition information entrained by the aggregate request, to each data directory determined
Inquiry operation is executed, initial query result is obtained;
Wherein it is possible to be realized by the prior art: right based on the query condition information entrained by the aggregate request
The each data directory determined executes inquiry operation, obtains initial query result.
S303: from obtained initial query result, screening obtains spare query result corresponding to the aggregate request;
Specifically, screening obtains spare inquiry knot corresponding to the aggregate request from obtained initial query result
Fruit may include:
According to predetermined order mode corresponding with the query condition information, obtained initial query result is ranked up
Processing;
It is handled in resulting sequencing queue from sequence, selection meets the part initial query result of the query condition information;
Using selected obtained part initial query result as the spare query result to first node server feedback.
Wherein, predetermined order mode is determined based on query condition information, such as: according to the sequence of similarity size, or,
Other pre-defined rules, etc.;Also, determine that predetermined order mode can be by prior art reality based on query condition information
Existing, this will not be repeated here.
The spare query result is fed back to the first node server by S304 so that the first node server from
In the spare query result of received all second node server feedbacks, screening is obtained corresponding to the data inquiry request
Target query result.
Wherein, spare query result of the first node server from received all second node server feedbacks
In, the specific implementation process that screening obtains target query result corresponding to the data inquiry request is referred to from first node
The corresponding description content of data query method provided by the angle of server, this will not be repeated here.
Using the embodiment of the present invention, after second node server receives the aggregate request of first node server transmission,
Primary Outcome inquiry is carried out according to information entrained by the aggregate request, is different from the prior art directly by the initial query result
It is sent to the first node server, but first once summarizes screening in locally progress, part initial query result is determined as
The spare query result is fed back to the first node server again, has effectively shared first node service by spare query result
The result queries pressure of device.
The third aspect, corresponding to embodiment of the method provided by the above-mentioned angle from first node server, the present invention is real
It applies example and provides a kind of data query device, be applied to first node server, which is data query system
Any node server in node server cluster included by uniting, as shown in figure 4, the apparatus may include:
Parsing module 410: for after obtaining data inquiry request, parsing to be obtained entrained by the data inquiry request extremely
The index mark and query condition information of a few data directory;
Determining module 420: for determining this at least one index mark respectively corresponding second node server, this
Two node servers are any node server in node server cluster included by the data query system;
Aggregate request constructs module 430:, should for being respectively the corresponding aggregate request of each second node server construction
Aggregate request carries all index marks corresponding to the query condition information and the second node server;
Aggregate request sending module 440: for constructed aggregate request to be sent to corresponding second node server,
So that second node server determines all respective corresponding data directories of index mark, base entrained by the aggregate request
The query condition information entrained by the aggregate request executes inquiry operation to each data directory determined, obtains
To initial query as a result, from obtained initial query result, screening obtains spare inquiry knot corresponding to the aggregate request
Fruit, and the spare query result is fed back into the first node server;
Target query result receiving module 450: for receiving the spare query result of all second node server feedbacks;
Target query result screens determining module 460: for from received all second node server feedbacks
In spare query result, screening obtains target query result corresponding to the data inquiry request.
Compared with prior art, in the present solution, aggregate request corresponding for each second node server construction, this is poly-
Closing request includes all index marks corresponding to corresponding second node server, and not as unit of independent data directory
Construct the request of data query, so that second node server can be right at least one data directory institute inquired
The query result answered carries out summarizing screening, and then the less the selection result that summarizes of data volume is sent to first node server,
And only the summarize the selection result less to data volume is summarized screening to first node server again, therefore, is realized
The calculating pressure of the node server of the data inquiry request received is effectively shared, the performance of node server cluster is improved
With the purpose of stability.
Specifically, the determining module 420 is specifically used for:
From the index mark of pre-stored data directory in the corresponding relationship of node server, determine this at least one
The respective corresponding second node server of index mark.
Specifically, the target query result screening module 460 may include: that sequencing unit, screening unit and target are looked into
Ask result determination unit;
The sequencing unit: it is used for according to predetermined order mode corresponding with the query condition information, to received institute
There is the spare query result of second node server feedback to be ranked up processing;
The screening unit: for handling in resulting sequencing queue from sequence, selection meets the portion of the query condition information
Divide spare query result;
The target query result determination unit: for being looked into using the selected spare query result in obtained part as the data
Ask the corresponding target query result of request.
Further, data query system provided by the embodiment of the present invention can also include that target query result returns to mould
Block;
The target query result return module: for described from received all second node server feedbacks
In spare query result, after screening obtains target query result corresponding to the data inquiry request, asked to the data query
Corresponding sender is asked to return to the target query result.
Specifically, the target query result return module is specifically used for:
In a manner of predetermined order corresponding with the query condition information, returned to sender corresponding to the data inquiry request
Return the target query result.
For systems/devices embodiment, since it is substantially similar to the method embodiment, so the comparison of description is simple
Single, the relevent part can refer to the partial explaination of embodiments of method.
Fourth aspect, corresponding to embodiment of the method provided by the above-mentioned angle from second node server, the present invention is real
It applies example and provides a kind of data query device, be applied to second node server, which is data query system
Any node server in node server cluster included by uniting, as shown in figure 5, the apparatus may include:
Data directory determining module 510: for determining that this is poly- after receiving first node server and sending aggregate request
The entrained respective corresponding data directory of all indexes mark of request is closed, which is that first node server is obtaining
It must carry constructed after the index mark of at least one data directory and the data inquiry request of query condition information and send
, wherein the aggregate request carries all index marks corresponding to query condition information and the second node server
Know, which is any node server in node server cluster included by data query system;
Initial query result determining module 520: for based on the query condition information entrained by the aggregate request, to institute
The each data directory determined executes inquiry operation, obtains initial query result;
Spare query result screens determining module 530: for from obtained initial query result, it is poly- that screening obtains this
Close the corresponding spare query result of request;
Spare query result feedback module 540: for the spare query result to be fed back to the first node server, with
So that the first node server is screened from the spare query result of received all second node server feedbacks
To target query result corresponding to the data inquiry request.
Using the embodiment of the present invention, after second node server receives the aggregate request of first node server transmission,
Primary Outcome inquiry is carried out according to information entrained by the aggregate request, is different from the prior art directly by the initial query result
It is sent to the first node server, but first once summarizes screening in locally progress, part initial query result is determined as
The spare query result is fed back to the first node server again, has effectively shared first node service by spare query result
The result queries pressure of device.
Further, the spare query result screening determining module 530 may include: sequence processing unit, primary
Query result selecting unit and spare query result determination unit;
The sequence processing unit: it is used for according to predetermined order mode corresponding with the query condition information, to obtained
Initial query result is ranked up processing;
The initial query result selecting unit: for handling in resulting sequencing queue from sequence, selection meets the inquiry
The part initial query result of conditional information;
The spare query result determination unit: for using selected obtained part initial query result as to first segment
The spare query result of point server feedback.
For systems/devices embodiment, since it is substantially similar to the method embodiment, so the comparison of description is simple
Single, the relevent part can refer to the partial explaination of embodiments of method.
It should be noted that, in this document, relational terms such as first and second and the like are used merely to a reality
Body or operation are distinguished with another entity or operation, are deposited without necessarily requiring or implying between these entities or operation
In any actual relationship or order or sequence.Moreover, the terms "include", "comprise" or its any other variant are intended to
Non-exclusive inclusion, so that the process, method, article or equipment including a series of elements is not only wanted including those
Element, but also including other elements that are not explicitly listed, or further include for this process, method, article or equipment
Intrinsic element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that
There is also other identical elements in process, method, article or equipment including the element.
Those of ordinary skill in the art will appreciate that all or part of the steps in realization above method embodiment is can
It is completed with instructing relevant hardware by program, the program can store in computer-readable storage medium,
The storage medium designated herein obtained, such as: ROM/RAM, magnetic disk, CD.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the scope of the present invention.It is all
Any modification, equivalent replacement, improvement and so within the spirit and principles in the present invention, are all contained in protection scope of the present invention
It is interior.
Claims (14)
1. a kind of data query method, is applied to first node server, the first node server is data query system
Any node server in included node server cluster, which is characterized in that the described method includes:
After obtaining data inquiry request, parsing obtains the rope of at least one data directory entrained by the data inquiry request
Tendering knowledge and query condition information;
Determine at least one described respective corresponding second node server of index mark, the second node server is institute
State any node server in node server cluster included by data query system;
The corresponding aggregate request of respectively each second node server construction, the aggregate request carry the querying condition
All index marks corresponding to information and the second node server;
Constructed aggregate request is sent to corresponding second node server, so that described in second node server is determining
All respective corresponding data directories of index mark entrained by aggregate request, described in entrained by the aggregate request
Query condition information executes inquiry operation to each data directory determined, obtains initial query as a result, from obtained
In initial query result, screening obtains spare query result corresponding to the aggregate request, and by the spare query result
Feed back to the first node server;
Receive the spare query result of all second node server feedbacks;
From the spare query result of received all second node server feedbacks, screening, which obtains the data query, is asked
Seek corresponding target query result.
2. the method according to claim 1, wherein respectively institute is right at least one index mark described in the determination
The second node server answered, comprising:
It is identified in the corresponding relationship with node server from the index of pre-stored data directory, determines at least one described rope
Respectively corresponding second node server is known in tendering.
3. the method according to claim 1, wherein described anti-from received all second node servers
In the spare query result of feedback, screening obtains target query result corresponding to the data inquiry request, comprising:
It is anti-to received all second node servers according to predetermined order mode corresponding with the query condition information
The spare query result of feedback is ranked up processing;
It is handled in resulting sequencing queue from sequence, selection meets the spare query result in part of the query condition information;
Using the selected spare query result in obtained part as target query result corresponding to the data inquiry request.
4. the method according to claim 1, wherein described from received all second node servers
In the spare query result of feedback, after screening obtains target query result corresponding to the data inquiry request, the side
Method further include:
The target query result is returned to sender corresponding to the data inquiry request.
5. according to the method described in claim 4, it is characterized in that, described to sender corresponding to the data inquiry request
Return to the target query result, comprising:
In a manner of predetermined order corresponding with the query condition information, sender corresponding to Xiang Suoshu data inquiry request is returned
Return the target query result.
6. a kind of data query method, is applied to second node server, the second node server is data query system
Any node server in included node server cluster, which is characterized in that the described method includes:
After the aggregate request for receiving the transmission of first node server, all index marks entrained by the aggregate request are determined
Know respectively corresponding data directory, the aggregate request carries at least one data rope in acquisition for first node server
It is constructed and transmission after the data inquiry request of the index mark and query condition information drawn, wherein the aggregate request is taken
It is identified with all indexes corresponding to query condition information and the second node server, the first node server
For any node server in node server cluster included by data query system;
Based on the query condition information entrained by the aggregate request, inquiry is executed to each data directory determined
Operation, obtains initial query result;
From obtained initial query result, screening obtains spare query result corresponding to the aggregate request;
The spare query result is fed back into the first node server, so that the first node server is from being connect
In the spare query result of all second node server feedbacks received, screening is obtained corresponding to the data inquiry request
Target query result.
7. according to the method described in claim 6, screening it is characterized in that, described from obtained initial query result
To spare query result corresponding to the aggregate request, comprising:
According to predetermined order mode corresponding with the query condition information, place is ranked up to obtained initial query result
Reason;
It is handled in resulting sequencing queue from sequence, selection meets the part initial query result of the query condition information;
Using selected obtained part initial query result as the spare query result to first node server feedback.
8. a kind of data query device, is applied to first node server, the first node server is data query system
Any node server in included node server cluster, which is characterized in that described device includes:
Parsing module: for after obtaining data inquiry request, parsing to be obtained at least one entrained by the data inquiry request
The index of a data directory identifies and query condition information;
Determining module: for determining at least one described index mark respectively corresponding second node server, described second
Node server is any node server in node server cluster included by the data query system;
Aggregate request constructs module: for being respectively the corresponding aggregate request of each second node server construction, the polymerization
Request carries all index marks corresponding to the query condition information and the second node server;
Aggregate request sending module: constructed aggregate request is sent to corresponding second node server, so that second
Node server determines all respective corresponding data directories of index mark entrained by the aggregate request, based on described poly-
The entrained query condition information of request is closed, inquiry operation is executed to each data directory determined, obtains primary
Query result, from obtained initial query result, screening obtains spare query result corresponding to the aggregate request, and
The spare query result is fed back into the first node server;
Target query result receiving module: for receiving the spare query result of all second node server feedbacks;
Target query result screens determining module: for the spare inquiry from received all second node server feedbacks
As a result in, screening obtains target query result corresponding to the data inquiry request.
9. device according to claim 8, which is characterized in that the determining module is specifically used for:
It is identified in the corresponding relationship with node server from the index of pre-stored data directory, determines at least one described rope
Respectively corresponding second node server is known in tendering.
10. device according to claim 8, which is characterized in that the target query result screening module includes: that sequence is single
Member, screening unit and target query result determination unit;
The sequencing unit: it is used for according to predetermined order mode corresponding with the query condition information, to received institute
There is the spare query result of second node server feedback to be ranked up processing;
The screening unit: for handling in resulting sequencing queue from sequence, selection meets the portion of the query condition information
Divide spare query result;
The target query result determination unit: for being looked into using the selected spare query result in obtained part as the data
Ask the corresponding target query result of request.
11. device according to claim 8, which is characterized in that further include target query result return module;
The target query result return module: for described from the standby of received all second node server feedbacks
With in query result, screen after obtaining target query result corresponding to the data inquiry request, Xiang Suoshu data query
The corresponding sender of request returns to the target query result.
12. device according to claim 11, which is characterized in that the target query result return module is specifically used for:
In a manner of predetermined order corresponding with the query condition information, sender corresponding to Xiang Suoshu data inquiry request is returned
Return the target query result.
13. a kind of data query device, is applied to second node server, the second node server is data query system
Any node server in included node server cluster, which is characterized in that described device includes:
Data directory determining module: for determining that the polymerization is asked after receiving first node server and sending aggregate request
Entrained all indexes are asked to identify respectively corresponding data directory, the aggregate request is that first node server is obtaining
It carries constructed after the index mark of at least one data directory and the data inquiry request of query condition information and sends,
Wherein, the aggregate request carries all index marks corresponding to query condition information and the second node server
Know, the first node server is any node server in node server cluster included by data query system;
Initial query result determining module: for based on the query condition information entrained by the aggregate request, to really
The each data directory made executes inquiry operation, obtains initial query result;
Spare query result screens determining module: being used for from obtained initial query result, screening, which obtains the polymerization, asks
Seek corresponding spare query result;
Spare query result feedback module: for the spare query result to be fed back to the first node server, so that
The first node server is obtained from the spare query result of received all second node server feedbacks, is screened
To target query result corresponding to the data inquiry request.
14. device according to claim 13, which is characterized in that the spare query result screens determining module and includes:
Sort processing unit, initial query result selecting unit and spare query result determination unit;
The sequence processing unit: it is used for according to predetermined order mode corresponding with the query condition information, to obtained
Initial query result is ranked up processing;
The initial query result selecting unit: for handling in resulting sequencing queue from sequence, selection meets the inquiry
The part initial query result of conditional information;
The spare query result determination unit: for using selected obtained part initial query result as to first node
The spare query result of server feedback.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510894044.8A CN106844405B (en) | 2015-12-07 | 2015-12-07 | Data query method and apparatus |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510894044.8A CN106844405B (en) | 2015-12-07 | 2015-12-07 | Data query method and apparatus |
Publications (2)
Publication Number | Publication Date |
---|---|
CN106844405A CN106844405A (en) | 2017-06-13 |
CN106844405B true CN106844405B (en) | 2019-10-22 |
Family
ID=59152056
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510894044.8A Active CN106844405B (en) | 2015-12-07 | 2015-12-07 | Data query method and apparatus |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106844405B (en) |
Families Citing this family (14)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110019332A (en) * | 2017-09-29 | 2019-07-16 | 北京国双科技有限公司 | A kind of data query method and device based on precomputation |
CN109165257A (en) * | 2018-08-07 | 2019-01-08 | 中国建设银行股份有限公司 | Data query method and related system, equipment and storage medium |
CN110889000B (en) * | 2018-09-10 | 2022-08-16 | 百度在线网络技术(北京)有限公司 | Method and apparatus for outputting information |
CN109271449A (en) * | 2018-09-30 | 2019-01-25 | 山东超越数控电子股份有限公司 | A kind of distributed storage inquiry system file-based and querying method |
CN109299348B (en) * | 2018-11-28 | 2021-09-28 | 北京字节跳动网络技术有限公司 | Data query method and device, electronic equipment and storage medium |
CN109933710A (en) * | 2019-02-27 | 2019-06-25 | 生活空间(沈阳)数据技术服务有限公司 | A kind of data query method, apparatus and storage medium, program product |
CN110196851B (en) * | 2019-05-09 | 2024-05-10 | 腾讯科技(深圳)有限公司 | Data storage method, device, equipment and storage medium |
CN110471947B (en) * | 2019-07-09 | 2023-11-10 | 广州视源电子科技股份有限公司 | Query method based on distributed search engine, server and storage medium |
CN110727549B (en) * | 2019-10-08 | 2022-07-05 | 浙江百岸科技有限公司 | Sensor data backup method and system |
CN111797091B (en) * | 2019-10-18 | 2024-09-20 | 北京沃东天骏信息技术有限公司 | Method, device, electronic equipment and storage medium for inquiring data in database |
CN110990146A (en) * | 2019-11-01 | 2020-04-10 | 北京信安世纪科技股份有限公司 | Load balancing method, device, system and storage medium |
CN113132267B (en) * | 2019-12-31 | 2022-09-02 | 奇安信科技集团股份有限公司 | Distributed system, data aggregation method and computer readable storage medium |
CN111698324B (en) * | 2020-06-12 | 2022-12-06 | 北京奇艺世纪科技有限公司 | Data request method, device and system |
CN113157736B (en) * | 2021-04-28 | 2024-01-05 | 联通沃音乐文化有限公司 | Query plan optimization method and system in distributed database |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102467570A (en) * | 2010-11-17 | 2012-05-23 | 日电(中国)有限公司 | Connection query system and method for distributed data warehouse |
CN103136364A (en) * | 2013-03-14 | 2013-06-05 | 曙光信息产业(北京)有限公司 | Cluster database system and data query processing method thereof |
CN104216957A (en) * | 2014-08-20 | 2014-12-17 | 北京奇艺世纪科技有限公司 | Query system and query method for video metadata |
CN104731951A (en) * | 2015-03-31 | 2015-06-24 | 北京奇艺世纪科技有限公司 | Data query method and device |
CN105007317A (en) * | 2015-07-10 | 2015-10-28 | 深圳市创梦天地科技有限公司 | Data processing method for distributed nodes, and gateway equipment |
-
2015
- 2015-12-07 CN CN201510894044.8A patent/CN106844405B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102467570A (en) * | 2010-11-17 | 2012-05-23 | 日电(中国)有限公司 | Connection query system and method for distributed data warehouse |
CN103136364A (en) * | 2013-03-14 | 2013-06-05 | 曙光信息产业(北京)有限公司 | Cluster database system and data query processing method thereof |
CN104216957A (en) * | 2014-08-20 | 2014-12-17 | 北京奇艺世纪科技有限公司 | Query system and query method for video metadata |
CN104731951A (en) * | 2015-03-31 | 2015-06-24 | 北京奇艺世纪科技有限公司 | Data query method and device |
CN105007317A (en) * | 2015-07-10 | 2015-10-28 | 深圳市创梦天地科技有限公司 | Data processing method for distributed nodes, and gateway equipment |
Also Published As
Publication number | Publication date |
---|---|
CN106844405A (en) | 2017-06-13 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106844405B (en) | Data query method and apparatus | |
US10949253B2 (en) | Data forwarder for distributed data acquisition, indexing and search system | |
US8924361B2 (en) | Monitoring entitlement usage in an on-demand system | |
CN109146447A (en) | The transparent sharding method of block chain, apparatus and system | |
CN109871224A (en) | A kind of gray scale dissemination method, system, medium and equipment based on user identifier | |
CN110134659B (en) | Log monitoring system, method, medium, and apparatus for running program | |
US20160323385A1 (en) | Distributed Data Storage Method, Apparatus, and System | |
CA3065118A1 (en) | Distributed searching and index updating method and system, servers, and computer devices | |
CN105243169B (en) | A kind of data query method and system | |
CN106445473A (en) | Container deployment method and apparatus | |
CN106453460B (en) | File distribution method, device and system | |
US9280402B2 (en) | System and method for updating a dual layer browser | |
CN106953926A (en) | A kind of method for routing and device | |
CN109740034A (en) | The case-involving information query method of enterprise and device based on graphic data base | |
CN104731951A (en) | Data query method and device | |
CN111930770A (en) | Data query method and device and electronic equipment | |
CN105471700B (en) | A kind of methods, devices and systems of Message Processing | |
EP2096594A1 (en) | Method and system for implementing multiple web services for a service query | |
CN112769943A (en) | Service processing method and device | |
CN105630852A (en) | Information inquiry method and server | |
CN106227597A (en) | Task priority treating method and apparatus | |
CN101667139A (en) | Service program invocation method based on aggregate type object, device and system therefor | |
CN113010786B (en) | Information pushing method, device, equipment and storage medium | |
CN107729421B (en) | The execution method, apparatus and storage medium of storing process | |
CN102737044B (en) | Method and device for releasing webpage information |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |