Elastic

springboot与elasticsearch整合

此生再无相见时 提交于 2020-08-05 10:31:40
资源下载: ElasticSearch官方下载地址: https://www.elastic.co/downloads/elasticsearch curl下载地址: http://curl.haxx.se/download.html Kibana下载地址: https://www.elastic.co/guide/en/kibana/4.6/index.html sense下载地址: https://download.elastic.co/elastic/sense/sense-latest.tar.gz ik分词器下载地址: https://github.com/medcl/elasticsearch-analysis-ik logstash下载地址: https://www.elastic.co/cn/downloads/logstash elasticsearch官网地址: https://www.elastic.co 注意:ElasticSearch和Kibana版本必须一致 我用到的elasticsearch版本和Kibana是 6.4.3 1,查看本地项目spring和springboot版本号 public static void main(String[] args) { System.out.println(SpringVersion.getVersion())

初级JAVA程序员应该掌握的ElasticSearch知识

爱⌒轻易说出口 提交于 2020-08-05 09:09:44
Elastic Search是什么 一个分布式的全文 检索 系统,基于RESTful web接口,具有高性能,高可用等特点。 为什么用Elastic Search? 检索比Mysql快,在要检索的数据是上亿级别的时候,一个聚合查询Mysql可能要800s,ES可能只需要1s,且ES具有分布式高可用的特点,非常适合中小型公司使用。 项目中用Elastic Search做什么? 收集数据,快速检索分析,日志分析。 Elastic Search为什么那么快? 基于Lucene,原理是倒排索引,简单来说就是给要检索的文档加了一个可以快速查询数据的目录,可以快速检索。 概念和Mysql数据库的对应 Index(索引)~Database(数据库) Type(类型)~Table(表) Document(文档)~Row(行) Field(字段)~Column(列) Mapping(映射)~Schema(方案) Query DSL(查询专用语言)~SQL(结构化查询语言) 如何使用ES 1.搜索“在Windows/linux/Mac安装ElasticSearch” 2.使用ES的JAVA API并结合文档进行操作ElasticSearch ES Java API 我们可以在Spring Boot里引入官方推荐的依赖,来操作Elastic Search, 官方文档写的很详细:https://www

elasticsearch返回指定字段

ε祈祈猫儿з 提交于 2020-08-05 06:18:29
1. postman 请求elasticsearch 返回指定字段   1.直接在请求体当中,json 数据,对应的是一个列表 {   "_source":['title','id','desc'],   "from":10,   "size":100, }    至于from和size是浅分页    2. 或者这样 { " _source " :{ "includes " :[ " title " , " url " , " id " ], "excludes " :[ " desc " ] } }   其中includes代表需要返回的字段,excludes代表不要返回的字段   3.直接在请求url带上需要查询参数 curl -XGET ' localhost:9200/_search?pretty&filter_path=took,hits.hits._id,hits.hits._score ' { " took " : 3 , " hits " : { " hits " : [ { " _id " : " 3640 " , " _score " : 1.0 }, { " _id " : " 3642 " , " _score " : 1.0 } ] } }   对_source的字段进行过滤 curl -XGET ' localhost:9200/_search

搞懂ELK并不是一件特别难的事(ELK)

三世轮回 提交于 2020-08-05 02:45:55
本篇文章主要介绍elk的一些框架组成,原理和实践,采用的ELK本版为7.7.0版本 一、ELK介绍 1.1、ELK简介   ELK是Elasticsearch、Logstash、Kibana三大开源框架首字母大写简称(但是后期出现的filebeat(beats中的一种)可以用来替代logstash的数据收集功能,比较轻量级)。市面上也被成为Elastic Stack。   Filebeat是用于转发和集中日志数据的轻量级传送工具。Filebeat监视您指定的日志文件或位置,收集日志事件,并将它们转发到Elasticsearch或 Logstash进行索引。Filebeat的工作方式如下:启动Filebeat时,它将启动一个或多个输入,这些输入将在为日志数据指定的位置中查找。对于Filebeat所找到的每个日志,Filebeat都会启动收集器。每个收集器都读取单个日志以获取新内容,并将新日志数据发送到libbeat,libbeat将聚集事件,并将聚集的数据发送到为Filebeat配置的输出。   Logstash是免费且开放的服务器端数据处理管道,能够从多个来源采集数据,转换数据,然后将数据发送到您最喜欢的“存储库”中。Logstash能够动态地采集、转换和传输数据,不受格式或复杂度的影响。利用Grok从非结构化数据中派生出结构,从IP地址解码出地理坐标,匿名化或排除敏感字段

zabbix4.4 历史数据存放elasticsearch 并定期清理

