Lucene是一套信息检索工具包!jar包,不好含搜索引擎系统!
包含的:索引结构!读写索引的工具!排序,搜索规则。。。工具包
Lucene 和 ElasticSearch关系:
ElasticSearch 是基于lucene做了一些封装和增强!
只要学不死,就往死里学!
谁在使用
ElasticSearch 是一个实时分布式搜索和分析引擎。
用于全文搜索、结构化搜索、分析以及将这三者混合使用;
jdk1.8最低要求!
ES依赖于java,确保java环境安装正确。
windows安装
1、解压就可以使用
2、熟悉目录
bin #启动目录
config #配置文件
log4j2 #日志配置文件
jvm.options #java虚拟机相关配置
elasticsearch.yml #elasticsearch 配置文件,默认端口 9200
lib #相关jar包
modules #功能模块
plugins #插件
3、启动
bin目录下面,elasticSearch.bat,双击即可启动!
4、访问测试
步骤:
1、进入head 目录,然后通过cmd进入,输入 cnpm install ,等待安装完成。
2、继续输入命令: npm run start
问题:出现了跨域问题:
解决跨域问题:
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 插件安装完毕。
把索引就是一个数据库!可以建立索引(库)、文档(库中的数据)
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/
1、索引
2、字段类型(mapping 映射)
3、文档
4、分片(倒序排列)
精确查询
GET kuang/user/_search?q=name:狂神说java
原文:https://www.cnblogs.com/wanglichaoya/p/ELK.html