Kafka query method, device, storage medium and equipment

By analyzing query requests, obtaining identity tags and cluster addresses, and reading target topic data, the problem of data leakage during query in Kafka cluster is solved, and safe and efficient data query is achieved.

CN115174423BActive Publication Date: 2025-03-07CHINA CONSTRUCTION BANK
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210814063.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-12
Publication Date
2025-03-07
Estimated Expiration
2042-07-12

AI Technical Summary

Technical Problem

In Kafka cluster, when users query topic data, it is easy to leak other topic data except target topic data.

Method used

By analyzing the query request sent by the front-end, obtaining the identity tag and other information items, determining whether the tag database contains the identity tag, obtaining the corresponding cluster address, accessing the cluster, reading the target topic data and sending it to the front-end, ensuring that only the target topic data is sent.

Benefits of technology

It avoids the leakage of other topic data except target topic data in Kafka cluster, and improves the security and efficiency of data query.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115174423B_ABST
    Figure CN115174423B_ABST
Patent Text Reader

Abstract

The present application discloses a Kafka query method, apparatus, storage medium and device, which parse query requests to obtain various information items; when a tag database contains an identity tag pre-stored locally in a front end, obtain a cluster address from a preset cluster address database; access the cluster to which the cluster address belongs, obtain multiple topic names of the cluster, and a user list corresponding to each topic name; the user list corresponding to the topic name pre-entered by the user contains the user name shown in the identity tag, and read the target topic data in the cluster to obtain a job flow; send various messages to the front end in sequence according to the processing order. Compared with the prior art, various messages sent to the front end are from the target topic data, rather than all the topic data in the cluster, thereby avoiding the leakage of other topic data in the cluster except the target topic data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data query technology, and in particular to a Kafka query method, device, storage medium and equipment. Background Art

[0002] With the widespread use of Kafka clusters (referred to as clusters in this application), there are usually a lot of topic data in the cluster. When users use topic data, they need to access the cluster to obtain it.

[0003] In the existing method, the user sends a query request to the cluster, the cluster obtains all topic data, and displays the topic data to the user in the form of a chart. The user can select topic data for use according to needs.

[0004] When users query topic data, they obtain all topic data. In addition to the topic data queried by the user, the user can also obtain other topic data. Therefore, there is a risk of leakage of other topic data. Summary of the invention

[0005] The present application provides a Kafka query method, apparatus, storage medium and device, the purpose of which is to avoid leakage of other topic data except target topic data in a cluster.

[0006] In order to achieve the above objectives, this application provides the following technical solutions:

[0007] A Kafka query method, including:

[0008] When receiving a query request sent by the front end, the query request is parsed to obtain various information items; the various information items at least include the identity tag pre-stored locally in the front end, and the project ID, topic name, data source name, and operating environment pre-entered by the user;

[0009] When the tag database contains the identity tag pre-stored locally by the front end, obtain a cluster address corresponding to the project ID, the topic name, the data source name, and the operating environment from a preset cluster address database;

[0010] Access the cluster to which the cluster address belongs, and obtain multiple topic names of the cluster and a user list corresponding to each topic name;

[0011] When the user list corresponding to the topic name pre-entered by the user includes the user name indicated by the identity tag, read the target topic data in the cluster to obtain a job flow; the target topic data includes topic data whose topic name is the same as the topic name pre-entered by the user; the job flow includes multiple messages and the processing order of each of the messages;

[0012] According to the processing order of each of the messages, each of the messages is sent to the front end in sequence.

[0013] Optionally, when receiving the query request sent by the front end, parsing the query request to obtain each information item further includes:

[0014] When the tag database does not contain the identity tag pre-stored locally in the front end, a prompt of query failure is sent to the front end, so that the front end displays the prompt of query failure to the user through a preset interface.

[0015] Optionally, after accessing the cluster to which the cluster address belongs and obtaining multiple topic names of the cluster and a user list corresponding to each topic name, the method further includes:

