使用 dmesg 来查看一些硬件或驱动程序的信息或问题。

社区日报 第1191期 (2021-02-05)

 1、SpringBoot 集成 Elasticsearch 指南(梯子)
 https://medium.com/better-prog ... 2b60b
 2、Observability:网站 User Experience 监控
https://elasticstack.blog.csdn ... 46386
 3、一周之内如何搞定 Elasticsearch,看老外怎么说?(梯子)
 https://www.quora.com/I-have-b ... -week
 
编辑:铭毅天下
归档:https://ela.st/cn-daily-all
订阅:https://ela.st/cn-daily-sub
沙龙:https://ela.st/cn-meetup
继续阅读 »
 1、SpringBoot 集成 Elasticsearch 指南(梯子)
 https://medium.com/better-prog ... 2b60b
 2、Observability:网站 User Experience 监控
https://elasticstack.blog.csdn ... 46386
 3、一周之内如何搞定 Elasticsearch,看老外怎么说?(梯子)
 https://www.quora.com/I-have-b ... -week
 
编辑:铭毅天下
归档:https://ela.st/cn-daily-all
订阅:https://ela.st/cn-daily-sub
沙龙:https://ela.st/cn-meetup 收起阅读 »

Observability:网站 User Experience 监控

用户体验(User Experience)提供了一种量化和分析 Web 应用程序感知性能的方法。 与测试环境不同,用户体验数据反映了真实的用户体验。 通过按 URL,操作系统,浏览器和位置查看数据来进一步细化 - 所有这些都会影响您的应用程序在最终用户计算机上的性能。通过用户体验监控,我们可以知道谁在使用我们的网站,他们的用户体验咋样。
 
详细阅读,请参阅 https://elasticstack.blog.csdn ... 46386
继续阅读 »
用户体验(User Experience)提供了一种量化和分析 Web 应用程序感知性能的方法。 与测试环境不同,用户体验数据反映了真实的用户体验。 通过按 URL,操作系统,浏览器和位置查看数据来进一步细化 - 所有这些都会影响您的应用程序在最终用户计算机上的性能。通过用户体验监控,我们可以知道谁在使用我们的网站,他们的用户体验咋样。
 
详细阅读,请参阅 https://elasticstack.blog.csdn ... 46386 收起阅读 »

社区日报 第1190期 (2021-02-04)

1.Elastic License v2简介
https://www.elastic.co/blog/elastic-license-v2
2.为 Elastic Security 定制 Detection rules
https://elasticstack.blog.csdn ... 84031
3.基于 Elasticsearch 的数据报表方案
https://www.jianshu.com/p/24b4ba3951eb

编辑:金桥
归档:https://ela.st/cn-daily-all
订阅:https://ela.st/cn-daily-sub
沙龙:https://ela.st/cn-meetup
继续阅读 »
1.Elastic License v2简介
https://www.elastic.co/blog/elastic-license-v2
2.为 Elastic Security 定制 Detection rules
https://elasticstack.blog.csdn ... 84031
3.基于 Elasticsearch 的数据报表方案
https://www.jianshu.com/p/24b4ba3951eb

编辑:金桥
归档:https://ela.st/cn-daily-all
订阅:https://ela.st/cn-daily-sub
沙龙:https://ela.st/cn-meetup
收起阅读 »

社区日报 第1189期 (2021-02-3)

1.2021 年 Elasticsearch 生态和技术峰会干货总结
https://mp.weixin.qq.com/s/3PihgMYpkSA-jJYFcLwrVg
2.使用 Dorothy 和 Elastic 安全测试您的 Okta 可见性和检测能力
https://www.elastic.co/cn/blog ... rothy
3.将日志数据从Jenkins传输到Kibana
https://blogs.sap.com/2019/04/ ... oard/

