Water conservancy data anomaly detection method and device based on Flink and medium

Through the Flink framework and Kafka message queue, water conservancy data in smart water conservancy systems are monitored and processed in real time, solving the problem of abnormal data detection delays caused by IoT equipment failures and ensuring stable operation of the system.

CN118550901APending Publication Date: 2024-08-27浪潮智慧科技有限公司

Patent Information

Application Number
CN202310182793.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-02-24
Publication Date
2024-08-27

AI Technical Summary

Technical Problem

The smart water conservancy system generates abnormal data due to reasons such as Internet of Things equipment failure, making it difficult for humans to detect in time and affecting the normal operation of the system.

Method used

The water conservancy data anomaly detection method based on Flink is used to collect data through IoT devices and store it in the MySQL database. It monitors Binlog log data, passes it into the Kafka message queue, performs data format conversion and anomaly detection, and delivers abnormal data in a timely manner for early warning.

Benefits of technology

It realizes the timely detection and processing of abnormal data in the smart water conservancy system, ensuring the normal operation of the system and avoiding manual detection delays.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118550901A
    Figure CN118550901A
Patent Text Reader

Abstract

The invention discloses a Flink-based water conservancy data anomaly detection method and device and a medium, and is used for solving the problem that abnormal water conservancy data in an existing intelligent water conservancy system cannot be manually detected in time, and normal operation of the intelligent water conservancy system is affected. The method comprises the steps that water conservancy data in the operation process of the intelligent water conservancy system is collected and stored in a MySQL database; based on the monitored Binlog data in the MySQL database, newly added water conservancy data in the Binlog data is collected and transmitted to a first Kafka distributed message queue; reading the newly added water conservancy data in the first Kafka distributed message queue through an Flink framework, and converting the newly added water conservancy data into a specified format; based on the initialization state of the intelligent water conservancy system and a preset threshold value, performing anomaly detection on the newly-added water conservancy data in the specified format to determine whether the newly-added water conservancy data is abnormal or not; and transmitting the abnormal water conservancy data into a second Kafka distributed message queue, and carrying out early warning on the abnormal water conservancy data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of water conservancy data anomaly detection, and in particular to a water conservancy data anomaly detection method, device and medium based on Flink. Background Art

[0002] In the era of big data, data assets are very important and can create value for the business. However, data that has not been governed is of poor quality, cannot be used, and is difficult to model. Therefore, it is crucial to ensure data quality, establish standardized data standards, improve data governance capabilities, achieve data security sharing, and maximize the value of data assets in the business. Data quality is the key to data application and value. If the data quality is poor and there is a large amount of abnormal data, then the data has no value for analysis and utilization.

[0003] At present, with the development of Internet of Things technology, Internet of Things technology has been widely used in various industries, changing the development direction of traditional fields and meeting the needs of the development of the times. In accordance with the high-quality development requirements of "demand-driven, application-oriented, digital empowerment, and capacity enhancement", water conservancy projects take digitalization, networking, and intelligence as the main line to build a smart water conservancy system with forecasting, early warning, rehearsal, and emergency plan functions, and apply it to IoT equipment application scenarios such as rainfall stations, water level stations, groundwater testing stations, and water quality testing stations. However, the smart water conservancy system will generate abnormal water conservancy data in the case of IoT equipment failures and other reasons. Therefore, how to detect abnormal water conservancy data has become an urgent problem to be faced and solved. Summary of the invention

[0004] The embodiments of the present application provide a Flink-based water conservancy data anomaly detection method, device and medium to solve the technical problem that the existing smart water conservancy system will generate abnormal water conservancy data due to reasons such as failure of Internet of Things equipment, and the abnormal water conservancy data cannot be detected in time by manual means, which affects the normal operation of the smart water conservancy system.

[0005] On the one hand, an embodiment of the present application provides a water conservancy data anomaly detection method based on Flink, including:

[0006] Collect water conservancy data during the operation of the smart water conservancy system through the Internet of Things devices, and store the water conservancy data in the MySQL database;

[0007] Based on the monitored Binlog log data in the MySQL database, newly added water conservancy data in the Binlog log data is collected, and the newly added water conservancy data is transferred to the first Kafka distributed message queue;

[0008] Through the Flink framework, read the newly added water conservancy data in the first Kafka distributed message queue, and convert the newly added water conservancy data into a specified format;

[0009] Based on the initialization state and the preset threshold value during the operation of the smart water conservancy system, anomaly detection is performed on the newly added water conservancy data in the specified format to determine whether the newly added water conservancy data is abnormal;

[0010] The abnormal water conservancy data is transmitted to the second Kafka distributed message queue, and an early warning is issued for the abnormal water conservancy data.

[0011] In one implementation of the present application, the collecting of newly added water conservancy data in the Binlog log data based on the monitored Binlog log data in the MySQL database specifically includes:

[0012] According to the preset monitoring requirements, a monitoring component is set in the MySQL database, and the Binlog log data in the MySQL database is monitored in real time through the monitoring component;

[0013] In the case of monitoring the Binlog log data in the MySQL database, determining that the smart water conservancy system stores the newly added water conservancy data collected by the Internet of Things device in the MySQL database;

[0014] According to the monitored Binlog log data, newly added water conservancy data in the Binlog log data is determined, and the newly added water conservancy data is collected.

[0015] In one implementation of the present application, before determining the newly added water conservancy data in the Binlog log data based on the monitored Binlog log data and collecting the newly added water conservancy data, the method further includes:

[0016] Parsing the Binlog log data, and determining a structured Binlog log corresponding to the Binlog log data according to the processing result;

[0017] The log sequence corresponding to the structured Binlog log is determined, and a cluster analysis is performed on multiple log sequences to determine abnormal Binlog log data.

[0018] In one implementation of the present application, before reading the newly added water conservancy data in the first Kafka distributed message queue through the Flink framework, the method further includes:

[0019] Configure the cluster information of the Flink framework to determine the access address of the Flink cluster;

[0020] Configure the concurrency information of the FLink framework, and according to the concurrency information, configure the Flink framework with a number of resource slots corresponding to the concurrency information;

[0021] And configure the data source path and data export path in the Flink framework to configure the Flink operating environment.

[0022] In one implementation of the present application, the Flink framework is used to read the newly added water conservancy data in the first Kafka distributed message queue, and the newly added water conservancy data is converted into a specified format, specifically including:

[0023] Based on the first Kafka distributed message queue and through the Flink framework, receiving the data stream corresponding to the newly added water conservancy data during the operation of the smart water conservancy system;

[0024] According to the monitored Binlog log data, newly added water conservancy data in the Binlog log data is obtained;

[0025] Parsing the newly added water conservancy data to obtain parsed structured water conservancy data, so as to convert the data format of the newly added water conservancy data into a specified format;

[0026] The structured water conservancy data at least includes a monitoring station code for identifying newly added water conservancy data, a monitoring value, and a monitoring timestamp corresponding to the newly added water conservancy data.

[0027] In one implementation of the present application, before performing anomaly detection on the newly added water conservancy data in the specified format based on the initialization state and the preset threshold during the operation of the smart water conservancy system to determine whether the newly added water conservancy data is abnormal, the method further includes:

[0028] Determine the first water conservancy data received by the Flink framework during the operation of the smart water conservancy system, and initialize the state of the water conservancy data in the smart water conservancy system according to the first water conservancy data;

[0029] The newly added water conservancy data acquired by the FLink framework is used as the data to be compared, so as to compare the newly added water conservancy data with the water conservancy data corresponding to the state initialization.

[0030] In one implementation of the present application, based on the initialization state and preset threshold value during the operation of the smart water conservancy system, anomaly detection is performed on the newly added water conservancy data in the specified format to determine whether the newly added water conservancy data is abnormal, specifically including:

