Storage method and device of operation data, electronic equipment and storage medium

文档序号:510415 发布日期:2021-05-28 浏览:16次 中文

阅读说明:本技术 操作数据的存储方法和装置、电子设备和存储介质 (Storage method and device of operation data, electronic equipment and storage medium ) 是由 杨冰 于 2021-01-18 设计创作,主要内容包括:本申请提供了一种操作数据的存储方法和装置、电子设备和存储介质,其中,该方法包括:接收第一对象发送目标操作指令,其中,目标操作指令用于指示对目标数据库执行目标业务操作;识别目标业务操作所属的操作类型;在目标业务操作所属的操作类型为目标操作类型的情况下,将目标操作数据发送到存储节点进行存储,其中,目标操作数据包含目标操作指令。通过本申请,解决了相关技术中的操作数据的存储方式存在对数据库性能影响大、磁盘空间占用大的问题。(The application provides a storage method and device of operation data, an electronic device and a storage medium, wherein the method comprises the following steps: receiving a target operation instruction sent by a first object, wherein the target operation instruction is used for indicating to execute target business operation on a target database; identifying an operation type to which a target service operation belongs; and under the condition that the operation type of the target business operation belongs to is the target operation type, sending the target operation data to the storage node for storage, wherein the target operation data comprises a target operation instruction. By the method and the device, the problems that the storage mode of the operation data in the related technology has large influence on the performance of the database and occupies large disk space are solved.)

1. A method for storing operational data, comprising:

receiving a target operation instruction sent by a first object, wherein the target operation instruction is used for instructing to execute target business operation on a target database;

identifying the operation type of the target business operation;

and sending target operation data to a storage node for storage under the condition that the operation type to which the target business operation belongs is the target operation type, wherein the target operation data comprises the target operation instruction.

2. The method of claim 1, wherein identifying the operation type to which the target business operation belongs comprises:

analyzing the target operation instruction, and identifying an operation type to which the target business operation belongs, wherein the operation type comprises the target operation type and other operation types except the target operation type, and the target operation type is a data definition language operation.

3. The method of claim 2, wherein parsing the target operation instruction and identifying the operation type to which the target business operation belongs comprises:

analyzing the target operation instruction to obtain the description information of the target service operation;

and matching the description information of the target business operation with the description information of at least one business operation belonging to the target operation type, and identifying the operation type of the target business operation.

4. The method of claim 1, wherein prior to sending the target operational data to the storage node for storage, the method further comprises:

adding target annotation information to the target operation instruction to obtain the target operation data, wherein the target annotation information comprises at least one of the following information: an object identification of the first object, a network address corresponding to the first object.

5. The method of claim 1, wherein after sending the target operational data to the storage node for storage, the method further comprises:

receiving a first acquisition request sent by a second object, wherein the first acquisition request is used for requesting to acquire operation data which is stored in the storage node and corresponds to the first object;

and responding to the first acquisition request, and sending first operation data which is stored in the storage node and corresponds to the first object to the second object, wherein the first operation data comprises the target operation data.

6. The method of claim 1, wherein after sending the target operational data to the storage node for storage, the method further comprises:

receiving a second acquisition request sent by a third object, wherein the second acquisition request is used for requesting to acquire operation data which is stored in the storage node and corresponds to the target service operation;

and sending second operation data which is stored by the storage node and corresponds to the target business operation to the third object in response to the second acquisition request, wherein the second operation data comprises the target operation data.

7. The method according to any one of claims 1 to 6, wherein before receiving the target operation instruction sent by the first object, the method further comprises:

sending an operation state indication message of the target database to a fourth object, wherein the operation state indication message is used for indicating the current operation state of the target database;

and receiving a target configuration message returned by the fourth object in response to the running state indication message, wherein the target configuration message is used for configuring an operation instruction which only stores the indicated operation type of the service operation as the target operation type.

8. An apparatus for storing operational data, comprising:

the system comprises a first receiving unit, a second receiving unit and a third receiving unit, wherein the first receiving unit is used for receiving a target operation instruction sent by a first object, and the target operation instruction is used for indicating to execute target business operation on a target database;

the identification unit is used for identifying the operation type of the target business operation;

a first sending unit, configured to send target operation data to a storage node for storage when an operation type to which the target service operation belongs is a target operation type, where the target operation data includes the target operation instruction.

9. An electronic device comprising a processor, a communication interface, a memory and a communication bus, wherein said processor, said communication interface and said memory communicate with each other via said communication bus,

the memory for storing a computer program;

the processor for performing the method steps of any one of claims 1 to 7 by running the computer program stored on the memory.

10. A computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to carry out the method steps of any one of claims 1 to 7 when executed.