编辑:寂寞的烟
归档:https://ela.st/cn-daily-all
订阅:https://ela.st/cn-daily-sub
沙龙:https://ela.st/cn-meetup
继续阅读 »
1.2021 年 Elasticsearch 生态和技术峰会干货总结
https://mp.weixin.qq.com/s/3PihgMYpkSA-jJYFcLwrVg
2.使用 Dorothy 和 Elastic 安全测试您的 Okta 可见性和检测能力
https://www.elastic.co/cn/blog ... rothy
3.将日志数据从Jenkins传输到Kibana
https://blogs.sap.com/2019/04/ ... oard/

编辑:寂寞的烟
归档:https://ela.st/cn-daily-all
订阅:https://ela.st/cn-daily-sub
沙龙:https://ela.st/cn-meetup 收起阅读 »

社区日报 第1188期 (2021-02-02)

1.Elasticsearch 聚合性能优化六大猛招
https://mp.weixin.qq.com/s/_eS0IndE0p2SYZVwn7TnbA

2.Elasticsearch使用:Routing API
https://cloud.tencent.com/deve ... 82295

3.ElasticSearch入门详解(结合Kibana)
https://www.jianshu.com/p/92e49c18ac96

编辑:叮咚光军
归档:https://ela.st/cn-daily-all
订阅:https://ela.st/cn-daily-sub
沙龙:https://ela.st/cn-meetup
继续阅读 »
1.Elasticsearch 聚合性能优化六大猛招
https://mp.weixin.qq.com/s/_eS0IndE0p2SYZVwn7TnbA

2.Elasticsearch使用:Routing API
https://cloud.tencent.com/deve ... 82295

3.ElasticSearch入门详解(结合Kibana)
https://www.jianshu.com/p/92e49c18ac96

编辑:叮咚光军
归档:https://ela.st/cn-daily-all
订阅:https://ela.st/cn-daily-sub
沙龙:https://ela.st/cn-meetup 收起阅读 »

社区日报 第1187期 (2021-02-01)

1.ElasticSearch的缓存清除策略
https://my.oschina.net/LucasZhu/blog/1570733

2.ElasticSearch Machine Learning
https://www.bmc.com/blogs/elas ... ning/

3.使用elasticsearch 进行异常诊断
https://www.invivoo.com/blog/m ... -elk/

编辑:cyberdak
归档:https://ela.st/cn-daily-all
订阅:https://ela.st/cn-daily-sub
沙龙:https://ela.st/cn-meetup
继续阅读 »
1.ElasticSearch的缓存清除策略
https://my.oschina.net/LucasZhu/blog/1570733

2.ElasticSearch Machine Learning
https://www.bmc.com/blogs/elas ... ning/

3.使用elasticsearch 进行异常诊断
https://www.invivoo.com/blog/m ... -elk/

编辑:cyberdak
归档:https://ela.st/cn-daily-all
订阅:https://ela.st/cn-daily-sub
沙龙:https://ela.st/cn-meetup 收起阅读 »

社区日报 第1186期 (2021-01-31)

1.搜索引擎比较– Elasticsearch,Solr还是Vespa? 
https://www.meetup.com/Haystac ... 20872 
2.(自备梯子)用于presto的高性能Elasticsearch连接器。 
https://blog.bigdataboutique.c ... uvf0w 
3.构建SaaS的首选堆栈。 
https://www.simplecto.com/dock ... 2021/

编辑:至尊宝
归档:https://ela.st/cn-daily-all 
订阅:https://ela.st/cn-daily-sub 
沙龙:https://ela.st/cn-meetup
继续阅读 »
1.搜索引擎比较– Elasticsearch,Solr还是Vespa? 
https://www.meetup.com/Haystac ... 20872 
2.(自备梯子)用于presto的高性能Elasticsearch连接器。 
https://blog.bigdataboutique.c ... uvf0w 
3.构建SaaS的首选堆栈。 
https://www.simplecto.com/dock ... 2021/

编辑:至尊宝
归档:https://ela.st/cn-daily-all 
订阅:https://ela.st/cn-daily-sub 
沙龙:https://ela.st/cn-meetup 收起阅读 »

社区日报 第1184期 (2021-01-29)

