These instructions work on linux, but can be easily adapated for other operating systems.
Install the latest version of ElasticSearch
Check http://www.elasticsearch.org/download/ for the latest version of ElasticSearch. (Currently version 0.17.2)
Install it as follows:
curl -L -O http://cloud.github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.17.2.zip unzip elasticsearch-0.17.2.zip mv elasticsearch-0.17.2 elasticsearch # rename dir to ./elasticsearch rm elasticsearch*.zip # tidy up
Optionally install the service wrapper
The service wrapper allows you to start, stop and restart elasticsearch using:
./elasticsearch/bin/service/elasticsearch start | stop | restart
If you install
it, then it will be setup as a service which will start on boot, just like the other processes available in /etc/init.d
. The service wrapper will also restart the ElasticSearch process if it dies for any reason.
Install the service wrapper:
curl -L http://github.com/elasticsearch/elasticsearch-servicewrapper/tarball/master | tar -xz mv *servicewrapper*/service elasticsearch/bin/ rm -Rf *servicewrapper* # tidy up # Setup ElasticSearch as a service: elasticsearch/bin/service/elasticsearch install # Set up rcelasticsearch as a shortcut to the service wrapper: ln -s `readlink -f elasticsearch/bin/service/elasticsearch` /usr/local/bin/rcelasticsearch
Configuring ElasticSearch
ElasticSearch needs minimal configuration to “just work”, however there are a few things that you should set up.
Edit the file: elasticsearch/config/elasticsearch.yml
Give your cluster a name.
This stops your cluster from trying to talk to other ElasticSearch clusters on the same network:
cluster: name: MyCluster
Set the network host
ElasticSearch tries to guess which IP address it should attach to. If you have more than one IP address on your server, then it may guess the wrong one.
network: host: 192.168.1.10 # IP address of your server OR _en0_ # IP address of the first ethernet interface
See Node network settings for more.
Configuring service wrapper
You can tweak the settings for the service wrapper by editing the file: elasticsearch/bin/service/elasticsearch.conf
Probably the only values that you might want to update are the three at the top of the file, ES_HOME
and the minimum and maximum amounts of memory that ElasticSearch should use. The values for ES_MIN_MEM
and ES_MAX_MEM
depend on how much memory you have available on your machine.
set.default.ES_HOME=<Path to ElasticSearch Home> set.default.ES_MIN_MEM=256 set.default.ES_MAX_MEM=1024
Also, see Running ElasticSearch as a non-root user
Starting and stopping ElasticSearch
Using the service wrapper
The service wrapper ensures that you have only one running instance of ElasticSearch.
rcelasticsearch start rcelasticsearch stop
Without the service wrapper
In the foreground
./elasticsearch/bin/elasticsearch -f
Press Ctrl-C
to stop the server
In the background
#start, and write the PID to pidfile ./elasticsearch/bin/elasticsearch -p pidfile #stop kill `cat pidfile`blog comments powered by Disqus