Technical Field

The present application relates to the field of data processing, and in particular, to a method and an apparatus for storing operation data, an electronic device, and a storage medium.

Background

At present, in a privatized environment, a provider of a database may provide a multi-user mechanism, that is, different service lines of a user may use different accounts to operate the same database, and the user may connect to the database through his own account and perform service operation.

In order to facilitate the troubleshooting of which users and which service lines have performed illegal operations (e.g., data being deleted or inserted by mistake due to negligence or problems with the service logic itself), the database may provide an audit service for recording all operations of the users, which may be a service provided by the database itself or a service provided by a database plug-in.

However, the auditing service provided by the database or other database auditing plug-ins can provide complete auditing data (record all user operations), but have a great influence on the performance of the database. Meanwhile, if all user operations are recorded, the amount of data that needs to be recorded is very large, which may occupy a large disk space in the case where the user operations are very frequent.

Therefore, the storage mode of the operation data in the related art has the problems of great influence on the performance of the database and large occupation of disk space.

Disclosure of Invention

The application provides a storage method and device of operation data, electronic equipment and a storage medium, which are used for solving the problem that the storage mode of the operation data in the related technology has great influence on the performance of a database.

According to an aspect of an embodiment of the present application, there is provided a storage method of operation data, including: receiving a target operation instruction sent by a first object, wherein the target operation instruction is used for instructing to execute target business operation on a target database; identifying the operation type of the target business operation; and sending target operation data to a storage node for storage under the condition that the operation type to which the target business operation belongs is the target operation type, wherein the target operation data comprises the target operation instruction.

Optionally, identifying the operation type to which the target business operation belongs includes: analyzing the target operation instruction, and identifying an operation type to which the target business operation belongs, wherein the operation type comprises the target operation type and other operation types except the target operation type, and the target operation type is a data definition language operation.

Optionally, analyzing the target operation instruction, and identifying the operation type to which the target service operation belongs includes: analyzing the target operation instruction to obtain the description information of the target service operation; and matching the description information of the target business operation with the description information of at least one business operation belonging to the target operation type, and identifying the operation type of the target business operation.

Optionally, before sending the target operation data to the storage node for storage, the method further includes: adding target annotation information to the target operation instruction to obtain the target operation data, wherein the target annotation information comprises at least one of the following information: an object identification of the first object, a network address corresponding to the first object.

Optionally, after sending the target operation data to the storage node for storage, the method further includes: receiving a first acquisition request sent by a second object, wherein the first acquisition request is used for requesting to acquire operation data which is stored in the storage node and corresponds to the first object; and responding to the first acquisition request, and sending first operation data which is stored in the storage node and corresponds to the first object to the second object, wherein the first operation data comprises the target operation data.

Optionally, after sending the target operation data to the storage node for storage, the method further includes: receiving a second acquisition request sent by a third object, wherein the second acquisition request is used for requesting to acquire operation data which is stored in the storage node and corresponds to the target service operation; and sending second operation data which is stored by the storage node and corresponds to the target business operation to the third object in response to the second acquisition request, wherein the second operation data comprises the target operation data.

Optionally, before receiving that the first object sends the target operation instruction, the method further includes: sending an operation state indication message of the target database to a fourth object, wherein the operation state indication message is used for indicating the current operation state of the target database; and receiving a target configuration message returned by the fourth object in response to the running state indication message, wherein the target configuration message is used for configuring an operation instruction which only stores the indicated operation type of the service operation as the target operation type.

According to another aspect of the embodiments of the present application, there is also provided a storage device for operation data, including: the system comprises a first receiving unit, a second receiving unit and a third receiving unit, wherein the first receiving unit is used for receiving a target operation instruction sent by a first object, and the target operation instruction is used for indicating to execute target business operation on a target database; the identification unit is used for identifying the operation type of the target business operation; a first sending unit, configured to send target operation data to a storage node for storage when an operation type to which the target service operation belongs is a target operation type, where the target operation data includes the target operation instruction.

Optionally, the identification unit includes: and the identification module is used for analyzing the target operation instruction and identifying the operation type to which the target business operation belongs, wherein the operation type comprises the target operation type and other operation types except the target operation type, and the target operation type is data definition language operation.

Optionally, the identification module comprises: the analysis submodule is used for analyzing the target operation instruction to obtain the description information of the target service operation; and the identification submodule is used for matching the description information of the target business operation with the description information of at least one business operation belonging to the target operation type, and identifying the operation type to which the target business operation belongs.

Optionally, the apparatus further comprises: an adding unit, configured to add target annotation information to the target operation instruction before sending the target operation data to the storage node for storage, so as to obtain the target operation data, where the target annotation information includes at least one of: an object identification of the first object, a network address corresponding to the first object.

