forked from junbaor/shell_script
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathredis-cluster.sh
98 lines (84 loc) · 1.86 KB
/
redis-cluster.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
apt update
apt install gcc make ruby -y
gem install redis
wget http://download.redis.io/releases/redis-4.0.1.tar.gz
tar zxvf redis-4.0.1.tar.gz
cd redis-4.0.1
make
cd ..
mkdir cluster-test && cd cluster-test
mkdir 7000 7001 7002 7003 7004 7005
cp ../redis-4.0.1/src/redis-cli ./
cp ../redis-4.0.1/src/redis-trib.rb ./
cp ../redis-4.0.1/src/redis-server 7000
cp ../redis-4.0.1/src/redis-server 7001
cp ../redis-4.0.1/src/redis-server 7002
cp ../redis-4.0.1/src/redis-server 7003
cp ../redis-4.0.1/src/redis-server 7004
cp ../redis-4.0.1/src/redis-server 7005
cat > 7000/redis.conf <<EOF
port 7000
cluster-enabled yes
cluster-config-file nodes.conf
cluster-node-timeout 5000
daemonize yes
protected-mode no
EOF
cat > 7001/redis.conf <<EOF
port 7001
cluster-enabled yes
cluster-config-file nodes.conf
cluster-node-timeout 5000
daemonize yes
protected-mode no
EOF
cat > 7002/redis.conf <<EOF
port 7002
cluster-enabled yes
cluster-config-file nodes.conf
cluster-node-timeout 5000
daemonize yes
protected-mode no
EOF
cat > 7003/redis.conf <<EOF
port 7003
cluster-enabled yes
cluster-config-file nodes.conf
cluster-node-timeout 5000
daemonize yes
protected-mode no
EOF
cat > 7004/redis.conf <<EOF
port 7004
cluster-enabled yes
cluster-config-file nodes.conf
cluster-node-timeout 5000
daemonize yes
protected-mode no
EOF
cat > 7005/redis.conf <<EOF
port 7005
cluster-enabled yes
cluster-config-file nodes.conf
cluster-node-timeout 5000
daemonize yes
protected-mode no
EOF
cat > start-all.sh <<EOF
cd 7000
./redis-server redis.conf
cd ../7001
./redis-server redis.conf
cd ../7002
./redis-server redis.conf
cd ../7003
./redis-server redis.conf
cd ../7004
./redis-server redis.conf
cd ../7005
./redis-server redis.conf
EOF
chmod 755 start-all.sh
./start-all.sh
./redis-trib.rb create --replicas 1 127.0.0.1:7000 127.0.0.1:7001 \
127.0.0.1:7002 127.0.0.1:7003 127.0.0.1:7004 127.0.0.1:7005