This commit is contained in:
2023-04-16 21:38:32 +08:00
parent a0849e40ef
commit 0b6c876a0f
59 changed files with 1026 additions and 189 deletions

View File

@@ -52,8 +52,8 @@ function Quit {
function ModifyConf {
local kv=
local clusterEnabled=
[ -e /etc/redis.conf ] && Print /etc/redis.conf already exists && return 0
Print Modify conf ...
[ -e /etc/redis.conf ] && Print /etc/redis.conf already exists. && return 0
Print Modifying conf ...
echo "bind 0.0.0.0
protected-mode no
maxmemory 6442450944
@@ -69,7 +69,7 @@ maxmemory-policy volatile-random
}
function DeployCluster {
Print Deploy redis cluster ...
Print Deploying redis cluster ...
local i=
local node=
local nodesId=
@@ -91,11 +91,11 @@ function DeployCluster {
Print $node not enable cluster mode! && exit 100
done
done
Print Create redis cluster with master nodes: ${MASTER_NODES[@]}
Print Creating redis cluster with master nodes: ${MASTER_NODES[@]}
$redisCliCmd --cluster-yes --cluster create ${MASTER_NODES[@]}
nodesId="$($redisCliCmd -s $SOCK_FILE cluster nodes | cut -d@ -f1)"
for i in ${!SLAVE_NODES[@]}; do
Print Add slave node ${SLAVE_NODES[$i]} with master: ${MASTER_NODES[$i]}
Print Adding slave node ${SLAVE_NODES[$i]} with master: ${MASTER_NODES[$i]}
$redisCliCmd --cluster-yes --cluster add-node ${SLAVE_NODES[$i]} \
${MASTER_NODES[0]} --cluster-slave \
--cluster-master-id $(echo "$nodesId" \
@@ -112,7 +112,7 @@ function Init {
}
function StartProc {
Print Start Redis ...
Print Starting Redis ...
redis-server /etc/redis.conf \
--daemonize no \
--dir $DATA_DIR \