Reputation: 426
I am trying to install Elasticsearch (0.90.5) as a service in my ubuntu (12.04) machine.
I tried
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.5.deb
sudo dpkg -i elasticsearch-0.90.5.deb
It gives response as
Selecting previously unselected package elasticsearch.
(Reading database ... 51009 files and directories currently installed.)
Unpacking elasticsearch (from elasticsearch-0.90.5.deb) ...
Setting up elasticsearch (0.90.5) ...
Adding system user `elasticsearch' (UID 107) ...
Adding new user `elasticsearch' (UID 107) with group `elasticsearch' ...
Not creating home directory `/usr/share/elasticsearch'.
* Starting ElasticSearch Server [ OK ]
Processing triggers for ureadahead ...
Then started the service with
sudo service elasticsearch start
* Starting ElasticSearch Server [ OK ]
After that when i am checking status, it shows
sudo service elasticsearch status
* elasticsearch is not running
I checked my log, but it is empty.
There is no other process running on port 9200
My java version : "1.6.0_31"
Does anyone have any idea why this happening?
Thank you for your help in advance
Upvotes: 2
Views: 11901
Reputation: 426
I just updated script for running elasticsearch as a service (/etc/init.d/elasticsearch). The below script solved the issue.
#! /bin/sh
### BEGIN INIT INFO
# Provides: elasticsearch
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts elasticsearch
# Description: Starts elasticsearch using start-stop-daemon
### END INIT INFO
ES_HOME=/usr/share/elasticsearch
ES_MIN_MEM=256m
ES_MAX_MEM=2g
DAEMON=$ES_HOME/bin/elasticsearch
NAME=elasticsearch
DESC=elasticsearch
PID_FILE=/var/run/$NAME.pid
#LOG_DIR=/var/log/$NAME
LOG_DIR=/extn1/es_log/
#DATA_DIR=/var/lib/$NAME
DATA_DIR=/extn1/data/
WORK_DIR=/tmp/$NAME
CONFIG_FILE=/etc/$NAME/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 $PID_FILE
then
echo "stopped."
else
echo "failed."
fi
;;
restart|force-reload)
${0} stop
sleep 0.5
${0} start
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0
Upvotes: 2
Reputation: 21
I think you should try to reduce the memory. Do the following changes:
vi /opt/elasticsearch-1.3.4/bin/service/elasticsearch.conf
ES_HEAP_SIZE
) limit. [1024 to 512 etc.]service elasticsearch start
Hope it will solve the issue.
Upvotes: 2