[0016] When the user list corresponding to the topic name pre-entered by the user does not contain the user name indicated by the identity tag, a prompt of unauthorized query is sent to the front end, so that the front end displays the prompt of unauthorized query to the user through the preset interface.

[0017] Optionally, after sending each of the messages to the front end in sequence according to the processing order of each of the messages, the method further includes:

[0018] In the process of sending each of the messages to the front end, counting the number of messages that have not been sent in the job flow, and obtaining the consumption accumulation amount of the target topic data;

[0019] For each of the messages in the job flow, acquiring attribute information of the message from the cluster; wherein the attribute information includes but is not limited to: group identifier, partition, publishing time, and data source;

[0020] The consumption accumulation amount and the attribute information of each of the messages are sent to the front end, so that the front end displays the consumption accumulation amount and the attribute information of each of the messages to the user through the preset interface.

[0021] A Kafka query device, comprising:

[0022] The parsing unit is used to parse the query request sent by the front end when receiving the query request to obtain various information items; the various information items at least include the identity tag pre-stored locally in the front end, and the project ID, topic name, data source name, and operating environment pre-entered by the user;

[0023] an acquisition unit, configured to acquire, from a preset cluster address database, a cluster address corresponding to the project ID, the topic name, the data source name, and the operating environment when the tag database contains the identity tag pre-stored locally by the front end;

[0024] An access unit, used to access the cluster to which the cluster address belongs, and obtain multiple topic names of the cluster and a user list corresponding to each topic name;

[0025] a reading unit, configured to read target topic data in the cluster to obtain a job flow when the user list corresponding to the topic name pre-input by the user includes the user name indicated by the identity tag; the target topic data includes topic data whose topic name is the same as the topic name pre-input by the user; the job flow includes multiple messages and a processing order of each of the messages;

[0026] The sending unit is used to send each of the messages to the front end in sequence according to the processing order of each of the messages.

[0027] Optionally, also include:

[0028] When the tag database does not contain the identity tag pre-stored locally in the front end, a prompt of query failure is sent to the front end, so that the front end displays the prompt of query failure to the user through a preset interface.

[0029] Optionally, also include:

[0030] When the user list corresponding to the topic name pre-entered by the user does not contain the user name indicated by the identity tag, a prompt of unauthorized query is sent to the front end, so that the front end displays the prompt of unauthorized query to the user through the preset interface.

[0031] Optionally, also include:

[0032] In the process of sending each of the messages to the front end, counting the number of messages that have not been sent in the job flow, and obtaining the consumption accumulation amount of the target topic data;

[0033] For each of the messages in the job flow, acquiring attribute information of the message from the cluster; wherein the attribute information includes but is not limited to: group identifier, partition, publishing time, and data source;

[0034] The consumption accumulation amount and the attribute information of each of the messages are sent to the front end, so that the front end displays the consumption accumulation amount and the attribute information of each of the messages to the user through the preset interface.

[0035] A computer-readable storage medium includes a stored program, wherein the program executes the Kafka query method.

[0036] A Kafka query device, comprising: a processor, a memory and a bus; the processor and the memory are connected via the bus;

[0037] The memory is used to store the program, and the processor is used to run the program, wherein the Kafka query method is executed when the program is running.

[0038] The technical solution provided by the present application parses the query request sent by the front end to obtain various information items when receiving the query request sent by the front end; when the label database contains the identity label pre-stored locally in the front end, obtains the cluster address corresponding to the project ID, the topic name, the data source name, and the operating environment from the preset cluster address database; accesses the cluster to which the cluster address belongs to obtain multiple topic names of the cluster and a user list corresponding to each topic name; when the user list corresponding to the topic name pre-entered by the user contains the user name shown in the identity label, reads the target topic data in the cluster to obtain the job flow; sends each message to the front end in sequence according to the processing order of each message. Compared with the prior art, each message sent to the front end comes from the target topic data, rather than all the topic data in the cluster, thereby avoiding the leakage of other topic data in the cluster except the target topic data. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0040] Figure 1 A flowchart of a Kafka query method provided in an embodiment of the present application;

