WO2018209574A1 - 一种告警数据查询方法及装置 - Google Patents

一种告警数据查询方法及装置 Download PDF

Info

Publication number
WO2018209574A1
WO2018209574A1 PCT/CN2017/084590 CN2017084590W WO2018209574A1 WO 2018209574 A1 WO2018209574 A1 WO 2018209574A1 CN 2017084590 W CN2017084590 W CN 2017084590W WO 2018209574 A1 WO2018209574 A1 WO 2018209574A1
Authority
WO
WIPO (PCT)
Prior art keywords
query
alarm data
index
condition
dynamic
Prior art date
Application number
PCT/CN2017/084590
Other languages
English (en)
French (fr)
Inventor
胡星蓓
袁多利
李德超
Original Assignee
深圳中兴力维技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳中兴力维技术有限公司 filed Critical 深圳中兴力维技术有限公司
Priority to PCT/CN2017/084590 priority Critical patent/WO2018209574A1/zh
Publication of WO2018209574A1 publication Critical patent/WO2018209574A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor

Definitions

  • the present invention relates to the field of data query technologies, and in particular, to a method and device for querying alarm data.
  • the power environment monitoring system is a comprehensive management platform for real-time monitoring of power equipment and environmental equipment.
  • the user uses the alarms reported by the system to take emergency measures to eliminate alarms, and through the filtering conditions, quickly search for alarms, which is convenient for users. Use the shortest time to query the alarm and respond.
  • the commonly used methods for searching for alarms in the industry mainly include the following methods: 1. Query directly from a database through a stored procedure. This method is affected by the performance of the database itself, and the amount of data is large and inefficient. 2, using third-party caching tools, such as Redis, H2, read all the data into the cache, from the cache, filter the alarm; Among them, Redis cache, although supporting data persistence, clustering, the type of data storage supported is also very Rich, but Redis is a key-value based NoSQL database, does not support complex queries like SQL. In the case of complex combined conditional queries, the query speed is slow and complex to implement; H2 is a lightweight relationship implemented by Java. Type data, with cross-platform features, support for SQL-92 standard, easy to use, fast, but in a big data environment, performance is unstable.
  • Redis cache although supporting data persistence, clustering, the type of data storage supported is also very Rich, but Redis is a key-value based NoSQL database, does not support complex queries like SQL.
  • the main purpose of the present invention is to provide an alarm data query method and device, which can quickly query data through a combination of a Redis database and an H2 database, thereby improving user experience.
  • an alarm data query method provided by the present invention includes:
  • a dynamic query index table is established in the H2 database, where the dynamic query parameter list includes a unique identifier ID of the alarm data; [0009] obtaining a query condition to be queried, and matching the query condition with the dynamic query index table to obtain a unique identifier ID;
  • the identification ID includes:
  • the dynamic query index table includes a plurality of index fields, and different query index tables are obtained according to different index fields.
  • the query condition to be queried is related to the index field.
  • the Redis database is refreshed according to a preset time point to synchronize with the real alarm data.
  • an alarm data query apparatus including:
  • a cache module configured to cache alarm data into a Redis database, and set a corresponding unique identifier ID for each alarm data
  • a preset module configured to establish an index configuration file, and set an index field in the index configuration file
  • an indexing module configured to establish a dynamic query index table in the H2 database according to the index configuration file
  • the dynamic query index table includes a unique identifier ID of the alarm data.
  • a matching module configured to obtain a query condition to be queried, and match the query condition with the dynamic query index table to obtain a unique identifier ID;
  • the alarm data obtaining module is configured to obtain corresponding alarm data from the Redis database by using the unique identifier ID.
  • the matching module includes:
  • a query condition obtaining unit configured to acquire a query condition
  • a first matching unit configured to match each query condition with the dynamic query index table, respectively Get the query result that matches each query condition, and get the number of alarm data in each query result.
  • a second matching unit configured to sort the matching quantity of each query condition, and match the query result corresponding to the quantity query result to the query condition corresponding to the quantity query result to obtain the final query result.
  • the unique ID in the ID is the unique ID in the ID.
  • the dynamic query index table includes a plurality of index fields, and different query index tables are obtained according to different index fields.
  • the query condition to be queried is related to the index field.
  • the Redis database is refreshed according to a preset time point to synchronize with the real alarm data.
  • the method and device for querying alarm data include: buffering alarm data into a Redis database, and setting a corresponding unique identifier ID for each alarm data; establishing an index configuration file, Setting an index field in the index configuration file; establishing a dynamic query index table in the H2 database according to the index configuration file, where the dynamic query index table includes a unique identifier ID of the alarm data; The query condition is matched with the dynamic query index table to obtain a unique identifier ID.
  • the corresponding identifier data is used to obtain corresponding alarm data from the Redis database, and the Redis database and the H2 database are obtained.
  • FIG. 1 is a flowchart of a method for querying alarm data according to Embodiment 1 of the present invention
  • FIG. 2 is a flow chart of the method of step S30 in FIG. 1;
  • FIG. 3 is a block diagram showing an exemplary structure of an alarm data query device according to Embodiment 2 of the present invention.
  • FIG. 4 is a block diagram showing an exemplary structure of the matching module of FIG. 3.
  • an alarm data query method includes:
  • S30 Establish a dynamic query index table in the H2 database according to the index configuration file, where the dynamic query parameter list includes a unique identifier ID of the alarm data.
  • S40 Obtain a query condition to be queried, match the query condition with the dynamic query index table, and obtain a unique identifier ID;
  • the Redis database and the H2 database are combined to quickly query data, which improves the user experience, and is particularly suitable for combined conditional query.
  • all the detailed information of the alarm data is cached in the Redis database, such as alarm content, alarm time, alarm location, alarm level, etc., and a corresponding unique identifier is set for each alarm data.
  • ID In the H2 database, the main purpose is to facilitate the query index.
  • the detailed information of the alarm data In the dynamic query index table, the detailed information of the alarm data is not included, and only the unique identification ID of the alarm data and several indexes related to the alarm data are included.
  • Field In this embodiment, only the index field is configured in the index configuration file, and H2 knows which index of the query condition is built when the index is built.
  • the step S40 when the number of the query conditions is greater than or equal to 2, the step S40 includes:
  • S41 Acquire a query condition.
  • S42 Match each query condition with the dynamic query index table, obtain a query result that matches each query condition, and obtain the number of alarm data in each query result. ;
  • S43 Sort the matching quantity of each query condition, and match the query result corresponding to the quantity query result to the query condition corresponding to the quantity query result to obtain the unique identification ID in the final query result. .
  • an alarm page of the WEB server first configure an index configuration file, set the station station and the alarm level to an index field, configure the file to be in the index file, and start the WEB server to read from the alarm table of the database.
  • the current alarm details are written in the format of ⁇ Ca C heID, alarm details> in the format of ⁇ Ca C heID, alarm details>, where CachelD is the unique identification ID of the alarm information; Redis cache is fixed and database alarm Stay in sync.
  • a dynamic query index table is established in the H2 database.
  • the index configuration file there are two index fields, namely, a station station and an alarm level, so that a station index table can be obtained, for example, Table 1 shows:
  • the dynamic query index table may further obtain an alarm level index table by using an alarm level as an index field, as shown in Table 2:
  • the query condition is also set to two, namely, the station 1 and the alarm level 4.
  • each query condition is respectively matched with the dynamic query index table.
  • the query result matched with the query condition station 1 is as shown in Table 3:
  • step S32 sorting the matching quantity of each query condition, and matching the query result corresponding to the number of the query results with a small number of query results again, it is known that the query condition bureau station
  • the number of the corresponding alarm data is 2, and the number of alarm data corresponding to the alarm level 4 is 3, and the query result with a small number is the table 3.
  • the query condition corresponding to the number of the query results is the alarm.
  • ID2 in Table 5 is the result of the query in this example, and the detailed information of the corresponding alarm data is obtained from the Redis database according to ID2. :
  • the recursion may be performed according to the above idea to quickly query the required alarm data.
  • the dynamic query index table includes a plurality of index fields, and different query index tables are obtained according to different index fields.
  • the query condition to be queried is related to the index field.
  • the Redis database is refreshed according to a preset time point to synchronize with the actual alarm data.
  • an alarm data query device includes:
  • the cache module 10 is configured to cache alarm data into the Redis database, and set a corresponding unique identifier ID for each alarm data.
  • the preset module 20 is configured to establish an index configuration file, and set an index field in the index configuration file; [0076] an indexing module 30, configured to establish a dynamic query in the H2 database according to the index configuration file. direction chart
  • the dynamic query index table includes a unique identifier ID of the alarm data.
  • the matching module 40 is configured to obtain a query condition to be queried, and match the query condition with the dynamic query index table to obtain a unique identifier ID.
  • the alarm data obtaining module 50 is configured to obtain, by using the unique identifier ID, the Redis database. Corresponding alarm data.
  • the Redis database and the H2 database are combined to quickly query data, which improves the user experience, and is particularly suitable for combined conditional query.
  • all the detailed information of the alarm data is cached in the Redis database, such as alarm content, alarm time, alarm location, alarm level, etc., and a corresponding unique identifier is set for each alarm data.
  • ID In the H2 database, the main purpose is to facilitate the query index. In the dynamic query index table, the detailed information of the alarm data is not included, and only the unique identification ID of the alarm data and several indexes related to the alarm data are included. Field.
  • the matching module when the number of the query conditions is greater than or equal to 2, the matching module includes:
  • a query condition obtaining unit 41 configured to acquire a query condition
  • the first matching unit 42 is configured to match each query condition with the dynamic query parameter table, obtain a query result that matches each query condition, and obtain each query. The number of alarm data in the result of the inquiry;
  • the second matching unit 43 is configured to sort the matching quantity of each query condition, and match the query result corresponding to the small number of query results to the query condition corresponding to the plurality of query results to obtain the final query.
  • the unique ID in the result is configured to sort the matching quantity of each query condition, and match the query result corresponding to the small number of query results to the query condition corresponding to the plurality of query results to obtain the final query. The unique ID in the result.
  • an alarm page of the WEB server first configure an index configuration file, set the station station and the alarm level to an index field, configure the file to be in the index file, and start the WEB server to read from the alarm table of the database.
  • the current alarm details are written in the format of ⁇ Ca C heID, alarm details> in the format of ⁇ Ca C heID, alarm details>, where CachelD is the unique identification ID of the alarm information; Redis cache is fixed and database alarm Stay in sync.
  • a dynamic query index table is established in the H2 database.
  • the index configuration file there are two index fields, namely, a station station and an alarm level, so that a station index table can be obtained, for example, Table 1 shows:
  • the dynamic query index table may further obtain an alarm level index table by using an alarm level as an index field, as shown in Table 2:
  • the query condition is also set to two, which are the station 1 and the alarm level 4.
  • each query condition is respectively associated with the dynamic query.
  • the I table is matched to obtain the query result that matches each query condition, and the query result matched with the query condition station 1 is as shown in Table 3:
  • the number of alarm data corresponding to the query condition station 1 is 2, and the number of alarm data corresponding to the alarm level 4 is 3, and the query result with a small number is Table 3:
  • the query condition corresponding to the number of query results is alarm level 4, matching Table 3 with alarm level 4, and using the dynamic combination query CachelD statement to obtain Table 5:
  • ID2 in Table 5 is the result of the query in this example, and the detailed information of the corresponding alarm data is obtained from the Redis database according to ID2.
  • the recursion may be performed according to the above idea to quickly query the required alarm data.
  • the dynamic query index table includes a plurality of index fields, and different query index tables are obtained according to different index fields.
  • the query condition to be queried is related to the index field.
  • the Redis database is refreshed according to a preset time point to synchronize with the actual alarm data.
  • the technical solution of the present invention which is essential or contributes to the prior art, may be embodied in the form of a software product stored in a storage medium (such as ROM/RAM, disk,
  • a storage medium such as ROM/RAM, disk
  • the optical disc includes a number of instructions for causing a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the methods described in various embodiments of the present invention.
  • the method and device for querying alarm data include: buffering alarm data into a Redis database, and setting a corresponding unique identification ID for each alarm data; establishing an index configuration file, Setting an index field in the index configuration file; establishing a dynamic query index table in the H2 database according to the index configuration file, where the dynamic query index table includes a unique identifier ID of the alarm data; The query condition is matched with the dynamic query index table to obtain a unique identifier ID.
  • the corresponding identifier data is used to obtain corresponding alarm data from the Redis database, and the Redis database and the H2 database are obtained. Combined way, quick query data, improved user experience. Therefore, it has industrial applicability

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)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