[0031] Determine the water conservancy data corresponding to the initialization state during the operation of the smart water conservancy system, and perform abnormal monitoring on the newly added water conservancy data in the specified format by comparing the water conservancy data corresponding to the initialization state with the newly added water conservancy data in the specified format;

[0032] According to the comparison result, the absolute difference between the water conservancy data corresponding to the initialization state and the newly added water conservancy data in the specified format is determined, and according to the size relationship between a preset threshold and the absolute difference, it is determined whether the newly added water conservancy data has an abnormality.

[0033] In one implementation of the present application, the abnormal water conservancy data is transmitted to the second Kafka distributed message queue, and an early warning is issued for the abnormal water conservancy data, specifically including:

[0034] When the absolute difference between the water conservancy data corresponding to the initialization state and the newly added water conservancy data in the specified format is greater than the preset threshold, determining that the newly added water conservancy data is abnormal;

[0035] Through a preset warning method, an early warning is issued for the abnormal water conservancy data, so that the corresponding management personnel can process the abnormal water conservancy data, and transfer the abnormal water conservancy data to the second Kafka distributed message queue for the management personnel to call the abnormal water conservancy data.

[0036] On the other hand, the embodiment of the present application further provides a water conservancy data anomaly detection device based on Flink, the device comprising:

[0037] at least one processor;

[0038] and, a memory communicatively coupled to the at least one processor;

[0039] The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the above-mentioned Flink-based water conservancy data anomaly detection method.

[0040] On the other hand, an embodiment of the present application further provides a non-volatile computer storage medium storing computer executable instructions, wherein the computer executable instructions are configured as follows:

[0041] Such as the above-mentioned water conservancy data anomaly detection method based on Flink.

[0042] The present application embodiment provides a Flink-based water conservancy data anomaly detection method, device, and medium, which at least have the following beneficial effects:

[0043] By monitoring the Binlog log data in the MySQL database in real time, the water conservancy data collected by the IoT devices in the smart water conservancy system can be timely known, so that the newly added water conservancy data in the Binlog log data can be found according to the monitored Binlog log data, and then the newly added water conservancy data can be transferred to the first Kafka distributed message queue, so as to facilitate the subsequent real-time acquisition of the newly added water conservancy data; the newly added water conservancy data in the first Kafka distributed message queue is read through the Flink framework, and the data format of the newly added water conservancy data is converted into a specified format that can be directly used by the FLink framework, so that the newly added water conservancy data can be detected for anomalies through the FLink framework, and the abnormal water conservancy data in the smart water conservancy system can be determined in time; by transferring the determined abnormal water conservancy data to the second Kafka distributed message queue, it is convenient for managers to call the abnormal water conservancy data, and issue an early warning for the abnormal water conservancy data, so that managers can process the abnormal water conservancy data in time to ensure the normal operation of the smart water conservancy system. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0045] Figure 1 A flowchart of a Flink-based water conservancy data anomaly detection method provided in an embodiment of the present application;

[0046] Figure 2 A schematic diagram of the internal structure of a Flink-based water conservancy data anomaly detection device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0047] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.

[0048] The embodiment of the present application provides a water conservancy data anomaly detection method, device and medium based on Flink. By real-time monitoring of the Binlog log data in the MySQL database, the water conservancy data collected by the Internet of Things device in the smart water conservancy system can be timely known, so that the newly added water conservancy data in the Binlog log data can be found according to the monitored Binlog log data, and then the newly added water conservancy data can be transferred to the first Kafka distributed message queue, so as to facilitate the subsequent real-time acquisition of the newly added water conservancy data; the newly added water conservancy data in the first Kafka distributed message queue is read through the Flink framework, and the data format of the newly added water conservancy data is converted into a specified format that can be directly used by the FLink framework, so that the newly added water conservancy data can be detected for anomalies through the FLink framework, and the abnormal water conservancy data in the smart water conservancy system can be determined in time; by transferring the determined abnormal water conservancy data into the second Kafka distributed message queue, it is convenient for the management personnel to call the abnormal water conservancy data, and the abnormal water conservancy data is warned, so that the management personnel can process the abnormal water conservancy data in time to ensure the normal operation of the smart water conservancy system. The technical problem that the existing smart water conservancy system will generate abnormal water conservancy data due to reasons such as failure of Internet of Things equipment and the abnormal water conservancy data cannot be detected in time by manual means, thus affecting the normal operation of the smart water conservancy system is solved.

