forked from Grokzen/redis-py-cluster
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
396 lines (350 loc) · 11.9 KB
/
Makefile
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
PATH := ./redis-git/src:${PATH}
# CLUSTER REDIS NODES
define REDIS_CLUSTER_NODE1_CONF
daemonize yes
port 7000
cluster-node-timeout 5000
pidfile /tmp/redis_cluster_node1.pid
logfile /tmp/redis_cluster_node1.log
save ""
appendonly no
cluster-enabled yes
cluster-config-file /tmp/redis_cluster_node1.conf
endef
define REDIS_CLUSTER_NODE2_CONF
daemonize yes
port 7001
cluster-node-timeout 5000
pidfile /tmp/redis_cluster_node2.pid
logfile /tmp/redis_cluster_node2.log
save ""
appendonly no
cluster-enabled yes
cluster-config-file /tmp/redis_cluster_node2.conf
endef
define REDIS_CLUSTER_NODE3_CONF
daemonize yes
port 7002
cluster-node-timeout 5000
pidfile /tmp/redis_cluster_node3.pid
logfile /tmp/redis_cluster_node3.log
save ""
appendonly no
cluster-enabled yes
cluster-config-file /tmp/redis_cluster_node3.conf
endef
define REDIS_CLUSTER_NODE4_CONF
daemonize yes
port 7003
cluster-node-timeout 5000
pidfile /tmp/redis_cluster_node4.pid
logfile /tmp/redis_cluster_node4.log
save ""
appendonly no
cluster-enabled yes
cluster-config-file /tmp/redis_cluster_node4.conf
endef
define REDIS_CLUSTER_NODE5_CONF
daemonize yes
port 7004
cluster-node-timeout 5000
pidfile /tmp/redis_cluster_node5.pid
logfile /tmp/redis_cluster_node5.log
save ""
appendonly no
cluster-enabled yes
cluster-config-file /tmp/redis_cluster_node5.conf
endef
define REDIS_CLUSTER_NODE6_CONF
daemonize yes
port 7005
cluster-node-timeout 5000
pidfile /tmp/redis_cluster_node6.pid
logfile /tmp/redis_cluster_node6.log
save ""
appendonly no
cluster-enabled yes
cluster-config-file /tmp/redis_cluster_node6.conf
endef
define REDIS_CLUSTER_NODE7_CONF
daemonize yes
port 7006
cluster-node-timeout 5000
pidfile /tmp/redis_cluster_node7.pid
logfile /tmp/redis_cluster_node7.log
save ""
appendonly no
cluster-enabled yes
cluster-config-file /tmp/redis_cluster_node7.conf
endef
define REDIS_CLUSTER_NODE8_CONF
daemonize yes
port 7007
cluster-node-timeout 5000
pidfile /tmp/redis_cluster_node8.pid
logfile /tmp/redis_cluster_node8.log
save ""
appendonly no
cluster-enabled yes
cluster-config-file /tmp/redis_cluster_node8.conf
endef
# CLUSTER REDIS PASSWORD PROTECTED NODES
define REDIS_CLUSTER_PASSWORD_PROTECTED_NODE1_CONF
daemonize yes
port 7100
cluster-node-timeout 5000
pidfile /tmp/redis_cluster_password_protected_node1.pid
logfile /tmp/redis_cluster_password_protected_node1.log
save ""
masterauth password_is_protected
requirepass password_is_protected
appendonly no
cluster-enabled yes
cluster-config-file /tmp/redis_cluster_password_protected_node1.conf
endef
define REDIS_CLUSTER_PASSWORD_PROTECTED_NODE2_CONF
daemonize yes
port 7101
cluster-node-timeout 5000
pidfile /tmp/redis_cluster_password_protected_node2.pid
logfile /tmp/redis_cluster_password_protected_node2.log
save ""
masterauth password_is_protected
requirepass password_is_protected
appendonly no
cluster-enabled yes
cluster-config-file /tmp/redis_cluster_password_protected_node2.conf
endef
define REDIS_CLUSTER_PASSWORD_PROTECTED_NODE3_CONF
daemonize yes
port 7102
cluster-node-timeout 5000
pidfile /tmp/redis_cluster_password_protected_node3.pid
logfile /tmp/redis_cluster_password_protected_node3.log
save ""
masterauth password_is_protected
requirepass password_is_protected
appendonly no
cluster-enabled yes
cluster-config-file /tmp/redis_cluster_password_protected_node3.conf
endef
define REDIS_CLUSTER_PASSWORD_PROTECTED_NODE4_CONF
daemonize yes
port 7103
cluster-node-timeout 5000
pidfile /tmp/redis_cluster_password_protected_node4.pid
logfile /tmp/redis_cluster_password_protected_node4.log
save ""
masterauth password_is_protected
requirepass password_is_protected
appendonly no
cluster-enabled yes
cluster-config-file /tmp/redis_cluster_password_protected_node4.conf
endef
define REDIS_CLUSTER_PASSWORD_PROTECTED_NODE5_CONF
daemonize yes
port 7104
cluster-node-timeout 5000
pidfile /tmp/redis_cluster_password_protected_node5.pid
logfile /tmp/redis_cluster_password_protected_node5.log
save ""
masterauth password_is_protected
requirepass password_is_protected
appendonly no
cluster-enabled yes
cluster-config-file /tmp/redis_cluster_password_protected_node5.conf
endef
define REDIS_CLUSTER_PASSWORD_PROTECTED_NODE6_CONF
daemonize yes
port 7105
cluster-node-timeout 5000
pidfile /tmp/redis_cluster_password_protected_node6.pid
logfile /tmp/redis_cluster_password_protected_node6.log
save ""
masterauth password_is_protected
requirepass password_is_protected
appendonly no
cluster-enabled yes
cluster-config-file /tmp/redis_cluster_password_protected_node6.conf
endef
define REDIS_CLUSTER_PASSWORD_PROTECTED_NODE7_CONF
daemonize yes
port 7106
cluster-node-timeout 5000
pidfile /tmp/redis_cluster_password_protected_node7.pid
logfile /tmp/redis_cluster_password_protected_node7.log
save ""
masterauth password_is_protected
requirepass password_is_protected
appendonly no
cluster-enabled yes
cluster-config-file /tmp/redis_cluster_password_protected_node7.conf
endef
define REDIS_CLUSTER_PASSWORD_PROTECTED_NODE8_CONF
daemonize yes
port 7107
cluster-node-timeout 5000
pidfile /tmp/redis_cluster_password_protected_node8.pid
logfile /tmp/redis_cluster_password_protected_node8.log
save ""
masterauth password_is_protected
requirepass password_is_protected
appendonly no
cluster-enabled yes
cluster-config-file /tmp/redis_cluster_password_protected_node8.conf
endef
ifndef REDIS_TRIB_RB
REDIS_TRIB_RB=tests/redis-trib.rb
endif
ifndef REDIS_VERSION
REDIS_VERSION=3.0.7
endif
export REDIS_CLUSTER_NODE1_CONF
export REDIS_CLUSTER_NODE2_CONF
export REDIS_CLUSTER_NODE3_CONF
export REDIS_CLUSTER_NODE4_CONF
export REDIS_CLUSTER_NODE5_CONF
export REDIS_CLUSTER_NODE6_CONF
export REDIS_CLUSTER_NODE7_CONF
export REDIS_CLUSTER_NODE8_CONF
export REDIS_CLUSTER_PASSWORD_PROTECTED_NODE1_CONF
export REDIS_CLUSTER_PASSWORD_PROTECTED_NODE2_CONF
export REDIS_CLUSTER_PASSWORD_PROTECTED_NODE3_CONF
export REDIS_CLUSTER_PASSWORD_PROTECTED_NODE4_CONF
export REDIS_CLUSTER_PASSWORD_PROTECTED_NODE5_CONF
export REDIS_CLUSTER_PASSWORD_PROTECTED_NODE6_CONF
export REDIS_CLUSTER_PASSWORD_PROTECTED_NODE7_CONF
export REDIS_CLUSTER_PASSWORD_PROTECTED_NODE8_CONF
help:
@echo "Please use 'make <target>' where <target> is one of"
@echo " clean remove temporary files created by build tools"
@echo " cleanmeta removes all META-* and egg-info/ files created by build tools"
@echo " cleancov remove all files related to coverage reports"
@echo " cleanall all the above + tmp files from development tools"
@echo " test run test suite"
@echo " sdist make a source distribution"
@echo " bdist make an egg distribution"
@echo " install install package"
@echo " benchmark runs all benchmarks. assumes nodes running on port 7001 and 7007"
@echo " *** CI Commands ***"
@echo " start starts a test redis cluster"
@echo " stop stop all started redis nodes (Started via 'make start' only affected)"
@echo " cleanup cleanup files after running a test cluster"
@echo " test starts/activates the test cluster nodes and runs tox test"
@echo " tox run all tox environments and combine coverage report after"
@echo " redis-install checkout latest redis commit --> build --> install ruby dependencies"
clean:
-rm -f MANIFEST
-rm -rf dist/
-rm -rf build/
cleancov:
-rm -rf htmlcov/
-coverage combine
-coverage erase
cleanmeta:
-rm -rf redis_py_cluster.egg-info/
cleanall: clean cleancov cleanmeta
-find . -type f -name "*~" -exec rm -f "{}" \;
-find . -type f -name "*.orig" -exec rm -f "{}" \;
-find . -type f -name "*.rej" -exec rm -f "{}" \;
-find . -type f -name "*.pyc" -exec rm -f "{}" \;
-find . -type f -name "*.parse-index" -exec rm -f "{}" \;
sdist: cleanmeta
python setup.py sdist
bdist: cleanmeta
python setup.py bdist_egg
install:
python setup.py install
start: cleanup
echo "$$REDIS_CLUSTER_NODE1_CONF" | redis-server -
echo "$$REDIS_CLUSTER_NODE2_CONF" | redis-server -
echo "$$REDIS_CLUSTER_NODE3_CONF" | redis-server -
echo "$$REDIS_CLUSTER_NODE4_CONF" | redis-server -
echo "$$REDIS_CLUSTER_NODE5_CONF" | redis-server -
echo "$$REDIS_CLUSTER_NODE6_CONF" | redis-server -
echo "$$REDIS_CLUSTER_NODE7_CONF" | redis-server -
echo "$$REDIS_CLUSTER_NODE8_CONF" | redis-server -
echo "$$REDIS_CLUSTER_PASSWORD_PROTECTED_NODE1_CONF" | redis-server -
echo "$$REDIS_CLUSTER_PASSWORD_PROTECTED_NODE2_CONF" | redis-server -
echo "$$REDIS_CLUSTER_PASSWORD_PROTECTED_NODE3_CONF" | redis-server -
echo "$$REDIS_CLUSTER_PASSWORD_PROTECTED_NODE4_CONF" | redis-server -
echo "$$REDIS_CLUSTER_PASSWORD_PROTECTED_NODE5_CONF" | redis-server -
echo "$$REDIS_CLUSTER_PASSWORD_PROTECTED_NODE6_CONF" | redis-server -
echo "$$REDIS_CLUSTER_PASSWORD_PROTECTED_NODE7_CONF" | redis-server -
echo "$$REDIS_CLUSTER_PASSWORD_PROTECTED_NODE8_CONF" | redis-server -
sleep 5
echo "yes" | ruby $(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
sleep 5
echo "yes" | ruby $(REDIS_TRIB_RB) create --replicas 1 --password password_is_protected 127.0.0.1:7100 127.0.0.1:7101 127.0.0.1:7102 127.0.0.1:7103 127.0.0.1:7104 127.0.0.1:7105
sleep 5
cleanup:
- rm -vf /tmp/redis_cluster_node*.conf 2>/dev/null
- rm -vf /tmp/redis_cluster_password_protected_node*.conf 2>/dev/null
- rm dump.rdb appendonly.aof - 2>/dev/null
stop:
kill `cat /tmp/redis_cluster_node1.pid` || true
kill `cat /tmp/redis_cluster_node2.pid` || true
kill `cat /tmp/redis_cluster_node3.pid` || true
kill `cat /tmp/redis_cluster_node4.pid` || true
kill `cat /tmp/redis_cluster_node5.pid` || true
kill `cat /tmp/redis_cluster_node6.pid` || true
kill `cat /tmp/redis_cluster_node7.pid` || true
kill `cat /tmp/redis_cluster_node8.pid` || true
kill `cat /tmp/redis_cluster_password_protected_node1.pid` || true
kill `cat /tmp/redis_cluster_password_protected_node2.pid` || true
kill `cat /tmp/redis_cluster_password_protected_node3.pid` || true
kill `cat /tmp/redis_cluster_password_protected_node4.pid` || true
kill `cat /tmp/redis_cluster_password_protected_node5.pid` || true
kill `cat /tmp/redis_cluster_password_protected_node6.pid` || true
kill `cat /tmp/redis_cluster_password_protected_node7.pid` || true
kill `cat /tmp/redis_cluster_password_protected_node8.pid` || true
rm -f /tmp/redis_cluster_node1.conf
rm -f /tmp/redis_cluster_node2.conf
rm -f /tmp/redis_cluster_node3.conf
rm -f /tmp/redis_cluster_node4.conf
rm -f /tmp/redis_cluster_node5.conf
rm -f /tmp/redis_cluster_node6.conf
rm -f /tmp/redis_cluster_node7.conf
rm -f /tmp/redis_cluster_node8.conf
rm -f /tmp/redis_cluster_password_protected_node1.conf
rm -f /tmp/redis_cluster_password_protected_node2.conf
rm -f /tmp/redis_cluster_password_protected_node3.conf
rm -f /tmp/redis_cluster_password_protected_node4.conf
rm -f /tmp/redis_cluster_password_protected_node5.conf
rm -f /tmp/redis_cluster_password_protected_node6.conf
rm -f /tmp/redis_cluster_password_protected_node7.conf
rm -f /tmp/redis_cluster_password_protected_node8.conf
test:
make start
make tox
make stop
tox:
coverage erase
tox
TEST_PASSWORD_PROTECTED=1 tox
coverage combine
coverage report
clone-redis:
[ ! -e redis-git ] && git clone https://github.com/antirez/redis.git redis-git || true
cd redis-git && git checkout $(REDIS_VERSION)
redis-install:
make clone-redis
make -C redis-git -j4
gem install redis
sleep 3
benchmark:
@echo ""
@echo " -- Running Simple benchmark with StrictRedis lib and non cluster server --"
python benchmarks/simple.py --port 7007 --timeit --nocluster
@echo ""
@echo " -- Running Simple benchmark with StrictRedisCluster lib and cluster server --"
python benchmarks/simple.py --port 7001 --timeit
@echo ""
@echo " -- Running Simple benchmark with pipelines & StrictRedis lib and non cluster server --"
python benchmarks/simple.py --port 7007 --timeit --pipeline --nocluster
@echo ""
@echo " -- Running Simple benchmark with StrictRedisCluster lib and cluster server"
python benchmarks/simple.py --port 7001 --timeit --pipeline
ptp:
python ptp-debug.py
.PHONY: test