Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: tidb有没有参数限制某个用户的连接数
[TiDB Usage Environment] Production Environment
[TiDB Version] v4.0.9
[Encountered Problem] Our developer mentioned that when using a common account to initiate 20 connections, an error occurs. However, using another user to initiate 20 connections does not cause any issues. The error message is as follows:
Currently, the connection configuration information for the TiDB database is as follows:
First, check the maximum number of connections configured in the connection pool by the developers.
Currently, it seems that it is not possible to limit the number of connections by user.
Setting the connection pool to 500 doesn’t work either, the initial value is 50.
I checked, TiDB does not support limiting the number of connections per user.
It is most likely an issue with the connection pool. Check how many connections this program has initiated with the database.
I checked, the user currently has 342 connections. The developer said that changing the connection pool to 500 still cannot create 20 more connections.
Increase the minimum connections in the connection pool and increase the connect timeout.
There is no parameter for minimum connections
Type: com.zaxxer.hikari.HikariDataSource
# Minimum number of idle connections
minimum-idle: 5
# Maximum number of connections in the connection pool, default is 10
maximum-pool-size: 500
# This property controls the default auto-commit behavior of connections returned from the pool, default value: true
auto-commit: true
# Maximum lifetime of idle connections, default 600000 (10 minutes)
idle-timeout: 30000
# Database connection timeout, default 30 seconds, i.e., 30000
connection-timeout: 30000
connection-test-query: SELECT 1
minimum-idle: 30 Try using 30
connection-timeout: 90000 Try using 90s
Where can I find the max-server-connections parameter?
Indeed
TiDB does not support WITH MAX_USER_CONNECTIONS
and other CREATE
options.
It does not support setting profiles similar to Oracle user profiles, right?
The developer replied that indeed it can connect after increasing the settings, but the speed is a bit slow.
TiDB does not support a profile-like format.
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.