查看:
方法1:在redis-cli命令行使用:info clients可以查看當前的redis連接數
127.0.0.1:6379> info clients
Clients
connected_clients:621
client_longest_output_list:0
client_biggest_input_buf:0
blocked_clients:0
127.0.0.1:6379>
方法2:config get maxclients 可以查詢redis允許的最大連接數
127.0.0.1:6379> CONFIG GET maxclients
##1) "maxclients"
##2) "10000"
127.0.0.1:6379>
設置:
- 在2.6之后版本,可以修改最大連接數配置,默認10000,可以在redis.conf配置文件中修改
...
maxclients 10000
...
2.config set maxclients num 可以設置redis允許的最大連接數
127.0.0.1:6379> CONFIG set maxclients 10
OK
127.0.0.1:6379>
3.啟動redis.service服務時加參數--maxclients 100000來設置最大連接數限制
redis-server --maxclients 100000 -f /etc/redis.conf
獲取客戶端信息命令
CLIENT LIST 獲取客戶端列表
CLIENT SETNAME 設置當前連接點redis的名稱
CLIENT GETNAME 查看當前連接的名稱
CLIENT KILL ip:port 殺死指定連接
CLIENT LIST
##id=3 addr=127.0.0.1:36588 fd=5 name= age=7 idle=0 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=32768 obl=0 oll=0 omem=0 events=r cmd=client
CLIENT SETNAME js
##OK
CLIENT LIST
##id=3 addr=127.0.0.1:36588 fd=5 name=js age=37 idle=0 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=32768 obl=0 oll=0 omem=0 events=r cmd=client
CLIENT GETNAME
##"js"
CLIENT KILL id 3
##(integer) 0
釋放超時鏈接配置:
查看超時配置
config get timeout
設置超時配置
config set timeout 600
作者:達微
鏈接:https://www.jianshu.com/p/390d83e3b24f
來源:簡書
著作權歸作者所有。商業轉載請聯系作者獲得授權,非商業轉載請注明出處。