2014/06/12

ElasticSearch on Ubuntu

剛裝完 Ubuntu 14.04 來試 ElasticSearch,下載 elasticsearch-1.2.1.deb 後,安裝過程會建立 elasticsearch 系統帳號,啟動指令是 sudo service elasticsearch start,想要在 bootup 啟動,要執行 sudo update-rc.d elasticsearch defaults 95 10。

接著試裝 logstash_1.4.1-1-bd507eb_all.deb 遇到下列問題,雖然這東西未必需要安裝:

dpkg: dependency problems prevent configuration of logstash:
logstash depends on java7-runtime-headless | java6-runtime-headless | j2re1.7; however:
Package java7-runtime-headless is not installed.
Package java6-runtime-headless is not installed.
Package j2re1.7 is not installed.

意思是要從 java6 或 java7 選一個來裝,參考文件 [1] [2] 提到 openjdk-7-jre-headless,照提示要用 apt-get -f install 才搞定。想要測試是否正確啟動:

$ curl http://localhost:9200
{
  "status" : 200,
  "name" : "Runner",
  "version" : {
    "number" : "1.2.1",
    "build_hash" : "6c95b759f9e7ef0f8e17f77d850da43ce8a4b364",
    "build_timestamp" : "2014-06-03T15:02:52Z",
    "build_snapshot" : false,
    "lucene_version" : "4.8"
  },
  "tagline" : "You Know, for Search"
}