1、Ansible自动化部署 Elastic Stack 
https://elasticstack.blog.csdn ... 67307
 
 2、踩坑日志之elasticSearch
 https://mp.weixin.qq.com/s/9TTGQRTFSLJo9-APnNh-SQ
 
 3、Elasticsearch中的相似度评分介绍
 https://cloud.tencent.com/developer/news/762466
 
编辑:铭毅天下
归档:https://ela.st/cn-daily-all
订阅:https://ela.st/cn-daily-sub
沙龙:https://ela.st/cn-meetup
继续阅读 »
1、Ansible自动化部署 Elastic Stack 
https://elasticstack.blog.csdn ... 67307
 
 2、踩坑日志之elasticSearch
 https://mp.weixin.qq.com/s/9TTGQRTFSLJo9-APnNh-SQ
 
 3、Elasticsearch中的相似度评分介绍
 https://cloud.tencent.com/developer/news/762466
 
编辑:铭毅天下
归档:https://ela.st/cn-daily-all
订阅:https://ela.st/cn-daily-sub
沙龙:https://ela.st/cn-meetup 收起阅读 »

Elasticsearch:EQL 入门 - 使用 EQL 检测威胁

EQL 的全名是 Event Query Language (EQL)。事件查询语言(EQL)是一种用于基于事件的时间序列数据(例如日志,指标和跟踪)的查询语言。EQL 在 Elastic Security 中被广泛使用。 
 
详细阅读,请参阅 https://elasticstack.blog.csdn ... 89999
继续阅读 »
EQL 的全名是 Event Query Language (EQL)。事件查询语言(EQL)是一种用于基于事件的时间序列数据(例如日志,指标和跟踪)的查询语言。EQL 在 Elastic Security 中被广泛使用。 
 
详细阅读,请参阅 https://elasticstack.blog.csdn ... 89999 收起阅读 »

社区日报 第1183期 (2021-01-28)

1.如何摄入 Websocket 数据到 Elasticsearch
https://elasticstack.blog.csdn ... 07195
2.提升四倍索引速度的办法
https://elasticsearch.cn/article/14228
3.滴滴Logi日志服务套件
https://blog.csdn.net/changxia ... 26532

编辑:金桥
归档:https://ela.st/cn-daily-all
订阅:https://ela.st/cn-daily-sub
沙龙:https://ela.st/cn-meetup
继续阅读 »
1.如何摄入 Websocket 数据到 Elasticsearch
https://elasticstack.blog.csdn ... 07195
2.提升四倍索引速度的办法
https://elasticsearch.cn/article/14228
3.滴滴Logi日志服务套件
https://blog.csdn.net/changxia ... 26532

编辑:金桥
归档:https://ela.st/cn-daily-all
订阅:https://ela.st/cn-daily-sub
沙龙:https://ela.st/cn-meetup 收起阅读 »

Elasticsearch生态&技术峰会


    开源最大的特征就是开放性,云生态则让开源技术更具开放性与创造性,Elastic 与阿里云的合作正是开源与云生态共生共荣的典范。值此合作三周年之际,我们邀请业界资深人士相聚云端,共话云上Elasticsearch生态与技术的未来。
 
    本次峰会邀请了阿里巴巴副总裁/阿里云智能高级研究员贾扬清、Elastic创始人&CEO Shay Banon共话开源与云生态未来发展之路,也汇聚了13位Elasticsearch技术领域资深的专家带来最前沿的技术分享。
 
    活动时间:2021年2月2日
    直播地址:https://developer.aliyun.com/t ... c9fkf 
 

es20210202.png

 
 

es_dingdinggroup.png

 
继续阅读 »

    开源最大的特征就是开放性,云生态则让开源技术更具开放性与创造性,Elastic 与阿里云的合作正是开源与云生态共生共荣的典范。值此合作三周年之际,我们邀请业界资深人士相聚云端,共话云上Elasticsearch生态与技术的未来。
 
    本次峰会邀请了阿里巴巴副总裁/阿里云智能高级研究员贾扬清、Elastic创始人&CEO Shay Banon共话开源与云生态未来发展之路,也汇聚了13位Elasticsearch技术领域资深的专家带来最前沿的技术分享。
 
    活动时间:2021年2月2日
    直播地址:https://developer.aliyun.com/t ... c9fkf 
 

