summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2020-06-22 11:21:21 +0200
committerantirez <antirez@gmail.com>2020-06-22 11:21:21 +0200
commit59fd178014c7cca1b0c668b30ab0d991dd3030f3 (patch)
tree408ea197781034d39109cdcb6d210cc8dc1857ad
parent42fd522c630d56c577f2b62e238ce0b5dce42c3a (diff)
downloadredis-59fd178014c7cca1b0c668b30ab0d991dd3030f3.tar.gz
Clarify maxclients and cluster in conf. Remove myself too.
-rw-r--r--redis.conf5
-rw-r--r--src/cluster.c5
2 files changed, 9 insertions, 1 deletions
diff --git a/redis.conf b/redis.conf
index 5cea06a47..a51ef007d 100644
--- a/redis.conf
+++ b/redis.conf
@@ -805,6 +805,11 @@ acllog-max-len 128
# Once the limit is reached Redis will close all the new connections sending
# an error 'max number of clients reached'.
#
+# IMPORTANT: When Redis Cluster is used, the max number of connections is also
+# shared with the cluster bus: every node in the cluster will use two
+# connections, one incoming and another outgoing. It is important to size the
+# limit accordingly in case of very large clusters.
+#
# maxclients 10000
############################## MEMORY MANAGEMENT ################################
diff --git a/src/cluster.c b/src/cluster.c
index cacf09bf3..87ed09e7e 100644
--- a/src/cluster.c
+++ b/src/cluster.c
@@ -694,8 +694,11 @@ void clusterAcceptHandler(aeEventLoop *el, int fd, void *privdata, int mask) {
/* Return the approximated number of sockets we are using in order to
* take the cluster bus connections. */
unsigned long getClusterConnectionsCount(void) {
+ /* We decrement the number of nodes by one, since there is the
+ * "myself" node too in the list. Each node uses two file descriptors,
+ * one incoming and one outgoing, thus the multiplication by 2. */
return server.cluster_enabled ?
- (dictSize(server.cluster->nodes)*2) : 0;
+ ((dictSize(server.cluster->nodes)-1)*2) : 0;
}
/* -----------------------------------------------------------------------------