forked from RedisLabs/spark-redis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
114 lines (97 loc) · 3.39 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
# STANDALONE REDIS NODE
define REDIS_STANDALONE_NODE_CONF
daemonize yes
port 6379
pidfile /tmp/redis_standalone_node_for_spark-redis.pid
logfile /tmp/redis_standalone_node_for_spark-redis.log
save ""
appendonly no
requirepass passwd
endef
# CLUSTER REDIS NODES
define REDIS_CLUSTER_NODE1_CONF
daemonize yes
port 7379
pidfile /tmp/redis_cluster_node1_for_spark-redis.pid
logfile /tmp/redis_cluster_node1_for_spark-redis.log
save ""
appendonly no
cluster-enabled yes
cluster-config-file /tmp/redis_cluster_node1_for_spark-redis.conf
endef
define REDIS_CLUSTER_NODE2_CONF
daemonize yes
port 7380
pidfile /tmp/redis_cluster_node2_for_spark-redis.pid
logfile /tmp/redis_cluster_node2_for_spark-redis.log
save ""
appendonly no
cluster-enabled yes
cluster-config-file /tmp/redis_cluster_node2_for_spark-redis.conf
endef
define REDIS_CLUSTER_NODE3_CONF
daemonize yes
port 7381
pidfile /tmp/redis_cluster_node3_for_spark-redis.pid
logfile /tmp/redis_cluster_node3_for_spark-redis.log
save ""
appendonly no
cluster-enabled yes
cluster-config-file /tmp/redis_cluster_node3_for_spark-redis.conf
endef
export REDIS_STANDALONE_NODE_CONF
export REDIS_CLUSTER_NODE1_CONF
export REDIS_CLUSTER_NODE2_CONF
export REDIS_CLUSTER_NODE3_CONF
start-standalone:
echo "$$REDIS_STANDALONE_NODE_CONF" | redis-server -
start-cluster:
echo "$$REDIS_CLUSTER_NODE1_CONF" | redis-server -
echo "$$REDIS_CLUSTER_NODE2_CONF" | redis-server -
echo "$$REDIS_CLUSTER_NODE3_CONF" | redis-server -
redis-cli -p 7380 cluster meet 127.0.0.1 7379 > /dev/null
redis-cli -p 7381 cluster meet 127.0.0.1 7379 > /dev/null
slots=$$(seq 0 2047); slots=$$(echo $$slots | tr '\n' ' '); redis-cli -p 7379 cluster addslots $$slots > /dev/null
slots=$$(seq 2048 3333); slots=$$(echo $$slots | tr '\n' ' '); redis-cli -p 7380 cluster addslots $$slots > /dev/null
slots=$$(seq 3334 5460); slots=$$(echo $$slots | tr '\n' ' '); redis-cli -p 7379 cluster addslots $$slots > /dev/null
slots=$$(seq 5461 7777); slots=$$(echo $$slots | tr '\n' ' '); redis-cli -p 7380 cluster addslots $$slots > /dev/null
slots=$$(seq 7778 9999); slots=$$(echo $$slots | tr '\n' ' '); redis-cli -p 7381 cluster addslots $$slots > /dev/null
slots=$$(seq 10000 10922); slots=$$(echo $$slots | tr '\n' ' '); redis-cli -p 7380 cluster addslots $$slots > /dev/null
slots=$$(seq 10923 16383); slots=$$(echo $$slots | tr '\n' ' '); redis-cli -p 7381 cluster addslots $$slots > /dev/null
start:
make start-standalone
make start-cluster
stop-standalone:
kill `cat /tmp/redis_standalone_node_for_spark-redis.pid`
stop-cluster:
kill `cat /tmp/redis_cluster_node1_for_spark-redis.pid` || true
kill `cat /tmp/redis_cluster_node2_for_spark-redis.pid` || true
kill `cat /tmp/redis_cluster_node3_for_spark-redis.pid` || true
rm -f /tmp/redis_cluster_node1_for_spark-redis.conf
rm -f /tmp/redis_cluster_node2_for_spark-redis.conf
rm -f /tmp/redis_cluster_node3_for_spark-redis.conf
stop:
make stop-standalone
make stop-cluster
restart:
make stop
make start
test:
make start
# with --batch-mode maven doesn't print 'Progress: 125/150kB', the progress lines take up 90% of the log and causes
# Travis build to fail with 'The job exceeded the maximum log length, and has been terminated'
mvn clean test -B
make stop
benchmark:
make start
mvn clean test -B -Pbenchmark
make stop
deploy:
make start
mvn --batch-mode clean deploy
make stop
package:
make start
mvn --batch-mode clean package
make stop
.PHONY: test