首页 > 其他 > 详细

ELK学习

时间:2020-12-23 09:02:40      阅读:28      评论:0      收藏:0      [点我收藏+]

 

 

Lucene是一套信息检索工具包!jar包,不好含搜索引擎系统!

包含的:索引结构!读写索引的工具!排序,搜索规则。。。工具包

Lucene 和 ElasticSearch关系:

ElasticSearch 是基于lucene做了一些封装和增强!

只要学不死,就往死里学!

 

ElasticSearch概述

技术分享图片

 

 

历史

技术分享图片

 

 

 

谁在使用

技术分享图片

 

 

 

ES和solr的差别

ElasticSearch简介

ElasticSearch 是一个实时分布式搜索和分析引擎。

用于全文搜索结构化搜索分析以及将这三者混合使用;

Solr简介

技术分享图片

 

 

 

Lucene简介

技术分享图片

 

 

 

ElasticSearch 和 solr比较

技术分享图片

 

 

技术分享图片

 

 

 技术分享图片

 

 

 技术分享图片

 

 

 

ElasticSearch安装

jdk1.8最低要求!

ES依赖于java,确保java环境安装正确。

安装

https://www.elastic.co/cn/

windows安装

1、解压就可以使用

2、熟悉目录

 bin #启动目录
 config #配置文件
   log4j2 #日志配置文件
   jvm.options #java虚拟机相关配置
   elasticsearch.yml #elasticsearch 配置文件,默认端口 9200
 lib  #相关jar包
 modules #功能模块
 plugins  #插件

 


3、启动

bin目录下面,elasticSearch.bat,双击即可启动!

技术分享图片

 

 

 

4、访问测试

技术分享图片

 

 

 安装可视化界面es head 插件

步骤:

1、进入head 目录,然后通过cmd进入,输入  cnpm install  ,等待安装完成。

技术分享图片

 

 

 技术分享图片

 

 

 技术分享图片

 

 

 2、继续输入命令: npm run start

技术分享图片

 

 

 

 技术分享图片

 

 

 问题:出现了跨域问题:

技术分享图片

 

 

 解决跨域问题

  1. 先停掉ElasticSearch,然后进入到ElasticSearch的安装目录下面,找到yml 文件,然后在最后一行输入:
  2. 技术分享图片

     

     

http.cors.enabled: true
http.cors.allow-origin: "*"

 

       

# ======================== Elasticsearch Configuration =========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
#       Before you set out to tweak and tune the configuration, make sure you
#       understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please consult the documentation for further information on configuration options:
# https://www.elastic.co/guide/en/elasticsearch/reference/index.html
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
#cluster.name: my-application
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
#node.name: node-1
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
#path.data: /path/to/data
#
# Path to log files:
#
#path.logs: /path/to/logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
#bootstrap.memory_lock: true
#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
#network.host: 192.168.0.1
#
# Set a custom port for HTTP:
#
#http.port: 9200
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when this node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
#discovery.seed_hosts: ["host1", "host2"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
#cluster.initial_master_nodes: ["node-1", "node-2"]
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
#gateway.recover_after_nodes: 3
#
# For more information, consult the gateway module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true


http.cors.enabled: true
http.cors.allow-origin: "*"

 

再次启动ElasticSearch.bat  如下图所示,就表示Es Head 插件安装完毕。

技术分享图片

 

 

 

把索引就是一个数据库!可以建立索引(库)、文档(库中的数据)

安装Kibana

 

了解ELK

ELK 是ElasticSearch 、Logstash 、Kibana 三大框架首字母大写简称。 也称作:Elastic Stack。

   1、 其中ElasticSearch 是一个基于 Lucene 、分布式、通过Restful 方式进行交互的近实时的搜索平台框架。

   2、 Logstash 是ELK 的中央数据流引擎,是用来从不同的渠道(文件,数据存储,redis,MQ消息队列中)收集不同格式的数据的,通过过滤候支持输出到不同过的目的地(文件、MQ、redis、elasticsearch、kafaka等

   3、 Kibana 可以把ElasticSearch 的数据展示出来,用来展示数据的。

技术分享图片

 

 

 安装Kibana

在kibana的bin目录下面,双击kibana.bat文件即可启动;可以看下,kibana.bat 是基于node 来启动的,所以要先安装node的环境

技术分享图片

 

 

 技术分享图片

 启动

1、双击bibana.bat

技术分享图片

 

 

技术分享图片

 

 

 2、在浏览器中访问  http://localhost:5601/

 技术分享图片

 

 

 

 

ES核心概念

1、索引

2、字段类型(mapping 映射)

3、文档

4、分片(倒序排列)

技术分享图片

 

精确查询

 GET kuang/user/_search?q=name:狂神说java

 

ELK学习

原文:https://www.cnblogs.com/wanglichaoya/p/ELK.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!