grails (11) vaadin (11) meteor (6) java (4) elasticsearch (3) apple (2) centos (1) cloudbees (1) google analytics (1) gradle (1) heroku (1) javafx (1) javascript (1) jdbc (1) jug (1) logback (1) logging (1) mac os (1) management (1) mongodb (1) mongolab (1) mysql (1) twitter (1) ubuntu (1)

Monday, October 28, 2013

How to install ElasticSearch as a service on CentOS

The following steps were tested for ElasticSearch 0.90.5 on CentOS 6.4.
# install missing libraries (if any)
cd ~
sudo yum update
yum install java-1.7.0-openjdk.x86_64
yum install unzip
yum install mc
yum install wget
yum install curl
# get and unpack elasticsearch zip file
cd /etc
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.5.zip
unzip elasticsearch-0.90.5.zip
rm elasticsearch-0.90.5.zip
mv elasticsearch-0.90.5 elasticsearch
# install elasticsearch plugins
cd elasticsearch/bin
./plugin -install mobz/elasticsearch-head
./plugin -install karmi/elasticsearch-paramedic
./plugin -url http://bit.ly/GMYV9l -install river-jdbc
cd /etc/elasticsearch/lib
wget http://qiiip.org/mysql-connector-java-5.1.26-bin.jar
# make elasticsearch runnable as a service
cd ~
curl -L http://github.com/elasticsearch/elasticsearch-servicewrapper/tarball/master | tar -xz
mv *servicewrapper*/service /etc/elasticsearch/bin/
rm -Rf *servicewrapper*
sudo /etc/elasticsearch/bin/service/elasticsearch install
# set elasticsearch to run on boot
sudo /sbin/chkconfig elasticsearch on
sudo /sbin/chkconfig --list
# open port 9200 (for http) and 9300 (for tcp)
sudo iptables -L -n
iptables -A INPUT -p tcp -m tcp --dport 9200 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 9300 -j ACCEPT
service iptables save
# set min max memory variables
export ES_MIN_MEM=5G
export ES_MAX_MEM=5G
# restart server
service elasticsearch restart
tail -f /etc/elasticsearch/logs/elasticsearch.log
TextLab for Mac
Ultimate application to validate, clean and format JSON, XML, SQL, HTML.

1 comment:

  1. You are the man!

    One correction:

    Line 21: The tiny url expired.. so I used this:

    21 ./plugin -url http://dl.bintray.com/jprante/elasticsearch-plugins/org/xbib/elasticsearch/plugin/elasticsearch-river-jdbc/2.2.2/elasticsearch-river-jdbc-2.2.2.zip -install river-jdbc


    This is the only guide that has worked for me on CentOS 6+. THANK YOU! If you need anything server/infrastructure related... Let me know!

    ReplyDelete