ElasticSearch 简介与插件安装(logstash、kibana)

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_18377515/article/details/84173891

简介

ElasticSearch是一个基于Lucene的搜索服务器。它提供了一个分布式多用户能力的全文搜索引擎,基于RESTful web接口。Elasticsearch是用Java开发的,并作为Apache许可条款下的开放源码发布,是当前流行的企业级搜索引擎。设计用于云计算中,能够达到实时搜索,稳定,可靠,快速,安装使用方便。
我们建立一个网站或应用程序,并要添加搜索功能,但是想要完成搜索工作的创建是非常困难的。我们希望搜索解决方案要运行速度快,我们希望能有一个零配置和一个完全免费的搜索模式,我们希望能够简单地使用JSON通过HTTP来索引数据,我们希望我们的搜索服务器始终可用,我们希望能够从一台开始并扩展到数百台,我们要实时搜索,我们要简单的多租户,我们希望建立一个云的解决方案。因此我们利用Elasticsearch来解决所有这些问题及可能出现的更多其它问题。

安装

elasticsearch安装

  1. 下载安装包 下载地址
  2. 解压 执行bin 目录中的elasticsearch.bat 或者, 后台进程启动 :如elasticsearch.bat -d -p 123。
  3. 浏览器中输入 http://127.0.0.1:9200/ 会显示出下面的信息 证明安装成功
{
  "name" : "4LQkK5-",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "b-M0r96WQOCGwMFUWF0U1Q",
  "version" : {
    "number" : "6.5.0",
    "build_flavor" : "default",
    "build_type" : "zip",
    "build_hash" : "816e6f6",
    "build_date" : "2018-11-09T18:58:36.352602Z",
    "build_snapshot" : false,
    "lucene_version" : "7.5.0",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}

kibana安装

Kibana是一个为Elasticsearch平台分析和可视化的开源平台,使用Kibana能够搜索、展示存储在Elasticsearch中的索引数据。使用它可以很方便用图表、表格、地图展示和分析数据。
Kibana能够轻松处理大量数据,通过浏览器接口能够轻松的创建和分享仪表盘,通过改变Elasticsearch查询时间,可以完成动态仪表盘。

  1. 下载安装包 下载地址
  2. 解压到某个目录 例如 D:\kibana-6.5.0-windows-x86_64
  3. 根据实际情况修改配置文件 D:\kibana-6.5.0-windows-x86_64\config
  4. 启动 D:\kibana-6.5.0-windows-x86_64\bin\kibana.bat
  5. 访问 http://localhost:5601/
    在这里插入图片描述

logstash 安装

logstash是一个数据分析软件,主要目的是分析log日志。整一套软件可以当作一个MVC模型,logstash是controller层,Elasticsearch是一个model层,kibana是view层。
首先将数据传给logstash,它将数据进行过滤和格式化(转成JSON格式),然后传给Elasticsearch进行存储、建搜索的索引,kibana提供前端的页面再进行搜索和图表可视化,它是调用Elasticsearch的接口返回的数据进行可视化。logstash和Elasticsearch是用Java写的,kibana使用node.js框架。

logstash windows 安装

  1. 解压下载的目录 D:\logstash-6.5.0
  2. 进入bin目录 执行 logstash -e “input { stdin { } } output { stdout { codec => rubydebug } }”

kanaba 中添加logstash

在这里插入图片描述

  1. 下载安装包 并解压到 D:\filebeat-6.5.0-windows-x86_64
  2. 重命名filebeat-6.5.0-windows 为FileBeat
  3. 管理员运行 PowerShell
  4. 执行install-service-filebeat.ps1
    在这里插入图片描述
  5. 修改D:\Filebeat\filebeat.yml 文件
#============================== Kibana =====================================

# Starting with Beats version 6.0.0, the dashboards are loaded via the Kibana API.
# This requires a Kibana endpoint configuration.
setup.kibana:

  # Kibana Host
  # Scheme and port can be left out and will be set to the default (http and 5601)
  # In case you specify and additional path, the scheme is required: http://localhost:5601/path
  # IPv6 addresses should always be defined as: https://[2001:db8::1]:5601
  host: "localhost:5601"

  # Kibana Space ID
  # ID of the Kibana Space into which the dashboards should be loaded. By default,
  # the Default Space will be used.
  #space.id:

#============================= Elastic Cloud ==================================

# These settings simplify using filebeat with the Elastic Cloud (https://cloud.elastic.co/).

# The cloud.id setting overwrites the `output.elasticsearch.hosts` and
# `setup.kibana.host` options.
# You can find the `cloud.id` in the Elastic Cloud web UI.
#cloud.id:

# The cloud.auth setting overwrites the `output.elasticsearch.username` and
# `output.elasticsearch.password` settings. The format is `<user>:<pass>`.
#cloud.auth:

#================================ Outputs =====================================

# Configure what output to use when sending the data collected by the beat.

#-------------------------- Elasticsearch output ------------------------------
output.elasticsearch:
  # Array of hosts to connect to.
  hosts: ["localhost:9200"]

  # Optional protocol and basic auth credentials.
  #protocol: "https"
  #username: "elastic"
  #password: "changeme"
  1. 启用和配置 logstash 模块
    在这里插入图片描述
  2. Start Filebeat
PS C:\Program Files\Filebeat> filebeat.exe setup
PS C:\Program Files\Filebeat> Start-Service filebeat

参考的文章

https://www.elastic.co/
https://www.elastic.co/guide/en/elasticsearch/reference/index.html
https://www.cnblogs.com/dreamroute/p/8484457.html
https://www.cnblogs.com/yincheng/p/logstash.html

猜你喜欢

转载自blog.csdn.net/qq_18377515/article/details/84173891