[0041] Figure 2 A flowchart of another Kafka query method provided in an embodiment of the present application;

[0042] Figure 3 A schematic diagram of the architecture of a Kafka query device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0043] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. 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 creative work are within the scope of protection of this application.

[0044] like Figure 1 As shown, it is a flowchart of a Kafka query method provided in an embodiment of the present application, which is applied to a server and includes:

[0045] S101: When receiving a query request sent by a front end, the query request is parsed to obtain various information items.

[0046] Among them, each information item includes at least an identity tag pre-stored locally on the front end, as well as a project ID, topic name, data source name, and operating environment pre-entered by the user. The identity tag includes any one of cookie information and token information. In the embodiment of the present application, the identity tag is pre-generated based on the user's (i.e., the user of the front end) username and the password corresponding to the username.

[0047] Optionally, after the user selects the statistical type (such as topic consumption accumulation), component (such as data collection, data integration, stream computing job, etc.), project ID and topic name, data source name, environment, etc. on the preset front-end interface, the front-end sends the query request to the server after being diverted by load balancing (LB).

[0048] It should be noted that the specific implementation method of parsing the query request is common knowledge known to those skilled in the art and will not be described in detail here.

[0049] S102: Determine whether the tag database contains the identity tag pre-stored locally in the front end.

[0050] If the tag database contains the identity tag pre-stored locally in the front end, then S103 is executed, otherwise S104 is executed.

[0051] Optionally, if the identity tag is cookie information, it is determined whether the tag database contains cookie information pre-stored in the front end.

[0052] If the identity tag is token information, it is determined whether the tag database contains the token information pre-stored in the front end.

[0053] It should be noted that when the front-end accesses the server for the first time with the username and password, the server will generate an identity tag based on the username and password, store the identity tag in the tag database, and send the identity tag to the front-end. When the front-end accesses the server again (that is, when sending a request to the server), it will automatically carry the identity tag.

[0054] It should be emphasized that the purpose of judging whether the label database contains identity labels pre-stored locally on the front end is to verify whether the user has query permissions. If the label database contains identity labels pre-stored locally on the front end, it means that the verification has passed and the user has query permissions. If the label database does not contain identity labels pre-stored locally on the front end, it means that the verification has failed and the user does not have query permissions.

[0055] Optionally, when the identity tag is cookie information, in order to reduce the load pressure on the server, the authentication system that sends the cookie information can be authenticated. The authentication system consists of auth-server (server) and auth-client (client). The auth-client includes an interceptor. When receiving the query request sent by the front end, the interceptor calls the SDK in the auth-client, and the SDK passes the cookie information to the authentication system for authentication.

[0056] Optionally, when the identity tag is token information, in order to reduce the load pressure on the server, the token information can be verified in the authentication system. First, the Kafka-query service applies for AK (identity identifier) ​​and SK (key), and sends AK and SK to the auth-server. After obtaining the target token information returned by the auth-server, the target token information and AK are sent to the data management interface, so that the data management interface compares whether the target token information and the token information are consistent (that is, the token information is verified).

[0057] S103: Obtaining, from a preset cluster address database, a cluster address corresponding to the project ID pre-input by the user, the topic name pre-input by the user, the data source name pre-input by the user, and the operating environment pre-input by the user.

[0058] After executing S103, continue to execute S105.

[0059] The cluster address database includes multiple cluster addresses, and the project ID, topic name, data source name, and operating environment corresponding to each cluster address.

[0060] Optionally, in order to reduce the load pressure on the server, the data management interface can be used to query the cluster address that meets the preset conditions.

[0061] S104: Sending a query failure prompt to the front end, so that the front end displays the query failure prompt to the user through a preset interface.

