ELK -elasticsearch

来源:互联网 发布:apm地面站软件 编辑:程序博客网 时间:2024/06/05 17:33

  • 简介
    • 安装
    • 配置文件
    • 启动
    • elasticsearch-servicewrapper 插件
      • 安装启动服务
      • 使用服务

简介

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: falsediscovery.zen.ping.timeout: 120sclient.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
0 0
原创粉丝点击