介绍
Quickwit 是首个以亚秒级延迟直接在云存储上执行复杂搜索和分析查询的引擎。它由 Rust 及其分离的计算和存储架构提供支持,旨在节省资源、易于操作并可扩展到 PB 级数据。
Quickwit 非常适合日志管理、分布式跟踪以及通常不可变的数据(例如对话数据(电子邮件、文本、消息平台)和基于事件的分析)。
- 全文搜索和聚合查询
- 兼容支持Elasticsearch查询语言
- 云存储上的亚秒级搜索(Amazon S3、Azure Blob Storage 等)
- 分离计算和存储,无状态索引器和搜索器
- 无模式或严格模式索引
- 无模式分析
- 可做为Grafana数据源
- 可做为Jaeger后端数据存储
- OTEL 原生日志和跟踪
- 支持Kubernetes部署
- 提供REST风格的API
- 支持多种数据来源Kafka/Kinesis/Pulsar 原生
- 多租户:使用多个索引和分区进行索引
- 可配的数据保留策略
- 删除任务(针对 GRPR 用例)
- 分布式、高可用性*引擎,可在几秒钟内扩展(仅使用 Kafka 进行 HA 索引)
- 分离计算和存储
- 单/多节点、本地或云端
- 无状态搜索器和索引器
- REST API
- 日志管理
- 分布式跟踪
- 向OLAP 数据库(例如 ClickHouse)添加全文搜索功能。
Docker安装
本示例以单机模式部署quickwit引擎独立docker服务,默认docker run命令运行方式;
# 此/opt/docker/sysdata为本地已建专门管理docker容器数据的映射目录,可自行另创建
docker run --rm -v /opt/docker/sysdata/quickwit_data:/quickwit/qwdata -p 7280:7280 quickwit/quickwit:latest run
通过Portainer安装Quickwit极其简单方便,在Images界面中拉取docker镜像文件:quickwit/quickwit:latest
如需了解Portainer,请参考《Docker可视化管理工具Portainer》
在Portainer下载Image成功后,在Containers中创建docker运行容器应用
在CMD命令中添加 run 参数
在Volumes卷中添加Docker服务器p宿主机与Docker运行容器之间的文件目录映射,默认quickwit在dcoker容器环境下会将数据置于/quickwit/qwdata目录,用于做数据管理与维护;
创建docker容器应用服务后,启动docker容器,查看容器中服务运行日志是否正常;
通过http://0.0.0.0:7280/ui/search访问UI管理界面,即Quickwit服务docker容器成功部署并运行;
创建Quickwit索引
在Docker服务器宿主机的卷目录里创建conf目录用于配置索引
mkdir -p conf
在conf目录中下载官方示例yaml索引配置
wget -o hdfs_logs_index_config.yaml https://raw.githubusercontent.com/quickwit-oss/quickwit/main/config/tutorials/hdfs-logs/index-config.yaml
或手动创建hdfs_logs_index_config.yaml,贴入如下索引配置:
version: 0.8index_id: hdfs-logsdoc_mapping:field_mappings:- name: timestamptype: datetimeinput_formats:- unix_timestampoutput_format: unix_timestamp_secsfast_precision: secondsfast: true- name: tenant_idtype: u64- name: severity_texttype: texttokenizer: raw- name: bodytype: texttokenizer: defaultrecord: position- name: resourcetype: jsontokenizer: rawtag_fields: [tenant_id]timestamp_field: timestampsearch_settings:default_search_fields: [severity_text, body]
通过docker exec -it containers_id进入到docker容器系统内,或通过Portainer》Containers界面进入到对应的容器命令行操作;
进入到conf目录中,执行创建index索引的命令
quickwit index create --index-config hdfs_logs_index_config.yaml
执行日志
root@1715ce634888:/quickwit/qwdata/conf# quickwit index create --index-config hdfs_logs_index_config.yaml
❯ Creating index...
✔ Index successfully created.
进入Quickwit管理UI的Indexes中正常显示ID为hdf-logs索引名称,即创建新的索引成功;
数据测试
将下载的quickwit官方提供的小批量10000条测试json数据,上传到quickwit引擎docker容器卷/quickwit/qwdata目录中(直接在docker服务主机下载或本地下载后,上传到的quickwit所在容器卷映射的物理文件夹下)
wget https://quickwit-datasets-public.s3.amazonaws.com/hdfs-logs-multitenants-10000.json
测试JSON数据格式如下:
...
{"timestamp":1440670498,"severity_text":"INFO","body":"PacketResponder: BP-108841162-10.10.34.11-1440074360971:blk_1073836234_95410, type=HAS_DOWNSTREAM_IN_PIPELINE terminating","resource":{"service":"datanode/27"},"attributes":{"class":"org.apache.hadoop.hdfs.server.datanode.DataNode"},"tenant_id":74}
{"timestamp":1440670499,"severity_text":"INFO","body":"Receiving BP-108841162-10.10.34.11-1440074360971:blk_1073836242_95418 src: /10.10.34.32:51233 dest: /10.10.34.37:50010","resource":{"service":"datanode/27"},"attributes":{"class":"org.apache.hadoop.hdfs.server.datanode.DataNode"},"tenant_id":48}
继续在Portainer的命令行窗口中通过curl方式通过http协义将测试数据json文件,提交到quickwit引擎指定索引hdfs-logs中,当然也可以通过Docker服务主机映射端口将json数据转发到docker容器quickwit引擎中;
root@1715ce634888:/quickwit/qwdata# ls
conf delete_task_service hdfs-logs-multitenants-10000.json indexer-split-cache indexes indexing queues wal
root@1715ce634888:/quickwit/qwdata# curl -XPOST http://localhost:7280/api/v1/hdfs-logs/ingest -H "content-type: application/json" --data-binary @hdfs-logs-multitenants-10000.json
{"num_docs_for_processing": 10000
}
进入Quickwit管理UI的Query editor中,选择Index ID:hdfs-logs索引,输入 * 查询出所有记录;
如需删除索引,则在docker exec -it containers_id命令中进入到docker容器系统内,执行如下quickwit删除索引脚本
quickwit index delete --index hdfs-logs
或通过API接口触发quickwit服务删除索引
curl -XDELETE http://127.0.0.1:7280/api/v1/indexes/hdfs-logs
更多Quckwit搜索引擎使用,请参考官方教程文档:
Quickstart | Quickwit