[0062] Among them, when the tag database does not contain the identity tag pre-stored locally by the front end, it means that there is no query permission, and a prompt of query failure is sent to the front end, so that the front end displays the prompt of query failure to the user through a preset interface.

[0063] S105: Access the cluster to which the cluster address belongs, and obtain the consumer authority information of the cluster.

[0064] The consumer authority information includes multiple topic names and a user list corresponding to each topic name.

[0065] S106: Determine whether the user list corresponding to the topic name pre-entered by the user contains the user name indicated by the identity tag.

[0066] If the user list corresponding to the topic name pre-input by the user includes the user name indicated by the identity tag, S107 is executed, otherwise S108 is executed.

[0067] Specifically, assuming that the list corresponding to the topic name is: Zhang San, Li Si, Wang Wu, and the user name indicated by the identity tag is Zhang San, determine whether the list corresponding to the topic name pre-entered by the user contains the user name indicated by the identity tag. Obviously, the list corresponding to the topic name pre-entered by the user contains the user name indicated by the identity tag. Therefore, continue to execute S107.

[0068] Specifically, assuming that the list corresponding to the topic name is: Zhang San, Li Si, Wang Wu, and the user name indicated by the identity tag is Zhang Si, determine whether the list corresponding to the topic name pre-entered by the user contains the user name indicated by the identity tag. Obviously, the list corresponding to the topic name pre-entered by the user does not contain the user name indicated by the identity tag. Therefore, continue to execute S108.

[0069] S107: Read the target topic data in the cluster to obtain the job flow.

[0070] The target topic data includes topic data whose topic name is the same as the topic name pre-input by the user. In addition, the so-called job flow includes multiple messages and the processing order of each message.

[0071] S108: Sending a prompt of unauthorized query to the front end, so that the front end displays the prompt of unauthorized query to the user through a preset interface.

[0072] It should be noted that when the user list corresponding to the topic name pre-entered by the user does not contain the user name shown in the identity tag, a prompt of unauthorized query is sent to the front end, so that the front end displays the prompt of unauthorized query to the user through a preset interface.

[0073] S109: Send each message to the front end in sequence according to the processing order of each message.

[0074] Specifically, assuming there are three messages, namely the first message, the second message, and the third message, according to the processing order of the first message, the second message, and the third message, the first message is sent to the front end; the second message is sent to the front end; and the third message is sent to the front end.

[0075] S110: In the process of sending each message to the front end, the number of messages that have not been sent in the job flow is counted to obtain the consumption accumulation amount of the target topic data.

[0076] S111: For each message in the job flow, obtain attribute information of the message from the cluster.

[0077] The attribute information includes, but is not limited to: group ID, partition (i.e., physical memory address where the message is stored), publishing time (which can be understood as generation time), and data source (i.e., producer of the message).

[0078] S112: Send the consumption accumulation amount and the attribute information of each message to the front end, so that the front end displays the consumption accumulation amount and the attribute information of each message to the user through a preset interface.

[0079] In order to reduce the server load pressure, the preset stream computing interface can be used to execute the above-mentioned S107-S112 process.

[0080] To summarize, if the user list corresponding to the topic name pre-entered by the user contains the user name shown in the identity tag, the user has the authority to query the target topic data and read the target topic data in the cluster. Compared with the existing technology, each message sent to the front end comes from the target topic data, rather than all the topic data in the cluster. Therefore, the leakage of other topic data in the cluster except the target topic data is avoided.

[0081] like Figure 2 As shown, it is a flowchart of another Kafka query method provided in an embodiment of the present application, including:

[0082] S201: When receiving a query request sent by the front end, the query request is parsed to obtain various information items.

[0083] Among them, each information item includes at least the identity tag pre-stored locally on the front end, as well as the project ID, topic name, data source name, and operating environment pre-entered by the user.

[0084] S202: When the tag database contains identity tags pre-stored locally in the front end, a cluster address corresponding to the project ID, the topic name, the data source name, and the operating environment is obtained from a preset cluster address database.