[0049] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.

[0050] Figure 1 A flow chart of a Flink-based water conservancy data anomaly detection method provided in an embodiment of the present application. Figure 1 As shown, a Flink-based water conservancy data anomaly detection method provided in an embodiment of the present application includes:

[0051] 101. Collect water conservancy data during the operation of the smart water conservancy system through Internet of Things devices, and store the water conservancy data in the MySQL database.

[0052] The smart water conservancy system uses IoT devices to monitor water conservancy projects such as rainfall stations, water level stations, groundwater monitoring stations, and water quality monitoring stations in real time. The server can obtain water conservancy data collected by IoT devices through IoT devices set up in a distributed environment in the smart water conservancy system, and store the obtained water conservancy data in the MySQL database for subsequent viewing of the water conservancy data generated by the smart water conservancy system.

[0053] It should be noted that the water conservancy data in the embodiment of the present application includes at least one of the following: water level data, rainfall data, groundwater volume data and water quality data.

[0054] The server groups the water conservancy data according to the monitoring stations, and divides the water conservancy data belonging to the same monitoring station into the same data stream, which facilitates subsequent anomaly detection of the same water conservancy data.

[0055] 102. Based on the monitored Binlog log data in the MySQL database, collect the newly added water conservancy data in the Binlog log data, and transfer the newly added water conservancy data to the first Kafka distributed message queue.

[0056] By monitoring the Binlog log data in the MySQL database, the server can know in real time the time when the water conservancy data is stored in the MySQL database. Then, based on the monitored Binlog log data in the MySQL database, the server can determine the newly added water conservancy data in the Binlog log data, and then pass the determined newly added water conservancy data to the first Kafka distributed message queue, so that the subsequent Flink framework can call the newly added water conservancy data.

[0057] Specifically, the server determines the monitoring requirements corresponding to the smart water conservancy system, and sets up a monitoring component in the MySQL database based on the determined monitoring requirements, so that the Binlog log data in the MySQL database can be monitored in real time through the monitoring component. Then, when the monitoring component monitors the Binlog log data in the MySQL database, it is known that the Internet of Things device has collected the new water conservancy data of the smart water conservancy system at this time, and stores the new water conservancy data in the MySQL database. Then, the server finds the new water conservancy data in the Binlog log data based on the monitored Binlog log data, and extracts the new water conservancy data in the Binlog log data.

[0058] In one embodiment of the present application, the server determines the newly added water conservancy data in the Binlog log data based on the monitored Binlog log data, and before collecting the newly added water conservancy data, it is necessary to preliminarily detect and process the Binlog log data to determine whether there is an abnormality in the operation of the smart water conservancy system. The server can obtain the processing result corresponding to the Binlog log data by parsing the Binlog log data, and then, based on the obtained processing result, the server can determine the structured Binlog log corresponding to the Binlog log data, that is, obtain multiple field information included in the Binlog log data, and then, the server can determine the log sequence corresponding to the structured Binlog log by aggregating the structured Binlog log, and can determine the abnormal Binlog log by aggregating and analyzing multiple log sequences.

[0059] 103. Through the Flink framework, read the newly added water conservancy data in the first Kafka distributed message queue, and convert the newly added water conservancy data into a specified format.

