[go: up one dir, main page]

CN112463832B - A query method, device and electronic device based on hbase-indexer - Google Patents

A query method, device and electronic device based on hbase-indexer Download PDF

Info

Publication number
CN112463832B
CN112463832B CN202011365011.1A CN202011365011A CN112463832B CN 112463832 B CN112463832 B CN 112463832B CN 202011365011 A CN202011365011 A CN 202011365011A CN 112463832 B CN112463832 B CN 112463832B
Authority
CN
China
Prior art keywords
query
index
searcher
hbase
indexer
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
Application number
CN202011365011.1A
Other languages
Chinese (zh)
Other versions
CN112463832A (en
Inventor
申胜利
侯满
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Metabrain Intelligent Technology Co Ltd
Original Assignee
Suzhou Inspur Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Suzhou Inspur Intelligent Technology Co Ltd filed Critical Suzhou Inspur Intelligent Technology Co Ltd
Priority to CN202011365011.1A priority Critical patent/CN112463832B/en
Publication of CN112463832A publication Critical patent/CN112463832A/en
Application granted granted Critical
Publication of CN112463832B publication Critical patent/CN112463832B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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/2455Query execution
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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/22Indexing; Data structures therefor; Storage structures
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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/248Presentation of query results

Landscapes

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

Abstract

The invention provides a query method and device based on a hbase-indexer, electronic equipment and a storage medium, belongs to the technical field of servers, and solves the technical problem that the hbase-indexer in the prior art cannot index data into an es searcher. The method comprises the following steps: the client configures parameters for a compatible es searcher which is used for client command input, and sets indexes for distinguishing the solr searcher and the es searcher; the server side confirms the type of the searcher according to the index, if the searcher is an es searcher, the searcher is switched to an es index logic, es connection is established according to the index, and the index is led into the es searcher; and adding query logic in an execution command of the hbase-indexer, wherein the query logic is used for performing combined query according to the parameters and the index when the client runs the combined query command, and returning a query result.

Description

一种基于hbase-indexer的查询方法、装置及电子设备A query method, device and electronic device based on hbase-indexer

技术领域technical field

本发明涉及服务器的技术领域,尤其是涉及一种基于hbase-indexer的查询方法、装置、电子设备及存储介质。The present invention relates to the technical field of servers, in particular to a query method, device, electronic device and storage medium based on hbase-indexer.

背景技术Background technique

Hbase-indexer是NGDATA公司为了将lily子系统里面相关HBase数据存储到Solr(solr是一个搜索服务器,一个开源的、基于Java的信息检索库)而开发的一个软件。HBase数据没有全文检索功能,只能在直接查询行键的场景下保持高效,不能兼容全文检索的功能。Hbase-indexer就是为了这种情况诞生的,但它只能将数据同步到solr中,只有同步模块没有查询模块,多租户安全模式下存在欠缺。目前很多场景更倾向于的使用ES(全称为elasticsearch,是一个搜索服务器,提供了一个分布式多用户能力的全文搜索引擎),因为ES相比slor更有优势。所以,目前Hbase-indexer功能有所欠缺。Hbase-indexer is a software developed by NGDATA to store related HBase data in the lily subsystem to Solr (solr is a search server, an open source, Java-based information retrieval library). HBase data does not have a full-text retrieval function, and can only maintain high efficiency in the scenario of directly querying row keys, which is not compatible with the full-text retrieval function. Hbase-indexer was born for this situation, but it can only synchronize data to solr, only the synchronization module has no query module, and there is a lack of multi-tenant security mode. At present, many scenarios prefer to use ES (the full name is elasticsearch, which is a search server that provides a full-text search engine with distributed multi-user capabilities), because ES has more advantages than slor. Therefore, the function of Hbase-indexer is currently lacking.

发明内容SUMMARY OF THE INVENTION

本发明的目的在于提供一种基于hbase-indexer的查询方法、装置、电子设备及存储介质,缓解了现有技术中存在的hbase-indexer无法对es以及solr进行查询的缺陷的技术问题。The purpose of the present invention is to provide a query method, device, electronic device and storage medium based on hbase-indexer, which alleviates the technical problem that hbase-indexer cannot query es and solr in the prior art.

第一方面,本发明提供的基于hbase-indexer的查询方法,包括以下步骤:A first aspect, the query method based on hbase-indexer provided by the present invention comprises the following steps:

客户端配置用于客户端命令传入的兼容es搜索器的参数,并设置区分solr搜索器和es搜索器的索引;The client configures parameters that are compatible with the es searcher passed in by the client command, and sets the index that distinguishes the solr searcher and the es searcher;

服务端根据所述索引确认搜索器类型,若为es搜索器,则切换至es索引逻辑;The server confirms the searcher type according to the index, and if it is an es searcher, it switches to the es indexing logic;

根据索引创建es连接,将索引导入到es搜索器;Create an es connection based on the index, and import the index into the es searcher;

在hbase-indexer的执行命令中加入查询逻辑,所述查询逻辑用于客户端运行联合查询命令时根据参数和索引进行联合查询,并返回查询结果。Query logic is added to the execution command of hbase-indexer, and the query logic is used to perform a joint query according to parameters and indexes when the client runs the joint query command, and returns the query result.

进一步的,所述在客户端中将用于客户端命令传入的参数兼容es搜索器,并设置索引代码区分solr搜索器和es搜索器的步骤之后,还包括:Further, after the step of making the parameters passed in the client command compatible with the es searcher in the client and setting the index code to distinguish the solr searcher and the es searcher, it also includes:

在客户端中加入索引校验过程和表权限校验过程。The index verification process and the table permission verification process are added to the client.

进一步的,所述根据索引创建es连接,将索引导入到es搜索器的步骤之前,还包括:Further, before the step of creating an es connection according to the index and importing the index into the es searcher, it also includes:

使用索引参数中的安全参数验证是否有权限;Use the security parameter in the index parameter to verify permission;

若是,则通过验证;If so, pass the verification;

若否,则生成异常信息。If not, an exception message is generated.

进一步的,所述服务端使用es票据进行安全认证的步骤之后,还包括:Further, after the step of using the es ticket for security authentication by the server, it further includes:

在批量导入历史记录的索引的执行命令中添加兼容es的参数。Add es-compatible parameters to the execution command of batch import history index.

进一步的,所述基于hbase-indexer的查询方法,还包括:Further, the query method based on hbase-indexer also includes:

基于ambari(一种基于Web的工具,支持Apache Hadoop集群的供应、管理和监控),添加服务控制脚本和自定义组件所需配置,使客户端可以在页面上安装hbase-indexer,并进行开启、停止、重启、删除的操作,以及自动修改参数。Based on ambari (a web-based tool that supports provisioning, management, and monitoring of Apache Hadoop clusters), add service control scripts and custom components to the required configuration, so that clients can install hbase-indexer on the page, and start, Stop, restart, delete operations, and automatically modify parameters.

进一步的,所述根据查询参数和索引进行联合查询,并返回查询结果的步骤,具体包括:Further, the step of performing a joint query according to the query parameters and the index, and returning the query result, specifically includes:

接收查询命令;receive query commands;

获取hbase-indexer索引配置;Get hbase-indexer index configuration;

根据所述索引配置以及hbase表权限进行安全认证;Perform security authentication according to the index configuration and hbase table permissions;

若通过认证,根据索引类型进行对应查询;If the authentication is passed, the corresponding query is performed according to the index type;

获取查询结果;Get query results;

根据查询结果获取hbase的行键;Get the row key of hbase according to the query result;

判断需要返回结果的类型,若需要返回结果,则使用hbase连接,并根据行键搜索结果并返回打印,若只需要返回行键,则返回行键并打印。Determine the type of the result to be returned. If the result needs to be returned, use the hbase connection, and search for the result according to the row key and return to print. If only the row key needs to be returned, return the row key and print.

进一步的,所述根据索引类型进行对应查询的步骤之前,还包括:Further, before the step of performing the corresponding query according to the index type, the method further includes:

判断是否查询命令的参数为索引列且查询的格式正确;Determine whether the parameter of the query command is an index column and the query format is correct;

若是,则将查询命令参数转换为对应搜索器中的查询语句。If so, convert the query command parameters into the query statement in the corresponding searcher.

第二方面,本发明还提供一种基于hbase-indexer的查询装置,包括:In a second aspect, the present invention also provides a query device based on hbase-indexer, comprising:

客户端管理模块,客户端配置用于客户端命令传入的兼容es搜索器的参数,并设置区分solr搜索器和es搜索器的索引;Client management module, the client configures the parameters that are compatible with the es searcher passed in by the client command, and sets the index that distinguishes the solr searcher and the es searcher;

服务端处理模块,服务端根据所述索引确认搜索器类型,若为es搜索器,则切换至es索引逻辑,根据索引创建es连接,将索引导入到es搜索器;The server processing module, the server confirms the searcher type according to the index, if it is an es searcher, it switches to the es index logic, creates an es connection according to the index, and imports the index into the es searcher;

查询模块,在hbase-indexer的执行命令中加入查询逻辑,所述查询逻辑用于客户端运行执行命令时根据参数和索引进行联合查询,并返回查询结果。In the query module, query logic is added to the execution command of hbase-indexer, and the query logic is used for joint query according to parameters and indexes when the client runs the execution command, and returns the query result.

第三方面,本发明还提供一种电子设备,包括存储器、处理器,所述存储器中存储有可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现上述方法的步骤。In a third aspect, the present invention also provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program that can run on the processor, and the processor implements the above method when executing the computer program A step of.

第四方面,本发明还提供一种计算机可读存储介质,所述计算机可读存储介质存储有机器可运行指令,所述计算机可运行指令在被处理器调用和运行时,所述计算机可运行指令促使所述处理器运行所述的方法。In a fourth aspect, the present invention also provides a computer-readable storage medium, where the computer-readable storage medium stores machine-executable instructions, and when the computer-executable instructions are invoked and run by a processor, the computer can run The instructions cause the processor to perform the method.

本发明提供的基于hbase-indexer的查询方法,通过客户端配置用于客户端命令传入的兼容es搜索器的参数,设置区分solr搜索器和es搜索器的索引,服务端根据所述索引确认搜索器类型并切换至对应的索引逻辑,根据索引创建连接,将索引导入到搜索器;在hbase-indexer的执行命令中加入查询逻辑,所述查询逻辑用于客户端运行执行命令时根据参数和索引进行联合查询,并返回查询结果;完成上述步骤,弥补了现有方案中hbase-indexer无法将数据索引到es搜索器中的缺陷,添加了对应搜索器和hbase的联合查询逻辑。In the query method based on hbase-indexer provided by the present invention, the client configures the parameters that are compatible with the es searcher input by the client command, sets the index that distinguishes the solr searcher and the es searcher, and the server confirms according to the index The searcher type is switched to the corresponding index logic, a connection is created according to the index, and the index is imported into the searcher; query logic is added to the execution command of hbase-indexer, and the query logic is used when the client runs the execution command according to the parameters and The index performs joint query and returns the query results; completing the above steps makes up for the defect that hbase-indexer cannot index data into the es searcher in the existing solution, and adds the joint query logic corresponding to the searcher and hbase.

相应地,本发明实施例提供的一种基于hbase-indexer的查询装置、电子设备及计算机可读存储介质,也同样具有上述技术效果。Correspondingly, the hbase-indexer-based query apparatus, electronic device, and computer-readable storage medium provided by the embodiments of the present invention also have the above technical effects.

附图说明Description of drawings

为了更清楚地说明本发明具体实施方式或现有技术中的技术方案,下面将对具体实施方式或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施方式,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to illustrate the specific embodiments of the present invention or the technical solutions in the prior art more clearly, the following briefly introduces the accompanying drawings that need to be used in the description of the specific embodiments or the prior art. Obviously, the accompanying drawings in the following description The drawings are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings without creative efforts.

图1为本发明实施例提供的基于hbase-indexer的查询方法流程图;1 is a flowchart of a query method based on hbase-indexer provided by an embodiment of the present invention;

图2为本发明实施例提供的基于hbase-indexer的查询流程图;Fig. 2 is the query flow chart based on hbase-indexer provided by the embodiment of the present invention;

图3为本发明实施例提供的基于hbase-indexer的查询装置示意图。FIG. 3 is a schematic diagram of a query device based on hbase-indexer provided by an embodiment of the present invention.

具体实施方式Detailed ways

为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合附图对本发明的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the purposes, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, but not all of them. example. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

本发明实施例中所提到的术语“包括”和“具有”以及它们的任何变形,意图在于覆盖不排他的包含。例如包含了一系列步骤或单元的过程、方法、系统、产品或设备没有限定于已列出的步骤或单元,而是可选地还包括其他没有列出的步骤或单元,或可选地还包括对于这些过程、方法、产品或设备固有的其它步骤或单元。The terms "comprising" and "having" mentioned in the embodiments of the present invention and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device comprising a series of steps or units is not limited to the listed steps or units, but optionally also includes other unlisted steps or units, or optionally also Include other steps or units inherent to these processes, methods, products or devices.

如图1所示,本发明实施例提供的基于hbase-indexer的查询方法,包括以下步骤:As shown in FIG. 1, the query method based on hbase-indexer provided by the embodiment of the present invention includes the following steps:

S11:客户端配置用于客户端命令传入的兼容es搜索器的参数,并设置区分solr搜索器和es搜索器的索引;S11: The client configures the parameters that are compatible with the es searcher passed in by the client command, and sets the index that distinguishes the solr searcher and the es searcher;

S12:服务端根据所述索引确认搜索器类型,若为es搜索器,则切换至es索引逻辑;S12: The server confirms the searcher type according to the index, and if it is an es searcher, switches to the es indexing logic;

S13:根据索引创建es连接,将索引导入到es搜索器;S13: Create an es connection based on the index, and import the index into the es searcher;

S14:在hbase-indexer的执行命令中加入查询逻辑,所述查询逻辑用于客户端运行联合查询命令时根据参数和索引进行联合查询,并返回查询结果。S14: Add query logic to the execution command of hbase-indexer, where the query logic is used to perform a joint query according to parameters and indexes when the client runs the joint query command, and returns the query result.

本发明提供的基于hbase-indexer的查询方法,通过客户端配置用于客户端命令传入的兼容es搜索器的参数,设置区分solr搜索器和es搜索器的索引,服务端根据所述索引确认搜索器类型并切换至对应的索引逻辑,根据索引创建连接,将索引导入到搜索器;在hbase-indexer的执行命令中加入查询逻辑,所述查询逻辑用于客户端运行联合查询命令时根据参数和索引进行联合查询,并返回查询结果;完成上述步骤,弥补了现有方案中hbase-indexer无法将数据索引到es搜索器中的缺陷,添加了对应搜索器和hbase的联合查询逻辑。In the query method based on hbase-indexer provided by the present invention, the client configures the parameters that are compatible with the es searcher input by the client command, sets the index that distinguishes the solr searcher and the es searcher, and the server confirms according to the index Searcher type and switch to the corresponding index logic, create a connection according to the index, and import the index into the searcher; add query logic to the execution command of hbase-indexer, and the query logic is used when the client runs the joint query command according to the parameters. Perform joint query with the index, and return the query result; completing the above steps makes up for the defect that hbase-indexer cannot index data into the es searcher in the existing solution, and adds the joint query logic corresponding to the searcher and hbase.

在一种可能的实施方式中,所述在客户端中将用于客户端命令传入的参数兼容es搜索器,并设置索引代码区分solr搜索器和es搜索器的步骤之后,还包括:In a possible implementation manner, after the steps of making the parameters used for the client command input in the client compatible with the es searcher, and setting the index code to distinguish the solr searcher and the es searcher, the method further includes:

在客户端中加入索引校验过程和表权限校验过程。The index verification process and the table permission verification process are added to the client.

在一种可能的实施方式中,所述根据索引创建es连接,将索引导入到es搜索器的步骤之前,还包括:In a possible implementation manner, before the step of creating the es connection according to the index and importing the index into the es searcher, the method further includes:

使用索引参数中的安全参数验证是否有权限,若是,根据索引创建es连接,将索引导入到es搜索器,若否,则生成异常信息。Use the security parameters in the index parameter to verify whether you have permission. If so, create an es connection based on the index, and import the index into the es searcher. If not, generate an exception message.

在进行查询之前,会进行身份以及权限等的校验,当校验失败则无法进行使用,保证系统的安全性。Before the query, the identity and authority verification will be carried out. When the verification fails, it cannot be used to ensure the security of the system.

在一种可能的实施方式中,所述服务端使用es票据进行安全认证的步骤之后,还包括:In a possible implementation manner, after the step of performing security authentication using the es ticket, the server further includes:

在批量导入历史记录的索引的执行命令中添加兼容es的参数。Add es-compatible parameters to the execution command of batch import history index.

创建索引之后,需要先将历史数据导入到es中,现有方案中是无法将历史记录导入到es中的,通过添加对应参数,使得历史记录可以顺利导入到es中。After the index is created, historical data needs to be imported into es first. In the existing solution, historical records cannot be imported into es. By adding corresponding parameters, historical records can be smoothly imported into es.

在一种可能的实施方式中,所述基于hbase-indexer的查询方法,还包括:In a possible implementation, the query method based on hbase-indexer further includes:

基于ambari,添加服务控制脚本和自定义组件所需配置,使客户端可以在页面上安装hbase-indexer,并进行开启、停止、重启、删除的操作,以及自动修改参数。Based on ambari, add the required configuration for service control scripts and custom components, so that the client can install hbase-indexer on the page, and start, stop, restart, delete, and automatically modify parameters.

如图2所示,在一种可能的实施方式中,所述根据查询参数和索引进行联合查询,并返回查询结果的步骤,具体包括:As shown in FIG. 2, in a possible implementation manner, the step of performing a joint query according to query parameters and indexes, and returning the query result, specifically includes:

S21:接收查询命令;S21: receive a query command;

S22:获取hbase-indexer索引配置;S22: Get the hbase-indexer index configuration;

S23:根据所述索引配置以及hbase表权限进行安全认证,若通过认证,则执行步骤S24,若未通过验证,则执行步骤S210;S23: Perform security authentication according to the index configuration and the authority of the hbase table, if the authentication is passed, execute step S24, and if the authentication fails, execute step S210;

S24:根据索引类型进行对应查询;S24: Perform a corresponding query according to the index type;

S25:获取查询结果;S25: get the query result;

S26:根据查询结果获取hbase的行键;S26: Obtain the row key of hbase according to the query result;

S27:判断需要返回结果的类型,若需要返回结果,则执行步骤S28,若只需要返回行键,则执行步骤S29;S27: Determine the type of the result to be returned, if the result needs to be returned, then go to step S28, if only the row key needs to be returned, go to step S29;

S28:使用hbase连接,并根据行键搜索结果并返回打印;S28: Use hbase connection, and search results according to row keys and return to print;

S29:返回行键并打印;S29: return row key and print;

S210:生成异常信息。S210: Generate abnormal information.

如图3所示,在一种可能的实施方式中,所述根据索引类型进行对应查询的步骤之前,还包括:As shown in FIG. 3, in a possible implementation manner, before the step of performing the corresponding query according to the index type, the method further includes:

S240:判断是否查询命令的参数为索引列且查询的格式正确,若是,则执行步骤S241,若否,则执行步骤S242;S240: Determine whether the parameter of the query command is an index column and the query format is correct, if so, execute step S241; if not, execute step S242;

S241:将查询命令参数转换为对应搜索器中的查询语句。S241: Convert the query command parameter into a query statement in a corresponding searcher.

S242:向客户端发送报错信息。S242: Send an error message to the client.

在查询之前,会对搜索的格式进行确定,当格式不正确时无法进行查询,保证查询的有效性。Before querying, the format of the search will be determined. When the format is incorrect, the query cannot be performed to ensure the validity of the query.

本发明实施例提供的基于hbase-indexer的查询方法,具体实施方式如下:The specific implementation manner of the query method based on hbase-indexer provided by the embodiment of the present invention is as follows:

由于hbase-indexer是为了solr设计的,客户端命令里能够传递的参数为solr需要的,如果切换为ES,需要将客户端传入的参数兼容ES的需要,并用“--connection-type-t”来区分solr和ES的索引器。Since hbase-indexer is designed for solr, the parameters that can be passed in the client command are required by solr. If you switch to ES, you need to make the parameters passed by the client compatible with the needs of ES, and use "--connection-type-t" " to differentiate between Solr and ES indexers.

同时,为了适应多租户安全场景的需要,使用客户端缓存的票据,索引的操作执行前验证缓存的票据是否拥有hbase表权限,有则进入下一步,如果没有直接失败。At the same time, in order to meet the needs of multi-tenant security scenarios, the client-side cached ticket is used. Before the index operation is executed, it is verified whether the cached ticket has the hbase table permission. If yes, go to the next step. If not, it will fail directly.

在创建索引时,需要添加ES安全方面所需的参数,据此验证连接ES,并能通过参数控制索引的副本数和分片数。判断ES中是否存在该索引,存在则失败,不存在则创建;删除索引时删除ES中的索引。When creating an index, you need to add the parameters required for ES security, according to which you can verify the connection to ES, and you can control the number of replicas and shards of the index through parameters. Determine whether the index exists in ES, if it exists, it fails, and if it does not exist, it is created; when deleting the index, delete the index in ES.

根据参数“--connection-type-t”的不同,如果为ES,则进入一种与solr平行逻辑,根据索引的参数创建ES连接,将导入到solr的流程全部换为导入到ES的流程,并将执行出错的行键加入到对应数据结构中。According to the difference of the parameter "--connection-type-t", if it is ES, it will enter a parallel logic with solr, create an ES connection according to the parameters of the index, and replace all the processes imported into solr with the processes imported into ES. And add the row key of the execution error to the corresponding data structure.

在安全场景下hbase方面的连接使用hbase服务端所用权限对应的票据,和ES的连接使用索引参数中的安全的参数,如果ES非安全模式和安全模式转换,需要客户端更新参数。In the security scenario, the connection on the hbase side uses the ticket corresponding to the authority used by the hbase server, and the connection with the ES uses the security parameters in the index parameter. If the ES non-secure mode and the security mode are converted, the client needs to update the parameters.

在批量执行的模块,添加ES所需的参数和索引器类型区分,并改造处理逻辑,导入方式增加ES的导入方式,根据“--connection-type-t”参数选择为ES的导入方式.In the batch execution module, add the parameters required by ES to distinguish the indexer type, and modify the processing logic. The import method increases the import method of ES, and selects the import method of ES according to the "--connection-type-t" parameter.

根据传入的参数或者从zookeeper(一个分布式应用程序协调服务,为分布式应用提供一致性服务,提供配置维护、域名服务、分布式同步、组服务等功能,hbase-indexer的索引参数维护在zookeeper中)中获取的索引配置进行ES连接的安全认证。According to the incoming parameters or from zookeeper (a distributed application coordination service that provides consistent services for distributed applications, configuration maintenance, domain name services, distributed synchronization, group services and other functions, the index parameters of hbase-indexer are maintained in The index configuration obtained in zookeeper) is used for security authentication of ES connection.

在hbase-indexer的执行操作里添加query(询问)的选项,并指向查询操作的执行者。Add the query (ask) option to the execution operation of hbase-indexer and point to the executor of the query operation.

根据传入的参数,进入查询逻辑,如果indexer(索引)存在,则由此获取到zookeeper上的配置信息,判断校验查询参数是否为索引列及格式是否正确,转换为对应搜索器中的查询语句,如果多个查询条件,行式索引则为与关系,列式索引为或的关系,并根据传参判断查询方式是否为默认的全文检索方式,如果是精确查询,则条件的查询关系为精确查询。According to the incoming parameters, enter the query logic, if the indexer (index) exists, then obtain the configuration information on the zookeeper, determine whether the verification query parameters are index columns and whether the format is correct, and convert them into the corresponding searcher query. statement, if there are multiple query conditions, the row index is an AND relationship, and the column index is an OR relationship, and judge whether the query mode is the default full-text retrieval mode according to the passed parameters. If it is an exact query, the query relationship of the condition is Exact query.

在查询对应搜索器的返回结果中获取hbase的行键,如果为列式索引则需要转换,如果配置有rowkey(hbase-indexer创建索引使用的xml配置文件里的一个属性)在索引中则直接取到该字段。根据参数判断如果需要只返回hbase的行键,则到此结束返回行键。如果需要返回结果,则还需要使用hbase连接,根据行键批量搜索并返回打印。Obtain the row key of hbase in the return result of the query corresponding to the searcher. If it is a columnar index, it needs to be converted. If the rowkey (an attribute in the xml configuration file used by hbase-indexer to create the index) is configured in the index, it is directly obtained. to this field. Judging from the parameters, if only the row key of hbase needs to be returned, then this is the end to return the row key. If you need to return results, you also need to use hbase connection, batch search based on row key and return print.

安全模式下使用客户端缓存的票据,校验hbase权限,使用获取到的索引配置里的ES安全配置去认证创建连接并查询。In security mode, use the ticket cached by the client to verify hbase permissions, and use the ES security configuration in the obtained index configuration to authenticate, create a connection and query.

基于ambari,添加服务控制脚本和各种自定义组件所需的配置,使hbase和ES或solr服务都安装好的情况下,才可以安装hbase-indexer,并且在安装后,自动修改hbase需要改动的配置如“hbase.replication=true”等。Based on ambari, add service control scripts and the configuration required for various custom components, so that hbase-indexer can be installed only when hbase and ES or solr services are installed, and after installation, automatically modify hbase needs to be changed Configuration such as "hbase.replication=true" and so on.

在开启安全的情况下,自动修改相关的env配置如“-Djava.security.auth.login.config=***”,能够通过页面,进行开启停止重启删除等管理操作。In the case of enabling security, the relevant env configuration such as "-Djava.security.auth.login.config=***" can be automatically modified, and management operations such as opening, stopping, restarting and deleting can be performed through the page.

如图3所示,本发明实施例还提供一种基于hbase-indexer的查询装置,包括:As shown in FIG. 3 , an embodiment of the present invention further provides a query device based on hbase-indexer, including:

客户端管理模块1,客户端配置用于客户端命令传入的兼容es搜索器的参数,并设置区分solr搜索器和es搜索器的索引;Client management module 1, the client configures the parameters that are compatible with the es searcher passed in by the client command, and sets the index that distinguishes the solr searcher and the es searcher;

服务端处理模块2,服务端根据所述索引确认搜索器类型,若为es搜索器,则切换至es索引逻辑,根据索引创建es连接,将索引导入到es搜索器;Server processing module 2, the server confirms the searcher type according to the index, if it is an es searcher, switches to the es index logic, creates an es connection according to the index, and imports the index into the es searcher;

查询模块3,在hbase-indexer的执行命令中加入查询逻辑,所述查询逻辑用于客户端运行执行命令时根据参数和索引进行联合查询,并返回查询结果。The query module 3 adds query logic to the execution command of the hbase-indexer, and the query logic is used to perform a joint query according to the parameters and the index when the client runs the execution command, and returns the query result.

对应于上述方法,本发明实施例还提供了一种电子设备,包括存储器、处理器,所述存储器中存储有可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现上述方法的步骤。Corresponding to the above method, an embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program that can run on the processor, and the processor executes the computer program When implementing the steps of the above method.

对应于上述方法,本发明实施例还提供了一种计算机可读存储介质,所述计算机可读存储介质存储有机器可运行指令,所述计算机可运行指令在被处理器调用和运行时,所述计算机可运行指令促使所述处理器运行上述方法的步骤。Corresponding to the above method, an embodiment of the present invention further provides a computer-readable storage medium, where the computer-readable storage medium stores machine-executable instructions, and when the computer-executable instructions are called and run by a processor, the The computer-executable instructions cause the processor to perform the steps of the above-described method.

本发明实施例所提供的装置可以为设备上的特定硬件或者安装于设备上的软件或固件等。本发明实施例所提供的装置,其实现原理及产生的技术效果和前述方法实施例相同,为简要描述,装置实施例部分未提及之处,可参考前述方法实施例中相应内容。所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,前述描述的系统、装置和单元的具体工作过程,均可以参考上述方法实施例中的对应过程,在此不再赘述。The apparatus provided by the embodiment of the present invention may be specific hardware on the device or software or firmware installed on the device, or the like. The implementation principle and technical effects of the device provided by the embodiment of the present invention are the same as those of the foregoing method embodiment. For brief description, for the parts not mentioned in the device embodiment, reference may be made to the corresponding content in the foregoing method embodiment. Those skilled in the art can clearly understand that, for the convenience and brevity of the description, the specific working processes of the systems, devices and units described above can all refer to the corresponding processes in the above method embodiments, which will not be repeated here.

在本发明所提供的几个实施例中,应该理解到,所揭露的装置和方法,也可以通过其它的方式实现。以上所描述的装置实施例仅仅是示意性的,例如,附图中的流程图和框图显示了根据本发明的多个实施例的装置、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段或代码的一部分,所述模块、程序段或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现方式中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个连续的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或动作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。In the several embodiments provided by the present invention, it should be understood that the disclosed apparatus and method may also be implemented in other manners. The apparatus embodiments described above are merely illustrative, for example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality and possible implementations of apparatuses, methods and computer program products according to various embodiments of the present invention. operate. 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 functions for implementing the specified logical function(s) 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 in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It is also noted that each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations, can be implemented in dedicated hardware-based systems that perform the specified functions or actions , or can be implemented in a combination of dedicated hardware and computer instructions.

又例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,再例如,多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些通信接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。For another example, the division of the units is only a logical function division, and there may be other division methods in actual implementation. For another example, multiple units or components may be combined or integrated into another system, or some features may be ignored. , or not implemented. On the other hand, the shown or discussed mutual coupling or direct coupling or communication connection may be through some communication interfaces, indirect coupling or communication connection of devices or units, which may be in electrical, mechanical or other forms.

所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.

另外,在本发明提供的实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。In addition, each functional unit in the embodiments provided by the present invention may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.

所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory,简称ROM)、随机存取存储器(Random Access Memory,简称RAM)、磁碟或者光盘等各种可以存储程序代码的介质。The functions, if implemented in the form of software functional units and sold or used as independent products, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention can be embodied in the form of a software product in essence, or the part that contributes to the prior art or the part of the technical solution. The computer software product is stored in a storage medium, including Several instructions are used to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, Read-Only Memory (ROM for short), Random Access Memory (RAM for short), magnetic disk or CD, etc. that can store program codes medium.