es20210202.png

 
 

es_dingdinggroup.png

  收起阅读 »

如何使用 Ansible自动化部署 Elastic Stack

Ansible 是新出现的自动化运维工具,基于Python开发,集合了众多运维工具(puppet、chef、func、fabric)的优点,实现了批量系统配置、批量程序部署、批量运行命令等功能。Ansible 是基于 paramiko 开发的,并且基于模块化工作,本身没有批量部署的能力。真正具有批量部署的是 ansible 所运行的模块,ansible 只是提供一种框架。ansible 不需要在远程主机上安装 client/agents,因为它们是基于 ssh 来和远程主机通讯的。ansible 目前已经已经被红帽官方收购,是自动化运维工具中大家认可度最高的,并且上手容易,学习简单。是每位运维工程师必须掌握的技能之一。
 
如果你想了解 ansible 是如何部署 Elastic Stack 的,请阅读系列文章:
 
如何使用 Ansible自动化部署 Elastic Stack - Overview(一)

如何使用 Ansible自动化部署 Elastic Stack - Elasticsearch (二)

如何使用 Ansible自动化部署 Elastic Stack - Kibana(三)

Elastic:如何使用 Ansible自动化部署 Elastic Stack -Security(四)

如何使用 Ansible自动化部署 Elastic Stack -Metricbeat(五)
继续阅读 »
Ansible 是新出现的自动化运维工具,基于Python开发,集合了众多运维工具(puppet、chef、func、fabric)的优点,实现了批量系统配置、批量程序部署、批量运行命令等功能。Ansible 是基于 paramiko 开发的,并且基于模块化工作,本身没有批量部署的能力。真正具有批量部署的是 ansible 所运行的模块,ansible 只是提供一种框架。ansible 不需要在远程主机上安装 client/agents,因为它们是基于 ssh 来和远程主机通讯的。ansible 目前已经已经被红帽官方收购,是自动化运维工具中大家认可度最高的,并且上手容易,学习简单。是每位运维工程师必须掌握的技能之一。
 
如果你想了解 ansible 是如何部署 Elastic Stack 的,请阅读系列文章:
 
如何使用 Ansible自动化部署 Elastic Stack - Overview(一)

如何使用 Ansible自动化部署 Elastic Stack - Elasticsearch (二)

如何使用 Ansible自动化部署 Elastic Stack - Kibana(三)

Elastic:如何使用 Ansible自动化部署 Elastic Stack -Security(四)

如何使用 Ansible自动化部署 Elastic Stack -Metricbeat(五) 收起阅读 »

四倍索引速度提升, 有点东西

最近看到 INFINI Gateway 新增了一个 bulk_reshuffle filter, 于是便简单地测试一下这个功能。(Gateway 下载地址 以及 参考文档)

测试机器配置

系统 处理器 内存
Macos 2 GHz 四核Intel Core i5 16 GB

测试所需软件及版本

  1. Elasticsearch 7.10
  2. Kibana 7.10
  3. INFINI Gateway 最新版本
  4. Logstash 7.10
  5. Metricbeat 7.10

本文就省略以上软件的下载和安装步骤了。 另外本文中测试 Elasticsearch 集群含两个节点,每个节点配置内存都为 1GB ,其他参数均为默认。

测试步骤

准备测试数据文件

本文测试数据文件 nginx_mock_log ,文件中每行结构如下:

{"timestamp":1611540661651,"method":"POST","msg":"mock log"}

大概一千多万条

Logstatsh 使用 Input file 模式直接输出数据到 Elasticsearch

编辑 Logstash 配置 test.conf 如下:

input{
     file {
        path => ["/test/nginx_mock_log"]
        type => "file_monitor"
        start_position => "beginning"
    }
}