Optionally, the apparatus further comprises: a second receiving unit, configured to receive a first acquisition request sent by a second object after the target operation data is sent to the storage node for storage, where the first acquisition request is used to request to acquire operation data corresponding to the first object and stored in the storage node; a second sending unit, configured to send, in response to the first obtaining request, first operation data corresponding to the first object and stored in the storage node to the second object, where the first operation data includes the target operation data.

Optionally, the apparatus further comprises: a third receiving unit, configured to receive a second acquisition request sent by a third object after the target operation data is sent to the storage node for storage, where the second acquisition request is used to request to acquire operation data corresponding to the target service operation and stored in the storage node; a third sending unit, configured to send, in response to the second obtaining request, second operation data corresponding to the target service operation and stored in the storage node to the third object, where the second operation data includes the target operation data.

Optionally, the apparatus further comprises: a fourth sending unit, configured to send, before receiving the target operation instruction sent by the first object, an operation state indication message of the target database to a fourth object, where the operation state indication message is used to indicate a current operation state of the target database; a fourth receiving unit, configured to receive a target configuration message returned by the fourth object in response to the running state indication message, where the target configuration message is used to configure an operation instruction in which only the indicated operation type of the service operation is stored as the target operation type.

According to another aspect of the embodiments of the present application, there is also provided an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory communicate with each other through the communication bus; wherein the memory is used for storing the computer program; a processor for performing the method steps in any of the above embodiments by running the computer program stored on the memory.

According to a further aspect of the embodiments of the present application, there is also provided a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to perform the method steps of any of the above embodiments when the computer program is executed.

In the embodiment of the application, a mode of only recording operation data of a specific operation type is adopted, and a target operation instruction sent by a first object is received, wherein the target operation instruction is used for indicating to execute target service operation on a target database; identifying an operation type to which a target service operation belongs; when the operation type of the target business operation is the target operation type, the target operation data is sent to the storage node for storage, wherein the target operation data comprises a target operation instruction, and the operation type to be stored can be configured as required due to the fact that only the operation data of the specific operation type is recorded, so that the purpose of reducing the operation data to be stored can be achieved, the technical effects of reducing the influence of operation data storage on the performance of the database and reducing the occupation of disk space are achieved, and the problems that the influence of the storage mode of the operation data in the related technology on the performance of the database is large and the occupation of the disk space is large are solved.

Drawings

The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.

In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.

FIG. 1 is a schematic diagram of a hardware environment for an alternative method of storing operational data according to an embodiment of the present application;

FIG. 2 is a flow chart illustrating an alternative method for storing operational data according to an embodiment of the present disclosure;

FIG. 3 is a schematic flow chart diagram illustrating an alternative method for storing operational data according to an embodiment of the present application;

FIG. 4 is a block diagram of an alternative data storage device according to an embodiment of the present application;

fig. 5 is a block diagram of an alternative electronic device according to an embodiment of the present application.

Detailed Description

In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only partial embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.

It should be noted that the terms "first," "second," and the like in the description and claims of this application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.

According to one aspect of the embodiment of the application, a storage method of operation data is provided. Alternatively, in the present embodiment, the storage method of the operation data may be applied to a hardware environment formed by the terminal 102 and the server 104 as shown in fig. 1. As shown in fig. 1, the server 104 is connected to the terminal 102 through a network, and may be configured to provide services (e.g., game services, application services, etc.) for the terminal or a client installed on the terminal, and may be configured with a database on the server or separately from the server, and configured to provide data storage services for the server 104.

The network may include, but is not limited to, at least one of: wired networks, wireless networks. The wired network may include, but is not limited to, at least one of: wide area networks, metropolitan area networks, local area networks, which may include, but are not limited to, at least one of the following: WIFI (Wireless Fidelity), bluetooth. The terminal 102 may not be limited to a PC, a mobile phone, a tablet computer, etc.

The method for storing the operation data according to the embodiment of the present application may be executed by the server 104, the terminal 102, or both the server 104 and the terminal 102. The method for storing the operation data executed by the terminal 102 according to the embodiment of the present application may be executed by a client installed thereon.

Taking the storage method of the operation data in the embodiment executed by the server as an example, fig. 2 is a schematic flow chart of an optional storage method of the operation data according to the embodiment of the present application, and as shown in fig. 2, the flow chart of the method may include the following steps:

step S202, receiving a target operation instruction sent by the first object, wherein the target operation instruction is used for instructing to execute a target business operation on the target database.