[0060] Apache Flink is a framework and distributed processing engine for stateful computations on unbounded and bounded data streams. Flink is designed to run in all common cluster environments, performing computations at memory speed and at any scale. In Flink, applications consist of streaming dataflows transformed by user-defined operators. These streaming dataflows form a directed graph that starts with one or more sources and ends with one or more sinks. Flink applications can consume real-time data from message queues or distributed log-like streaming data sources (such as Apache Kafka or Kinesis), or they can consume bounded historical data from a variety of data sources. Similarly, the result streams generated by Flink applications can also be sent to various data sinks.

[0061] Flink supports parallel processing, and Flink programs are essentially distributed parallel programs. During program execution, a stream has one or more stream partitions (Stream Partition), and each operator has one or more operator subtasks (Operator Subtask). Each subtask is independent of each other and runs in different threads, or runs in different computers or containers. The number of operator subtasks is the parallelism of its corresponding operator. Operators in Flink can be stateful, which is used to process and save the intermediate results generated when an operator is operated. This means that how to process an event may depend on the accumulated results of all event data before the event.

[0062] The server can read the newly added water conservancy data in the MySQL database in real time in the first Kafka distributed message queue through the FLink framework. Since the newly added water conservancy data read by the Flink framework from the first Kafka distributed message queue is a comma-delimited string data, it cannot be used directly. Therefore, the server also needs to convert the data format of the newly added water conservancy data into a specified format to facilitate direct reading and calling by the Flink framework. It should be noted that the specified format corresponding to the newly added water conservancy data in the embodiment of the present application is a triple format.

[0063] Specifically, based on the first Kafka distributed message queue and through the Flink framework, the server can receive the data stream corresponding to the newly added water conservancy data during the operation of the smart water conservancy system. Then, based on the monitored Binlog log data, the server can find the newly added water conservancy data in the Binlog log data, and then parse the newly added water conservancy data to obtain the parsed structured water conservancy data, and convert the data format of the newly added water conservancy data into the specified format. It should be noted that the structured water conservancy data in the embodiment of the present application at least includes the monitoring station code, monitoring value and monitoring timestamp corresponding to the newly added water conservancy data for identifying the newly added water conservancy data.

[0064] In one embodiment of the present application, before the server reads the newly added water conservancy data in the first Kafka distributed message queue through the Flink framework, it is necessary to configure the operating environment of the FLink framework, determine the access address of the Flink cluster by configuring the cluster information of the Flink framework, and specify the number of tasks to be executed by the Flink framework by configuring the concurrency information of the FLink framework. Then, the server configures a number of resource slots corresponding to the concurrency information for the Flink framework according to the concurrency information of the FLink framework, so as to execute the corresponding Flink tasks in each resource slot. At the same time, the server also specifies the source of the data in the Flink framework and where to write the processed data by configuring the data source path and the data export path in the Flink framework, thereby realizing the configuration of the Flink framework operating environment.

[0065] 104. Based on the initialization state and preset thresholds during the operation of the smart water conservancy system, anomaly detection is performed on the newly added water conservancy data in the specified format to determine whether there are any anomalies in the newly added water conservancy data.

[0066] Since any water conservancy data in the smart water conservancy system will not experience a large increase or decrease in a very short period of time, for example, the water level station automatically uploads a measured water conservancy data every 5 minutes, and the difference between the two water conservancy data is 1 meter, because the rise and fall of the water level is a process, the server sets a corresponding threshold for each type of water conservancy data to identify the occurrence of abnormal situations in the smart water conservancy system. The server can determine the difference between the water conservancy data corresponding to the initialization state of the smart water conservancy system and the newly added water conservancy data by comparing the water conservancy data corresponding to the initialization state during the operation of the smart water conservancy system, and then realizes the abnormal detection of the newly added water conservancy data according to the pre-set threshold to determine whether the newly added water conservancy data is abnormal.