output{
    elasticsearch {
        hosts => ["localhost:9200"]
        index => "nginx_mock_log"
        http_compression => false
    }
}

在 kibana 中创建索引 nginx_mock_log ,将主分片设置为2(为了体现出 Gateway的性能优势, 主分片数应设置大于1), 配置如下:


PUT nginx_mock_log
{
"mappings" : {
      "properties" : {
        "@timestamp" : {
          "type" : "date"
        },
        "@version" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "host" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "message" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "path" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "type" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        }
      }
    },
    "settings" : {
        "number_of_shards" : "2"
    }
}

运行 Logstash

/usr/local/logstash/bin/logstash -f test.conf

打开 Kibana Stack Monitorning 查看 Indexing Rate 监控指标如下图:

1.png

从图中可以看到索引速率基本保持在4300/s 上下

Logstatsh 使用 Input file 模式输出数据到 Gateway

进入 Kibana 删除索引 nginx_mock_log 并重建

DELETE nginx_mock_log

PUT nginx_mock_log
{
"mappings" : {
      "properties" : {
        "@timestamp" : {
          "type" : "date"
        },
        "@version" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "host" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "message" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "path" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "type" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        }
      }
    },
    "settings" : {
        "number_of_shards" : "2"
    }
}

修改 Logstash 配置 test.conf 如下:

input{
     file {
        path => ["/test/nginx_mock_log"]
        type => "file_monitor"
        start_position => "beginning"
    }
}

output{
    elasticsearch {
        hosts => ["localhost:8000"]
        index => "nginx_mock_log"
        http_compression => false
    }
}

修改 Gateway 配置文件 gateway.yaml 如下:

path.data: data
path.logs: log

entry:
  - name: es_gateway #your gateway endpoint
    enabled: true
    router: default
    network:
      binding: localhost:8000
      reuse_port: true #you can start multi gateway instance, they share same port, to full utilize system's resources

flow:
  - name: bulk_es_test
    filter: #comment out any filter sections, like you don't need cache or rate-limiter
      - name: bulk_reshuffle
        parameters:
          elasticsearch: dev
          level: node
          mode: async
      - name: elasticsearch
        parameters:
          elasticsearch: dev
          refresh:
            enabled: true
            interval: 30s
  - name: request_logging
    filter:
      - name: request_logging
        parameters:
          queue_name: request_logging
router:
  - name: default
    default_flow: bulk_es_test
    tracing_flow: request_logging

elasticsearch:
- name: dev
  enabled: true
  endpoint: http://localhost:9200 # if your elasticsearch is using https, your gateway should be listen on as https as well
  basic_auth: #used to discovery full cluster nodes, or check elasticsearch's health and versions
    username: elastic
    password: yV6syH3KLt4DxqMlCyag
  discovery: # auto discovery elasticsearch cluster nodes
    enabled: true
    refresh:
      enabled: true

modules:
- name: elastic
  enabled: true
  elasticsearch: dev
  store:
    enabled: true
  orm:
    enabled: true
    init_template: true
    template_name: ".infini-default1"
    index_prefix: "gateway_"

- name: pipeline
  enabled: true
  runners:
    - name: nodes_index
      enabled: true
      max_go_routine: 2
      threshold_in_ms: 0
      timeout_in_ms: 5000
      pipeline_id: bulk_request_ingest
    - name: request_logging_test_name
      enabled: true
      max_go_routine: 2
      threshold_in_ms: 0
      timeout_in_ms: 5000
      pipeline_id: request_logging_index

pipelines:
- name: bulk_request_ingest
  start:
    joint: bulk_indexing
    enabled: true
    parameters:
      elasticsearch: "dev"
      timeout: "5s"
      worker_size: 10
      bulk_size_in_mb: 1 #in MB
- name: request_logging_index
  start:
    joint: json_indexing
    enabled: true
    parameters:
      index_name: "gateway_requests"
      elasticsearch: "dev"
      input_queue: "request_logging"
      timeout: "5s"
      worker_size: 10
      bulk_size_in_mb: 1 #in MB