The method for storing operation data in this embodiment may be applied to a scenario in which operation data of service operations performed on the same database by multiple related objects is stored, for example, in a privatization environment, different service lines of a user may use different accounts to operate the same database.

For the target database, the target database may be an SQL (Structured Query Language) database, and the user operations recorded by the auditing service may be SQL operations. The user (corresponding to the object) may log in to the client operating on its terminal device using the corresponding account and password (dynamic password) or in other ways, and the client may be connected to the server of the target database through the network.

The server may include a computing node and a storage node, where the computing node is configured to execute the control logic, and the storage node may be configured to store the operation data, and may also be configured to store a data table in a database (the operation data and the data table may be stored by the same storage node or different storage nodes). The operation data may be stored in the storage node by a log file, for example, binlog (binary log file).

The first object (corresponding to the first user, through the first account identifier, the first account identifier may be a user name of the first user) may send, to the server, a target operation instruction through the first client running on the terminal device of the first object, where the target operation instruction is used to instruct to perform a target service operation on the target database. The computing node of the target database may receive the target operation instruction sent by the first object.

Step S204, identifying the operation type of the target business operation.

The business operations executed on the database may be divided into multiple operation types in multiple division manners, for example, the business operations may be divided according to specific operations, for example, the business operations may be divided into select (acquisition), update (update), insert (insert), delete (delete), create (create), alter (modify), drop (delete), and dump) according to the specific operations, and may also be divided according to corresponding database languages, for example, SQL may be divided into DML (Data management Language, Data Manipulation Language), DDL (Data Definition Language), and the like according to the database Language used.

The embodiment provides a lighter audit implementation mode, and only part of operation data of operation types is recorded, so that the influence of the recording process of user operation on the performance of a database can be reduced, and the disk space occupied by the operation data can be reduced.

The operation type of the service operation to be stored, that is, the target operation type, may be pre-configured on the computing node, and the service operation not belonging to the target operation type may belong to other operation types. For example, the infrequent operation statements such as create, drop, and truncate may be configured as the operation type of the service operation to be recorded, and the DDL operation may also be configured as the operation type of the service operation to be recorded, that is, all the DDL operations are configured as the operation type of the service operation to be recorded.

After receiving the target operation instruction, the computing node may analyze the target service operation and identify an operation type to which the target service operation belongs. For example, the target operation instruction is "create table test", a data table named test is created, and the target service operation may be creating the table. If the operation type is divided according to the specific operation, the operation type to which the target service operation belongs is create, and if the operation type is divided according to the adopted database language, the operation type to which the target service operation belongs may be DDL.

Step S206, sending the target operation data to the storage node for storage when the operation type to which the target service operation belongs is the target operation type, where the target operation data includes the target operation instruction.

If the operation type to which the target service operation belongs is a preset operation type in which operation data needs to be stored, that is, a target operation type, the computing node may determine the target operation data according to the target operation instruction, where the target operation data may include other data that needs to be stored, such as user identification information, in addition to the target operation instruction.

After obtaining the target operation data, the compute node may send the target operation data to a storage node, and the storage node may store the target operation data in a log file, which may be a binary log file (binlog).

Through the steps S202 to S206, receiving a target operation instruction sent by the first object, where the target operation instruction is used to instruct to execute a target service operation on the target database; identifying an operation type to which a target service operation belongs; and when the operation type to which the target service operation belongs is the target operation type, sending the target operation data to the storage node for storage, wherein the target operation data comprises a target operation instruction, so that the problems that the storage mode of the operation data in the related technology has large influence on the performance of the database and large occupation of the disk space are solved, the influence of the operation data storage on the performance of the database is reduced, and the occupation of the disk space is reduced.

As an alternative embodiment, before receiving the first object sending target operation instruction, the method further includes:

s11, sending an operation state indication message of the target database to the fourth object, wherein the operation state indication message is used for indicating the current operation state of the target database;

and S12, receiving a target configuration message returned by the fourth object responding to the running state indication message, wherein the target configuration message is used for configuring an operation instruction which only stores the indicated operation type of the business operation as the target operation type.

In order to improve the integrity of the recorded user data, whether all user operations or part of the user operations are recorded can be determined according to the running state of the database. The computing node (or other nodes) may trigger to send an operation state indication message of the target database to the fourth object according to a request of the fourth object or when other trigger conditions are met, where the operation state indication message is used to indicate a current operation state of the target database, and the operation state may reflect a current resource occupation condition (e.g., an internal memory occupation condition and an external memory occupation condition) of the database.