[0085] S203: Access the cluster to which the cluster address belongs, and obtain multiple topic names of the cluster and a user list corresponding to each topic name.

[0086] S204: When the user list corresponding to the topic name pre-input by the user includes the user name indicated by the identity tag, the target topic data in the cluster is read to obtain the job flow.

[0087] The target topic data includes topic data whose topic name is the same as the topic name pre-input by the user; the job flow includes multiple messages and the processing order of each message.

[0088] S205: Send each message to the front end in sequence according to the processing order of each message.

[0089] To summarize, if the user list corresponding to the topic name pre-entered by the user contains the user name shown in the identity tag, the user has the authority to query the target topic data and read the target topic data in the cluster. Compared with the existing technology, each message sent to the front end comes from the target topic data, rather than all the topic data in the cluster. Therefore, the leakage of other topic data in the cluster except the target topic data is avoided.

[0090] like Figure 3 As shown, it is a schematic diagram of the architecture of a Kafka query device provided in an embodiment of the present application, including:

[0091] The parsing unit 100 is used to parse the query request sent by the front end when receiving the query request to obtain various information items; each information item at least includes an identity tag pre-stored locally on the front end, and a project ID, topic name, data source name, and operating environment pre-entered by the user.

[0092] The parsing unit 100 is also used to send a query failure prompt to the front end when the tag database does not contain the identity tag pre-stored locally in the front end, so that the front end displays the query failure prompt to the user through a preset interface.

[0093] The acquisition unit 200 is used to obtain a cluster address corresponding to the project ID, the topic name, the data source name, and the operating environment from a preset cluster address database when the tag database contains an identity tag pre-stored locally in the front end.

[0094] The access unit 300 is used to access the cluster to which the cluster address belongs, and obtain multiple topic names of the cluster and a user list corresponding to each topic name.

[0095] The access unit 300 is also used to send a prompt of unauthorized query to the front end when the user list corresponding to the topic name pre-entered by the user does not contain the user name indicated by the identity tag, so that the front end displays the prompt of unauthorized query to the user through a preset interface.

[0096] The reading unit 400 is used to read the target topic data in the cluster and obtain the job flow when the user list corresponding to the topic name pre-input by the user contains the user name indicated by the identity tag; the target topic data includes the topic data whose topic name is the same as the topic name pre-input by the user; the job flow includes multiple messages and the processing order of each message.

[0097] The sending unit 500 is used to send each message to the front end in sequence according to the processing order of each message.

[0098] The sending unit 500 is also used to count the number of messages that have not been sent in the job flow during the process of sending each message to the front end, and obtain the consumption accumulation of the target topic data; for each message in the job flow, obtain the attribute information of the message from the cluster; wherein the attribute information includes but is not limited to: group ID, partition, release time, data source; send the consumption accumulation and the attribute information of each message to the front end, so that the front end can display the consumption accumulation and the attribute information of each message to the user through a preset interface.

[0099] To summarize, if the user list corresponding to the topic name pre-entered by the user contains the user name shown in the identity tag, the user has the authority to query the target topic data and read the target topic data in the cluster. Compared with the existing technology, each message sent to the front end comes from the target topic data, rather than all the topic data in the cluster. Therefore, the leakage of other topic data in the cluster except the target topic data is avoided.

[0100] The present application also provides a computer-readable storage medium, which includes a stored program, wherein the program executes the Kafka query method provided by the present application.

[0101] The present application also provides a Kafka query device, including: a processor, a memory, and a bus. The processor and the memory are connected via a bus, the memory is used to store programs, and the processor is used to run programs, wherein when the program is running, the Kafka query method provided by the present application is executed, including the following steps:

[0102] When receiving a query request sent by the front end, the query request is parsed to obtain various information items; the various information items at least include the identity tag pre-stored locally in the front end, and the project ID, topic name, data source name, and operating environment pre-entered by the user;

