-
Notifications
You must be signed in to change notification settings - Fork 7
/
add.sh
42 lines (34 loc) · 995 Bytes
/
add.sh
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
#!/bin/bash
#
# add.sh
set -x
MASTER_SERVER=${1:-127.0.0.1}
port=${2:-6371} # Initial port to start trying.
gcs_normal=0
gcs_ckptonly=1
gcs_ckptflush=2
gcs_mode=${gcs_ckptflush}
gcs_mode=${gcs_normal}
function add() {
# pushd build
# make -j
# popd
# Master.
# ./redis/src/redis-server --loadmodule ./build/src/libmaster.so --port 6369 &> master.log &
# Assume by default the master & 1 node are already running, at 6369, 6370, respectively.
while true; do
result=$(pgrep -a redis-server | grep $port)
if [ -z "${result}" ]; then
echo 'breaking...'
break
fi
port=$(expr $port + 1)
done
echo 'break!'
taskset 0x1 ./redis/src/redis-server --loadmodule ./build/src/libmember.so ${gcs_mode} --port $port --protected-mode no &> $port.log &
sleep 0.5
# myip=$(curl ipinfo.io/ip)
myip=$(hostname -i)
./redis/src/redis-cli -h ${MASTER_SERVER} -p 6369 MASTER.ADD ${myip} $port
}
add