最后应说明的是:以上所述实施例,仅为本发明的具体实施方式,用以说明本发明的技术方案,而非对其限制,本发明的保护范围并不局限于此,尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,其依然可以对前述实施例所记载的技术方案进行修改或可轻易想到变化,或者对其中部分技术特征进行等同替换;而这些修改、变化或者替换,并不使相应技术方案的本质脱离本发明实施例技术方案的范围。都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以权利要求的保护范围为准。Finally, it should be noted that the above-mentioned embodiments are only specific implementations of the present invention, and are used to illustrate the technical solutions of the present invention, but not to limit them. The protection scope of the present invention is not limited thereto, although referring to the foregoing The embodiment has been described in detail the present invention, and those of ordinary skill in the art should understand: any person skilled in the art who is familiar with the technical field of the present invention can still modify the technical solutions described in the foregoing embodiments within the technical scope disclosed by the present invention. Or changes can be easily conceived, or equivalent replacements are made to some of the technical features; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention. All should be included within the protection scope of the present invention. Therefore, the protection scope of the present invention should be subject to the protection scope of the claims.

Claims (10)

1.一种基于hbase-indexer的查询方法,其特征在于,应用于服务系统中,包括以下步骤:1. a query method based on hbase-indexer, is characterized in that, is applied in the service system, comprises the following steps: 客户端配置用于客户端命令传入的兼容es搜索器的参数,并设置区分solr搜索器和es搜索器的索引;The client configures parameters that are compatible with the es searcher passed in by the client command, and sets the index that distinguishes the solr searcher and the es searcher; 服务端根据所述索引确认搜索器类型,若为es搜索器,则切换至es索引逻辑;The server confirms the searcher type according to the index, and if it is an es searcher, it switches to the es indexing logic; 根据索引创建es连接,将索引导入到es搜索器;Create an es connection based on the index, and import the index into the es searcher; 在hbase-indexer的执行命令中加入查询逻辑,所述查询逻辑用于客户端运行联合查询命令时根据参数和索引进行联合查询,并返回查询结果。Query logic is added to the execution command of hbase-indexer, and the query logic is used to perform a joint query according to parameters and indexes when the client runs the joint query command, and returns the query result. 2.根据权利要求1所述的基于hbase-indexer的查询方法,其特征在于,在客户端配置用于客户端命令传入的兼容es搜索器的参数,并设置区分solr搜索器和es搜索器的索引的步骤之后,还包括:2. the query method based on hbase-indexer according to claim 1 is characterized in that, the parameter that is used for the compatible es searcher that the client command is passed in is configured at the client, and is set to distinguish between the solr searcher and the es searcher After the indexing steps, also include: 在客户端中加入索引校验过程和表权限校验过程。The index verification process and the table permission verification process are added to the client. 3.根据权利要求2所述的基于hbase-indexer的查询方法,其特征在于,所述根据索引创建es连接,将索引导入到es搜索器的步骤之前,还包括:3. the query method based on hbase-indexer according to claim 2, is characterized in that, described creating es connection according to index, before the step that index is imported into es searcher, also comprises: 使用索引参数中的安全参数验证是否有权限;Use the security parameter in the index parameter to verify permission; 若是,则通过验证;If so, pass the verification; 若否,则生成异常信息。If not, an exception message is generated. 4.根据权利要求1所述的基于hbase-indexer的查询方法,其特征在于,根据索引创建es连接,将索引导入到es搜索器的步骤之后,还包括:4. the query method based on hbase-indexer according to claim 1, is characterized in that, create es connection according to index, after the step that index is imported into es searcher, also comprises: 在批量导入历史记录的索引的执行命令中添加兼容es的参数。Add es-compatible parameters to the execution command of batch import history index. 5.根据权利要求1所述的基于hbase-indexer的查询方法,其特征在于,还包括:5. the query method based on hbase-indexer according to claim 1, is characterized in that, also comprises: 基于ambari,添加服务控制脚本和自定义组件所需配置,使客户端可以在页面上安装hbase-indexer,并进行开启、停止、重启、删除的操作,以及自动修改参数。Based on ambari, add the required configuration for service control scripts and custom components, so that the client can install hbase-indexer on the page, and start, stop, restart, delete, and automatically modify parameters. 6.根据权利要求1所述的基于hbase-indexer的查询方法,其特征在于,根据参数和索引进行联合查询,并返回查询结果的步骤,具体包括:6. the query method based on hbase-indexer according to claim 1, is characterized in that, according to parameter and index, carry out joint query, and the step of returning query result, specifically comprises: 接收查询命令;receive query commands; 获取hbase-indexer索引配置;Get hbase-indexer index configuration; 根据所述索引配置以及hbase表权限进行安全认证;Perform security authentication according to the index configuration and hbase table permissions; 若通过认证,根据索引类型进行对应查询;If the authentication is passed, the corresponding query is performed according to the index type; 获取查询结果;Get query results; 根据查询结果获取hbase的行键;Get the row key of hbase according to the query result; 判断需要返回结果的类型,若需要返回结果,则使用hbase连接,并根据行键搜索结果并返回打印,若只需要返回行键,则返回行键并打印。Determine the type of the result to be returned. If the result needs to be returned, use the hbase connection, and search for the result according to the row key and return to print. If only the row key needs to be returned, return the row key and print. 7.根据权利要求6所述的基于hbase-indexer的查询方法,其特征在于,所述根据索引类型进行对应查询的步骤之前,还包括:7. The query method based on hbase-indexer according to claim 6, characterized in that, before the step of carrying out corresponding query according to the index type, further comprising: 判断是否查询命令的参数为索引列且查询的格式正确;Determine whether the parameters of the query command are index columns and the query format is correct; 若是,则将查询命令参数转换为对应搜索器中的查询语句。If so, convert the query command parameters into the query statement in the corresponding searcher. 8.一种基于hbase-indexer的查询装置,其特征在于,包括:8. a query device based on hbase-indexer, is characterized in that, comprises: 客户端管理模块,客户端配置用于客户端命令传入的兼容es搜索器的参数,并设置区分solr搜索器和es搜索器的索引;Client management module, the client configures the parameters that are compatible with the es searcher passed in by the client command, and sets the index that distinguishes the solr searcher and the es searcher; 服务端处理模块,服务端根据所述索引确认搜索器类型,若为es搜索器,则切换至es索引逻辑,根据索引创建es连接,将索引导入到es搜索器;The server processing module, the server confirms the searcher type according to the index, if it is an es searcher, switches to the es index logic, creates an es connection according to the index, and imports the index into the es searcher; 查询模块,在hbase-indexer的执行命令中加入查询逻辑,所述查询逻辑用于客户端运行执行命令时根据参数和索引进行联合查询,并返回查询结果。In the query module, query logic is added to the execution command of hbase-indexer, and the query logic is used for joint query according to parameters and indexes when the client runs the execution command, and returns the query result. 9.一种电子设备,包括存储器、处理器,所述存储器中存储有可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现上述权利要求1至7任一项所述的方法的步骤。9. An electronic device, comprising a memory and a processor, wherein a computer program that can be run on the processor is stored in the memory, wherein the processor implements claim 1 when executing the computer program The steps of any one of to 7. 10.一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有机器可运行指令,所述计算机可运行指令在被处理器调用和运行时,所述计算机可运行指令促使所述处理器运行所述权利要求1至7任一项所述的方法。10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores machine-executable instructions that, when invoked and executed by a processor, cause the computer-executable instructions to The processor executes the method of any one of claims 1 to 7.
CN202011365011.1A 2020-11-27 2020-11-27 A query method, device and electronic device based on hbase-indexer Active CN112463832B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011365011.1A CN112463832B (en) 2020-11-27 2020-11-27 A query method, device and electronic device based on hbase-indexer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011365011.1A CN112463832B (en) 2020-11-27 2020-11-27 A query method, device and electronic device based on hbase-indexer

