Skip to content

Commit 691cc94

Browse files
authored
Add explanations to README
1 parent e5c7c50 commit 691cc94

1 file changed

Lines changed: 23 additions & 1 deletion

File tree

README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,33 @@
11
# RDPROXY
22

3-
This is a redis proxy to make ACL more convenient. It prefixes keys with the ACL username before sending it to upstream and undoing it when it about to send downstream. This makes the connection appear truly support redis for multi tenancy.
3+
This is a redis proxy to make ACL more convenient. It prefixes keys with the ACL username before sending it to upstream and undoing it when it about to send downstream. This makes the connecting clients appear like the whole service is dedicated for that client while actually the redis server is shared or set for multi tenancy.
44

55
At the moment this proxy does.
66

77
Your app can connect to this instance listening by default at port `6479`.
88

9+
## What it does do
10+
11+
Let's assume this software runs on port 6479 while the upstream Redis is on port 6379.
12+
13+
When you call `GET foo:bar` to port 6479, without any `AUTH` command, it will send `GET default:foo:bar` to upstream Redis, since the current user is `default`. Let's notate this as `|GET foo:bar| > |GET default:foo:bar|`.
14+
15+
This is how it works when it executed serially:
16+
17+
```
18+
|GET foo| > |GET default:foo|
19+
|AUTH user pass| > |AUTH user pass|
20+
|GET foo| > |GET user:foo|
21+
|SET foo bar| > |GET user:foo bar|
22+
|KEYS foo:*| > |KEYS user:foo:*|
23+
|SCAN 0| > |SCAN 0 MATCH user:*|
24+
|EVAL "return redis.call('KEYS', KEYS[1])" 1 *| > |EVAL "return redis.call('KEYS', KEYS[1])" 1 user:*|
25+
```
26+
27+
The return values of some commands like KEYS and SCAN will be "revived" (e.g. from `user:foo:bar` to `foo:bar`) so redis clients wouldn't need to adapt.
28+
29+
Note that the revival values doesn't work for KEYS ran via EVAL, that means you should only access key names provided via `KEYS` otherwise your lua script won't work properly.
30+
931
## Envar Options
1032

1133
| Env | Default |

0 commit comments

Comments
 (0)