-
Notifications
You must be signed in to change notification settings - Fork 8
Elastic search Configuration
Install JDK
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-7-jdk
Install Elastic Search
wget http://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.20.2.zip
sudo unzip elasticsearch-0.20.2 -d /usr/local/elasticsearch
rm elasticsearch-0.20.2.zip
Add EC2 cloud plugin for elastic
cd /usr/local/elasticsearch/elasticsearch-0.20.2/
sudo bin/plugin -install elasticsearch/elasticsearch-cloud-aws/1.4.0
Start elastic in the background
Elastic files are present in /usr/local/elasticsearch: sudo bin/elasticsearch
Add elasticsearch service in server init.d folder to start/stop automatically according to server state
-
Create a file called 'elasticsearch' in /etc/init.d/ folder.
-
Add the following contents to file and save it.
#! /bin/sh
ES_HOME=/usr/local/elasticsearch/elasticsearch-0.20.2 ES_MIN_MEM=256m ES_MAX_MEM=1g DAEMON=$ES_HOME/bin/elasticsearch NAME=elasticsearch DESC=elasticsearch PID_FILE=/var/run/$NAME.pid LOG_DIR=/var/log/$NAME DATA_DIR=$ES_HOME/$NAME/data WORK_DIR=/tmp/$NAME CONFIG_FILE=$ES_HOME/config/elasticsearch.yml DAEMON_OPTS="-p $PID_FILE -Des.config=$CONFIG_FILE -Des.path.home=$ES_HOME -Des.path.logs=$LOG_DIR -Des.path.data=$DATA_DIR -Des.path.work=$WORK_DIR"
test -x $DAEMON || exit 0
set -e
case "$1" in
start)
echo -n "Starting $DESC: "
mkdir -p $LOG_DIR $DATA_DIR $WORK_DIR
if start-stop-daemon --start --pidfile $PID_FILE --startas $DAEMON -- $DAEMON_OPTS
then
echo "started."
else
echo "failed."
fi
;;
stop)
echo -n "Stopping $DESC: "
if start-stop-daemon --stop --pidfile
exit 0##
-
While in init.d folder , run sudo chmod 755 elasticsearch
-
Run sudo systemctl start elasticsearch