Published on Jan 12 2015 in Java
This tutorial covers installation of standalone ElasticSearch distribution running with included Netty webserver. It is installed on shared server alongside (main) private JVM running application server.
Prerequisites:
- You will need JDK 1.7 or higher. You can view/change JDK version in cPanel - Java Control Panel
- You will need one (or 2) of your free (unused) custom ports. Find it in cPanel - Java Control Panel - Ports. For example the one labelled with OPENEJB_ prefix. Request another port from support if needed.
- Make sure your appserver is stopped (run
jk
if unsure) as by default you are allowed to run only single JVM and JVM with your appserver + JVM with ElasticSearch will make them two. If you need to persistently run 2 JVMs order 'secondary JVM' addon.
Now the procedure in steps:
- Login to your account via SSH. Check our Articles section if you have not setup your SSH key already.
- Download and unpack ElasticSearch, for example
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.4.2.tar.gz
tar xzf elasticsearch-1.4.2.tar.gz
- Set a custom port (determined above) to listen for HTTP traffic (it is 10963 for our example) by running
sed -i 's/^#http.port: 9200/http.port: 10963/' elasticsearch-1.4.2/config/elasticsearch.yml
- Optionally set transport.tcp.port the same way using an other free port (10962 in our example).
sed -i 's/^#transport.tcp.port: 9300/http.port: 10962/' elasticsearch-1.4.2/config/elasticsearch.yml
- Adjust JVM memory limits to match your package limits
sed -i -r 's/ES_MAX_MEM=[[:digit:]]+.*/ES_MAX_MEM=256m/' elasticsearch-1.4.2/bin/elasticsearch.in.sh
sed -i -r 's/ES_MIN_MEM=[[:digit:]]+.*/ES_MIN_MEM=256m/' elasticsearch-1.4.2/bin/elasticsearch.in.sh
Note, your package limits may be too low to run the app. You may want to upgrade the package then.
- Start ElasticSearch in background with
elasticsearch-1.4.2/bin/elasticsearch 2>&1 >> ~/elasticsearch.log &
Press Enter if you did not get command line prompt. Check the ~/elasticsearch.log
for error messages or try running it in foreground.
Note, if you skip 2>&1 >> ~/elasticsearch.log &
the output will go to terminal (foreground run) and you can stop it with Ctrl+C.
- Test it from another machine with
curl -X GET http://yourdomain.com:10963/
You should get:
{
"status" : 200,
"name" : "Wildpride",
"cluster_name" : "elasticsearch",
"version" : {
"number" : "1.4.2",
"build_hash" : "927caff6f05403e936c20bf4529f144f0c89fd8c",
"build_timestamp" : "2014-12-16T14:11:12Z",
"build_snapshot" : false,
"lucene_version" : "4.10.2"
},
"tagline" : "You Know, for Search"
}