-
Notifications
You must be signed in to change notification settings - Fork 43
Added info on kakfa engine and grant setup #132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
CaptTofu
wants to merge
1
commit into
Altinity:main
Choose a base branch
from
CaptTofu:kafka-grant-issue
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
66 changes: 66 additions & 0 deletions
66
content/en/altinity-kb-integrations/altinity-kb-kafka/altinity-kb-kafka-grants.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Grants and the Kafka Engine | ||
|
||
There are some issues that are useful to know about when working with the Kafka engine with respect to Grants | ||
|
||
## Default user, out of the box | ||
|
||
The default user, as set up on a stock installation, has no issues with respect to access to both Kafka Engine tables or `system.kakfa_consumers`. | ||
|
||
## Creating users with access to Kafka engine tables and `system.kafka_consumers` | ||
|
||
There is sometimes a need to create a database user for the purpose of accessing various system tables, albeit one without admin privileges and one that is read-only. | ||
|
||
In this situation, the grants given aren't what one would expect in that grants would be given on a table-granular level, but at a database-wide level. | ||
|
||
The request: there needs to be a "dba" user with read-only privileges that has the ability to read `system.kafka_consumers`. | ||
|
||
Granting `SELECT` to the user specifying `system.kafka_consumers` and any Kafka engine tables, per table, will allow access to those tables and `system.kafka_cosumers` without any errors, but the resultset of selecting the rows in `system.kafka_consumers` will be empty. | ||
|
||
The only way for this to work is the following: | ||
|
||
``` | ||
CREATE ROLE 'dbsupport'; | ||
GRANT SELECT on *.* to dbsupport_admin; | ||
CREATE USER dba INDENTIFIED WITH sha256_password BY 'secure-password' | ||
GRANT dbsupport TO dba | ||
``` | ||
|
||
This user should then be able to query `system.kafka_consumers`: | ||
|
||
example: | ||
|
||
``` | ||
|
||
clickhouse-client -u dba | ||
|
||
clickhouse01 :) select * from system.kafka_consumers FORMAT Vertical; | ||
|
||
SELECT * | ||
FROM system.kafka_consumers | ||
FORMAT Vertical | ||
|
||
Query id: 218de3e6-d12f-43f0-95ed-122cd39be7c1 | ||
|
||
Row 1: | ||
────── | ||
database: default | ||
table: readings_queue | ||
consumer_id: ClickHouse-clickhouse01-default-readings_queue-68867c5b-92b6-4fa8-994d-ea4834fedc1c | ||
assignments.topic: ['readings','readings','readings','readings','readings','readings'] | ||
assignments.partition_id: [0,1,2,3,4,5] | ||
assignments.current_offset: [-1001,-1001,-1001,-1001,-1001,-1001] | ||
exceptions.time: [] | ||
exceptions.text: [] | ||
last_poll_time: 2025-03-06 20:33:21 | ||
num_messages_read: 6 | ||
last_commit_time: 2025-03-05 21:20:36 | ||
num_commits: 1 | ||
last_rebalance_time: 2025-03-06 11:49:46 | ||
num_rebalance_revocations: 3 | ||
num_rebalance_assignments: 4 | ||
is_currently_used: 1 | ||
last_used: 2025-03-06 20:33:21.187460 | ||
rdkafka_stat: | ||
|
||
1 row in set. Elapsed: 0.004 sec. | ||
``` |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dbsupport ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't SHOW TABLES enough?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be glad to take on the task of how to set up permissions for the system database in general. @SaltTan I can talk to you about it this week?