[0067] Specifically, the server first determines the water conservancy data corresponding to the initialization state during the operation of the smart water conservancy system, and then monitors the newly added water conservancy data in the specified format for abnormalities by comparing the water conservancy data corresponding to the initialization state with the newly added water conservancy data in the specified format. According to the comparison result, the absolute difference between the water conservancy data corresponding to the initialization state and the newly added water conservancy data in the specified format can be determined, and then whether the newly added water conservancy data is abnormal is determined based on the size relationship between a preset threshold and the absolute difference.

[0068] In one embodiment of the present application, the server performs anomaly detection on the newly added water conservancy data in the specified format based on the initialization state and a preset threshold during the operation of the smart water conservancy system to determine whether the newly added water conservancy data is abnormal. The server determines the first water conservancy data received by the Flink framework during the operation of the smart water conservancy system, and initializes the state of the water conservancy data in the smart water conservancy system based on the first water conservancy data. Then, the newly added water conservancy data obtained by the FLink framework is used as the data to be compared, so that the newly added water conservancy data can be compared with the water conservancy data corresponding to the state initialization in the future.

[0069] 105. The abnormal water conservancy data is transferred to the second Kafka distributed message queue, and an early warning is issued for the abnormal water conservancy data.

[0070] When it is determined that the newly added water conservancy data is abnormal, the server will transfer the abnormal water conservancy data to the second Kafka distributed message queue for subsequent viewing and calling as needed. In addition, the server will also issue an early warning for the abnormal water conservancy data so that the abnormal water conservancy data can be processed in a timely manner.

[0071] Specifically, when the absolute difference between the water conservancy data corresponding to the initialization state and the newly added water conservancy data in the specified format is greater than the preset threshold, the server can determine that there is an abnormality in the newly added water conservancy data. Then, the server issues an early warning for the abnormal water conservancy data through a preset early warning method, so that the corresponding management personnel can obtain the early warning information in real time and process the abnormal water conservancy data. At the same time, the server also transmits the abnormal water conservancy data to the second Kafka distributed message queue for the management personnel to call the abnormal water conservancy data.

[0072] The above is an embodiment of the method proposed in this application. Based on the same inventive concept, this application embodiment also provides a Flink-based water conservancy data anomaly detection device, whose structure is as follows: Figure 2 shown.

[0073] Figure 2The internal structure diagram of a Flink-based water conservancy data anomaly detection device provided in the embodiment of the present application. Figure 2 As shown, the device includes:

[0074] at least one processor;

[0075] and, a memory communicatively coupled to the at least one processor;

[0076] The memory stores instructions that can be executed by at least one processor, and the instructions are executed by at least one processor to enable the at least one processor to:

[0077] Collect water conservancy data during the operation of the smart water conservancy system through IoT devices and store the water conservancy data in the MySQL database;

[0078] Based on the monitored Binlog log data in the MySQL database, the newly added water conservancy data in the Binlog log data is collected, and the newly added water conservancy data is transmitted to the first Kafka distributed message queue;

[0079] Through the Flink framework, read the newly added water conservancy data in the first Kafka distributed message queue and convert the newly added water conservancy data into the specified format;

[0080] Based on the initialization state and preset thresholds during the operation of the smart water conservancy system, anomaly detection is performed on the newly added water conservancy data in the specified format to determine whether there are any anomalies in the newly added water conservancy data;

[0081] The abnormal water conservancy data is transmitted to the second Kafka distributed message queue, and an early warning is issued for the abnormal water conservancy data.

[0082] The embodiment of the present application further provides a non-volatile computer storage medium storing computer executable instructions, wherein the computer executable instructions are configured as follows:

[0083] Collect water conservancy data during the operation of the smart water conservancy system through IoT devices and store the water conservancy data in the MySQL database;

[0084] Based on the monitored Binlog log data in the MySQL database, the newly added water conservancy data in the Binlog log data is collected, and the newly added water conservancy data is transmitted to the first Kafka distributed message queue;

[0085] Through the Flink framework, read the newly added water conservancy data in the first Kafka distributed message queue and convert the newly added water conservancy data into the specified format;

