forked from turtleDeng/eredis_cluster
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathMakefile
133 lines (115 loc) · 2.81 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
ERL=erl
BEAMDIR=./deps/*/ebin ./ebin
REBAR ?= rebar3
PATH := ./redis-git/src:${PATH}
# CLUSTER REDIS NODES
define NODE1_CONF
daemonize yes
port 30001
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 NODE2_CONF
daemonize yes
port 30002
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 NODE3_CONF
daemonize yes
port 30003
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 NODE4_CONF
daemonize yes
port 30004
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 NODE5_CONF
daemonize yes
port 30005
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 NODE6_CONF
daemonize yes
port 30006
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
export NODE1_CONF
export NODE2_CONF
export NODE3_CONF
export NODE4_CONF
export NODE5_CONF
export NODE6_CONF
all: clean compile xref
compile:
@$(REBAR) compile
xref:
@$(REBAR) xref skip_deps=true
clean:
@ $(REBAR) clean
eunit:
@rm -rf .eunit
@mkdir -p .eunit
@ERL_FLAGS="-config test.config" $(REBAR) eunit
test: eunit
edoc:
@$(REBAR) skip_deps=true doc
help:
@echo "Please use 'make <target>' where <target> is one of"
@echo " start starts a test redis cluster"
@echo " cleanup cleanup config files after redis cluster"
@echo " stop stops all redis servers"
start: cleanup
echo "$$NODE1_CONF" | redis-server -
echo "$$NODE2_CONF" | redis-server -
echo "$$NODE3_CONF" | redis-server -
echo "$$NODE4_CONF" | redis-server -
echo "$$NODE5_CONF" | redis-server -
echo "$$NODE6_CONF" | redis-server -
cleanup:
- rm -vf /tmp/redis_cluster_node*.conf 2>/dev/null
- rm -f /tmp/redis_cluster_node1.conf
- 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
make cleanup