Cluster: node timeout is now configurable.

This commit is contained in:
antirez 2013-04-04 12:29:10 +02:00
parent 00bab23c41
commit 05fa4f4034
5 changed files with 14 additions and 1 deletions

View File

@ -493,6 +493,12 @@ lua-time-limit 5000
#
# cluster-config-file nodes-6379.conf
# Cluster node timeout is the amount of seconds a node must be unreachable
# for it to be considered in failure state.
# Most other internal time limits are multiplicators of the node timeout.
#
# cluster-node-timeout 15
# In order to setup your cluster make sure to read the documentation
# available at http://redis.io web site.

View File

@ -231,7 +231,7 @@ void clusterInit(void) {
server.cluster->state = REDIS_CLUSTER_FAIL;
server.cluster->size = 1;
server.cluster->nodes = dictCreate(&clusterNodesDictType,NULL);
server.cluster->node_timeout = REDIS_CLUSTER_DEFAULT_NODE_TIMEOUT;
server.cluster->node_timeout = server.cluster_node_timeout;
server.cluster->failover_auth_time = 0;
server.cluster->failover_auth_count = 0;
memset(server.cluster->migrating_slots_to,0,

View File

@ -387,6 +387,11 @@ void loadServerConfigFromString(char *config) {
} else if (!strcasecmp(argv[0],"cluster-config-file") && argc == 2) {
zfree(server.cluster_configfile);
server.cluster_configfile = zstrdup(argv[1]);
} else if (!strcasecmp(argv[0],"cluster-node-timeout") && argc == 2) {
server.cluster_node_timeout = atoi(argv[1]);
if (server.cluster_node_timeout <= 0) {
err = "cluster node timeout must be 1 or greater"; goto loaderr;
}
} else if (!strcasecmp(argv[0],"lua-time-limit") && argc == 2) {
server.lua_time_limit = strtoll(argv[1],NULL,10);
} else if (!strcasecmp(argv[0],"slowlog-log-slower-than") &&

View File

@ -1261,6 +1261,7 @@ void initServerConfig() {
server.repl_ping_slave_period = REDIS_REPL_PING_SLAVE_PERIOD;
server.repl_timeout = REDIS_REPL_TIMEOUT;
server.cluster_enabled = 0;
server.cluster_node_timeout = REDIS_CLUSTER_DEFAULT_NODE_TIMEOUT;
server.cluster_configfile = zstrdup("nodes.conf");
server.lua_caller = NULL;
server.lua_time_limit = REDIS_LUA_TIME_LIMIT;

View File

@ -853,6 +853,7 @@ struct redisServer {
xor of REDIS_NOTIFY... flags. */
/* Cluster */
int cluster_enabled; /* Is cluster enabled? */
int cluster_node_timeout; /* Cluster node timeout. */
char *cluster_configfile; /* Cluster auto-generated config file name. */
clusterState *cluster; /* State of the cluster */
/* Scripting */