[0086] Based on the initialization state and preset thresholds during the operation of the smart water conservancy system, anomaly detection is performed on the newly added water conservancy data in the specified format to determine whether there are any anomalies in the newly added water conservancy data;

[0087] The abnormal water conservancy data is transmitted to the second Kafka distributed message queue, and an early warning is issued for the abnormal water conservancy data.

[0088] In the 1990s, improvements to a technology could be clearly distinguished as hardware improvements (for example, improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the method flow). However, with the development of technology, many improvements to the method flow today can be regarded as direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement in a method flow cannot be implemented using a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask a chip manufacturer to design and produce a dedicated integrated circuit chip. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed ​​Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages ​​and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.

[0089] The controller can be implemented in any appropriate manner, for example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (such as software or firmware) that can be executed by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in a purely computer-readable program code manner, the controller can be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, this controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be regarded as structures within the hardware component. Or even, the devices for implementing various functions can be regarded as both software modules for implementing the method and structures within the hardware component.

[0090] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0091] For the convenience of description, the above device is described in various units according to their functions. Of course, when implementing this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.

[0092] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems, or computer program products. Therefore, the embodiments of this specification may be in the form of complete hardware embodiments, complete software embodiments, or embodiments in combination with software and hardware. Moreover, the embodiments of this specification may be in the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0093] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0094] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0095] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0096] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0097] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0098] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0099] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0100] This specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. This specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

[0101] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, equipment, and non-volatile computer storage medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0102] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0103] The above description is only one or more embodiments of this specification and is not intended to limit this specification. For those skilled in the art, one or more embodiments of this specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of one or more embodiments of this specification shall be included in the scope of the claims of this specification.

Claims

1. A water conservancy data anomaly detection method based on Flink, characterized in that: The method comprises: Collect water conservancy data during the operation of the smart water conservancy system through the Internet of Things devices, and store the water conservancy data in the MySQL database; Based on the monitored Binlog log data in the MySQL database, newly added water conservancy data in the Binlog log data is collected, and the newly added water conservancy data is transferred to the first Kafka distributed message queue; Using the Flink framework, reading the newly added water conservancy data from the first Kafka distributed message queue, and converting the newly added water conservancy data into a specified format; Based on the initialization state and the preset threshold value during the operation of the smart water conservancy system, anomaly detection is performed on the newly added water conservancy data in the specified format to determine whether the newly added water conservancy data is abnormal; The abnormal water conservancy data is transmitted to the second Kafka distributed message queue, and an early warning is issued for the abnormal water conservancy data.

2. According to the Flink-based water conservancy data anomaly detection method according to claim 1, it is characterized in that: The collecting of the newly added water conservancy data in the Binlog log data based on the monitored Binlog log data in the MySQL database specifically includes: According to the preset monitoring requirements, a monitoring component is set in the MySQL database, and the Binlog log data in the MySQL database is monitored in real time through the monitoring component; In the case of monitoring the Binlog log data in the MySQL database, determining that the smart water conservancy system stores the newly added water conservancy data collected by the Internet of Things device in the MySQL database; According to the monitored Binlog log data, newly added water conservancy data in the Binlog log data is determined, and the newly added water conservancy data is collected.

3. According to the Flink-based water conservancy data anomaly detection method according to claim 2, it is characterized in that: Before determining the newly added water conservancy data in the Binlog log data according to the monitored Binlog log data and collecting the newly added water conservancy data, the method further includes: Parsing the Binlog log data, and determining a structured Binlog log corresponding to the Binlog log data according to the processing result; The log sequence corresponding to the structured Binlog log is determined, and a cluster analysis is performed on multiple log sequences to determine abnormal Binlog log data.