拥有回忆 提交于 2020-08-05 00:02:18
一、其他不多说 直接开始做吧 elasticsearch 安装配置 我这里测试用的2台机器安装ES6.8 rpm -ivh elasticsearch-6.8.10.rpm 集群配置 节点一 root@[ 8.1.10.146 @elastic1:/root ]# cat /etc/elasticsearch/elasticsearch.yml |grep -v "^#" cluster.name: Zabbix-history node.name: 8.1.10.146 path.data: /data/ESdata path.logs: /var/log/elasticsearch bootstrap.memory_lock: true network.host: 0.0.0.0 http.max_initial_line_length: 128k http.max_header_size: 64kb http.max_content_length: 500mb discovery.zen.ping.unicast.hosts: ["8.1.10.146", "8.1.10.147"] discovery.zen.minimum_master_nodes: 2 节点二 root@[ 8.1.10.147 @elastic2:/root ]# cat /etc

Elasticsearch到底哪点好?

笑着哭i 提交于 2020-08-04 20:23:32
少点代码,多点头发 本文已经收录至我的GitHub,欢迎大家踊跃star 和 issues。 https://github.com/midou-tech/articles 从今天开始准备给大家带来全新的一系列文章,Elasticsearch系列 新系列肯定会有很多疑惑,先为大家答疑解惑,下面是今天要讲的问题 为什么写Elasticsearch系列文章? 之前在文章中也陆陆续续的提到过,龙叔是做搜索引擎的。搜索引擎技术属于商业技术,大家耳熟能详的百度搜索,Google搜索,这可都是因为把握核心搜索技术,从而诞生了商业帝国。 每个互联网大厂都想去分一杯搜索的羹,360搜索、神马、头条、搜狗搜索等等,由此可见搜索技术的商业作用和机密性了。 搜索把握用户的入口 蘑菇街的搜索引擎是一款使用C++开发、完全自研、没有开源的搜索引擎,没有开源就是不能随便写出来的。 但是现在不一样了 第一、我离职了,离开了意味着不在持有那些商业机密了,就算不讲出来我也没啥心理负担(但还是不能讲的,离职协议写的很清楚,不能 泄露公司商业机密 )。 第二、去新的公司还是在搜索领域,他们用Es Elasticsearch是一个开源搜索,开源的东西可以随便说,但还是不能说公司的 商业数据 。 自己一直在搜索领域做,输出搜索相关的文章,第一个可以让自己更好的学习和总结,第二个可以让粉丝们了解到搜索这个神秘的技术

使用Docker和K8s搭建ELK日志收集系统

瘦欲@ 提交于 2020-08-04 18:23:47
  环境查看 # cat /etc/redhat-release CentOS Linux release 7.5.1804 (Core) [root@localhost elasticsearch]# uname -a Linux localhost.localdomain 3.10.0-862.el7.x86_64 #1 SMP Fri Apr 20 16:44:24 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux [root@localhost elasticsearch]# docker info Client: Debug Mode: false Server: Containers: 1 Running: 1 Paused: 0 Stopped: 0 Images: 5 Server Version: 19.03.8 Storage Driver: overlay2 Backing Filesystem: <unknown> Supports d_type: true Native Overlay Diff: true Logging Driver: json-file Cgroup Driver: cgroupfs Plugins: Volume: local Network: bridge host ipvlan macvlan

ElasticSearch设置用户名密码访问

删除回忆录丶 提交于 2020-08-04 16:39:33
版本号:7.3.1 1.需要在配置文件中开启x-pack验证, 修改config目录下面的elasticsearch.yml文件,在里面添加如下内容,并重启. xpack.security.enabled: true xpack.license.self_generated.type: basic xpack.security.transport.ssl.enabled: true 2,执行设置用户名和密码的命令,这里需要为4个用户分别设置密码,elastic, kibana, logstash_system,beats_system bin/elasticsearch-setup-passwords interactive Initiating the setup of passwords for reserved users elastic,kibana,logstash_system,beats_system. You will be prompted to enter passwords as the process progresses. Please confirm that you would like to continue [y/ N]y Enter password for [elastic]: passwords must be at least [ 6 ]

elasticsearch 开启密码验证,让你的数据不再裸奔

∥☆過路亽.° 提交于 2020-08-04 09:29:16
官方给的消息是从6.8 和 7.1 开始默认提供。这对于那些裸奔在互联网的搜索服务来说,绝对是一个好消息。 配置起来也很简单。 第一步:切换到elastsearch的目录下,使用下列命令生成证书 bin/elasticsearch-certutil cert - out config/elastic-certificates.p12 -pass "" 第二步:打开config/elasticsearch.yaml,在尾部添加下面一行代码: xpack.security.enabled: true xpack.security.transport.ssl.enabled: true xpack.security.transport.ssl.verification_mode: certificate xpack.security.transport.ssl.keystore.path: elastic-certificates.p12 xpack.security.transport.ssl.truststore.path: elastic-certificates.p12 然后启动elasticsearch 第三步:新打开一个终端,使用cd命令切换到elasticsearch目录,然后使用 bin/elasticsearch-setup-passwords auto