This repository has been archived by the owner on Oct 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 173
/
start-sensei-node.sh
executable file
·59 lines (46 loc) · 2.01 KB
/
start-sensei-node.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env bash
#usage="Usage: start-sensei-node.sh <id> <port> <partitions> <conf-dir>"
# if no args specified, show usage
#if [ $# -le 3 ]; then
# echo $usage
# exit 1
#fi
bin=`dirname "$0"`
bin=`cd "$bin"; pwd`
OS=`uname`
IP="" # store IP
case $OS in
Linux) IP=`/sbin/ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'`;;
FreeBSD|OpenBSD|Darwin) IP=`ifconfig | grep -E '^en[0-9]:' -A 4 | grep -E 'inet.[0-9]' | grep -v '127.0.0.1' | awk '{ print $2}'` ;;
SunOS) IP=`ifconfig -a | grep inet | grep -v '127.0.0.1' | awk '{ print $2} '` ;;
*) IP="Unknown";;
esac
lib=$bin/../target/lib
dist=$bin/../target
resources=$bin/../resources
logs=$bin/../logs
if [[ ! -d $logs ]]; then
echo "Log file does not exists, creating one..."
mkdir $logs
fi
# HEAP_OPTS="-Xmx4096m -Xms2048m -XX:NewSize=1024m" # -d64 for 64-bit awesomeness
HEAP_OPTS="-Xmx1g -Xms1g -XX:NewSize=256m"
# HEAP_OPTS="-Xmx1024m -Xms512m -XX:NewSize=128m"
# HEAP_OPTS="-Xmx512m -Xms256m -XX:NewSize=64m"
# GC_OPTS="-verbosegc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -XX:+UseConcMarkSweepGC -XX:+UseParNewGC"
#JAVA_DEBUG="-Xdebug -Xrunjdwp:transport=dt_socket,address=1044,server=y,suspend=y"
#GC_OPTS="-XX:+UseConcMarkSweepGC -XX:+UseParNewGC"
JAVA_OPTS="-server -d64"
JMX_OPTS="-Djava.rmi.server.hostname=$IP -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=18889 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"
MAIN_CLASS="com.sensei.search.nodes.SenseiServer"
CLASSPATH=$resources/:$lib/*:$dist/*
PIDFILE=/tmp/sensei-search-node.pid
if [ -f $PIDFILE ]; then
echo "File $PIDFILE exists shutdown may not be proper"
echo "Please check PID" `cat $PIDFILE`
echo "Make sure the node is shutdown and the file" $PIDFILE "is removed before stating the node"
else
echo "File $PIDFILE does not exists"
java $JAVA_OPTS $JMX_OPTS $HEAP_OPTS $GC_OPTS -classpath $CLASSPATH -Dlog.home=$logs $MAIN_CLASS $1 &
echo $! > ${PIDFILE}
fi