The fourth object (corresponding to the fourth account) may receive the running state indication message through a fourth client running on the terminal device, determine the current running state of the target database according to the running state indication message, prompt the current running state of the target database to the fourth object through a display interface of the fourth client or in other manners (e.g., notification messages, session messages in instant messaging applications), and obtain a configuration operation of the first object, where the configuration operation is used to indicate a mode of an audit service, that is, record all user operations, and record part of the user operations. The configuration operation may be a click operation, a slide operation, a voice input operation, or other type of operation.

If the configuration operation is used for indicating that only part of the user operations are recorded, the fourth client may generate a target configuration message in response to the configuration operation, where the target configuration message is used for configuring an operation instruction that only indicates that the operation type of the service operation is the target operation type, and sending the target configuration message to the computing node.

In response to the received target configuration message, the computing node may determine a mode used by the audit service, that is, only store the operation instruction of which the indicated operation type of the service operation is the target operation type, identify the operation type of the service operation indicated by the received operation instruction according to the mode used by the audit service, and determine whether the operation instruction needs to be stored according to the indicated operation type of the service operation.

Through the embodiment, the method and the system interact with the user, so that the user can conveniently configure the auditing service according to the current running state of the database, the flexibility of auditing service configuration can be improved, and the integrity of auditing data can be ensured.

As an alternative embodiment, identifying the operation type to which the target business operation belongs includes:

and S21, analyzing the target operation instruction, and identifying the operation type to which the target business operation belongs, wherein the operation type comprises the target operation type and other operation types except the target operation type, and the target operation type is a data definition language operation.

In order to effectively supervise illegal operations (for example, data is deleted or inserted by mistake due to negligence or problems of business logic), the computing node can analyze target operation instructions, identify the operation type to which the target business operation belongs, and distinguish the operation type according to whether the data stored in the database is changed or not. For example, the target operation type may be an operation type that changes data stored in the database, and may include, but is not limited to, at least one of: update, insert, delete, create, alter, drop, truncate.

To further reduce the impact of audit services on database performance, the operation types may also be differentiated by whether or not they are DDL operations. For example, the target operation type may be a DDL operation (e.g., a create table, a drop table, a truncate table, etc. infrequently-operated statement). Optionally, when the disk resources of the database are sufficient, the DDL operation and the DML operation may be recorded at the same time, and operations in other database languages may also be recorded.

Through the embodiment, the operation data only storing the DDL operation is configured, so that the influence of the audit service on the performance of the database can be reduced while the illegal operation of the database is effectively supervised.

As an optional embodiment, parsing the target operation instruction, and identifying the operation type to which the target service operation belongs includes:

s31, analyzing the target operation instruction to obtain the description information of the target service operation;

s32, matching the description information of the target business operation with the description information of at least one business operation belonging to the target operation type, and identifying the operation type to which the target business operation belongs.

When the operation type to which the target service operation belongs is identified, at least one service operation belonging to the target operation type may be configured in advance, for example, the target operation type is a DDL operation, and the at least one service operation belonging to the target operation type may include: create table, drop table, truncate table, etc.

The computing node may first analyze the target operation instruction to determine description information of the target service operation, where the description information of the service operation may include one or more of operation information of the service operation, information of an operation object (e.g., a database, a table, a graph, and the like), and the like.

After the description information of the target service operation is analyzed, the computing node may match the description information of the target service operation with the description information of at least one service operation belonging to the target operation type, so as to determine whether there is a service operation matched with the target service operation in the at least one service operation belonging to the target operation type, if so, it may be determined that the target service operation belongs to the target operation type, otherwise, it is determined that the target service operation belongs to another operation type.

When the description information of the target business operation is matched with the description information of a certain business operation belonging to the target operation type, the matching between the operation information and the operation information may be performed, or the matching between the operation information and between the operation object and the operation object may also be performed, or the matching between other types of description information may also be performed, which is not limited in this embodiment.

For example, the target operation instruction is "create table test", and the parsed description information of the target service operation may include: the operation information "create", the operation object information "table", if the description information of a certain business operation belonging to the target operation type is "create", it can be determined that the target business operation belongs to the target operation type.

By the embodiment, the accuracy and the efficiency of service identification can be improved by configuring the description information of the service operation belonging to the target operation type and matching the description information of the current service operation with the configured description information of the service operation.

As an alternative embodiment, before sending the target operation data to the storage node for storage, the method further includes:

s41, adding target annotation information for the target operation instruction to obtain target operation data, wherein the target annotation information includes at least one of the following: an object identification of the first object, a network address corresponding to the first object.

To obtain the target operation data, the computing node may add target annotation information to the target operation instruction, and the added target annotation information may be used to describe the first object, which may include, but is not limited to, at least one of the following: an object identification (e.g., username) of the first object, and a network address (e.g., IP address) corresponding to the first object.

