Solr 可观测性最佳实践

Solr 介绍

Solr 是一个开源的搜索平台,由 Apache 软件基金会维护。它建立在 Apache Lucene 项目之上,提供了一个完整的搜索应用服务器,具有高度可靠、可扩展和容错的特性。

监控 Solr 指标如服务器负载、内存使用、索引情况、查询性能、缓存命中率等,可以帮助了解 Solr 的运行状况,发现潜在问题,并进行相应的优化。

观测云

观测云是一款专为 IT 工程师打造的全链路可观测产品,它集成了基础设施监控、应用程序性能监控和日志管理,为整个技术栈提供实时可观察性。这款产品能够帮助工程师全面了解端到端的用户体验追踪,了解应用内函数的每一次调用,以及全面监控云时代的基础设施。此外,观测云还具备快速发现系统安全风险的能力,为数字化时代提供安全保障。

部署 DataKit

DataKit 是一个开源的、跨平台的数据收集和监控工具,由观测云开发并维护。它旨在帮助用户收集、处理和分析各种数据源,如日志、指标和事件,以便进行有效的监控和故障排查。DataKit 支持多种数据输入和输出格式,可以轻松集成到现有的监控系统中。

登录观测云控制台,在「集成」 - 「DataKit」选择对应安装方式,当前采用 Linux 主机部署 DataKit。

采集器配置

进入 DataKit 安装目录下的 conf.d/db 目录,复制 solr.conf.sample 并命名为 solr.conf。示例如下:

ini 复制代码
[[inputs.solr]]
  ##(optional) collect interval, default is 10 seconds
  interval = '10s'

  ## specify a list of one or more Solr servers
  servers = ["http://localhost:8983"]

  ## Optional HTTP Basic Auth Credentials
  # username = "username"
  # password = "pa$$word"

  ## Set true to enable election
  election = true

  # [inputs.solr.log]
  # files = []
  # #grok pipeline script path
  # pipeline = "solr.p"

  [inputs.solr.tags]
  # some_tag = "some_value"
  # more_tag = "some_other_value"

配置好后,重启 DataKit 即可。

关键指标

以下是一些关键的 Solr 指标,这些指标对于监控 Solr 的性能和稳定性至关重要。

Metric Description Type Unit
hitratio Ratio of cache hits to lookups for the current index searcher. float percent
hits Number of hits for the current index searcher. int count
lookups Number of lookups against the cache. int count
size Number of entries in the cache at that particular instance. int count
ram_bytes_used Actual heap usage of the cache at that particular instance. int B
max_ram Maximum heap that should be used by the cache beyond which keys will be evicted. int MB
count Total number of requests made since the Solr process was started. int count
mean Mean of all the request processing time. float ms
median Median of all the request processing time. float ms
p95 Request processing time in milliseconds for the request which belongs to the 95th Percentile. float ms
p99 Request processing time in milliseconds for the request which belongs to the 99th Percentile. float ms
rate_1min Requests per second received over the past 1 minutes. float req/s
rate_5min Requests per second received over the past 5 minutes. float req/s
rate_15min Requests per second received over the past 15 minutes. float req/s
num_docs The total number of indexed documents. int count
deleted_docs The number of deleted documents. int count
warmup The time spent warming up. int ms

场景视图

登录观测云控制台,点击「场景」 -「新建仪表板」,输入 "Solr", 选择 "Solr 监控视图",点击 "确定" 即可添加视图。

监控器(告警)

Solr 实例缓存命中率小于 60% 就触发告警,提醒用户缓存配置需要优化。

Solr 实例 P95 请求响应时间大于 1 秒就触发告警,提醒用户系统性能可能存在问题。

Solr 实例所有请求处理平均时间大于 500 毫秒就触发告警,提醒用户系统性能可能存在问题。

总结

本文从指标、可视化仪表板、监控告警等三个角度展示了如何使用观测云这个一体化观测平台对 Solr 进行全面观测,大大减少了管理多个运维工具的负担,让 DevOps 团队将更多精力投放到更高价值的工作中。

相关推荐
木风小助理9 天前
C# 高效编程:Any () 与 Count () 正确选择
java·solr·lucene
qq 87622396515 天前
基于组态王技术的锅炉控制系统仿真研究与实现
solr
风若飞21 天前
Solr 8 ik-analyzer 中文分词 基本使用篇
中文分词·solr·lucene
liyanchao20181 个月前
3、Solr CCS (Cross Collection Search)与协调节点(Coordinator Node)的协同工作逻辑及自定义开发指南
solr
liyanchao20181 个月前
2、Solr跨集合查询(Cross Collection Search)机制
solr
咨询QQ:4877392781 个月前
C#程序源码:相机图片展示、工艺图片打包压缩及全屏显示缺陷图片的类别查询功能
solr
LFly_ice1 个月前
LINQ语法
服务器·solr·linq
爱编程的鱼2 个月前
C# var 关键字详解:从入门到精通
开发语言·c#·solr
酥酥禾3 个月前
C# LINQ常用语法
solr·lucene
李白你好4 个月前
Solr任意文件读取-快速利用工具
solr