[0103] When the tag database contains the identity tag pre-stored locally by the front end, obtain a cluster address corresponding to the project ID, the topic name, the data source name, and the operating environment from a preset cluster address database;

[0104] Access the cluster to which the cluster address belongs, and obtain multiple topic names of the cluster and a user list corresponding to each topic name;

[0105] When the user list corresponding to the topic name pre-entered by the user includes the user name indicated by the identity tag, read the target topic data in the cluster to obtain a job flow; the target topic data includes topic data whose topic name is the same as the topic name pre-entered by the user; the job flow includes multiple messages and the processing order of each of the messages;

[0106] According to the processing order of each of the messages, each of the messages is sent to the front end in sequence.

[0107] Optionally, when receiving the query request sent by the front end, parsing the query request to obtain each information item further includes:

[0108] When the tag database does not contain the identity tag pre-stored locally in the front end, a prompt of query failure is sent to the front end, so that the front end displays the prompt of query failure to the user through a preset interface.

[0109] Optionally, after accessing the cluster to which the cluster address belongs and obtaining multiple topic names of the cluster and a user list corresponding to each topic name, the method further includes:

[0110] When the user list corresponding to the topic name pre-entered by the user does not contain the user name indicated by the identity tag, a prompt of unauthorized query is sent to the front end, so that the front end displays the prompt of unauthorized query to the user through the preset interface.

[0111] Optionally, after sending each of the messages to the front end in sequence according to the processing order of each of the messages, the method further includes:

[0112] In the process of sending each of the messages to the front end, counting the number of messages that have not been sent in the job flow, and obtaining the consumption accumulation amount of the target topic data;

[0113] For each of the messages in the job flow, acquiring attribute information of the message from the cluster; wherein the attribute information includes but is not limited to: group identifier, partition, publishing time, and data source;

[0114] The consumption accumulation amount and the attribute information of each of the messages are sent to the front end, so that the front end displays the consumption accumulation amount and the attribute information of each of the messages to the user through the preset interface.

[0115] If the functions described in the method of the embodiment of the present application are implemented in the form of software functional units and sold or used as independent products, they can be stored in a storage medium readable by a computing device. Based on this understanding, the part of the embodiment of the present application that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computing device (which can be a personal computer, server, mobile computing device or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memories, random access memories, magnetic disks or optical disks.

[0116] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0117] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A Kafka query method, characterized in that: include: When receiving the query request sent by the front end, the query request is parsed to obtain various information items; Each of the information items at least includes an identity tag pre-stored locally on the front end, and a project ID, topic name, data source name, and operating environment pre-entered by the user; The identity tag pre-stored locally on the front end is cookie information or token information; Determine whether the tag database contains the identity tag pre-stored locally on the front end, including: if the identity tag pre-stored locally on the front end is the cookie information, the interceptor in the authentication system calls the SDK in the auth-client to pass the cookie information into the authentication system for authentication; if the identity tag pre-stored locally on the front end is the token information, the Kafka-query service applies for AK and SK, sends the AK and SK to the auth-server, obtains the target token information returned by the auth-server, and sends the target token information and the AK to the data management interface, so that the data management interface compares whether the target token information is consistent with the token information; When the tag database contains the identity tag pre-stored locally by the front end, obtain a cluster address corresponding to the project ID, the topic name, the data source name, and the operating environment from a preset cluster address database; Access the cluster to which the cluster address belongs, and obtain multiple topic names of the cluster and a user list corresponding to each topic name; When the user list corresponding to the topic name pre-entered by the user includes the user name indicated by the identity tag, read the target topic data in the cluster to obtain a job flow; the target topic data includes topic data whose topic name is the same as the topic name pre-entered by the user; the job flow includes multiple messages and the processing order of each of the messages; Sending each of the messages to the front end in sequence according to the processing order of each of the messages; In the process of sending each of the messages to the front end, counting the number of messages that have not been sent in the job flow, and obtaining the consumption accumulation amount of the target topic data; For each of the messages in the job flow, acquiring attribute information of the message from the cluster; wherein the attribute information includes but is not limited to: group identifier, partition, publishing time, and data source; The consumption accumulation amount and the attribute information of each of the messages are sent to the front end, so that the front end displays the consumption accumulation amount and the attribute information of each of the messages to the user through a preset interface.