For example, if the original SQL statement of the user is "drop table test", after adding the annotation, the SQL statement is rewritten as "drop table test/. [email protected] admin/", where "127.0.0.1" is the IP address and "@ admin" is the user name.

According to the embodiment, the annotation information is added to the operation instruction to identify the object corresponding to the operation instruction, so that the object of the illegal operation is conveniently positioned, and the troubleshooting efficiency of the illegal operation is improved.

It should be noted that, in addition to providing the audit service, for the target operation instruction, the computing node may also control to execute the target service operation on the target database, and the execution process may refer to related technologies, which is not described herein again in this embodiment.

Optionally, after the operation type to which the target business operation belongs is identified, in the case that the operation type to which the target business operation belongs is another operation type other than the target operation type, the target business operation may be controlled to be executed on the target database, and the target operation instruction is prohibited from being sent to the storage node for storage.

When related personnel carry out illegal operation investigation, the operation data meeting the request condition can be pulled from the storage node in a request obtaining mode.

As an alternative embodiment, after sending the target operation data to the storage node for storage, the method further includes:

s51, receiving a first acquisition request sent by a second object, wherein the first acquisition request is used for requesting to acquire the operation data which is stored in the storage node and corresponds to the first object;

and S52, responding to the first acquisition request, and sending the first operation data which is stored in the storage node and corresponds to the first object to the second object, wherein the first operation data comprises target operation data.

The second object (corresponding to the second user, and through the second account id, the second account id may be a user name of the second user) may send, to the server, a first request for obtaining operation data corresponding to the first object, which is stored in the storage node, through the second client running on the terminal device of the second object. The computing node of the target database may receive the first acquisition request sent by the second object.

In response to the first obtaining request, the computing node may pull, from the storage node, the operation data that satisfies the request condition (corresponding to the first object), that is, the first operation data, where the pulled first operation data includes the target operation data, and send the pulled first operation data to the second object (the second client). The first operation data may be used to check whether the first object performs an illegal operation.

After receiving the first operation data, the second client can display the received first operation data through a display interface of the second client, so that the second object can conveniently view the first operation data; alternatively, the second object may be prompted by the prompt message that the first operation data has been received, and the second object opens the first operation data by performing a corresponding operation when necessary.

By the embodiment, the operation data of the specific object is acquired from the storage node to check whether the object is subjected to illegal operation, so that the efficiency of checking the illegal operation can be improved.

As an alternative embodiment, after sending the target operation data to the storage node for storage, the method further includes:

s61, receiving a second acquisition request sent by a third object, wherein the second acquisition request is used for requesting to acquire operation data which is stored in a storage node and corresponds to the target service operation;

and S62, responding to the second obtaining request, and sending second operation data which is stored by the storage node and corresponds to the target service operation to the third object, wherein the second operation data comprises the target operation data.

The third object (corresponding to the third user, and through the third account id, the third account id may be a user name of the third user) may send a second acquisition request to the server through a third client running on the terminal device of the third object, where the second acquisition request is used to request to acquire operation data corresponding to the target service operation and stored in the storage node. The compute node of the target database may receive the second fetch request sent by the third object.

In response to the second acquisition request, the computing node may pull, from the storage node, operation data that satisfies the request condition (corresponding to the target business operation), that is, the second operation data, where the pulled second operation data includes the target operation data, and send the pulled second operation data to a third object (a third client). The second operation data may be used to investigate whether a user has performed an illegal target business operation.

After receiving the second operation data, the third client can display the received second operation data through a display interface of the third client, so that the third object can conveniently view the second operation data; alternatively, the third object may be prompted by the prompt information that the second operation data has been received, and the third object opens the second operation data by performing a corresponding operation when necessary.

By the embodiment, the operation data of the specific service operation is acquired from the storage node to check whether the user executes the illegal specific service operation, so that the efficiency of checking the illegal operation can be improved.

It should be noted that, in addition to performing the audit service, for the user's operating instructions,

optionally, after the operation type to which the target business operation belongs is identified, if the operation type to which the target business operation belongs is another operation type other than the target operation type, the target business operation is controlled to be executed on the target database, and the target operation instruction is prohibited from being sent to the storage node for storage.

The following explains a storage method of operation data in the embodiment of the present application with reference to an alternative example. In this example, the target operation type is a DDL operation and the network address is an IP address.

As shown in fig. 3, the flow of the storage method of the operation data in the present alternative example may include the following steps:

in step S302, the compute node of the database receives the SQL statement of the user.

Step S304, carrying out syntactic analysis on the SQL sentence of the user, and identifying the type of the SQL sentence of the user.