一种告警数据查询方法及装置,该方法包括:将告警数据缓存到Redis数据库中,并为每一条告警数据设置一个对应的唯一标识ID(S10);建立索引配置文件,在所述索引配置文件中设置索引字段(S20);根据所述索引配置文件,在H2数据库中建立动态查询索引表,所述动态查询索引表中包括告警数据的唯一标识ID(S30);获取待查询的查询条件,将所述查询条件与所述动态查询索引表进行匹配,获得唯一标识ID(S40);通过所述唯一标识ID,从所述Redis数据库中获取对应的告警数据(S50),通过Redis数据库和H2数据库相结合的方式,快速查询数据,提高了用户体验。

Description

一种告警数据査询方法及装置 技术领域
[0001] 本发明涉及数据査询技术领域, 尤其涉及一种告警数据査询方法及装置。
背景技术
[0002] 动力环境监控系统是一种对动力设备和环境设备进行实吋监控的综合管理平台 , 用户通过系统上报的告警, 采取紧急处理措施, 消除告警, 通过过滤条件, 快速搜索告警, 方便用户用最短的吋间査询到告警, 作出响应。
[0003] 目前, 业内搜索告警的常用的方法主要有下列几种方法: 1、 直接通过存储过 程从数据库中査询, 这种方法, 受到数据库本身性能的影响, 在数据量大吋, 效率低下; 2、 使用第三方缓存工具, 如 Redis、 H2, 将数据全部读入缓存, 从 缓存中, 过滤告警; 其中, Redis缓存, 虽然支持数据持久化、 可做集群, 支持 的数据存储类型也很丰富, 但是 Redis是基于 key-value的 NoSQL数据库, 不支持 类似 SQL的复杂査询, 在复杂组合条件査询的情况下, 査询速度慢, 且实现复杂 ; H2是 java实现的轻量级关系型数据, 具有跨平台特性, 支持 SQL-92标准, 使 用方便, 速度快, 但在大数据环境下, 性能不稳定。
技术问题
[0004] 本发明的主要目的在于提出一种告警数据査询方法及装置, 能够通过 Redis数 据库和 H2数据库相结合的方式, 快速査询数据, 提高了用户体验。
问题的解决方案
技术解决方案
[0005] 为实现上述目的, 本发明提供的一种告警数据査询方法, 包括:
[0006] 将告警数据缓存到 Redis数据库中, 并为每一条告警数据设置一个对应的唯一 标识 ID;
[0007] 建立索引配置文件, 在所述索引配置文件中设置索引字段;
[0008] 根据所述索引配置文件, 在 H2数据库中建立动态査询索引表, 所述动态査询索 弓 I表中包括告警数据的唯一标识 ID; [0009] 获取待査询的査询条件, 将所述査询条件与所述动态査询索引表进行匹配, 获 得唯一标识 ID;
[0010] 通过所述唯一标识 ID, 从所述 Redis数据库中获取对应的告警数据。
[0011] 可选地, 当所述査询条件的数量大于等于 2吋, 所述获取待査询的査询条件, 将所述査询条件与所述动态査询索引表进行匹配, 获得唯一标识 ID包括:
[0012] 获取査询条件;
[0013] 将每个査询条件分别与所述动态査询索引表进行匹配, 获得与每个査询条件相 匹配的査询结果, 并获取每个査询结果中的告警数据的数量;
[0014] 对每个査询条件的匹配数量进行排序, 将数量少的査询结果与数量多的査询结 果对应的査询条件进行再次匹配, 获得最终査询结果中的唯一标识 ID。
[0015] 可选地, 所述动态査询索引表中包含有若干个索引字段, 根据不同的索引字段 得到不同的査询索引表。
[0016] 可选地, 所述待査询的査询条件与所述索引字段相关。
[0017] 可选地, 所述 Redis数据库按照预设的吋间点定吋刷新, 以便与实吋告警数据 同步。
[0018] 作为本发明的另一方面, 提供的一种告警数据査询装置, 包括:
[0019] 缓存模块, 用于将告警数据缓存到 Redis数据库中, 并为每一条告警数据设置 一个对应的唯一标识 ID;
[0020] 预设模块, 用于建立索引配置文件, 在所述索引配置文件中设置索引字段; [0021] 索引模块, 用于根据所述索引配置文件, 在 H2数据库中建立动态査询索引表, 所述动态査询索引表中包括告警数据的唯一标识 ID;
[0022] 匹配模块, 用于获取待査询的査询条件, 将所述査询条件与所述动态査询索引 表进行匹配, 获得唯一标识 ID;
[0023] 告警数据获取模块, 用于通过所述唯一标识 ID, 从所述 Redis数据库中获取对 应的告警数据。
[0024] 可选地, 当所述査询条件的数量大于等于 2吋, 所述匹配模块包括:
[0025] 査询条件获取单元, 用于获取査询条件;
[0026] 第一匹配单元, 用于将每个査询条件分别与所述动态査询索引表进行匹配, 获 得与每个査询条件相匹配的査询结果, 并获取每个査询结果中的告警数据的数
[0027] 第二匹配单元, 用于对每个査询条件的匹配数量进行排序, 将数量少的査询结 果与数量多的査询结果对应的査询条件进行再次匹配, 获得最终査询结果中的 唯一标识 ID。
[0028] 可选地, 所述动态査询索引表中包含有若干个索引字段, 根据不同的索引字段 得到不同的査询索引表。
[0029] 可选地, 所述待査询的査询条件与所述索引字段相关。
[0030] 可选地, 所述 Redis数据库按照预设的吋间点定吋刷新, 以便与实吋告警数据 同步。
发明的有益效果
有益效果
[0031] 本发明提出的一种告警数据査询方法及装置, 该方法包括: 将告警数据缓存到 Redis数据库中, 并为每一条告警数据设置一个对应的唯一标识 ID; 建立索引配 置文件, 在所述索引配置文件中设置索引字段; 根据所述索引配置文件, 在 H2 数据库中建立动态査询索引表, 所述动态査询索引表中包括告警数据的唯一标 识 ID; 获取待査询的査询条件, 将所述査询条件与所述动态査询索引表进行匹 配, 获得唯一标识 ID; 通过所述唯一标识 ID, 从所述 Redis数据库中获取对应的 告警数据, 通过 Redis数据库和 H2数据库相结合的方式, 快速査询数据, 提高了 用户体验。
对附图的简要说明
附图说明
[0032] 图 1为本发明实施例一提供的一种告警数据査询方法流程图;
[0033] 图 2为图 1中步骤 S30的方法流程图;
[0034] 图 3为本发明实施例二提供的一种告警数据査询装置示范性结构框图;
[0035] 图 4为图 3中匹配模块的示范性结构框图。
[0036] 本发明目的的实现、 功能特点及优点将结合实施例, 参照附图做进一步说明。 本发明的实施方式
[0037] 应当理解, 此处所描述的具体实施例仅仅用以解释本发明, 并不用于限定本发 明。
[0038] 在后续的描述中, 使用用于表示元件的诸如"模块"、 "部件 "或"单元"的后缀仅 为了有利于本发明的说明, 其本身并没有特定的意义。 因此, "模块 "与"部件"可 以混合地使用。
[0039] 实施例一
[0040] 如图 1所示, 在本实施例中, 一种告警数据査询方法, 包括:
[0041] S10、 将告警数据缓存到 Redis数据库中, 并为每一条告警数据设置一个对应的 唯一标识 ID;
[0042] S20、 建立索引配置文件, 在所述索引配置文件中设置索引字段;
[0043] S30、 根据所述索引配置文件, 在 H2数据库中建立动态査询索引表, 所述动态 査询索弓 I表中包括告警数据的唯一标识 ID;
[0044] S40、 获取待査询的査询条件, 将所述査询条件与所述动态査询索引表进行匹 配, 获得唯一标识 ID;
[0045] S50、 通过所述唯一标识 ID, 从所述 Redis数据库中获取对应的告警数据。
[0046] 在本实施例中, 通过 Redis数据库和 H2数据库相结合的方式, 快速査询数据, 提高了用户体验, 尤其适用于组合条件査询。
[0047] 在本实施例中, 将告警数据的所有详细信息都缓存在 Redis数据库中, 比如告 警内容、 告警吋间、 告警位置、 告警级别等, 并为每条告警数据设置一个对应 的唯一标识 ID; 而在 H2数据库中, 主要是为了便于査询索引, 在动态査询索引 表中, 不包括告警数据的详细信息, 仅包括告警数据的唯一标识 ID及与该告警 数据相关的几个索引字段, 在本实施例中, 只有在索引配置文件中配置了索引 字段, H2在建立索引的吋候才知道, 建哪些査询条件的索引。
[0048] 如图 2所示, 在本实施例中, 当所述査询条件的数量大于等于 2吋, 所述步骤 S4 0包括:
[0049] S41、 获取査询条件; [0050] S42、 将每个査询条件分别与所述动态査询索引表进行匹配, 获得与每个査询 条件相匹配的査询结果, 并获取每个査询结果中的告警数据的数量;
[0051] S43、 对每个査询条件的匹配数量进行排序, 将数量少的査询结果与数量多的 査询结果对应的査询条件进行再次匹配, 获得最终査询结果中的唯一标识 ID。
[0052] 以 WEB服务器的某一告警页面为例, 首先配置索引配置文件, 将局站、 告警级 别设置为索引字段, 配置到索引文件中, WEB服务器启动吋, 从数据库的告警 表中读取当前的告警详细信息, 将获取的告警信息按 < CaCheID, 告警详细信息 > 的格式写入 Redis缓存中, 其中 CachelD为该条告警信息的唯一标识 ID; Redis缓 存通过定吋刷新与数据库告警保持同步。
[0053] 根据上述索引配置文件, 在 H2数据库中建立动态査询索引表, 上述索引配置文 件中, 索引字段有两个, 分别为局站和告警级别, 那么就可以得到局站索引表 , 如表 1所示:
[]
Figure imgf000007_0001
[0054] 表 1
[0055] 由表 1可知, 目前未消除的告警数据有 4条, 分别对应局站 1和局站 2, 告警级别 也包括告警级别 1和告警级别 4。
[0056] 同样, 上述动态査询索引表还可以是以告警级别为索引字段, 得到告警级别索 引表, 如表 2所示:
[]
Figure imgf000007_0002
[0057] 表 2
[0058] 由上可知, 表 2的内容是和表 1相同的, 只是排列方式不同, 这也是为了便于査 询, 这是 H2数据库的优点所在。
[0059] 为了便于描述, 将査询条件也设置为 2个, 分别为局站 1和告警级别 4, 根据上 述步骤 S32可知, 将每个査询条件分别与所述动态査询索引表进行匹配, 获得与 每个査询条件相匹配的査询结果, 则与査询条件局站 1所匹配的査询结果如表 3 所示:
[]
Figure imgf000008_0001
[0062] 表 4
[0063] 由表 3、 表 4可知, 这次的索引表又有了变化, 是以 CachelD为第一列, 这是因 为我们的目标是获取 CachelD作为唯一标识 ID, 这也是 H2数据库的动态査询的便 捷之处。
[0064] 根据上述步骤 S32、 对每个査询条件的匹配数量进行排序, 将数量少的査询结 果与数量多的査询结果对应的査询条件进行再次匹配, 可知, 査询条件局站 1对 应的告警数据的数量为 2, 査询条件告警级别 4对应的告警数据的数量为 3, 则用 数量少的査询结果为表 3, 数量多的査询结果对应的査询条件为告警级别 4, 将 表 3与告警级别 4进行匹配, 使用动态组合査询 CachelD的语句, 得到表 5:
[] ϋ ;
:雄 2
[0065] 表 5
[0066] 表 5中的 ID2即为本例的査询结果, 根据 ID2从所述 Redis数据库中获取对应的告 警数据的详细信息昏。 :
[0067] 作为另一种实施例, 当査询条件的数量为 3或更多吋, 也可以按照以上思路进 行递推, 快速査询到所需要的告警数据。
[0068] 以査询条件的数量为 3为例, 将 3个査询条件分别与所述动态査询索引表进行匹 配, 获得与每个査询条件相匹配的査询结果; 对每个査询条件的匹配数量进行 排序, 将数量最少的査询结果与数量最多的査询结果对应的査询条件进行再次 匹配; 得到二次匹配的査询结果, 将该査询结果再与数量中间的査询结果重复 上述过程, 即可査询到所需要的告警数据, 兹不赘述。
[0069] 在本实施例中, 所述动态査询索引表中包含有若干个索引字段, 根据不同的索 引字段得到不同的査询索引表。
[0070] 在本实施例中, 所述待査询的査询条件与所述索引字段相关。
[0071] 在本实施例中, 所述 Redis数据库按照预设的吋间点定吋刷新, 以便与实吋告 警数据同步。
[0072] 实施例二
[0073] 如图 3所示, 在本实施例中, 一种告警数据査询装置, 包括:
[0074] 缓存模块 10, 用于将告警数据缓存到 Redis数据库中, 并为每一条告警数据设 置一个对应的唯一标识 ID;
[0075] 预设模块 20, 用于建立索引配置文件, 在所述索引配置文件中设置索引字段; [0076] 索引模块 30, 用于根据所述索引配置文件, 在 H2数据库中建立动态査询索引表
, 所述动态査询索引表中包括告警数据的唯一标识 ID;
[0077] 匹配模块 40, 用于获取待査询的査询条件, 将所述査询条件与所述动态査询索 引表进行匹配, 获得唯一标识 ID;
[0078] 告警数据获取模块 50, 用于通过所述唯一标识 ID, 从所述 Redis数据库中获取 对应的告警数据。
[0079] 在本实施例中, 通过 Redis数据库和 H2数据库相结合的方式, 快速査询数据, 提高了用户体验, 尤其适用于组合条件査询。
[0080] 在本实施例中, 将告警数据的所有详细信息都缓存在 Redis数据库中, 比如告 警内容、 告警吋间、 告警位置、 告警级别等, 并为每条告警数据设置一个对应 的唯一标识 ID; 而在 H2数据库中, 主要是为了便于査询索引, 在动态査询索引 表中, 不包括告警数据的详细信息, 仅包括告警数据的唯一标识 ID及与该告警 数据相关的几个索引字段。
[0081] 如图 4所示, 在本实施例中, 当所述査询条件的数量大于等于 2吋, 所述匹配模 块包括:
[0082] 査询条件获取单元 41, 用于获取査询条件;
[0083] 第一匹配单元 42, 用于将每个査询条件分别与所述动态査询索弓 I表进行匹配, 获得与每个査询条件相匹配的査询结果, 并获取每个査询结果中的告警数据的 数量;
[0084] 第二匹配单元 43, 用于对每个査询条件的匹配数量进行排序, 将数量少的査询 结果与数量多的査询结果对应的査询条件进行再次匹配, 获得最终査询结果中 的唯一标识 ID。
[0085] 以 WEB服务器的某一告警页面为例, 首先配置索引配置文件, 将局站、 告警级 别设置为索引字段, 配置到索引文件中, WEB服务器启动吋, 从数据库的告警 表中读取当前的告警详细信息, 将获取的告警信息按 < CaCheID, 告警详细信息 > 的格式写入 Redis缓存中, 其中 CachelD为该条告警信息的唯一标识 ID; Redis缓 存通过定吋刷新与数据库告警保持同步。
[0086] 根据上述索引配置文件, 在 H2数据库中建立动态査询索引表, 上述索引配置文 件中, 索引字段有两个, 分别为局站和告警级别, 那么就可以得到局站索引表 , 如表 1所示:
[0087] 鳥 : i, :腿 ■ 鳥 :腿 :
應: :2. 湖 ^ : :: 屬. . ■
[0088] 表 1
[0089] 由表 1可知, 目前未消除的告警数据有 4条, 分别对应局站 1和局站 2, 告警级别 也包括告警级别 1和告警级别 4。
[0090] 同样, 上述动态査询索引表还可以是以告警级别为索引字段, 得到告警级别索 引表, 如表 2所示:
[]
Figure imgf000011_0001
[0091] 表 2
[0092] 由上可知, 表 2的内容是和表 1相同的, 只是排列方式不同, 这也是为了便于査 询, 这是 Η2数据库的优点所在。
[0093] 为了便于描述, 将査询条件也设置为 2个, 分别为局站 1和告警级别 4, 根据上 述第一匹配单元可知, 将每个査询条件分别与所述动态査询索弓 I表进行匹配, 获得与每个査询条件相匹配的査询结果, 则与査询条件局站 1所匹配的査询结果 如表 3所示:
[]
Figure imgf000011_0002
[0094] 表 3 [0095] 与査询条件告警级别 4所匹配的査询结果如表 4所示:
[]
Figure imgf000012_0001
[0096] 表 4
[0097] 由表 3、 表 4可知, 这次的索引表又有了变化, 是以 CachelD为第一列, 这是因 为我们的目标是获取 CachelD作为唯一标识 ID, 这也是 H2数据库的动态査询的便 捷之处。
[0098] 根据上述第二匹配单元可知, 査询条件局站 1对应的告警数据的数量为 2, 査询 条件告警级别 4对应的告警数据的数量为 3, 则用数量少的査询结果为表 3, 数量 多的査询结果对应的査询条件为告警级别 4, 将表 3与告警级别 4进行匹配, 使用 动态组合査询 CachelD的语句, 得到表 5:
[]
Figure imgf000012_0002
[0099] 表 5
[0100] 表 5中的 ID2即为本例的査询结果, 根据 ID2从所述 Redis数据库中获取对应的告 警数据的详细信息。
[0101] 作为另一种实施例, 当査询条件的数量为 3或更多吋, 也可以按照以上思路进 行递推, 快速査询到所需要的告警数据。
[0102] 以査询条件的数量为 3为例, 将 3个査询条件分别与所述动态査询索引表进行匹 配, 获得与每个査询条件相匹配的査询结果; 对每个査询条件的匹配数量进行 排序, 将数量最少的査询结果与数量最多的査询结果对应的査询条件进行再次 匹配; 得到二次匹配的査询结果, 将该査询结果再与数量中间的査询结果重复 上述过程, 即可査询到所需要的告警数据, 兹不赘述。
[0103] 在本实施例中, 所述动态査询索引表中包含有若干个索引字段, 根据不同的索 引字段得到不同的査询索引表。 [0104] 在本实施例中, 所述待査询的査询条件与所述索引字段相关。
[0105] 在本实施例中, 所述 Redis数据库按照预设的吋间点定吋刷新, 以便与实吋告 警数据同步。
[0106] 需要说明的是, 在本文中, 术语"包括"、 "包含 "或者其任何其他变体意在涵盖 非排他性的包含, 从而使得包括一系列要素的过程、 方法、 物品或者装置不仅 包括那些要素, 而且还包括没有明确列出的其他要素, 或者是还包括为这种过 程、 方法、 物品或者装置所固有的要素。 在没有更多限制的情况下, 由语句 "包 括一个 ...... "限定的要素, 并不排除在包括该要素的过程、 方法、 物品或者装置 中还存在另外的相同要素。
[0107] 上述本发明实施例序号仅仅为了描述, 不代表实施例的优劣。
[0108] 通过以上的实施方式的描述, 本领域的技术人员可以清楚地了解到上述实施例 方法可借助软件加必需的通用硬件平台的方式来实现, 当然也可以通过硬件, 但很多情况下前者是更佳的实施方式。 基于这样的理解, 本发明的技术方案本 质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来, 该计 算机软件产品存储在一个存储介质 (如 ROM/RAM、 磁碟、 光盘) 中, 包括若干 指令用以使得一台终端设备 (可以是手机, 计算机, 服务器, 空调器, 或者网 络设备等) 执行本发明各个实施例所述的方法。
[0109] 以上仅为本发明的优选实施例, 并非因此限制本发明的专利范围, 凡是利用本 发明说明书及附图内容所作的等效结构或等效流程变换, 或直接或间接运用在 其他相关的技术领域, 均同理包括在本发明的专利保护范围内。
工业实用性
[0110] 本发明提出的一种告警数据査询方法及装置, 该方法包括: 将告警数据缓存到 Redis数据库中, 并为每一条告警数据设置一个对应的唯一标识 ID; 建立索引配 置文件, 在所述索引配置文件中设置索引字段; 根据所述索引配置文件, 在 H2 数据库中建立动态査询索引表, 所述动态査询索引表中包括告警数据的唯一标 识 ID; 获取待査询的査询条件, 将所述査询条件与所述动态査询索引表进行匹 配, 获得唯一标识 ID; 通过所述唯一标识 ID, 从所述 Redis数据库中获取对应的 告警数据, 通过 Redis数据库和 H2数据库相结合的方式, 快速査询数据, 提高了 用户体验。 因此, 具有工业实用性

