forked from RedisLabs/spark-redis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
90 lines (80 loc) · 2.93 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
# 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:
echo "$$REDIS_STANDALONE_NODE_CONF" | redis-server -
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
stop:
kill `cat /tmp/redis_standalone_node_for_spark-redis.pid`
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
test:
make start
mvn -Dtest=${TEST} clean compile test
make stop
deploy:
make start
mvn clean deploy
make stop
package:
make start
mvn clean package
make stop
.PHONY: test