Identifying the type of SQL statement (user operation) can be divided into: DML statement and DDL statement, and the auditing service provided by the database only records the DDL operation performed by the user.

Step S306, if the type of the SQL statement of the user is the DDL statement, adding a comment to the identified SQL statement, sending the rewritten SQL statement to the storage node, and recording the rewritten SQL statement in the binlog on the storage node.

And adding the user name and the IP address for DDL operation into the SQL statement in an annotation mode, thereby rewriting the SQL statement, recording the rewritten SQL statement in a binlog of the storage node, and finishing audit storage of the user name and the operation IP.

By the method, only DDL operation performed by the user is recorded, so that influence of audit service on database performance and occupation of disk space can be reduced; and a binlog mechanism of the database is used for storing audit operation, so that additional service opening is avoided, and the cost of maintenance service is reduced.

It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present application is not limited by the order of acts described, as some steps may occur in other orders or concurrently depending on the application. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required in this application.

Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (e.g., a ROM (Read-Only Memory)/RAM (Random Access Memory), a magnetic disk, an optical disk) and includes several instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, or a network device) to execute the methods according to the embodiments of the present application.

According to another aspect of the embodiments of the present application, there is also provided a storage device for operation data for implementing the storage method for operation data. Fig. 4 is a block diagram of an alternative storage device for operation data according to an embodiment of the present application, and as shown in fig. 4, the storage device may include:

a first receiving unit 402, configured to receive a target operation instruction sent by a first object, where the target operation instruction is used to instruct a target database to perform a target business operation;

an identifying unit 404, connected to the first receiving unit 402, for identifying an operation type to which the target service operation belongs;

and a first sending unit 406, connected to the identifying unit 404, configured to send the target operation data to the storage node for storage if the operation type to which the target service operation belongs is the target operation type, where the target operation data includes the target operation instruction.

It should be noted that the first receiving unit 402 in this embodiment may be configured to execute the step S202, the identifying unit 404 in this embodiment may be configured to execute the step S204, and the first sending unit 406 in this embodiment may be configured to execute the step S206.

Receiving a target operation instruction sent by a first object through the module, wherein the target operation instruction is used for indicating to execute target business operation on a target database; identifying an operation type to which a target service operation belongs; and when the operation type to which the target service operation belongs is the target operation type, sending the target operation data to the storage node for storage, wherein the target operation data comprises a target operation instruction, so that the problems that the storage mode of the operation data in the related technology has large influence on the performance of the database and large occupation of the disk space are solved, the influence of the operation data storage on the performance of the database is reduced, and the occupation of the disk space is reduced.

As an alternative embodiment, the recognition unit 404 includes:

and the identification module is used for analyzing the target operation instruction and identifying the operation type to which the target business operation belongs, wherein the operation type comprises a target operation type and other operation types except the target operation type, and the target operation type is data definition language operation.

As an alternative embodiment, the identification module comprises:

the analysis submodule is used for analyzing the target operation instruction to obtain the description information of the target service operation;

and the identification submodule is used for matching the description information of the target business operation with the description information of at least one business operation belonging to the target operation type, and identifying the operation type of the target business operation.

As an alternative embodiment, the apparatus further comprises:

the adding unit is used for adding target annotation information to the target operation instruction before sending the target operation data to the storage node for storage, so as to obtain the target operation data, wherein the target annotation information comprises at least one of the following information: an object identification of the first object, a network address corresponding to the first object.

As an alternative embodiment, the apparatus further comprises:

the second receiving unit is used for receiving a first acquisition request sent by a second object after sending the target operation data to the storage node for storage, wherein the first acquisition request is used for requesting to acquire the operation data which is stored in the storage node and corresponds to the first object;

and the second sending unit is used for responding to the first acquisition request and sending the first operation data which is stored in the storage node and corresponds to the first object to the second object, wherein the first operation data comprises target operation data.

As an alternative embodiment, the apparatus further comprises:

the third receiving unit is used for receiving a second acquisition request sent by a third object after the target operation data is sent to the storage node for storage, wherein the second acquisition request is used for requesting to acquire the operation data which is stored in the storage node and corresponds to the target service operation;

and a third sending unit, configured to send, in response to the second obtaining request, second operation data corresponding to the target service operation and stored in the storage node to a third object, where the second operation data includes the target operation data.

As an alternative embodiment, the apparatus further comprises:

the fourth sending unit is used for sending an operating state indicating message of the target database to the fourth object before receiving the target operation instruction sent by the first object, wherein the operating state indicating message is used for indicating the current operating state of the target database;

and a fourth receiving unit, configured to receive a target configuration message returned by the fourth object in response to the running state indication message, where the target configuration message is used to configure an operation instruction in which only the indicated operation type of the service operation is stored as the target operation type.

