pingcap/tidb

how to record the client's ip and the db'username

Open

#23.923 geöffnet am 8. Apr. 2021

Auf GitHub ansehen
 (1 Kommentar) (1 Reaktion) (0 zugewiesene Personen)Go (6.186 Forks)batch import
help wantedtype/feature-request

Repository-Metriken

Stars
 (40.090 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 14T 4h) (346 gemergte PRs in 30 T)

Beschreibung

how to record the client's ip and the db'username

Describe the feature you'd like: In tidb,it is hard to get the userstat,We can only fetch the ProcessList periodically。When we migrate tidb , we have to know where the user is coming from and which DB is going to access.

Teachability, Documentation, Adoption, Migration Strategy: like the feature in mariadb : https://mariadb.com/kb/en/user-statistics/

Maybe the table and record as below:

mysql [test]> select * from userstats;
+----------+--------------+-----------------+-------------+---------------------+
| username | client       | instance        | schema_name | last_accesstime     |
+----------+--------------+-----------------+-------------+---------------------+
| appuser2 | 172.168.12.6 | 10.19.12.6:4000 | schema_1    | 2021-04-08 19:32:00 |
| appuser1 | 179.168.9.10 | 11.19.12.9:4000 | schema_1    | 2021-04-08 19:31:00 |
+----------+--------------+-----------------+-------------+---------------------+
2 rows in set (0.00 sec)

mysql [test]> 

Contributor Guide