2. The method according to claim 1, characterized in that When receiving the query request sent by the front end, the query request is parsed to obtain various information items, and the following further includes: When the tag database does not contain the identity tag pre-stored locally in the front end, a prompt of query failure is sent to the front end, so that the front end displays the prompt of query failure to the user through a preset interface.

3. The method according to claim 1, characterized in that After accessing the cluster to which the cluster address belongs and obtaining a plurality of topic names of the cluster and a user list corresponding to each topic name, the method further includes: When the user list corresponding to the topic name pre-input by the user does not include the user name indicated by the identity tag, a prompt of unauthorized query is sent to the front end, so that the front end displays the prompt of unauthorized query to the user through a preset interface.

4. A Kafka query device, characterized in that: include: A parsing unit, configured to parse the query request sent by the front end to obtain various information items upon receiving the query request; Each of the information items at least includes an identity tag pre-stored locally on the front end, and a project ID, topic name, data source name, and operating environment pre-entered by the user; The identity tag pre-stored locally on the front end is cookie information or token information; Determine whether the tag database contains the identity tag pre-stored locally on the front end, including: if the identity tag pre-stored locally on the front end is the cookie information, the interceptor in the authentication system calls the SDK in the auth-client to pass the cookie information into the authentication system for authentication; if the identity tag pre-stored locally on the front end is the token information, the Kafka-query service applies for AK and SK, sends the AK and SK to the auth-server, obtains the target token information returned by the auth-server, and sends the target token information and the AK to the data management interface, so that the data management interface compares whether the target token information is consistent with the token information; an acquisition unit, configured to acquire, from a preset cluster address database, a cluster address corresponding to the project ID, the topic name, the data source name, and the operating environment when the tag database contains the identity tag pre-stored locally by the front end; An access unit, used to access the cluster to which the cluster address belongs, and obtain multiple topic names of the cluster and a user list corresponding to each topic name; a reading unit, configured to read target topic data in the cluster to obtain a job flow when the user list corresponding to the topic name pre-input by the user includes the user name indicated by the identity tag; the target topic data includes topic data whose topic name is the same as the topic name pre-input by the user; the job flow includes multiple messages and a processing order of each of the messages; A sending unit, configured to send each of the messages to the front end in sequence according to the processing order of each of the messages; In the process of sending each of the messages to the front end, the number of messages that have not been sent in the job flow is counted to obtain the consumption accumulation of the target topic data; for each of the messages in the job flow, the attribute information of the message is obtained from the cluster; wherein the attribute information includes but is not limited to: group ID, partition, release time, data source; the consumption accumulation and the attribute information of each of the messages are sent to the front end, so that the front end displays the consumption accumulation and the attribute information of each of the messages to the user through a preset interface.

5. The device according to claim 4, characterized in that Also includes: When the tag database does not contain the identity tag pre-stored locally in the front end, a prompt of query failure is sent to the front end, so that the front end displays the prompt of query failure to the user through a preset interface.

6. The device according to claim 4, characterized in that Also includes: When the user list corresponding to the topic name pre-input by the user does not include the user name indicated by the identity tag, a prompt of unauthorized query is sent to the front end, so that the front end displays the prompt of unauthorized query to the user through a preset interface.

7. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein the program executes the Kafka query method described in any one of claims 1-3.

8. A Kafka query device, characterized in that: include: processor, memory, and bus; The processor is connected to the memory via the bus; The memory is used to store programs, and the processor is used to run programs, wherein the program executes the Kafka query method described in any one of claims 1-3 when running.

Citation Information

Patent Citations

  • Database access permission control method and device and electronic equipment

    CN111756752A