ELK -elasticsearch

簡介

elasticsearch 是基於Apache Lucene 的搜索引擎。它是由API來驅動的,所有的行爲都可以基於Restful API,用json來實現。


安裝

安裝elasticsearch 要儘量使用非root 用戶,因爲root用戶是無法啓動elasticsearch

  • 網址 https://www.elastic.co/downloads/elasticsearch
  • 相關文檔 https://www.elastic.co/guide/index.html
  • 下載tar包安裝 tar -zxvf tar包

配置文件

安裝完成後只需修改config目錄下的elasticsearch.yml 配置文件
注意:配置文件開頭要有空格,配置項和對應值之間的冒號後面也要有空格

添加如下配置

discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.timeout: 120s
client.transport.ping_timeout: 60s

修改如下配置

 cluster.name: my-application //集羣的名字
 node.name: node-1 //當前機器的nodename
 discovery.zen.ping.unicast.hosts: ["ip", "ip2", "ip3"] //集羣中node 的host 

要想別別的機器訪問還需要配置

  network.host: IP1
  network.publish_host: IP1
  network.bind_host: IP1

啓動

可以用bin/elasticsearch 啓動,但這種並不是以服務的方式啓動。


elasticsearch-servicewrapper 插件

https://github.com/elasticsearch/elasticsearch-servicewrapper下載該插件後,解壓縮。將service目錄拷貝到elasticsearch安裝目錄的bin目錄下。

安裝啓動服務

sudo bin/service/elasticsearch install

使用服務

bin/service/elasticsearch start/stop/restart
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章