Claims

权利要求书
[权利要求 1] 一种告警数据査询方法, 包括:
将告警数据缓存到 Redis数据库中, 并为每一条告警数据设置一个对 应的唯一标识 ID;
建立索弓 I配置文件, 在所述索弓 I配置文件中设置索弓 I字段; 根据所述索引配置文件, 在 H2数据库中建立动态査询索引表, 所述 动态査询索引表中包括告警数据的唯一标识 ID;
获取待査询的査询条件, 将所述査询条件与所述动态査询索弓 I表进行 匹配, 获得唯一标识 ID;
通过所述唯一标识 ID, 从所述 Redis数据库中获取对应的告警数据。
[权利要求 2] 根据权利要求 1所述的一种告警数据査询方法, 其中, 当所述査询条 件的数量大于等于 2吋, 所述获取待査询的査询条件, 将所述査询条 件与所述动态査询索引表进行匹配, 获得唯一标识 ID包括: 获取査询条件;
将每个査询条件分别与所述动态査询索引表进行匹配, 获得与每个査 询条件相匹配的査询结果, 并获取每个査询结果中的告警数据的数量 对每个査询条件的匹配数量进行排序, 将数量少的査询结果与数量多 的査询结果对应的査询条件进行再次匹配, 获得最终査询结果中的唯 一标识 ID。
[权利要求 3] 根据权利要求 2所述的一种告警数据査询方法, 其中, 所述动态査询 索引表中包含有若干个索引字段, 根据不同的索引字段得到不同的査 询索引表。
[权利要求 4] 根据权利要求 3所述的一种告警数据査询方法, 其中, 所述待査询的 査询条件与所述索引字段相关。
[权利要求 5] 根据权利要求 1所述的一种告警数据査询方法, 其中, 所述 Redis数据 库按照预设的吋间点定吋刷新, 以便与实吋告警数据同步。
[权利要求 6] —种告警数据査询装置, 包括: 缓存模块, 用于将告警数据缓存到 Redis数据库中, 并为每一条告警 数据设置一个对应的唯一标识 ID;
预设模块, 用于建立索引配置文件, 在所述索引配置文件中设置索引 字段;
索引模块, 用于根据所述索引配置文件, 在 H2数据库中建立动态査 询索引表, 所述动态査询索引表中包括告警数据的唯一标识 ID; 匹配模块, 用于获取待査询的査询条件, 将所述査询条件与所述动态 査询索引表进行匹配, 获得唯一标识 ID;
告警数据获取模块, 用于通过所述唯一标识 ID, 从所述 Redis数据库 中获取对应的告警数据。
[权利要求 7] 根据权利要求 6所述的一种告警数据査询装置, 其中, 当所述査询条 件的数量大于等于 2吋, 所述匹配模块包括:
査询条件获取单元, 用于获取査询条件;
第一匹配单元, 用于将每个査询条件分别与所述动态査询索引表进行 匹配, 获得与每个査询条件相匹配的査询结果, 并获取每个査询结果 中的告警数据的数量;
第二匹配单元, 用于对每个査询条件的匹配数量进行排序, 将数量少 的査询结果与数量多的査询结果对应的査询条件进行再次匹配, 获得 最终査询结果中的唯一标识 ID。
[权利要求 8] 根据权利要求 7所述的一种告警数据査询装置, 其中, 所述动态査询 索引表中包含有若干个索引字段, 根据不同的索引字段得到不同的査 询索引表。
[权利要求 9] 根据权利要求 8所述的一种告警数据査询装置, 其中, 所述待査询的 査询条件与所述索引字段相关。
[权利要求 10] 根据权利要求 6所述的一种告警数据査询装置, 其中, 所述 Redis数据 库按照预设的吋间点定吋刷新, 以便与实吋告警数据同步。
PCT/CN2017/084590 2017-05-16 2017-05-16 一种告警数据查询方法及装置 WO2018209574A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2017/084590 WO2018209574A1 (zh) 2017-05-16 2017-05-16 一种告警数据查询方法及装置

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2017/084590 WO2018209574A1 (zh) 2017-05-16 2017-05-16 一种告警数据查询方法及装置

