forked from RedisLabs/spark-redis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
142 lines (123 loc) · 4.29 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
# user
USER_ACL = user alice on >p1pp0 ~* +@all
# 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
$(USER_ACL)
endef
# STANDALONE REDIS NODE WITH SSL
define REDIS_STANDALONE_NODE_CONF_SSL
daemonize yes
port 0
pidfile /tmp/redis_standalone_node__ssl_for_spark-redis.pid
logfile /tmp/redis_standalone_node_ssl_for_spark-redis.log
save ""
appendonly no
requirepass passwd
$(USER_ACL)
tls-auth-clients no
tls-port 6380
tls-cert-file ./src/test/resources/tls/redis.crt
tls-key-file ./src/test/resources/tls/redis.key
tls-ca-cert-file ./src/test/resources/tls/ca.crt
tls-dh-params-file ./src/test/resources/tls/redis.dh
endef
# CLUSTER REDIS NODES
define REDIS_CLUSTER_NODE1_CONF
daemonize yes
port 7379
$(USER_ACL)
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
$(USER_ACL)
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
$(USER_ACL)
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_STANDALONE_NODE_CONF_SSL
export REDIS_CLUSTER_NODE1_CONF
export REDIS_CLUSTER_NODE2_CONF
export REDIS_CLUSTER_NODE3_CONF
start-standalone:
echo "$$REDIS_STANDALONE_NODE_CONF" | redis-server -
echo "$$REDIS_STANDALONE_NODE_CONF_SSL" | 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`
kill `cat /tmp/redis_standalone_node__ssl_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 -DargLine="-Djavax.net.ssl.trustStorePassword=password -Djavax.net.ssl.trustStore=./src/test/resources/tls/clientkeystore -Djavax.net.ssl.trustStoreType=jceks"
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