It should be noted here that the modules described above are the same as the examples and application scenarios implemented by the corresponding steps, but are not limited to the disclosure of the above embodiments. It should be noted that the modules described above as a part of the apparatus may be operated in a hardware environment as shown in fig. 1, and may be implemented by software, or may be implemented by hardware, where the hardware environment includes a network environment.

According to another aspect of the embodiments of the present application, there is also provided an electronic device for implementing the storage method of the operation data, where the electronic device may be a server, a terminal, or a combination thereof.

Fig. 5 is a block diagram of an alternative electronic device according to an embodiment of the present application, as shown in fig. 5, including a processor 502, a communication interface 504, a memory 506, and a communication bus 508, where the processor 502, the communication interface 504, and the memory 506 are communicated with each other via the communication bus 508, and where,

a memory 506 for storing a computer program;

the processor 502, when executing the computer program stored in the memory 506, implements the following steps:

s1, receiving a target operation instruction sent by the first object, wherein the target operation instruction is used for instructing the target database to execute target business operation;

s2, identifying the operation type of the target business operation;

and S3, when the operation type of the target business operation is the target operation type, sending the target operation data to the storage node for storage, wherein the target operation data comprises a target operation instruction.

Alternatively, in this embodiment, the communication bus may be a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown in FIG. 5, but this is not intended to represent only one bus or type of bus.

The communication interface is used for communication between the electronic equipment and other equipment.

The memory may include RAM, and may also include non-volatile memory (non-volatile memory), such as at least one disk memory. Alternatively, the memory may be at least one memory device located remotely from the processor.

As an example, the memory 506 may include, but is not limited to, the first receiving unit 402, the identifying unit 404, and the first sending unit 406 in a storage device of the operation data. In addition, the present invention may further include, but is not limited to, other module units in the storage device of the above operation data, which is not described in detail in this example.

The processor may be a general-purpose processor, and may include but is not limited to: a CPU (Central Processing Unit), an NP (Network Processor), and the like; but also a DSP (Digital Signal Processing), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component.

Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, and this embodiment is not described herein again.

It will be understood by those skilled in the art that the structure shown in fig. 5 is merely an illustration, and the device implementing the above storage method of operation data may be a terminal device. Fig. 5 is a diagram illustrating a structure of the electronic device. For example, the electronic device may also include more or fewer components (e.g., network interfaces, display devices, etc.) than shown in FIG. 5, or have a different configuration than shown in FIG. 5.

Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by a program instructing hardware associated with the terminal device, where the program may be stored in a computer-readable storage medium, and the storage medium may include: flash disk, ROM, RAM, magnetic or optical disk, and the like.

According to still another aspect of an embodiment of the present application, there is also provided a storage medium. Optionally, in this embodiment, the storage medium may be configured to execute a program code of any one of the storage methods of the operation data in this embodiment of the present application.

Optionally, in this embodiment, the storage medium may be located on at least one of a plurality of network devices in a network shown in the above embodiment.

Optionally, in this embodiment, the storage medium is configured to store program code for performing the following steps:

s1, receiving a target operation instruction sent by the first object, wherein the target operation instruction is used for instructing the target database to execute target business operation;

s2, identifying the operation type of the target business operation;

and S3, when the operation type of the target business operation is the target operation type, sending the target operation data to the storage node for storage, wherein the target operation data comprises a target operation instruction.

Optionally, the specific example in this embodiment may refer to the example described in the above embodiment, which is not described again in this embodiment.

Optionally, in this embodiment, the storage medium may include, but is not limited to: various media capable of storing program codes, such as a U disk, a ROM, a RAM, a removable hard disk, a magnetic disk, or an optical disk.

The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments.

The integrated unit in the above embodiments, if implemented in the form of a software functional unit and sold or used as a separate product, may be stored in the above computer-readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or a part of or all or part of the technical solution contributing to the prior art may be embodied in the form of a software product stored in a storage medium, and including instructions for causing one or more computer devices (which may be personal computers, servers, network devices, or the like) to execute all or part of the steps of the method described in the embodiments of the present application.

In the above embodiments of the present application, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.

In the several embodiments provided in the present application, it should be understood that the disclosed client may be implemented in other manners. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one type of division of logical functions, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.

The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, and may also be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution provided in the embodiment.

In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.

The foregoing is only a preferred embodiment of the present application and it should be noted that those skilled in the art can make several improvements and modifications without departing from the principle of the present application, and these improvements and modifications should also be considered as the protection scope of the present application.

19页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种基于审计策略来处理日志的方法及系统

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!