Publications (2)

Publication Number Publication Date
CN112463832A CN112463832A (en) 2021-03-09
CN112463832B true CN112463832B (en) 2022-10-25

Family

ID=74809315

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011365011.1A Active CN112463832B (en) 2020-11-27 2020-11-27 A query method, device and electronic device based on hbase-indexer

Country Status (1)

Country Link
CN (1) CN112463832B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100287183A1 (en) * 2009-05-08 2010-11-11 Microsoft Corporation Sharing and collaboration of search findings
CN106326429A (en) * 2016-08-25 2017-01-11 武汉光谷信息技术股份有限公司 Hbase second-level query scheme based on solr

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100287183A1 (en) * 2009-05-08 2010-11-11 Microsoft Corporation Sharing and collaboration of search findings
CN106326429A (en) * 2016-08-25 2017-01-11 武汉光谷信息技术股份有限公司 Hbase second-level query scheme based on solr

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
《Performance Evaluation of Distributed Indexing Using Solr and Terrier Information Retrievals》;Ali Y. Aldailamy 等;《2018 Fourth International Conference on Information Retrieval and Knowledge Management (CAMP)》;20181231;全文 *
《高性能分布式搜索引擎Solr的研究与实现》;赵璞 等;《电子科技》;20150415;全文 *

