docs: refine filter documentation (#907)
This commit is contained in:
parent
a8c472e8a2
commit
43f6d16236
|
@ -7,18 +7,22 @@ RedisShake provides various built-in filter rules that users can choose from acc
|
||||||
## Filtering Keys
|
## Filtering Keys
|
||||||
RedisShake supports filtering by key name, key name prefixes, and suffixes. You can set the following options in the configuration file, for example:
|
RedisShake supports filtering by key name, key name prefixes, and suffixes. You can set the following options in the configuration file, for example:
|
||||||
```toml
|
```toml
|
||||||
|
[filter]
|
||||||
allow_keys = ["user:1001", "product:2001"] # allowed key names
|
allow_keys = ["user:1001", "product:2001"] # allowed key names
|
||||||
allow_key_prefix = ["user:", "product:"] # allowed key name prefixes
|
allow_key_prefix = ["user:", "product:"] # allowed key name prefixes
|
||||||
allow_key_suffix = [":active", ":valid"] # allowed key name suffixes
|
allow_key_suffix = [":active", ":valid"] # allowed key name suffixes
|
||||||
|
allow_key_regex = [":\\d{11}:"] # allowed key name regex, 11-digit mobile phone number
|
||||||
block_keys = ["temp:1001", "cache:2001"] # blocked key names
|
block_keys = ["temp:1001", "cache:2001"] # blocked key names
|
||||||
block_key_prefix = ["temp:", "cache:"] # blocked key name prefixes
|
block_key_prefix = ["temp:", "cache:"] # blocked key name prefixes
|
||||||
block_key_suffix = [":tmp", ":old"] # blocked key name suffixes
|
block_key_suffix = [":tmp", ":old"] # blocked key name suffixes
|
||||||
|
block_key_regex = [":test:\\d{11}:"] # blocked key name regex, 11-digit mobile phone number with "test" prefix
|
||||||
```
|
```
|
||||||
If these options are not set, all keys are allowed by default.
|
If these options are not set, all keys are allowed by default.
|
||||||
|
|
||||||
## Filtering Databases
|
## Filtering Databases
|
||||||
You can specify allowed or blocked database numbers, for example:
|
You can specify allowed or blocked database numbers, for example:
|
||||||
```toml
|
```toml
|
||||||
|
[filter]
|
||||||
allow_db = [0, 1, 2]
|
allow_db = [0, 1, 2]
|
||||||
block_db = [3, 4, 5]
|
block_db = [3, 4, 5]
|
||||||
```
|
```
|
||||||
|
@ -27,6 +31,7 @@ If these options are not set, all databases are allowed by default.
|
||||||
## Filtering Commands
|
## Filtering Commands
|
||||||
RedisShake allows you to filter specific Redis commands, for example:
|
RedisShake allows you to filter specific Redis commands, for example:
|
||||||
```toml
|
```toml
|
||||||
|
[filter]
|
||||||
allow_command = ["GET", "SET"]
|
allow_command = ["GET", "SET"]
|
||||||
block_command = ["DEL", "FLUSHDB"]
|
block_command = ["DEL", "FLUSHDB"]
|
||||||
```
|
```
|
||||||
|
@ -37,6 +42,7 @@ You can also filter by command groups. Available command groups include:
|
||||||
SERVER, STRING, CLUSTER, CONNECTION, BITMAP, LIST, SORTED_SET, GENERIC, TRANSACTIONS, SCRIPTING, TAIRHASH, TAIRSTRING, TAIRZSET, GEO, HASH, HYPERLOGLOG, PUBSUB, SET, SENTINEL, STREAM
|
SERVER, STRING, CLUSTER, CONNECTION, BITMAP, LIST, SORTED_SET, GENERIC, TRANSACTIONS, SCRIPTING, TAIRHASH, TAIRSTRING, TAIRZSET, GEO, HASH, HYPERLOGLOG, PUBSUB, SET, SENTINEL, STREAM
|
||||||
For example:
|
For example:
|
||||||
```toml
|
```toml
|
||||||
|
[filter]
|
||||||
allow_command_group = ["STRING", "HASH"]
|
allow_command_group = ["STRING", "HASH"]
|
||||||
block_command_group = ["SCRIPTING", "PUBSUB"]
|
block_command_group = ["SCRIPTING", "PUBSUB"]
|
||||||
```
|
```
|
||||||
|
|
|
@ -7,18 +7,22 @@ RedisShake 提供了多种内置的过滤规则,用户可以根据需要选择
|
||||||
## 过滤 Key
|
## 过滤 Key
|
||||||
RedisShake 支持通过键名、键名前缀和后缀进行过滤。您可以在配置文件中设置以下选项,例如:
|
RedisShake 支持通过键名、键名前缀和后缀进行过滤。您可以在配置文件中设置以下选项,例如:
|
||||||
```toml
|
```toml
|
||||||
|
[filter]
|
||||||
allow_keys = ["user:1001", "product:2001"] # 允许的键名
|
allow_keys = ["user:1001", "product:2001"] # 允许的键名
|
||||||
allow_key_prefix = ["user:", "product:"] # 允许的键名前缀
|
allow_key_prefix = ["user:", "product:"] # 允许的键名前缀
|
||||||
allow_key_suffix = [":active", ":valid"] # 允许的键名后缀
|
allow_key_suffix = [":active", ":valid"] # 允许的键名后缀
|
||||||
|
allow_key_regex = [":\\d{11}:"] # 允许的键名正则,11位手机号
|
||||||
block_keys = ["temp:1001", "cache:2001"] # 阻止的键名
|
block_keys = ["temp:1001", "cache:2001"] # 阻止的键名
|
||||||
block_key_prefix = ["temp:", "cache:"] # 阻止的键名前缀
|
block_key_prefix = ["temp:", "cache:"] # 阻止的键名前缀
|
||||||
block_key_suffix = [":tmp", ":old"] # 阻止的键名后缀
|
block_key_suffix = [":tmp", ":old"] # 阻止的键名后缀
|
||||||
|
block_key_regex = [":test:\\d{11}:"] # 阻止的键名正则,11位手机号,前缀为test
|
||||||
```
|
```
|
||||||
如果不设置这些选项,默认允许所有键。
|
如果不设置这些选项,默认允许所有键。
|
||||||
|
|
||||||
## 过滤数据库
|
## 过滤数据库
|
||||||
您可以指定允许或阻止的数据库编号,例如:
|
您可以指定允许或阻止的数据库编号,例如:
|
||||||
```toml
|
```toml
|
||||||
|
[filter]
|
||||||
allow_db = [0, 1, 2]
|
allow_db = [0, 1, 2]
|
||||||
block_db = [3, 4, 5]
|
block_db = [3, 4, 5]
|
||||||
```
|
```
|
||||||
|
@ -27,6 +31,7 @@ block_db = [3, 4, 5]
|
||||||
## 过滤命令
|
## 过滤命令
|
||||||
RedisShake 允许您过滤特定的 Redis 命令,例如:
|
RedisShake 允许您过滤特定的 Redis 命令,例如:
|
||||||
```toml
|
```toml
|
||||||
|
[filter]
|
||||||
allow_command = ["GET", "SET"]
|
allow_command = ["GET", "SET"]
|
||||||
block_command = ["DEL", "FLUSHDB"]
|
block_command = ["DEL", "FLUSHDB"]
|
||||||
```
|
```
|
||||||
|
@ -37,6 +42,7 @@ block_command = ["DEL", "FLUSHDB"]
|
||||||
SERVER, STRING, CLUSTER, CONNECTION, BITMAP, LIST, SORTED_SET, GENERIC, TRANSACTIONS, SCRIPTING, TAIRHASH, TAIRSTRING, TAIRZSET, GEO, HASH, HYPERLOGLOG, PUBSUB, SET, SENTINEL, STREAM
|
SERVER, STRING, CLUSTER, CONNECTION, BITMAP, LIST, SORTED_SET, GENERIC, TRANSACTIONS, SCRIPTING, TAIRHASH, TAIRSTRING, TAIRZSET, GEO, HASH, HYPERLOGLOG, PUBSUB, SET, SENTINEL, STREAM
|
||||||
例如:
|
例如:
|
||||||
```toml
|
```toml
|
||||||
|
[filter]
|
||||||
allow_command_group = ["STRING", "HASH"]
|
allow_command_group = ["STRING", "HASH"]
|
||||||
block_command_group = ["SCRIPTING", "PUBSUB"]
|
block_command_group = ["SCRIPTING", "PUBSUB"]
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in New Issue