4. According to the Flink-based water conservancy data anomaly detection method according to claim 1, it is characterized in that: Before reading the newly added water conservancy data in the first Kafka distributed message queue through the Flink framework, the method further includes: Configure the cluster information of the Flink framework to determine the access address of the Flink cluster; Configure the concurrency information of the FLink framework, and according to the concurrency information, configure the Flink framework with a number of resource slots corresponding to the concurrency information; And configure the data source path and data export path in the Flink framework to configure the Flink operating environment.

5. According to the Flink-based water conservancy data anomaly detection method according to claim 1, it is characterized in that: The method of reading the newly added water conservancy data in the first Kafka distributed message queue through the Flink framework and converting the newly added water conservancy data into a specified format specifically includes: Based on the first Kafka distributed message queue and through the Flink framework, receiving the data stream corresponding to the newly added water conservancy data during the operation of the smart water conservancy system; According to the monitored Binlog log data, newly added water conservancy data in the Binlog log data is obtained; Parsing the newly added water conservancy data to obtain parsed structured water conservancy data, so as to convert the data format of the newly added water conservancy data into a specified format; The structured water conservancy data at least includes a monitoring station code for identifying newly added water conservancy data, a monitoring value, and a monitoring timestamp corresponding to the newly added water conservancy data.

6. The Flink-based water conservancy data anomaly detection method according to claim 1 is characterized in that: Before performing anomaly detection on the newly added water conservancy data in the specified format based on the initialization state and the preset threshold during the operation of the smart water conservancy system to determine whether the newly added water conservancy data is abnormal, the method further includes: Determine the first water conservancy data received by the Flink framework during the operation of the smart water conservancy system, and initialize the state of the water conservancy data in the smart water conservancy system according to the first water conservancy data; The newly added water conservancy data acquired by the FLink framework is used as the data to be compared, so as to compare the newly added water conservancy data with the water conservancy data corresponding to the state initialization.

7. The Flink-based water conservancy data anomaly detection method according to claim 1 is characterized in that: The method of performing anomaly detection on the newly added water conservancy data in the specified format based on the initialization state and the preset threshold value during the operation of the smart water conservancy system to determine whether the newly added water conservancy data is abnormal includes: Determine the water conservancy data corresponding to the initialization state during the operation of the smart water conservancy system, and perform abnormal monitoring on the newly added water conservancy data in the specified format by comparing the water conservancy data corresponding to the initialization state with the newly added water conservancy data in the specified format; According to the comparison result, the absolute difference between the water conservancy data corresponding to the initialization state and the newly added water conservancy data in the specified format is determined, and according to the size relationship between a preset threshold and the absolute difference, it is determined whether the newly added water conservancy data has an abnormality.

8. The Flink-based water conservancy data anomaly detection method according to claim 1 is characterized in that: The abnormal water conservancy data is transmitted to the second Kafka distributed message queue, and an early warning is issued for the abnormal water conservancy data, specifically including: When the absolute difference between the water conservancy data corresponding to the initialization state and the newly added water conservancy data in the specified format is greater than the preset threshold, determining that the newly added water conservancy data is abnormal; Through a preset warning method, an early warning is issued for the abnormal water conservancy data, so that the corresponding management personnel can process the abnormal water conservancy data, and transfer the abnormal water conservancy data to the second Kafka distributed message queue for the management personnel to call the abnormal water conservancy data.

9. A water conservancy data anomaly detection device based on Flink, characterized in that: The device comprises: at least one processor; and, a memory communicatively coupled to the at least one processor; The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute a Flink-based water conservancy data anomaly detection method as described in any one of claims 1 to 8.

10. A non-volatile computer storage medium storing computer executable instructions, characterized in that: The computer executable instructions are configured to: A water conservancy data anomaly detection method based on Flink as described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Abnormity detection method for hydrological sensor stream data

    CN112948145A

  • Energy monitoring data storage method and device based on time sequence database and medium

    CN114116821A

  • Flink-based hydrological sensor data analysis system and construction method thereof

    CN114817361A

Cited By

  • Real-time storage method and device for big data and medium

    CN119620948A