queue:
  min_msg_size: 1
  max_msg_size: 5000000000
  max_bytes_per_file: 53687091200
  sync_every_records: 100000 # sync by records count
  sync_timeout_in_ms: 10000 # sync by time in million seconds
  write_chan_buffer: 1000
  read_chan_buffer: 1000

以上各配置节点含义,请参考 Gateway 文档

启动 Gateway ./gateway

删除 Logstash data 目录

rm -rf /usr/local/logstash/data

启动 Logstash

/usr/local/logstash/bin/logstash -f test.conf

打开 Kibana Stack Monitorning 查看 Indexing Rate 监控指标如下图:

2.png

从上图后半部分可以看到索引速率可以保持在 25000/s 上下(一会儿的功夫,一千多万条数据导入ES完事了)

前面看到 Gateway 配置开启了 request_logging,因此可以在 Kibana Dashboard 里面的 INFINI Gateway Dashboard 查看请求信息,如下图:

3.png

4.png

注意,上面图中的请求速率是 _bulk 请求的速率,不是索引速率

总结

从测试结果来看,相同环境下,用 Logstash elasticsearch output 输出数据到 Gateway 的方式比 Logstash elasticsearch output 直接到 ES 的方式速率快了4倍,不得不说这速率是真的杠杠的。至于能不能通过参数调优再提升速率呢?大家有兴趣的自己下载测试吧!最后感谢 medcl 大神出品。

继续阅读 »

最近看到 INFINI Gateway 新增了一个 bulk_reshuffle filter, 于是便简单地测试一下这个功能。(Gateway 下载地址 以及 参考文档)

测试机器配置

系统 处理器 内存
Macos 2 GHz 四核Intel Core i5 16 GB

测试所需软件及版本

  1. Elasticsearch 7.10
  2. Kibana 7.10
  3. INFINI Gateway 最新版本
  4. Logstash 7.10
  5. Metricbeat 7.10

本文就省略以上软件的下载和安装步骤了。 另外本文中测试 Elasticsearch 集群含两个节点,每个节点配置内存都为 1GB ,其他参数均为默认。

测试步骤

准备测试数据文件

本文测试数据文件 nginx_mock_log ,文件中每行结构如下:

{"timestamp":1611540661651,"method":"POST","msg":"mock log"}

大概一千多万条

Logstatsh 使用 Input file 模式直接输出数据到 Elasticsearch

编辑 Logstash 配置 test.conf 如下:

input{
     file {
        path => ["/test/nginx_mock_log"]
        type => "file_monitor"
        start_position => "beginning"
    }
}

output{
    elasticsearch {
        hosts => ["localhost:9200"]
        index => "nginx_mock_log"
        http_compression => false
    }
}

在 kibana 中创建索引 nginx_mock_log ,将主分片设置为2(为了体现出 Gateway的性能优势, 主分片数应设置大于1), 配置如下:


PUT nginx_mock_log
{
"mappings" : {
      "properties" : {
        "@timestamp" : {
          "type" : "date"
        },
        "@version" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "host" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "message" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "path" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "type" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        }
      }
    },
    "settings" : {
        "number_of_shards" : "2"
    }
}

运行 Logstash

/usr/local/logstash/bin/logstash -f test.conf

打开 Kibana Stack Monitorning 查看 Indexing Rate 监控指标如下图:

1.png

从图中可以看到索引速率基本保持在4300/s 上下

Logstatsh 使用 Input file 模式输出数据到 Gateway

进入 Kibana 删除索引 nginx_mock_log 并重建

DELETE nginx_mock_log

PUT nginx_mock_log
{
"mappings" : {
      "properties" : {
        "@timestamp" : {
          "type" : "date"
        },
        "@version" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "host" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "message" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "path" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "type" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        }
      }
    },
    "settings" : {
        "number_of_shards" : "2"
    }
}

修改 Logstash 配置 test.conf 如下:

input{
     file {
        path => ["/test/nginx_mock_log"]
        type => "file_monitor"
        start_position => "beginning"
    }
}