Publications (1)

Publication Number Publication Date
WO2018209574A1 true WO2018209574A1 (zh) 2018-11-22

Family

ID=64273194

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/084590 WO2018209574A1 (zh) 2017-05-16 2017-05-16 一种告警数据查询方法及装置

Country Status (1)

Country Link
WO (1) WO2018209574A1 (zh)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111865691A (zh) * 2020-07-22 2020-10-30 平安证券股份有限公司 基于人工智能的报警文件分发方法、装置、设备和介质
CN112131242A (zh) * 2020-08-03 2020-12-25 福建威盾科技集团有限公司 一种基于redis的数据快速查询方法及装置
CN115292314A (zh) * 2022-07-28 2022-11-04 上海数禾信息科技有限公司 序列号生成方法、装置、计算机设备和存储介质

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102314506A (zh) * 2011-09-07 2012-01-11 北京人大金仓信息技术股份有限公司 基于动态索引的分布式缓冲区管理方法
CN102902730A (zh) * 2012-09-10 2013-01-30 新浪网技术(中国)有限公司 基于数据缓存的读数据方法及装置
CN103177027A (zh) * 2011-12-23 2013-06-26 北京新媒传信科技有限公司 获取动态Feed索引的方法和系统
CN104731922A (zh) * 2015-03-26 2015-06-24 江苏物联网研究发展中心 基于分布式数据库HBase的结构化数据的快速检索系统及方法
CN105279213A (zh) * 2015-03-13 2016-01-27 中国移动通信集团广东有限公司 一种日志数据库检索装置及检索方法
CN106326429A (zh) * 2016-08-25 2017-01-11 武汉光谷信息技术股份有限公司 一种基于solr的Hbase秒级查询方案

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102314506A (zh) * 2011-09-07 2012-01-11 北京人大金仓信息技术股份有限公司 基于动态索引的分布式缓冲区管理方法
CN103177027A (zh) * 2011-12-23 2013-06-26 北京新媒传信科技有限公司 获取动态Feed索引的方法和系统
CN102902730A (zh) * 2012-09-10 2013-01-30 新浪网技术(中国)有限公司 基于数据缓存的读数据方法及装置
CN105279213A (zh) * 2015-03-13 2016-01-27 中国移动通信集团广东有限公司 一种日志数据库检索装置及检索方法
CN104731922A (zh) * 2015-03-26 2015-06-24 江苏物联网研究发展中心 基于分布式数据库HBase的结构化数据的快速检索系统及方法
CN106326429A (zh) * 2016-08-25 2017-01-11 武汉光谷信息技术股份有限公司 一种基于solr的Hbase秒级查询方案

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111865691A (zh) * 2020-07-22 2020-10-30 平安证券股份有限公司 基于人工智能的报警文件分发方法、装置、设备和介质
CN112131242A (zh) * 2020-08-03 2020-12-25 福建威盾科技集团有限公司 一种基于redis的数据快速查询方法及装置
CN115292314A (zh) * 2022-07-28 2022-11-04 上海数禾信息科技有限公司 序列号生成方法、装置、计算机设备和存储介质
CN115292314B (zh) * 2022-07-28 2023-11-24 上海数禾信息科技有限公司 序列号生成方法、装置、计算机设备和存储介质

