{"id":1443,"date":"2015-11-20T07:01:45","date_gmt":"2015-11-20T11:01:45","guid":{"rendered":"http:\/\/agileadam.com\/?p=1443"},"modified":"2015-11-20T08:34:21","modified_gmt":"2015-11-20T12:34:21","slug":"installing-elasticsearch-on-webfaction","status":"publish","type":"post","link":"https:\/\/agileadam.com\/2015\/11\/installing-elasticsearch-on-webfaction\/","title":{"rendered":"Installing ElasticSearch on Webfaction"},"content":{"rendered":"
You read everywhere that setting up and running elasticsearch is very simple. In fact, it is. There are some hurdles to clear when you’re setting it up on Webfaction, however. These instructions will hopefully provide some guidance.<\/p>\n
export JAVA_HOME=$HOME\/share\/java7\r\nPATH=$JAVA_HOME\/bin:$PATH:$HOME\/bin\r\nexport PATH<\/pre>\n<\/li>\n
If you have a working elasticsearch, you may be wondering how to keep it running all the time, even after you log out.<\/p>\n
One solution is to create a simple bash script that starts a process if it’s not already running, and then execute this script regularly via a cronjob.<\/p>\n
elasticsearch creates many processes that appear to ps<\/span>\u00a0 as “java”. This is not helpful. Using -eLf<\/span>\u00a0 we can see which processes are related to elasticsearch AND java. If there is\u00a0less than 1\u00a0such process, we start elasticsearch, otherwise we do nothing.<\/p>\n <\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":" You read everywhere that setting up and running elasticsearch is very simple. In fact, it is. There are some hurdles to clear when you’re setting it up on Webfaction, however. These instructions will hopefully provide some guidance.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[76],"tags":[271],"_links":{"self":[{"href":"https:\/\/agileadam.com\/wp-json\/wp\/v2\/posts\/1443"}],"collection":[{"href":"https:\/\/agileadam.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/agileadam.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/agileadam.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/agileadam.com\/wp-json\/wp\/v2\/comments?post=1443"}],"version-history":[{"count":13,"href":"https:\/\/agileadam.com\/wp-json\/wp\/v2\/posts\/1443\/revisions"}],"predecessor-version":[{"id":1457,"href":"https:\/\/agileadam.com\/wp-json\/wp\/v2\/posts\/1443\/revisions\/1457"}],"wp:attachment":[{"href":"https:\/\/agileadam.com\/wp-json\/wp\/v2\/media?parent=1443"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/agileadam.com\/wp-json\/wp\/v2\/categories?post=1443"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/agileadam.com\/wp-json\/wp\/v2\/tags?post=1443"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}\n
# This should be executed regularly via a cronjob\r\nif [ `ps -u YOURUSERNAME -eLf | grep -i elasticsearch | grep -i java | wc -l` -lt 1 ]\r\nthen\r\n echo \"Starting elasticsearch.\"\r\n \/home\/YOURUSERNAME\/webapps\/elasticsearch\/bin\/elasticsearch\r\nelse\r\n echo \"elasticsearch is running.\"\r\nfi\r\n<\/pre>\n<\/li>\n
JAVA_HOME=\/home\/YOURUSERNAME\/share\/java7\r\nPATH=\/home\/YOURUSERNAME\/share\/java7\/bin:\/usr\/local\/bin:\/usr\/bin:\/usr\/local\/sbin:\/usr\/sbin:\/home\/YOURUSERNAME\/bin\r\n\r\n# Make sure elasticsearch is running (every minute)\r\n* * * * * \/home\/YOURUSERNAME\/bin\/elasticsearch_autostart.sh<\/pre>\n