output{
    elasticsearch {
        hosts => ["localhost:8000"]
        index => "nginx_mock_log"
        http_compression => false
    }
}

修改 Gateway 配置文件 gateway.yaml 如下:

path.data: data
path.logs: log

entry:
  - name: es_gateway #your gateway endpoint
    enabled: true
    router: default
    network:
      binding: localhost:8000
      reuse_port: true #you can start multi gateway instance, they share same port, to full utilize system's resources

flow:
  - name: bulk_es_test
    filter: #comment out any filter sections, like you don't need cache or rate-limiter
      - name: bulk_reshuffle
        parameters:
          elasticsearch: dev
          level: node
          mode: async
      - name: elasticsearch
        parameters:
          elasticsearch: dev
          refresh:
            enabled: true
            interval: 30s
  - name: request_logging
    filter:
      - name: request_logging
        parameters:
          queue_name: request_logging
router:
  - name: default
    default_flow: bulk_es_test
    tracing_flow: request_logging

elasticsearch:
- name: dev
  enabled: true
  endpoint: http://localhost:9200 # if your elasticsearch is using https, your gateway should be listen on as https as well
  basic_auth: #used to discovery full cluster nodes, or check elasticsearch's health and versions
    username: elastic
    password: yV6syH3KLt4DxqMlCyag
  discovery: # auto discovery elasticsearch cluster nodes
    enabled: true
    refresh:
      enabled: true

modules:
- name: elastic
  enabled: true
  elasticsearch: dev
  store:
    enabled: true
  orm:
    enabled: true
    init_template: true
    template_name: ".infini-default1"
    index_prefix: "gateway_"

- name: pipeline
  enabled: true
  runners:
    - name: nodes_index
      enabled: true
      max_go_routine: 2
      threshold_in_ms: 0
      timeout_in_ms: 5000
      pipeline_id: bulk_request_ingest
    - name: request_logging_test_name
      enabled: true
      max_go_routine: 2
      threshold_in_ms: 0
      timeout_in_ms: 5000
      pipeline_id: request_logging_index

pipelines:
- name: bulk_request_ingest
  start:
    joint: bulk_indexing
    enabled: true
    parameters:
      elasticsearch: "dev"
      timeout: "5s"
      worker_size: 10
      bulk_size_in_mb: 1 #in MB
- name: request_logging_index
  start:
    joint: json_indexing
    enabled: true
    parameters:
      index_name: "gateway_requests"
      elasticsearch: "dev"
      input_queue: "request_logging"
      timeout: "5s"
      worker_size: 10
      bulk_size_in_mb: 1 #in MB

queue:
  min_msg_size: 1
  max_msg_size: 5000000000
  max_bytes_per_file: 53687091200
  sync_every_records: 100000 # sync by records count
  sync_timeout_in_ms: 10000 # sync by time in million seconds
  write_chan_buffer: 1000
  read_chan_buffer: 1000

以上各配置节点含义,请参考 Gateway 文档

启动 Gateway ./gateway

删除 Logstash data 目录

rm -rf /usr/local/logstash/data

启动 Logstash

/usr/local/logstash/bin/logstash -f test.conf

打开 Kibana Stack Monitorning 查看 Indexing Rate 监控指标如下图:

2.png

从上图后半部分可以看到索引速率可以保持在 25000/s 上下(一会儿的功夫,一千多万条数据导入ES完事了)

前面看到 Gateway 配置开启了 request_logging,因此可以在 Kibana Dashboard 里面的 INFINI Gateway Dashboard 查看请求信息,如下图:

3.png

4.png

注意,上面图中的请求速率是 _bulk 请求的速率,不是索引速率

总结

从测试结果来看,相同环境下,用 Logstash elasticsearch output 输出数据到 Gateway 的方式比 Logstash elasticsearch output 直接到 ES 的方式速率快了4倍,不得不说这速率是真的杠杠的。至于能不能通过参数调优再提升速率呢?大家有兴趣的自己下载测试吧!最后感谢 medcl 大神出品。

收起阅读 »