หน้าเว็บ

วันเสาร์ที่ 17 สิงหาคม พ.ศ. 2556

install elastic search on ubuntu 12.04

system evironment
    server : ubuntu 12.04
    user : elastic
    user group : elastic

elastic search
    version : 0.90.3
2. download elasticsearch จาก https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.3.tar.gz
$ cd ~
$ mkdir Download
$ cd Download
$ wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.3.tar.gz
3. copy to /opt/  and change name to elasticsearch
# copy folder and sub folder (-r) into /opt/
$ sudo cp -r elasticsearch-0.90.3.tar.gz /opt/ 

# extract file
$ sudo tar xzf elasticsearch-0.90.3.tar.gz

# rename folder
$ sudo mv elasticsearch-0.90.3 elasticsearch 

# remove .tar.gz file
$ sudo rm -r elasticsearch-0.90.3.tar.gz
4. change group and authorize
# owner can read write and execute, but other can read only
$ sudo chmod 744 -R elasticsearch

#change group to folder and sub folder (-R)
$ sudo chown -R elastic:elastic elasticsearch
5. start elastic search
...
# run elasticsearch
$ ./elasticsearch/bin/elasticsearch 
...
6. check working
# download json from localhost:9200 not save file (show output console only)
$ wget -qO- localhost:9200

# response
{ 
  "ok" : true,
  "status" : 200,
  "name" : "Fantastic Four",
  "version" : {
    "number" : "0.90.3",
    "build_hash" : "5c38d6076448b899d758f29443329571e2522410",
    "build_timestamp" : "2013-08-06T13:18:31Z",
    "build_snapshot" : false,
    "lucene_version" : "4.4"
  },
  "tagline" : "You Know, for Search"
}

running elastic search as service

7. download elasticsearch-servicewrapper from  :https://github.com/elasticsearch/elasticsearch-servicewrapper
zip file : https://github.com/elasticsearch/elasticsearch-servicewrapper/archive/master.zip
# check current directory
$ pwd 
/opt/elasticsearch/bin

# download
$ wget https://github.com/elasticsearch/elasticsearch-servicewrapper/archive/master.zip
8. extract zip file
# install unzip 
$ sudo apt-get install unzip

$ unzip master.zip

$ ls -l
..
elasticsearch-servicewrapper-master
..

# move service folder in elasticsearch-servicewrapper-master folder to this folder (/opt/elasticsearch/bin)
$ mv elasticsearch-servicewrapper-master/service .
9. config elastic search service wrapper
$ cd service
$ vi elasticsearch.conf

# fisrt line attribute set.default.ES_HOME
# set to /opt/elasticsearch/bin and save
set.default.ES_HOME = /opt/elasticsearch/bin 
10. run service
$ pwd
/opt/elasticsearch/bin/service

# start
$ ./elasticsearch start
# output
Starting ElasticSearch...
Waiting for ElasticSearch......
running PID : 2036


# stop
$ ./elasticsearch stop
# output
Stopping ElasticSearch...
Stopped ElasticSearch.
learning more : http://www.elasticsearch.org/

ไม่มีความคิดเห็น:

แสดงความคิดเห็น