vitess icon indicating copy to clipboard operation
vitess copied to clipboard

Question: how use Query blacklisting ?is there any examples for vitess to use Query blacklisting ?

Open ronghuaihai opened this issue 3 years ago • 5 comments

Question

i can not find any examples to introduce query blacklisting in official document . How to use query blacklisting ?if DBAs find slowly sql , how to blocking or forbbiden application querys that affect performance of vitess by query sql content or source ? image

ronghuaihai avatar Apr 08 '22 05:04 ronghuaihai

@vitessio/query-serving

mattlord avatar Apr 12 '22 15:04 mattlord

Thank you for the issue, @ronghuaihai ! You're correct, there's no documentation on this feature today. The related source code is here: https://github.com/vitessio/vitess/tree/main/go/vt/vttablet/tabletserver/rules and here: https://github.com/vitessio/vitess/tree/main/go/vt/vttablet/customrule

So I can see that this is configured on vttablets via a file containing a JSON document which can be watched for changes and auto-reloaded OR the rules can be stored in the topo server, with the contents currently loaded in memory shown at the /debug/query_rules endpoint. And we can see some samples in the test: https://github.com/vitessio/vitess/blob/main/go/vt/vttablet/tabletserver/rules/rules_test.go#L135-L144 And the key fields here: https://github.com/vitessio/vitess/blob/main/go/vt/vttablet/tabletserver/rules/rules.go#L274-L284

But we clearly need some docs. 🙂

Also, just FYI you have the ability to do this directly in the MySQL instances too: https://dev.mysql.com/doc/refman/8.0/en/rewriter-query-rewrite-plugin.html

You could rewrite the problematic queries to select "this query is not allowed" as blocked. There's also the MySQL Firewall plugin but that's not FOSS.

mattlord avatar Apr 12 '22 16:04 mattlord

Hello @mattlord, I have searched and found Query blacklisting is not available in recent doc anymore. Thus I think this issue is not relevant anymore, isnt it?

image

mhmohona avatar Aug 11 '24 01:08 mhmohona

@mhmohona it's no longer mentioned in the docs, but the feature still exists w/o any docs.

mattlord avatar Aug 12 '24 15:08 mattlord

In that case, as a doc contributor, is there anything I can do?

mhmohona avatar Aug 12 '24 15:08 mhmohona