mirror of
https://github.com/redis/redis.git
synced 2026-02-03 20:39:54 -05:00
Merge 72417dc58c into b5a37c0e42
This commit is contained in:
commit
a923f3c670
2 changed files with 35 additions and 10 deletions
|
|
@ -7097,17 +7097,15 @@ static int clusterManagerCommandCreate(int argc, char **argv) {
|
|||
int replicas = config.cluster_manager_command.replicas;
|
||||
int masters_count = CLUSTER_MANAGER_MASTERS_COUNT(node_len, replicas);
|
||||
if (masters_count < 3) {
|
||||
clusterManagerLogErr(
|
||||
"*** ERROR: Invalid configuration for cluster creation.\n"
|
||||
"*** Redis Cluster requires at least 3 master nodes.\n"
|
||||
"*** This is not possible with %d nodes and %d replicas per node.",
|
||||
node_len, replicas);
|
||||
clusterManagerLogErr("\n*** At least %d nodes are required.\n",
|
||||
3 * (replicas + 1));
|
||||
return 0;
|
||||
int ignore_force = 0;
|
||||
clusterManagerLogInfo("Requested to create a cluster with %d masters and "
|
||||
"%d replicas per master.\n", masters_count, replicas);
|
||||
if (!confirmWithYes("Redis Cluster requires at least 3 master nodes for "
|
||||
"automatic failover. Are you sure?", ignore_force))
|
||||
return 0;
|
||||
}
|
||||
clusterManagerLogInfo(">>> Performing hash slots allocation "
|
||||
"on %d nodes...\n", node_len);
|
||||
"on %d node(s)...\n", node_len);
|
||||
int interleaved_len = 0, ip_count = 0;
|
||||
clusterManagerNode **interleaved = zcalloc(node_len*sizeof(**interleaved));
|
||||
char **ips = zcalloc(node_len * sizeof(char*));
|
||||
|
|
|
|||
|
|
@ -9,8 +9,35 @@ set ::singledb 1
|
|||
# cluster creation is complicated with TLS, and the current tests don't really need that coverage
|
||||
tags {tls:skip external:skip cluster} {
|
||||
|
||||
# start three servers
|
||||
set base_conf [list cluster-enabled yes cluster-node-timeout 1000]
|
||||
|
||||
start_multiple_servers 3 [list overrides $base_conf] {
|
||||
test {Create 1 node cluster} {
|
||||
exec src/redis-cli --cluster-yes --cluster create \
|
||||
127.0.0.1:[srv 0 port]
|
||||
|
||||
wait_for_condition 1000 50 {
|
||||
[CI 0 cluster_state] eq {ok}
|
||||
} else {
|
||||
fail "Cluster doesn't stabilize"
|
||||
}
|
||||
}
|
||||
|
||||
test {Create 2 node cluster} {
|
||||
exec src/redis-cli --cluster-yes --cluster create \
|
||||
127.0.0.1:[srv -1 port] \
|
||||
127.0.0.1:[srv -2 port]
|
||||
|
||||
wait_for_condition 1000 50 {
|
||||
[CI 1 cluster_state] eq {ok} &&
|
||||
[CI 2 cluster_state] eq {ok}
|
||||
} else {
|
||||
fail "Cluster doesn't stabilize"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# start three servers
|
||||
start_multiple_servers 3 [list overrides $base_conf] {
|
||||
|
||||
set node1 [srv 0 client]
|
||||
|
|
|
|||
Loading…
Reference in a new issue