October 31, 2013

Setting up ElasticSearch on CentOS: plugin, run as a service

Setting up ElasticSearch is straight forward, but there are a few things to note.

Environment:
CentOS on VM or a physical machine
- Assumptions: sshd is installed.

1. If it's fresh install of CentOS, you're accessing it remotely and you're sure it's in secure network (not directly connected to the internet), then you can turn off the firewall to access ElasticSearch's default port 9200.
$ sudo service iptables save
$ sudo service iptables stop
$ sudo chkconfig iptables off
$ sudo service ip6tables save
$ sudo service ip6tables stop
$ sudo chkconfig ip6tables off

2. Install ElasticSearch
- Download ElasticSearch.
- Uncompress the files on the CentOS server and put it under where you put optional 3rd party software.  I use /opt.

3. Install as a service
# generate wrapper for ElasticSearch
$ curl -L http://github.com/elasticsearch/elasticsearch-servicewrapper/tarball/master | tar -xz
$ mv *servicewrapper*/service /usr/local/share/elasticsearch/bin/
$ rm -Rf *servicewrapper*
$ sudo /usr/local/share/elasticsearch/bin/service/elasticsearch install

# Add it as a service
$ sudo chkconfig --add elasticsearch

# check if installed as service
$ sudo chkconfig --list | grep elasticsearch

4. Start it as a service
sudo service elasticsearch start

5. Install the plugins.  The instruction is here.

No comments: