forked from y123456yz/Reading-and-comprehense-redis-cluster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
redisstart_auto.sh
42 lines (31 loc) · 1.3 KB
/
redisstart_auto.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
echo ""
echo ""
echo ""
echo "========================================================================================================================================================"
echo "========================================================== Welcome to Redis Cluster ==========================================================="
echo "========================================================================================================================================================"
echo ""
echo "Starting Redis cluster.........."
killall -9 redis-server
ip=172.16.3.42
ip_cluster_str=cluster_create
for i in {1..10}
do
node=`expr 7000 + $i`
node_conf="nodes_""${node}"
rm -rf /usr/local/cluster/$node
mkdir -p /usr/local/cluster/$node
cp ./src/redis-server /usr/local/cluster/$node
cp ./redis.conf /usr/local/cluster/$node
sed -i "s/6379/$node/g" /usr/local/cluster/$node/redis.conf
done
for i in {1..10}
do
node=`expr 7000 + $i`
echo "Start Server $i at port $node >>>>>>>>>>>>>"
cd /usr/local/cluster/$node
./redis-server /usr/local/cluster/$node/redis.conf &
done
sleep 2
ps -ef | grep redis
echo "===============================================================================Finish===================================================================="