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 团队将更多精力投放到更高价值的工作中。

相关推荐
沐风清扬19 天前
Solr-搜索引擎-入门到精通
后端·搜索引擎·php·solr
江沉晚呤时23 天前
深入了解 C# 中的 LINQ:功能、语法与应用解析
c#·solr·.netcore·lucene
步、步、为营2 个月前
解锁C#编程新姿势:Lambda与LINQ深度探秘
c#·solr·linq
字节全栈_vBr2 个月前
面试之Solr&Elasticsearch
elasticsearch·面试·solr
幽兰的天空3 个月前
推荐一些关于C#中LINQ的学习资料
c#·solr·linq
cdg==吃蛋糕3 个月前
solr8加鉴权
chrome·json·solr
ccc_9wy4 个月前
Apache Solr XXE(CVE-2017-12629)--vulhub
apache·solr·lucene·xxe·ssrf·vulhub·cve-2017-12629
ccc_9wy4 个月前
Apache Solr RCE(CVE-2017-12629)--vulhub
apache·solr·lucene·burp suite·vulhub·远程命令执行漏洞rce·cve-2017-12629
ccc_9wy4 个月前
Apache Solr RCE(CVE-2019-0193)--vulhub
网络安全·apache·solr·lucene·vulhub·cve-2019-0193·远程命令执行漏洞rce