gpt4 book ai didi

c# - 如何模拟Redis本地连接被拒绝

转载 作者:可可西里 更新时间:2023-11-01 11:13:06 25 4
gpt4 key购买 nike

是否有一个值,例如“MaxConnections”,我可以在本地 Redis 上将其设置为“2”,以便我可以查看我的应用程序在 get/set 上的行为被拒绝了?

我问这个问题是因为我的应用程序应该在 azure 上运行,而 redis 实例的连接限制非常严格......

最佳答案

您可以指定maxclients参数来运行redis服务器:

redis-server --maxclients 2

或者在redis.conf中设置

最大客户端数 2

Set the max number of connected clients at the same time. By default this limit is set to 10000 clients, however if the Redis server is not able to configure the process file limit to allow for the specified limit the max number of allowed clients is set to the current file limit minus 32 (as Redis reserves a few file descriptors for internal uses).

Once the limit is reached Redis will close all the new connections sending an error 'max number of clients reached'.

您还可以阅读redis clients .

希望这有帮助。

关于c# - 如何模拟Redis本地连接被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41723571/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com