CN103235820B - Date storage method and device in a kind of group system - Google Patents
Date storage method and device in a kind of group system Download PDFInfo
- Publication number
- CN103235820B CN103235820B CN201310153509.5A CN201310153509A CN103235820B CN 103235820 B CN103235820 B CN 103235820B CN 201310153509 A CN201310153509 A CN 201310153509A CN 103235820 B CN103235820 B CN 103235820B
- Authority
- CN
- China
- Prior art keywords
- data
- server
- mapping relationship
- collected
- initial mapping
- 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.)
- Expired - Fee Related
Links
- 238000000034 method Methods 0.000 title claims abstract description 53
- 238000013507 mapping Methods 0.000 claims abstract description 176
- 108010028984 3-isopropylmalate dehydratase Proteins 0.000 claims abstract description 42
- 238000006243 chemical reaction Methods 0.000 claims abstract description 10
- 238000013500 data storage Methods 0.000 claims description 34
- 238000007726 management method Methods 0.000 claims description 12
- 238000007405 data analysis Methods 0.000 claims description 10
- 238000012423 maintenance Methods 0.000 abstract description 10
- 238000010586 diagram Methods 0.000 description 11
- 101100328886 Caenorhabditis elegans col-2 gene Proteins 0.000 description 4
- 101100328884 Caenorhabditis elegans sqt-3 gene Proteins 0.000 description 4
- 238000004891 communication Methods 0.000 description 3
- 238000004458 analytical method Methods 0.000 description 2
- 238000012544 monitoring process Methods 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 1
- 230000003139 buffering effect Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005538 encapsulation Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000002688 persistence Effects 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 230000001568 sexual effect Effects 0.000 description 1
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
本发明公开了一种集群系统中数据的存储方法与装置,所述方法包括:对采集的服务器运行数据进行解析;若解析出的数据是基于IPMI协议采集的数据,根据解析出的服务器标识ID确定对应的初始映射关系表;执行基于IPMI协议采集的数据的转化步骤,以去除数据异构性;建立所有被采集传感器的数值与表字段名之间的目标映射关系表;根据所述目标映射关系表,生成SQL语句将所述采集的服务器运行数据存入数据库。本发明中,通过设置不同服务器初始映射关系表和建立服务器目标映射关系表的形式去除了数据的异构性,将所有服务器运行数据集中存储,便于数据的统一管理和集群的维护。
The invention discloses a method and device for storing data in a cluster system. The method includes: parsing the collected server operation data; Determine the corresponding initial mapping relationship table; perform the conversion step based on the data collected by the IPMI protocol to remove data heterogeneity; establish a target mapping relationship table between the values of all collected sensors and table field names; according to the target mapping A relational table, generating an SQL statement to store the collected server operation data into a database. In the present invention, the heterogeneity of data is eliminated by setting the initial mapping relationship table of different servers and establishing the server target mapping relationship table, and centrally stores all server operation data, which is convenient for unified management of data and maintenance of clusters.
Description
技术领域technical field
本发明涉及集群通信技术领域,更具体的说是涉及一种集群系统中数据存储方法与装置。The present invention relates to the technical field of cluster communication, and more specifically relates to a data storage method and device in a cluster system.
背景技术Background technique
为了实时获取服务器集群是否正常运行,需要对服务器集群进行监控,对服务器集群进行监控主要包括根据通信协议采集服务器运行数据(是封装的数据,便于传输),存储采集的服务器运行数据,根据存储的服务器运行数据分析集群运行是否正常。其中所述运行数据进一步可以包括状态数据和性能数据,所述状态数据是指一些数值固定的数据,比如CPU型号;所述性能数据可以包括CPU使用率、网络流量使用信息等一些动态变化的数据。In order to obtain whether the server cluster is running normally in real time, it is necessary to monitor the server cluster. The monitoring of the server cluster mainly includes collecting server operating data (encapsulated data for easy transmission) according to the communication protocol, storing the collected server operating data, Whether the server running data analysis cluster is running normally. Wherein the operation data may further include status data and performance data, the status data refers to some data with fixed values, such as CPU model; the performance data may include some dynamically changing data such as CPU usage rate and network traffic usage information .
在采集服务器运行数据时,若集群中的服务器型号不同,基于SNMP协议采集的数据具有相同的维度,可以统一存储管理。但是,基于IPMI协议主要通过服务器中传感器采集数据,采集的数据维度一般不同,比如服务器中传感器的名称不同,传感器种类不同,这些会导致采集数据的异构性,数据存储起来较困难。目前互联网公司采用的都是由服务器生产厂商提供的IPMI管理系统,如果组成集群的服务器来自于多个厂商,那么,在对服务器集群监控时就会有多套IPMI管理系统,即不同型号服务器运行数据保存在不同的数据库中。当维护人员要通过所有服务器的运行数据来检测集群的运行状态时,需要在不同的IPMI管理系统之间进行数据的调取和比较,当集群规模较大时,存储的服务器运行数据量较大,使得集群的维护难度较大,效率较低。When collecting server operation data, if the server models in the cluster are different, the data collected based on the SNMP protocol has the same dimension and can be stored and managed in a unified manner. However, based on the IPMI protocol, data is mainly collected through sensors in the server, and the collected data dimensions are generally different. For example, the names of the sensors in the server are different, and the types of sensors are different. These will lead to the heterogeneity of the collected data and make it difficult to store the data. At present, Internet companies use the IPMI management system provided by the server manufacturer. If the servers forming the cluster come from multiple manufacturers, then there will be multiple sets of IPMI management systems when monitoring the server cluster, that is, different types of servers run Data is kept in different databases. When maintenance personnel want to detect the running status of the cluster through the running data of all servers, they need to retrieve and compare data between different IPMI management systems. When the cluster scale is large, the amount of stored server running data is large , making cluster maintenance more difficult and less efficient.
发明内容Contents of the invention
本申请实施例提供一种集群系统中数据存储方法与装置,以解决现有技术中由不同型号服务器构成的集群中,服务器运行数据存在异构性无法统一存储,造成的集群整体的管理维护分散的技术问题,为具有异构性的数据提供一种统一的数据存储方式,将所有型号的服务器运行数据存储在数据库的同一张表中,提高服务器运行数据的集中度和集群整体的维护效率。The embodiment of the present application provides a method and device for storing data in a cluster system to solve the problem of decentralized management and maintenance of the cluster as a result of the heterogeneity of server operating data in a cluster composed of different types of servers in the prior art. To solve the technical problems, provide a unified data storage method for heterogeneous data, store all types of server operation data in the same table in the database, improve the concentration of server operation data and the overall maintenance efficiency of the cluster.
为解决上述技术问题,本发明提供一种集群系统中数据存储方法与装置,本发明提供如下技术方案:In order to solve the above technical problems, the present invention provides a data storage method and device in a cluster system. The present invention provides the following technical solutions:
一种集群系统中数据存储方法,所述方法包括:A data storage method in a cluster system, the method comprising:
对采集的服务器运行数据进行解析;Analyze the collected server operation data;
若解析出的数据是基于智能平台管理IPMI协议采集的数据,根据解析出的服务器标识ID确定所述服务器对应的初始映射关系表,所述初始映射关系表记录了所述服务器中至少一个传感器名称与表字段名之间的映射关系,不同服务器对应的初始映射表中使用相同的表字段名;If the parsed data is based on the data collected by the intelligent platform management IPMI protocol, determine the corresponding initial mapping table of the server according to the parsed server identification ID, and the initial mapping table records at least one sensor name in the server The mapping relationship with the table field name, the same table field name is used in the initial mapping table corresponding to different servers;
执行基于IPMI协议采集的数据转化步骤以去除数据异构性,所述基于IPMI协议采集的数据转化步骤包括:判断解析出的所有被采集传感器的名称在所述初始映射关系表是否都有记录,若是,则根据初始映射关系表建立被采集传感器的数值与表字段名之间的目标映射关系表;若否,在所述初始映射关系表中增加新的表字段名,并建立所述新表字段名与未记录的被采集传感器名称之间的映射关系;执行所述根据初始映射关系表建立被采集传感器的数值与表字段名之间的目标映射关系表的步骤;Execute the data conversion step collected based on the IPMI protocol to remove data heterogeneity, the described data conversion step collected based on the IPMI protocol includes: judging whether the names of all collected sensors analyzed are recorded in the initial mapping table, If so, then set up the target mapping relationship table between the value of the collected sensor and the table field name according to the initial mapping relationship table; if not, add a new table field name in the initial mapping relationship table, and set up the new table The mapping relationship between the field name and the unrecorded collected sensor name; perform the step of establishing the target mapping relationship table between the value of the collected sensor and the table field name according to the initial mapping relationship table;
根据所述目标映射关系表,生成SQL语句将所述基于IPMI协议采集的数据存入数据库。According to the target mapping relationship table, an SQL statement is generated to store the data collected based on the IPMI protocol into a database.
优选的,所述根据解析出的服务器标识ID确定所述服务器对应的初始映射关系表包括:Preferably, the determining the initial mapping relationship table corresponding to the server according to the parsed server ID includes:
根据所述服务器标识ID以数据库检索的方式确定服务器型号标识;Determine the server model identifier by means of database retrieval according to the server identifier ID;
根据所述服务器型号标识确定所述服务器对应的初始映射关系表。An initial mapping relationship table corresponding to the server is determined according to the server model identifier.
优选的,所述初始映射关系表以哈希索引表的方式建立,则根据所述服务器的型号确定所述服务器对应的初始映射表包括:根据服务器型号对应的标识,通过哈希方式查找所述预先存储的初始映射关系表。Preferably, the initial mapping table is established in the form of a hash index table, then determining the initial mapping table corresponding to the server according to the model of the server includes: according to the identification corresponding to the server model, searching for the Pre-stored initial mapping relationship table.
优选的,所述对采集的服务器运行数据进行解析,包括:Preferably, the parsing of the collected server operation data includes:
根据Epoll方式获取由可读文件描述符组成的队列;Obtain a queue composed of readable file descriptors according to the Epoll method;
从可读文件描述符队列中获取队列头指示的文件描述符;Obtain the file descriptor indicated by the head of the queue from the readable file descriptor queue;
根据所述队列头指示的文件描述符获取服务器运行原始数据,包括:从Socket中读取预设个数的字节,以确定所述队列头指示的文件描述符描述的服务器运行数据的长度;根据确定的数据长度,从所述文件描述符描述的文件中读取该长度值的数据;根据预设数据格式从所述长度的数据中读取服务器的原始数据。Obtaining the original server operation data according to the file descriptor indicated by the queue head includes: reading a preset number of bytes from the Socket to determine the length of the server operation data described by the file descriptor indicated by the queue head; According to the determined data length, read the data of the length value from the file described by the file descriptor; read the original data of the server from the data of the length according to the preset data format.
优选的,若解析出的数据是基于简单网络管理SNMP协议采集的数据,执行基于SNMP协议采集的数据的存储步骤;Preferably, if the parsed data is based on the data collected by the Simple Network Management SNMP protocol, perform a storage step based on the data collected by the SNMP protocol;
所述基于SNMP协议采集的数据的存储步骤包括:建立解析出的数据及所述解析出的数据对应的参数名称之间的映射关系表;根据所述映射关系表中的状态数据,通过SQL语句更新所述状态数据在数据库中的值;将所述映射关系表中的性能数据通过SQL语句存入数据库。The storage step of the data collected based on the SNMP protocol includes: establishing a mapping relationship table between the data analyzed and the corresponding parameter name of the data analyzed; according to the state data in the mapping relationship table, through the SQL statement Updating the value of the state data in the database; storing the performance data in the mapping relationship table into the database through SQL statements.
优选的,所述数据库为关系型数据库。Preferably, the database is a relational database.
本发明还提供一种集群系统中数据存储装置,其特征在于,所述装置包括:The present invention also provides a data storage device in a cluster system, wherein the device includes:
数据解析模块,用于对采集的服务器运行数据进行解析;The data analysis module is used to analyze the collected server operation data;
初始映射表获取模块,用于解析出的数据是基于IPMI协议采集的数据时,根据解析出的服务器标识ID确定所述服务器对应的初始映射关系表,所述初始映射关系表记录了所述服务器中至少一个传感器名称与表字段名之间的映射关系,不同服务器对应的初始映射表中使用相同的表字段名;The initial mapping table acquisition module is used to determine the initial mapping table corresponding to the server according to the parsed server identification ID when the parsed data is data collected based on the IPMI protocol, and the initial mapping table records the server In the mapping relationship between at least one sensor name and table field name, the same table field name is used in the initial mapping table corresponding to different servers;
第一执行模块,用于执行基于IPMI协议采集的数据的转化以去除数据的异构性,所述第一执行模块包括:判断子模块,用于判断所有被采集传感器的名称在所述初始映射关系表是否都有记录;生成子模块,用于所述判断子模块的结果为是时,根据初始映射关系表建立被采集传感器的数值与表字段名之间目标映射关系表;表字段名新增模块,用于所述判断子模块的结果为否时,在所述初始映射关系表中增加新的表字段名,并建立所述新表字段名与未记录的被采集传感器名称之间的映射关系;触发子模块,用于触发所述生成子模块。The first execution module is used to perform the conversion of the data collected based on the IPMI protocol to remove the heterogeneity of the data, and the first execution module includes: a judging sub-module, used to judge the names of all collected sensors in the initial mapping Whether relational table has record; Generate submodule, when the result for described judging submodule is yes, set up target mapping relational table between the numerical value of collected sensor and table field name according to initial mapping relational table; Table field name new Adding module, when the result of the judging submodule is No, add a new table field name in the initial mapping relationship table, and establish the relationship between the new table field name and the unrecorded collected sensor name Mapping relationship; a triggering submodule, used to trigger the generating submodule.
数据存储模块,用于根据所述目标映射关系表,生成SQL语句将所述基于IPMI协议采集的数据存入数据库。The data storage module is configured to generate an SQL statement to store the data collected based on the IPMI protocol into a database according to the target mapping relationship table.
优选的,所述初始映射表获取模块包括:Preferably, the initial mapping table acquisition module includes:
服务器型号标识确定子模块,用于根据解析出的服务器标识ID以数据库检索的方式确定服务器型号标识;The server model identification determination submodule is used to determine the server model identification in a database retrieval manner according to the parsed server identification ID;
初始映射关系表确定子模块,用于根据所述服务器型号标识确定所述服务器对应的初始映射关系表。The initial mapping relationship table determination submodule is configured to determine the initial mapping relationship table corresponding to the server according to the server model identifier.
优选的,所述初始映射关系表以哈希索引表的方式建立,则初始映射关系表确定子模块,具体用于根据服务器型号对应的标识,通过哈希方式查找所述预先存储的初始映射关系表。Preferably, the initial mapping relationship table is established in the form of a hash index table, and the initial mapping relationship table determination submodule is specifically used to search for the pre-stored initial mapping relationship through hashing according to the identification corresponding to the server model surface.
优选的,所述数据解析模块包括:Preferably, the data analysis module includes:
描述符队列获取子模块,用于根据Epoll方式获取由可读文件描述符组成的队列;The descriptor queue acquisition submodule is used to acquire a queue composed of readable file descriptors according to the Epoll method;
描述符读取子模块,用于从可读文件描述符队列中获取队列头指示的文件描述符;The descriptor reading submodule is used to obtain the file descriptor indicated by the head of the queue from the readable file descriptor queue;
原始数据读取子模块,用于根据所述队列头指示的文件描述符获取服务器运行原始数据具体包括:从Socket中读取预设个数的字节,以确定所述队列头指示的文件描述符描述的服务器运行数据的长度;根据确定的数据长度,从所述文件描述符描述的文件中读取该长度值的数据;根据预设数据格式从所述长度的数据中读取服务器的原始数据。The raw data reading sub-module is used to obtain the server running raw data according to the file descriptor indicated by the queue head, specifically including: reading a preset number of bytes from the Socket to determine the file description indicated by the queue head The length of the server running data described by the descriptor; according to the determined data length, read the data of the length value from the file described by the file descriptor; read the original data of the server from the data of the length according to the preset data format data.
优选的,所述装置还包括:Preferably, the device also includes:
第二执行模块,用于解析出的数据是基于SNMP协议采集的数据时,执行基于SNMP协议采集的数据的存储;The second execution module is used to store the data collected based on the SNMP protocol when the parsed data is based on the data collected by the SNMP protocol;
所述第二执行模块包括:映射关系表建立子模块,用于解析出的数据是基于SNMP协议采集的数据时,建立解析出的数据及所述数据对应的参数名称之间的映射关系表;状态数据存储子模块,用于根据所述映射关系表中的状态数据,通过SQL语句更新所述状态数据在数据库中的值;性能数据存储子模块,用于将所述映射关系表中的性能数据,通过SQL语句存入数据库。The second execution module includes: a mapping relationship table establishment submodule, which is used to establish a mapping relationship table between the analyzed data and the parameter names corresponding to the data when the parsed data is data collected based on the SNMP protocol; The state data storage submodule is used to update the value of the state data in the database through SQL statements according to the state data in the mapping relationship table; the performance data storage submodule is used to store the performance data in the mapping relationship table The data is stored in the database through SQL statements.
本发明的技术方案中,集群中每个服务器都有对应的传感器名称与表字段名之间的初始映射关系表,然后根据所述初始关系映射表与采集的传感器的数值建立目标映射关系表。所述目标映射关系表中记录的是表字段名与被采集传感器的数值之间的关系,通过初始映射关系表与目标映射关系表的比较可知,此时得到的目标映射关系表中仅仅有传感器对应的数值与表字段名之间的映射关系,已经没有传感器名称了。同时,本发明中对于每个服务器对应的初始映射表中使用的表字段名相同,至此,目标映射关系表中记录的数据已经没有异构性。如果将表字段名看作参数名称的话,对应的传感器数值就是参数值,这是一种简单的一一对应关系,在存储时,只要建立具有上述表字段名的一张表,然后将对应的采集值存放在对应的表字段名下即可。只不过对于不同的服务器来说,参数值代表的物理意义可能不同。目标映射关系表已经去掉了由传感器名称和个数不同带来的数据异构性,此时,就可以采用统一的SQL语句将所述采集的服务器运行数据存入数据库。In the technical solution of the present invention, each server in the cluster has an initial mapping relationship table between corresponding sensor names and table field names, and then establishes a target mapping relationship table according to the initial relationship mapping table and the collected sensor values. What is recorded in the target mapping relationship table is the relationship between the table field name and the value of the collected sensor. By comparing the initial mapping relationship table with the target mapping relationship table, it can be seen that only the sensor There is no sensor name for the mapping relationship between the corresponding value and the field name of the table. At the same time, the table field names used in the initial mapping table corresponding to each server in the present invention are the same, so far, the data recorded in the target mapping relationship table has no heterogeneity. If the table field name is regarded as the parameter name, the corresponding sensor value is the parameter value, which is a simple one-to-one correspondence. When storing, just create a table with the above table field name, and then the corresponding The collection value can be stored under the corresponding table field name. It's just that for different servers, the physical meaning of the parameter value may be different. The target mapping relationship table has removed the data heterogeneity caused by the different sensor names and numbers. At this time, the collected server operation data can be stored in the database by using a unified SQL statement.
通过本发明的技术方案可以将不同型号服务器基于IPMI协议的数据统一存储在一张表中,对于维护人员来说,需要监测集群整体的运行状态时,只需要在同一张表中进行数据的读取和比较,即使集群规模较大,在同一张表中查找数据进行比较的速度也是较快的,降低了集群的维护难度,提高了集群的维护效率。Through the technical solution of the present invention, the data of different types of servers based on the IPMI protocol can be uniformly stored in one table. For maintenance personnel, when it is necessary to monitor the overall operating status of the cluster, they only need to read and compare the data in the same table. Even if the scale of the cluster is large, the speed of searching and comparing data in the same table is relatively fast, which reduces the difficulty of cluster maintenance and improves the maintenance efficiency of the cluster.
附图说明Description of drawings
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请中记载的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only These are some embodiments described in this application. Those skilled in the art can also obtain other drawings based on these drawings without creative work.
图1为本发明一种集群系统中数据存储方法实施例1的流程图;Fig. 1 is the flowchart of embodiment 1 of data storage method in a kind of cluster system of the present invention;
图2为本发明一种集群系统中数据存储方法实施例2的流程图Fig. 2 is a flow chart of Embodiment 2 of a data storage method in a cluster system of the present invention
图3为本发明一种集群系统中数据存储方法实施例3的流程图;Fig. 3 is a flow chart of Embodiment 3 of a data storage method in a cluster system of the present invention;
图4为本发明一种集群系统中数据存储装置实施例1的结构示意图;4 is a schematic structural diagram of Embodiment 1 of a data storage device in a cluster system of the present invention;
图5为本发明装置实施例1中第一执行模块403的结构示意图;FIG. 5 is a schematic structural diagram of the first execution module 403 in Embodiment 1 of the device of the present invention;
图6为本发明装置实施例1中初始映射表获取模块402的结构示意图;FIG. 6 is a schematic structural diagram of an initial mapping table acquisition module 402 in Embodiment 1 of the device of the present invention;
图7为本发明一种集群系统中数据存储装置实施例2的结构示意图;7 is a schematic structural diagram of Embodiment 2 of a data storage device in a cluster system of the present invention;
图8为本发明装置实施例2中数据解析模块401的结构示意图;FIG. 8 is a schematic structural diagram of the data parsing module 401 in Embodiment 2 of the device of the present invention;
图9为本发明实施例在实际应用场景下的一种结构图。FIG. 9 is a structural diagram of an embodiment of the present invention in an actual application scenario.
具体实施方式detailed description
为了使本技术领域的人员更好地理解本发明方案,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only It is a part of embodiments of the present invention, but not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.
本发明所有实施例中均以集群系统包括不同型号服务器为前提进行说明。参考图1所示,为本发明提供的一种集群系统中数据存储方法实施例1的流程图,本实施例具体可以包括:All embodiments of the present invention are described on the premise that the cluster system includes servers of different models. Referring to FIG. 1, it is a flow chart of Embodiment 1 of a data storage method in a cluster system provided by the present invention. This embodiment may specifically include:
步骤101:解析采集的服务器运行数据。Step 101: Parse the collected server operation data.
实际应用场景下,服务器运行数据是按照一定的采集协议采集到的,采集完服务器运行数据后,需要对采集到的数据进行封装,封装后数据才能在信道中传输。所以在接收到服务器运行数据后首先要进行数据的解析,以获取采集的服务器原始运行数据。关于数据的解析可以参考现有技术中数据解析的实现方式,这里不再赘述。In actual application scenarios, the server operation data is collected according to a certain collection protocol. After the server operation data is collected, the collected data needs to be encapsulated, and the encapsulated data can be transmitted in the channel. Therefore, after receiving the server operation data, the data analysis must be performed first to obtain the original server operation data collected. Regarding data parsing, reference may be made to an implementation manner of data parsing in the prior art, which will not be repeated here.
步骤102:若解析出的数据是基于IPMI协议采集的数据,根据解析出的服务器标识ID确定所述服务器对应的初始映射关系表。Step 102: If the parsed data is data collected based on the IPMI protocol, determine an initial mapping table corresponding to the server according to the parsed server ID.
如果解析出的数据是基于IPMI协议(Intelligent PlatformManagement Interface,智能平台管理接口)采集的数据,那么对应的不同型号服务器的基于IPMI协议采集到的数据存在异构性,为了去除数据的异构性,第一步就是获取该服务器对应的初始映射关系表。具体的,根据解析出的基于IPMI协议采集的数据,可以通过数据解析获取该服务器的ID(标识),然后通过数据库检索的方式获取与该服务器ID对应的服务器型号(或者型号ID),最后,根据确定的服务器型号通过哈希方式查找到对应所述型号服务器的初始映射关系表。If the parsed data is collected based on the IPMI protocol (Intelligent Platform Management Interface, Intelligent Platform Management Interface), then the data collected based on the IPMI protocol for different types of servers is heterogeneous. In order to remove the data heterogeneity, The first step is to obtain the initial mapping relationship table corresponding to the server. Specifically, according to the parsed data collected based on the IPMI protocol, the ID (identification) of the server can be obtained through data parsing, and then the server model (or model ID) corresponding to the server ID can be obtained through database retrieval. Finally, According to the determined server model, the initial mapping relationship table corresponding to the model server is searched by means of hash.
优选的,所述初始映射关系表以哈希索引表方式建立,对于每个服务器可以预存一个初始映射关系表,在实际操作中,可以为每一种型号的服务器预存一个对应的初始映射关系表,并且不同型号服务器对应的初始映射关系表中使用相同的表字段名。或者,在每次解析完数据后,建立解析出的传感器名称与表字段名之间的映射关系表作为初始映射关系表。以预存每一种型号的服务器对应的初始映射关系表、集群中包括的其中两种不同型号的服务器举例来说,为了便于描述将所述型号分别记为第一型号和第二型号,参考表1所示由哈希索引表方式建立的第一型号服务器对应的初始映射关系表A1;表2为由哈希索引表方式建立的第二型号服务器对应的初始映射关系表A2。Preferably, the initial mapping relationship table is established in the form of a hash index table, and an initial mapping relationship table can be pre-stored for each server. In actual operation, a corresponding initial mapping relationship table can be pre-stored for each type of server , and the same table field names are used in the initial mapping tables corresponding to different models of servers. Alternatively, after parsing the data each time, a mapping relationship table between the parsed sensor names and table field names is established as an initial mapping relationship table. Take the pre-stored initial mapping relationship table corresponding to each type of server, and two different types of servers included in the cluster as an example. For the convenience of description, the models are respectively recorded as the first model and the second model. Refer to Table 1 shows the initial mapping relationship table A1 corresponding to the first model server established by the hash index table method; Table 2 is the initial mapping relationship table A2 corresponding to the second model server established by the hash index table method.
表1 初始映射关系表A1Table 1 Initial mapping relationship table A1
表2 初始映射关系表A2Table 2 Initial mapping relationship table A2
这里所述表1和表2中的传感器名称是以Name1、Name2、Name3和Name4标识的。表1和表2中的传感器名称并不一定是对应型号服务器中包括的所有传感器的名称,而可能是该具体型号服务器中所有传感器中的几个传感器的名称,这是由一个具体型号对应多个服务器的出厂时间不同导致的。比如,对于第一型号的服务器来说,假设其包括的传感器的个数为3,具体是温度传感器、电压传感器和电流传感器。但是,在实际使用中有可能存在服务器升级等情况。比如,在原有基础上增加新的传感器或者删除某个传感器,此时,对于剩余的原有传感器的名称保持不变,同一型号出厂时间不同的服务器包括的传感器的个数可能会不同。而对于一个型号的服务器对应一个初始映射表,所以该初始映射表中的传感器名称与该型号的每个服务器采集的实际传感器的名称可能不完全相同。The names of the sensors in Table 1 and Table 2 are identified by Name1, Name2, Name3 and Name4. The sensor names in Table 1 and Table 2 are not necessarily the names of all the sensors included in the server of the corresponding model, but may be the names of several sensors among all the sensors in the server of the specific model. The factory time of each server is different. For example, for the server of the first model, it is assumed that the number of sensors it includes is 3, specifically a temperature sensor, a voltage sensor and a current sensor. However, there may be situations such as server upgrades in actual use. For example, if a new sensor is added or a certain sensor is deleted on the original basis, the names of the remaining original sensors remain unchanged, and the number of sensors included in servers of the same model with different factory dates may be different. A server of a model corresponds to an initial mapping table, so the names of the sensors in the initial mapping table may not be exactly the same as the names of the actual sensors collected by each server of the model.
参考表1和表2可知,对于第一型号第二型号的服务器来说,其对应的初始映射表中使用的表字段名相同,只不过同一表字段名对应的传感器名称不同。Referring to Table 1 and Table 2, it can be seen that for the servers of the first model and the second model, the table field names used in the corresponding initial mapping tables are the same, but the sensor names corresponding to the same table field names are different.
步骤103:执行基于IPMI协议采集的数据转化步骤以去除数据异构性,生成目标映射关系表。Step 103: Perform a data conversion step collected based on the IPMI protocol to remove data heterogeneity and generate a target mapping relationship table.
因为基于IPMI协议采集的数据存在异构性,为了便于数据统一存储,在进行数据的存储之前,首先要对数据进行数据结构的转化。具体的数据结构的转化过程如下:Because the data collected based on the IPMI protocol is heterogeneous, in order to facilitate the unified storage of data, before storing the data, the data structure must be transformed first. The specific data structure conversion process is as follows:
解析出服务器原始运行数据后,根据解析出的数据建立实际采集的服务器中传感器名称与对应采集值之间的映射关系表(本实施例中以数据哈希表的形式给出)。为了便于理解,以表3对应第一型号的某个被采集服务器的数据哈希表B1、表4为对应第二型号的某个被采集服务器的数据哈希表B2为示例进行本步骤的示意性说明。After parsing out the original running data of the server, a mapping relationship table (given in the form of a data hash table in this embodiment) between the actual collected sensor names and the corresponding collected values in the server is established according to the parsed data. For ease of understanding, this step is illustrated by taking Table 3 as an example corresponding to the data hash table B1 of a certain collected server of the first model, and Table 4 as an example of the data hash table B2 corresponding to a certain collected server of the second model sexual description.
表3 数据哈希表B1Table 3 Data hash table B1
表4 数据哈希表B2Table 4 Data hash table B2
获取服务器对应的数据哈希表后,判断表1中包括的传感器名称集合是否包含表3中包括的传感器名称集合,或者说表3中包括的所有传感器名称在表1中是否均存在,如果是,则称为表3被表1完全覆盖。如果表3被表1完全覆盖,直接进行表1与表3的合并,建立表字段名与采集值之间的目标映射表,对于所述第一型号的服务器来说,参考表5所示,为表1与表3合并后得到的目标映射关系表,即第一型号被采集的某个服务器的目标映射关系表。After obtaining the data hash table corresponding to the server, judge whether the set of sensor names included in Table 1 includes the set of sensor names included in Table 3, or whether all sensor names included in Table 3 exist in Table 1, if yes , it is said that Table 3 is completely covered by Table 1. If table 3 is completely covered by table 1, directly perform the merging of table 1 and table 3, and establish the target mapping table between the table field name and the collection value. For the server of the first model, as shown in table 5, It is the target mapping relationship table obtained by merging Table 1 and Table 3, that is, the target mapping relationship table of a certain server whose first model is collected.
表5 第一型号服务器的目标映射关系表Table 5 Target mapping relationship table of the first model server
对于第一型号的所述被采集的服务器来说,其初始映射表与数据哈希表是完全覆盖的,合并比较简单。从表2与表4可以看出,对于被采集的第二型号的某个服务器来说,其对应的初始映射表与数据哈希表不是完全覆盖的。这种情况下,要为没有被初始映射关系表包含的传感器名称建立与新增表字段名之间的映射关系。在实际操作中,因为服务器升级存在不可预知性,所以可以建立一个表字段名集合,当碰到初始映射关系表没有包含的传感器名称时,从所述表字段名集合中获取未被使用的表字段名来建立与没有包含的传感器名称之间的映射关系。比如,使用Col3对应Name5的采集值,那么,参考表6所示,为获得的对应与第二型号的被采集的某个服务器的目标映射关系表。For the collected server of the first model, its initial mapping table and data hash table are completely covered, and the merging is relatively simple. It can be seen from Table 2 and Table 4 that, for a server of the second type collected, its corresponding initial mapping table and data hash table are not completely covered. In this case, it is necessary to establish a mapping relationship between sensor names not included in the initial mapping relationship table and the field names of the newly added table. In actual operation, because of the unpredictability of server upgrades, a set of table field names can be established. When encountering sensor names that are not included in the initial mapping table, unused tables can be obtained from the set of table field names. Field names to map to sensor names that are not included. For example, if Col3 is used to correspond to the collection value of Name5, then refer to Table 6 for the obtained target mapping relationship table corresponding to a server of the second model that is collected.
表6 第二型号的目标映射关系表Table 6 Target mapping relationship table of the second model
所述步骤103中是以采集的一个服务器为例进行说明的,在对其他服务器数据进行处理时,原理相同。The step 103 is described by taking one collected server as an example, and the principle is the same when processing other server data.
步骤104:根据所述目标映射关系表生成SQL语句将所述基于IPMI协议采集的数据存入数据库。Step 104: Generate an SQL statement according to the target mapping relationship table to store the data collected based on the IPMI protocol into a database.
生成目标映射关系表后,通过生成SQL语句将所述基于IPMI协议采集的数据存入数据库。其中,目标映射关系表中数据对应的SQL语句包括insert插入语句和update更新语句,具体的,将目标映射关系表中状态型数据通过更新语句保存到数据库,性能数据通过插入语句保存到数据库。After the target mapping table is generated, the data collected based on the IPMI protocol is stored in the database by generating SQL statements. Wherein, the SQL statement corresponding to the data in the target mapping relationship table includes an insert statement and an update update statement. Specifically, the state data in the target mapping relationship table is saved to the database through the update statement, and the performance data is saved to the database through the insert statement.
insert语句格式:Insert statement format:
insert into table_name(x1,x2,x3,x4,...)values(y1,y2,y3,y4,...)insert into table_name(x1,x2,x3,x4,...)values(y1,y2,y3,y4,...)
其中xn,yn分别对应目标映射关系表中的表字段名和采集值对。Among them, xn and yn respectively correspond to the table field names and collection value pairs in the target mapping relationship table.
update语句格式:update statement format:
update table_name set x1=y1,x2=y2,x3=y3,...where...update table_name set x1=y1,x2=y2,x3=y3,...where...
其中xn,yn分别对应目标映射关系表中的表字段名和采集值对,数据入库时遍历目标映射关系表即可,时间复杂度为O(N)。Among them, xn and yn respectively correspond to the table field names and collection value pairs in the target mapping relationship table. When data is stored in the database, it is only necessary to traverse the target mapping relationship table, and the time complexity is O(N).
本实施例的技术方案中,集群中每个服务器都有对应的传感器名称与表字段名之间的初始映射关系表,然后根据所述初始关系映射表与采集的传感器的数值建立目标映射关系表。所述目标映射关系表中记录的是表字段名与被采集传感器的数值之间的关系,通过初始映射关系表与目标映射关系表的比较可知,此时得到的目标映射关系表中仅仅有传感器对应的数值与表字段名之间的映射关系,已经没有传感器名称了。同时,本发明中对于每个服务器对应的初始映射表中使用的表字段名相同,至此,目标映射关系表中记录的数据已经没有异构性。如果将表字段名看作参数名称的话,对应的传感器数值就是参数值,这是一种简单的一一对应关系,在存储时,只要建立具有上述表字段名的一张表,然后将对应的采集值存放在对应的表字段名下即可。只不过对于不同的服务器来说,参数值代表的物理意义可能不同。目标映射关系表已经去掉了由传感器名称和个数不同带来的数据异构性,此时,就可以采用统一的SQL语句将所述采集的服务器运行数据存入数据库。In the technical solution of this embodiment, each server in the cluster has an initial mapping relationship table between the corresponding sensor name and the table field name, and then establishes a target mapping relationship table according to the initial relationship mapping table and the collected sensor values . What is recorded in the target mapping relationship table is the relationship between the table field name and the value of the collected sensor. By comparing the initial mapping relationship table with the target mapping relationship table, it can be seen that only the sensor There is no sensor name for the mapping relationship between the corresponding value and the field name of the table. At the same time, the table field names used in the initial mapping table corresponding to each server in the present invention are the same, so far, the data recorded in the target mapping relationship table has no heterogeneity. If the table field name is regarded as the parameter name, the corresponding sensor value is the parameter value, which is a simple one-to-one correspondence. When storing, just create a table with the above table field name, and then the corresponding The collection value can be stored under the corresponding table field name. It's just that for different servers, the physical meaning of the parameter value may be different. The target mapping relationship table has removed the data heterogeneity caused by the different sensor names and numbers. At this time, the collected server operation data can be stored in the database by using a unified SQL statement.
通过本发明的技术方案可以将不同型号服务器基于IPMI协议采集的数据统一存储在一张表中,对于维护人员来说,需要监测集群整体的运行状态时,只需要在同一张表中进行数据的读取和比较,即使集群规模较大,在同一张表中查找数据进行比较的速度也是较快的,降低了集群的维护难度,提高了集群的维护效率。Through the technical solution of the present invention, the data collected by different types of servers based on the IPMI protocol can be uniformly stored in one table. For maintenance personnel, when it is necessary to monitor the overall operating status of the cluster, they only need to read and compare data in the same table. , even if the scale of the cluster is large, the speed of looking up data in the same table for comparison is relatively fast, which reduces the difficulty of maintaining the cluster and improves the maintenance efficiency of the cluster.
所述实施例1中对基于IPMI协议采集的数据存储进行了描述,对数据解析时采用现有的数据解析技术,但是现有数据解析时,是将实时接收的运行数据直接放在队列中缓存,需要解析数据时,从数据队列中直接读取数据。因为数据直接在队列中缓存,会占用较多的操作系统资源,而且队列容量有限,并不适合于高并发数据的存储。为了解决高并发性数据的存储,本发明提供一种集群系统中数据存储方法实施例2,采用一种新的数据解析方式,为高并发性数据提供存储方式。同时为基于IPMI协议采集的数据与基于SNMP协议(Simple Network Management Protocol,简单网络管理协议)采集的运行数据提供一种高效的存储方式。In the described embodiment 1, the data storage based on the IPMI protocol collection is described, and the existing data analysis technology is adopted when analyzing the data, but when the existing data is analyzed, the operation data received in real time is directly placed in the queue for buffering , when the data needs to be parsed, read the data directly from the data queue. Because the data is directly cached in the queue, it will occupy more operating system resources, and the queue capacity is limited, so it is not suitable for the storage of highly concurrent data. In order to solve the storage of high-concurrency data, the present invention provides a data storage method embodiment 2 in a cluster system, which adopts a new data analysis method to provide a storage method for high-concurrency data. At the same time, it provides an efficient storage method for the data collected based on the IPMI protocol and the operation data collected based on the SNMP protocol (Simple Network Management Protocol, Simple Network Management Protocol).
参考图2所示,为本发明提供的一种集群系统中数据存储方法实施例2的流程图,在实施例1的基础上,本实施例中以SNMP协议采集的数据的存储为例进行详细说明,虽然在SNMP协议采集的数据的背景下介绍新的数据解析形式,但是仅仅是为了对解析方式进行说明,并不是说本解析方式只适用于SNMP协议采集的数据。对于与上述实施例相同的步骤的实现方式参考上述实施例中的步骤,本实施例不再赘述。本实施例具体可以包括:Referring to Fig. 2, it is a flowchart of a data storage method embodiment 2 in a cluster system provided by the present invention. On the basis of embodiment 1, in this embodiment, the storage of data collected by the SNMP protocol is taken as an example to carry out detailed Note that although the new data analysis form is introduced in the context of data collected by the SNMP protocol, it is only for the purpose of explaining the analysis method, not to say that this analysis method is only applicable to the data collected by the SNMP protocol. For the implementation manner of the same steps as those in the foregoing embodiments, refer to the steps in the foregoing embodiments, and details will not be repeated in this embodiment. This embodiment can specifically include:
步骤201:在数据库中预先存储每种型号服务器对应的初始映射关系表。Step 201: Pre-store an initial mapping relationship table corresponding to each type of server in the database.
这里所述的初始映射关系表主要是针对基于IPMI协议采集的数据设置的。The initial mapping relationship table described here is mainly set for the data collected based on the IPMI protocol.
步骤202:对采集的服务器运行数据进行解析。Step 202: Analyzing the collected server operation data.
本实施例中采用Epoll接口接收数据,Epoll接口为Linux下多路复用IO接口select/poll的增强版本,它能显著提高程序在大量并发连接中只有少量活跃的情况下的系统CPU利用率,因为它会复用文件描述符集合来传递结果而不用迫使开发者每次等待事件之前都必须重新准备要被侦听的文件描述符集合;另一点原因就是获取事件的时候,它无须遍历整个被侦听的描述符集,只要遍历那些被内核IO事件异步唤醒而加入队列的描述符集合就行了。所述队列是一种“先进先出”(FIFO—first in first out)的线性表。In this embodiment, the Epoll interface is used to receive data, and the Epoll interface is an enhanced version of the multiplexing IO interface select/poll under Linux, which can significantly improve the system CPU utilization rate of the program in the case of only a small amount of activity in a large number of concurrent connections. Because it will reuse the file descriptor set to deliver the result without forcing the developer to re-prepare the file descriptor set to be listened to each time before waiting for the event; another reason is that when getting the event, it does not need to traverse the entire To listen to the descriptor set, just traverse the descriptor sets that are asynchronously awakened by the kernel IO event and added to the queue. The queue is a "first in first out" (FIFO—first in first out) linear table.
基于Epoll接收数据的方式,进行的数据解析具体过程为:首先通过Epoll的方式,从系统中获得当前时刻可读的文件描述符,并将获取的可读文件描述符放入可读文件描述符队列中,读取队列头中的可读文件描述符。并且根据队列头中的可读文件描述符从对应的文件中读取服务器原始运行数据(未封装之前的服务器运行数据)。在根据文件描述符获取服务器原始运行数据时,首先从Socket中读取预设个字节,所述预设个字节中存储的是所述队列头中的可读文件描述符表示的文件中封装数据的长度;根据此长度值,从该文件描述符中对应的文件中读取该长度的数据,然后按照通信双方约定的格式从所述长度的数据中解读服务器原始运行数据。每次进行数据解析时,均读取队列头对应的可读文件描述符进行数据解析。如果解析出的数据是基于IPMI协议的数据,参考实施例1中所述的数据存储方式进行存储,如果解析出的数据是基于SNMP协议的数据,进入步骤203。Based on the way Epoll receives data, the specific process of data parsing is as follows: first, obtain the readable file descriptor from the system at the current moment through Epoll, and put the obtained readable file descriptor into the readable file descriptor In the queue, read the readable file descriptor at the head of the queue. And according to the readable file descriptor in the queue head, the original running data of the server (the running data of the server before encapsulation) is read from the corresponding file. When obtaining the original operating data of the server according to the file descriptor, first read the preset bytes from the Socket, and the preset bytes are stored in the file represented by the readable file descriptor in the queue head The length of the encapsulated data; according to the length value, read the data of this length from the corresponding file in the file descriptor, and then interpret the original operating data of the server from the data of the length according to the format agreed by the communication parties. Every time data analysis is performed, the readable file descriptor corresponding to the head of the queue is read for data analysis. If the parsed data is based on the IPMI protocol, store it with reference to the data storage method described in Embodiment 1, and if the parsed data is based on the SNMP protocol, go to step 203.
步骤203:确定基于SNMP协议采集的数据及所述数据对应的参数名称之间的映射关系表。Step 203: Determine the mapping relation table between the data collected based on the SNMP protocol and the parameter names corresponding to the data.
如果解析出的数据是基于SNMP协议采集的数据,首先需要确定基于SNMP协议采集的数据及所述数据对应的参数名称之间的映射关系表。映射关系表确定以后就可以进入步骤204的数据存储了。If the parsed data is data collected based on the SNMP protocol, it is first necessary to determine a mapping relationship table between the data collected based on the SNMP protocol and the parameter names corresponding to the data. After the mapping relationship table is determined, the data storage in step 204 can be entered.
步骤204:将状态数据存储到关系型数据库。Step 204: Store state data in a relational database.
对于采集到的状态数据,其多次采集到的数值可能是相同的,所以没有必要将每次采集的状态数据都单独存储起来,只要每次更新数据库中的状态数据即可。实际操作中,可以将基于SNMP协议采集的状态数据通过SQL语句更新这些状态型数据在数据库中的值。For the collected state data, the value collected multiple times may be the same, so there is no need to store the state data collected each time separately, as long as the state data in the database is updated each time. In actual operation, the status data collected based on the SNMP protocol can be used to update the values of these status data in the database through SQL statements.
步骤205:将性能数据存储到所述关系型数据库。Step 205: Store performance data in the relational database.
优选的,可以从所述映射关系表中过滤所述状态数据,将剩余的性能数据通过SQL语句存入数据库,即完成了基于SNMP协议采集数据的存储。基于IPMI协议采集的数据入库存储时使用的SQL语句格式适用于SNMP协议采集的数据的存储。在实际操作中,状态数据与性能数据可以分开存储在不同的表中,同时基于IPMI协议采集的数据和基于SNMP协议采集的数据分开存储在不同的表中。Preferably, the status data can be filtered from the mapping relationship table, and the remaining performance data can be stored in the database through SQL statements, that is, the storage of collected data based on the SNMP protocol is completed. The SQL statement format used when the data collected based on the IPMI protocol is stored in the database is suitable for the storage of the data collected by the SNMP protocol. In actual operation, the status data and performance data can be stored separately in different tables, and the data collected based on the IPMI protocol and the data collected based on the SNMP protocol are stored in different tables separately.
由上述内容可知,基于SNMP协议采集的数据存储要比基于IPMI协议采集的数据存储简单的多,因为对于不同型号的服务器基于SNMP协议采集的数据维度是相同的,即采集的参数个数和参数名称是相同的,此时只要有参数名称与表字段名之间的映射关系就可以采用哈希表合并的方式获取采集值与表字段名之间的目标哈希表,而且对于不同型号的服务器对应的参数名称与表字段名之间的映射关系是相同的。It can be seen from the above that the data storage based on the SNMP protocol is much simpler than the data storage based on the IPMI protocol, because the data dimensions collected based on the SNMP protocol are the same for different types of servers, that is, the number of collected parameters and parameters The names are the same. At this time, as long as there is a mapping relationship between the parameter name and the table field name, the hash table merge method can be used to obtain the target hash table between the collection value and the table field name, and for different models of servers The mapping relationship between corresponding parameter names and table field names is the same.
本实施例的技术方案中,使用了一种与现有技术不同的数据解析方式,通过文件描述符读取服务器原始运行数据,因为运行文件描述符不占用操作系统资源,而是应用程序本身,降低了对操作系统的影响。另外,队列中放置的是文件描述符,如果有高并发性数据,此时只要将数据对应的描述符缓存在队列中即可,不会占用过多的资源,有效的解决了高并发数据的存储问题。In the technical solution of this embodiment, a data parsing method different from the prior art is used, and the original running data of the server is read through the file descriptor, because the running file descriptor does not occupy the resources of the operating system, but the application itself. Reduced impact on the operating system. In addition, file descriptors are placed in the queue. If there is high concurrency data, you only need to cache the descriptor corresponding to the data in the queue at this time, which will not occupy too many resources, and effectively solve the problem of high concurrency data. storage problem.
现有技术中对集群进行监控时,采集到的数据一般使用RRD(RoundRobin Database,环状数据库)来存储,所谓的RRD就象一个周边标有点的圆环--这些点就是按照时间存储的位置。在一个圆环上存储数据,没有起点和终点。长时间后,RRD中新的数据会覆盖原有数据,即数据的持久性较差。相应的,本实施例中采用关系型数据库来存储数据,可以保持数据的持久性。In the prior art, when the cluster is monitored, the collected data is generally stored using RRD (RoundRobin Database, ring database). The so-called RRD is like a ring marked with points around - these points are the positions stored according to time . Store data on a ring with no start and end. After a long time, the new data in the RRD will overwrite the original data, that is, the durability of the data is poor. Correspondingly, in this embodiment, a relational database is used to store data, which can maintain data persistence.
虽然对于基于IPMI协议采集和基于SNMP协议采集的数据存储是通过不同实施例分开描述的,在实际应用中,是同时存在的,因为对于一个服务器来说,在某些时候,既要基于SNMP协议采集数据,同时也要基于IPMI协议采集数据,现将实施例1与实施例2的流程进行整合,参考图3所示,为集群中数据存储的完整实现流程图,其中相关步骤的实现可以参考实施例1和实施例2中相关步骤的实现方式。Although the data storage based on the IPMI protocol collection and the SNMP protocol collection is described separately through different embodiments, in practical applications, they exist at the same time, because for a server, at some point, it must be based on the SNMP protocol To collect data, it is also necessary to collect data based on the IPMI protocol. Now integrate the processes of Embodiment 1 and Embodiment 2, as shown in Figure 3, which is a complete implementation flow chart of data storage in the cluster, and the implementation of related steps can be referred to Implementation of relevant steps in Embodiment 1 and Embodiment 2.
对应于方法实施例,相应的,本发明还提供一种集群系统中数据存储装置,参考图4所示,为本发明提供的一种集群系统中数据存储装置实施例1的结构示意图,所述装置包括:Corresponding to the method embodiment, correspondingly, the present invention also provides a data storage device in a cluster system. Referring to FIG. 4 , it is a schematic structural diagram of Embodiment 1 of a data storage device in a cluster system provided by the present invention. Devices include:
数据解析模块401,用于对采集的服务器运行数据进行解析;A data parsing module 401, configured to parse the collected server operation data;
初始映射表获取模块402,用于解析出的数据是基于IPMI协议采集的数据时,根据解析出的服务器标识ID确定所述服务器对应的初始映射关系表,所述初始映射关系表记录了所述服务器中至少一个传感器名称与表字段名之间的映射关系,不同服务器对应的初始映射表中使用相同的表字段名;The initial mapping table acquisition module 402 is used to determine the initial mapping table corresponding to the server according to the parsed server identification ID when the parsed data is data collected based on the IPMI protocol, and the initial mapping table records the The mapping relationship between at least one sensor name and table field name in the server, the same table field name is used in the initial mapping table corresponding to different servers;
第一执行模块403,用于执行基于IPMI协议采集的数据的转化,以生成目标映射关系表。The first execution module 403 is configured to perform conversion of data collected based on the IPMI protocol, so as to generate a target mapping relationship table.
数据存储模块404,用于根据所述目标映射关系表,生成SQL语句将所述基于IPMI协议采集的数据存入数据库。The data storage module 404 is configured to generate an SQL statement to store the data collected based on the IPMI protocol into a database according to the target mapping relationship table.
其中,优选的,参考图5所示,为所述第一执行模块403的结构示意图,所述第一执行模块403包括:Wherein, preferably, as shown in FIG. 5 , which is a schematic structural diagram of the first execution module 403, the first execution module 403 includes:
判断子模块501,用于判断所有被采集传感器的名称在所述初始映射关系表是否都有记录;Judging sub-module 501, used to judge whether the names of all collected sensors are recorded in the initial mapping relation table;
生成子模块502,用于所述判断子模块的结果为是时,根据初始映射关系表建立被采集传感器的数值与表字段名之间目标映射关系表;Generate sub-module 502, when the result of the judgment sub-module is yes, set up the target mapping relationship table between the value of the collected sensor and the table field name according to the initial mapping relationship table;
表字段名新增子模块503,用于在所述初始映射关系表中增加新的表字段名,并建立所述新表字段名与未记录的被采集传感器名称之间的映射关系;The table field name adding submodule 503 is used to add a new table field name in the initial mapping relationship table, and establish a mapping relationship between the new table field name and the unrecorded collected sensor name;
触发子模块,用于触发所述生成子模块。The triggering submodule is used to trigger the generating submodule.
优选的,参考图6所示,为所述初始映射表获取模块402的结构示意图,所述初始映射关系表获取模块402包括:Preferably, as shown in FIG. 6 , which is a schematic structural diagram of the initial mapping table acquisition module 402, the initial mapping table acquisition module 402 includes:
服务器型号标识确定子模块601,用于根据解析出的服务器标识以数据库检索的方式确定服务器型号标识;The server model identifier determination submodule 601 is used to determine the server model identifier in a database retrieval manner according to the parsed server identifier;
初始映射关系表确定子模块602,用于根据所述服务器型号标识确定所述服务器对应的初始映射关系表。The initial mapping relationship table determination submodule 602 is configured to determine the initial mapping relationship table corresponding to the server according to the server model identifier.
所述初始映射关系表以哈希索引表方式建立,则初始映射关系表确定子模块603,具体用于根据服务器型号对应的标识,通过哈希方式查找所述预先存储的初始映射关系表。The initial mapping relationship table is established in the form of a hash index table, and the initial mapping relationship table determination sub-module 603 is specifically configured to search the pre-stored initial mapping relationship table through a hash method according to the identification corresponding to the server model.
装置中各模块所实现的功能与方法实施例1中方法操作步骤对应,这里不再赘述。The functions realized by each module in the device correspond to the operation steps of the method in the method embodiment 1, and will not be repeated here.
本发明提供的一种集群系统中数据存储装置实施例2的结构示意图,参考图7所示,为本发明提供的一种集群系统中数据存储装置实施例2的结构示意图,除了图4所示的模块外,所述装置还可以包括:A schematic structural diagram of Embodiment 2 of a data storage device in a cluster system provided by the present invention, as shown in FIG. In addition to the modules, the device may also include:
第二执行模块701,用于解析出的数据是基于SNMP协议采集的数据时,执行基于SNMP协议采集的数据的存储;The second execution module 701 is used to store data collected based on the SNMP protocol when the parsed data is collected based on the SNMP protocol;
所述第二执行模块701包括:映射关系表建立子模块7011,用于解析出的数据是基于SNMP协议采集的数据时,建立解析出的数据及所述数据对应的参数名称之间的映射关系表;The second execution module 701 includes: a mapping relationship table establishment submodule 7011, which is used to establish a mapping relationship between the parsed data and the parameter name corresponding to the data when the parsed data is data collected based on the SNMP protocol surface;
状态数据存储子模块7012,用于根据所述映射关系表中的状态数据,通过SQL语句更新所述状态数据在数据库中的值;The status data storage sub-module 7012 is configured to update the value of the status data in the database through an SQL statement according to the status data in the mapping relationship table;
性能数据存储子模块7013,用于将所述映射关系表中的性能数据,通过SQL语句存入数据库。The performance data storage sub-module 7013 is configured to store the performance data in the mapping relationship table into the database through SQL statements.
优选的,参考图8所示,为所述数据解析模块401在本实施例中的结构示意图,所述数据解析模块401包括:Preferably, referring to FIG. 8 , which is a schematic structural diagram of the data parsing module 401 in this embodiment, the data parsing module 401 includes:
描述符队列获取子模块801,用于根据Epoll方式获取由可读文件描述符组成的队列;The descriptor queue acquisition submodule 801 is used to acquire a queue composed of readable file descriptors according to the Epoll mode;
描述符读取子模块802,用于从可读文件描述符队列中获取队列头指示的文件描述符;The descriptor reading submodule 802 is used to obtain the file descriptor indicated by the head of the queue from the readable file descriptor queue;
原始数据读取子模块803,用于根据所述队列头指示的文件描述符获取服务器运行原始数据具体包括:从Socket中读取预设个数的字节,以确定所述队列头指示的文件描述符描述的服务器运行数据的长度;根据确定的数据长度,从所述文件描述符描述的文件中读取该长度值的数据;根据预设数据格式从所述长度的数据中读取服务器的原始数据。The raw data reading sub-module 803 is configured to obtain the server running raw data according to the file descriptor indicated by the queue head, specifically including: reading a preset number of bytes from the Socket to determine the file indicated by the queue head The length of the server running data described by the descriptor; according to the determined data length, read the data of the length value from the file described by the file descriptor; read the server’s data from the data of the length according to the preset data format Raw data.
装置中各模块所实现的功能与方法实施例2中方法操作步骤对应,这里不再赘述。The functions realized by each module in the device correspond to the operation steps of the method in the method embodiment 2, and will not be repeated here.
参考图9所示,为本发明实施例在实际应用场景下的一种实现,主线程通过Epoll将可用的文件描述符放入可读文件描述符队列中(A1所示)。工作线程池中含有一定数量的线程,负责从可读文件描述符队列中取出队列头中的文件描述符(A2所示),从中读取数据、解析数据和存储数据(A3所示),完成IPMI数据的统一存储。数据库的设计中,按照采集数据时效性的不同分开存储。同时为每一张表设计一个表格存储各字段的最新值,访问数据库时可以快速地获取到各项数据的最新值。Referring to FIG. 9 , which is an implementation of the embodiment of the present invention in a practical application scenario, the main thread puts available file descriptors into the readable file descriptor queue (shown in A1 ) through Epoll. The worker thread pool contains a certain number of threads, which are responsible for taking out the file descriptor in the head of the queue from the readable file descriptor queue (shown in A2), reading data from it, parsing the data and storing the data (shown in A3), and completing Unified storage of IPMI data. In the design of the database, it is stored separately according to the timeliness of the collected data. At the same time, a table is designed for each table to store the latest value of each field, and the latest value of each data can be quickly obtained when accessing the database.
需要说明的是,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个......”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should be noted that the term "comprising", "comprising" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article or apparatus comprising a set of elements includes not only those elements, but also includes none other elements specifically listed, or also include elements inherent in such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article or apparatus comprising said element.
对于系统实施例而言,由于其基本对应于方法实施例,所以相关之处参见方法实施例的部分说明即可。以上所描述的系统实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。As for the system embodiment, since it basically corresponds to the method embodiment, for related parts, please refer to the part description of the method embodiment. The system embodiments described above are only illustrative, and the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in One place, or it can be distributed to multiple network elements. Part or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. It can be understood and implemented by those skilled in the art without creative effort.
以上所述仅是本发明的具体实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本发明的保护范围。The foregoing is only a specific embodiment of the present invention. It should be pointed out that for those of ordinary skill in the art, some improvements and modifications can also be made without departing from the principle of the present invention. It should be regarded as the protection scope of the present invention.
Claims (11)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310153509.5A CN103235820B (en) | 2013-04-27 | 2013-04-27 | Date storage method and device in a kind of group system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310153509.5A CN103235820B (en) | 2013-04-27 | 2013-04-27 | Date storage method and device in a kind of group system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103235820A CN103235820A (en) | 2013-08-07 |
CN103235820B true CN103235820B (en) | 2016-10-05 |
Family
ID=48883861
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201310153509.5A Expired - Fee Related CN103235820B (en) | 2013-04-27 | 2013-04-27 | Date storage method and device in a kind of group system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103235820B (en) |
Families Citing this family (18)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106330990B (en) * | 2015-06-17 | 2020-02-11 | 阿里巴巴集团控股有限公司 | Performance monitoring and analyzing system and method of B/S structure |
CN106909557B (en) * | 2015-12-23 | 2020-06-16 | 中国电信股份有限公司 | Memory cluster storage method and device and memory cluster reading method and device |
CN106302554A (en) * | 2016-11-08 | 2017-01-04 | 郑州云海信息技术有限公司 | A kind of socket communication means, device and storage device |
CN106529195A (en) * | 2016-12-02 | 2017-03-22 | 郑州云海信息技术有限公司 | Data acquisition and analysis method and device |
CN107169075A (en) * | 2017-05-10 | 2017-09-15 | 深圳大普微电子科技有限公司 | Data access method, storage device and the storage system of feature based analysis |
CN107463618B (en) * | 2017-07-04 | 2020-06-30 | 北京奇艺世纪科技有限公司 | Index creating method and device |
CN107229838A (en) * | 2017-07-17 | 2017-10-03 | 成都嘉逸科技有限公司 | A kind of collecting method and data acquisition unit for medical monitoring equipment |
CN108228426A (en) * | 2018-01-19 | 2018-06-29 | 郑州云海信息技术有限公司 | A kind of method and apparatus for recording SDR information |
CN108595121B (en) * | 2018-04-17 | 2021-03-02 | 湖北文理学院 | Data storage method and device |
CN111274051B (en) * | 2020-01-19 | 2023-08-22 | 中信银行股份有限公司 | Data processing method and device, electronic equipment and computer readable storage medium |
CN111538775A (en) * | 2020-04-28 | 2020-08-14 | 中车株洲电力机车有限公司 | Train running state data analysis method and system and rail transit vehicle |
CN111738909B (en) * | 2020-06-11 | 2023-09-26 | 杭州海康威视数字技术股份有限公司 | Image generation method and device |
CN113312390A (en) * | 2021-06-01 | 2021-08-27 | 北京沃东天骏信息技术有限公司 | Service data calling method and device, storage medium and electronic equipment |
CN113992658B (en) * | 2021-10-28 | 2023-09-26 | 科大讯飞股份有限公司 | Data transmission method, related device, equipment, system and storage medium |
CN114911521A (en) * | 2022-05-28 | 2022-08-16 | 青岛奥利普自动化控制系统有限公司 | A method, device and storage medium for data collection of equipment in lithium battery industry |
CN115580562A (en) * | 2022-11-07 | 2023-01-06 | 广东海术云电子科技有限公司 | ERP data acquisition method based on portable acquisition device and acquisition device thereof |
CN116352330B (en) * | 2023-06-01 | 2023-08-01 | 广州富士汽车整线集成有限公司 | Switching control device of heavy-load slewing mechanism and automobile processing production line system |
CN117312435A (en) * | 2023-11-23 | 2023-12-29 | 首都信息发展股份有限公司 | Data acquisition method and device and electronic equipment |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101212355A (en) * | 2006-12-29 | 2008-07-02 | 佛山市顺德区顺达电脑厂有限公司 | Server monitoring method |
CN101916260A (en) * | 2010-07-21 | 2010-12-15 | 中国测绘科学研究院 | A Method for Constructing Semantic Mapping Between Disaster Ontology and Relational Database |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7051363B2 (en) * | 2001-09-20 | 2006-05-23 | Intel Corporation | System and method for interfacing to different implementations of the intelligent platform management interface |
-
2013
- 2013-04-27 CN CN201310153509.5A patent/CN103235820B/en not_active Expired - Fee Related
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101212355A (en) * | 2006-12-29 | 2008-07-02 | 佛山市顺德区顺达电脑厂有限公司 | Server monitoring method |
CN101916260A (en) * | 2010-07-21 | 2010-12-15 | 中国测绘科学研究院 | A Method for Constructing Semantic Mapping Between Disaster Ontology and Relational Database |
Also Published As
Publication number | Publication date |
---|---|
CN103235820A (en) | 2013-08-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103235820B (en) | Date storage method and device in a kind of group system | |
CN111881011B (en) | Log management method, platform, server and storage medium | |
WO2021169268A1 (en) | Data processing method, apparatus and device, and storage medium | |
CN106407302B (en) | Support the method of invoking the specific functions of the middleware database through simple SQL | |
CN112000502B (en) | Processing method and device for mass error logs, electronic device and storage medium | |
CN104917627B (en) | A kind of log cluster for large server cluster scans and analysis method | |
US10657099B1 (en) | Systems and methods for transformation and analysis of logfile data | |
CN106951552A (en) | A kind of user behavior data processing method based on Hadoop | |
CN108369550B (en) | Real-time alteration of data from different sources | |
CN112579552A (en) | Log storage and calling method, device and system | |
CN103840969A (en) | Alarm log management method and system in cloud computing system | |
CN112052134A (en) | Method and device for monitoring service data | |
WO2022237506A1 (en) | Method, apparatus, and device for monitoring online diagnosis service, and storage medium | |
CN110083600A (en) | A kind of method, apparatus, calculating equipment and the storage medium of log collection processing | |
CN105205167A (en) | Log data system | |
CN103034650B (en) | A kind of data handling system and method | |
CN114328759A (en) | Data construction and management method and terminal for data warehouse | |
CN110928681A (en) | Data processing method and device, storage medium and electronic device | |
CN116719872A (en) | Database deployment method and database management platform | |
CN102799555A (en) | Design method capable of configuring data interaction tool in electric power information system and system | |
CN113778996B (en) | A method, device, electronic device and storage medium for processing large data streams | |
CN115033764A (en) | Metadata acquisition method and device, storage medium and electronic equipment | |
CN110795480B (en) | Traffic operation data processing method and device | |
CN107357919A (en) | User behaviors log inquiry system and method | |
CN118540371A (en) | Cluster resource management method and device, storage medium and electronic equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
CP02 | Change in the address of a patent holder |
Address after: 100086 12, 1201, 3 building, 2 South Road, Haidian District Academy of Sciences, Beijing. Patentee after: BEIJING SOHU NEW MEDIA INFORMATION TECHNOLOGY Co.,Ltd. Address before: 100084 Beijing Haidian District Zhongguancun East Road 1 hospital 9 building Sohu cyber building 15 Floor Patentee before: BEIJING SOHU NEW MEDIA INFORMATION TECHNOLOGY Co.,Ltd. |
|
CP02 | Change in the address of a patent holder | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20161005 |
|
CF01 | Termination of patent right due to non-payment of annual fee |