Also Published As

Publication number Publication date
CN112463832A (en) 2021-03-09

Similar Documents

Publication Publication Date Title
US11750607B2 (en) Identifying accounts having shared credentials
Bossert et al. Towards automated protocol reverse engineering using semantic information
Blanchet Automatic verification of correspondences for security protocols
CN109495308B (en) An automatic operation and maintenance system based on management information system
US9166893B2 (en) Methods, apparatus and systems for monitoring locations of data within a network service
US10826943B2 (en) Security controller
JP2016522932A (en) Synchronizing credential hashes across directory services
US20240411752A1 (en) Processing Natural Language Network Queries
US10986084B1 (en) Authentication data migration
CN112910904A (en) Login method and device of multi-service system
US10791023B2 (en) System and method for activating a network node
CN119136229B (en) SMS channel test configuration method, device, equipment and storage medium
US12373246B2 (en) Automatic update management in a computing infrastructure
US20250110976A1 (en) Natural language interface for identity management data mining using generative ai
CN109218089B (en) Interface implementation method for transparent fault switching of distributed storage system
CN105637471B (en) Method and device for monitoring and controlling a storage environment
CN104363095A (en) Method for establishing hadoop identity authentication mechanism
CN118612096A (en) A method and device for verifying operation and maintenance identity security
US11379434B2 (en) Efficient and automatic database patching using elevated privileges
CN112463832B (en) A query method, device and electronic device based on hbase-indexer
CN114238244A (en) Result set generation method, device, equipment and storage medium
CN118897701A (en) Program defect state synchronization method, device, equipment and storage medium
Mödersheim et al. Verifying sevecom using set-based abstraction
CN114489772A (en) Workflow execution method and device, storage medium and equipment
JP2015141643A (en) Monitoring device for business system and control method for monitoring device

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
CP03 Change of name, title or address

Address after: 215000 Building 9, No.1 guanpu Road, Guoxiang street, Wuzhong Economic Development Zone, Suzhou City, Jiangsu Province

Patentee after: Suzhou Yuannao Intelligent Technology Co.,Ltd.

Country or region after: China

Address before: 215000 Building 9, No.1 guanpu Road, Guoxiang street, Wuzhong Economic Development Zone, Suzhou City, Jiangsu Province

Patentee before: SUZHOU LANGCHAO INTELLIGENT TECHNOLOGY Co.,Ltd.

Country or region before: China