Similar Documents

Publication Publication Date Title
CN103377652B (zh) 一种用于进行语音识别的方法、装置和设备
US20140358889A1 (en) Natural language search results for intent queries
US20130337779A1 (en) Method and system for retrieving instant voice message, user equipment, and server
WO2018209574A1 (zh) 一种告警数据查询方法及装置
CN106156088B (zh) 一种索引数据处理方法、数据查询方法及装置
CN103187053A (zh) 输入方法和电子设备
WO2015081848A1 (zh) 社交化扩展搜索方法及相应的装置、系统
US10984059B2 (en) Data retrieval method and system
CN106202305A (zh) 一种日志处理方法、装置及数据库系统
TW201610724A (zh) 應用程式的查找方法與系統
CA3008454A1 (en) Method and device for correlating multiple tables in a database environment
CN104216896B (zh) 一种查找联系人信息的方法及装置
WO2014067471A1 (zh) 一种用于在移动终端上提供搜索结果的方法和设备
AU2013397053A1 (en) Content sharing method and social synchronization apparatus
JP6453464B2 (ja) 検索エンジンにウェブサイト認証データを提供するための方法及び装置
CN111723161A (zh) 一种数据处理方法、装置及设备
CN107169046A (zh) 一种数据库索引查找方法、装置及用户终端
CN110941641B (zh) 一种跨多个数据库进行数据搜索的方法
CN107169003B (zh) 一种数据关联方法及装置
CN104035943A (zh) 存储数据的方法及相应服务器
CN109947759A (zh) 一种数据索引建立方法、索引检索方法及装置
CN105989007B (zh) 一种文件路径处理方法及装置
CN111814020A (zh) 一种数据的获取方法和装置
KR101743731B1 (ko) 분산된 데이터를 통합하여 생성한 온톨로지를 기반으로 쿼리를 처리하는 방법 및 장치
CN111104408A (zh) 基于地图数据的数据交换方法、装置及存储介质

Legal Events

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

Ref document number: 17909893

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17909893

Country of ref document: EP

Kind code of ref document: A1