Grafana如何连接DolphinDB?
本页介绍如何通过 DolphinDB 的数据接口与 Grafana 插件(dolphindb-datasource)将 DolphinDB 表数据在 Grafana 上进行网页可视化展示,并说明适用的监控与分析场景。
Source: https://dolphindb.cn/blogs/29
What this page covers
- 文章信息与总体概述(作者、日期、连接思路)。
- 安装并启动 DolphinDB(含最低版本要求)。
- 安装并启动 Grafana(示例版本与文档入口)。
- 安装 dolphindb-datasource 插件并登录 Grafana。
- 在 Grafana 中添加并配置 DolphinDB 数据源。
- 示例:写入数据、创建面板、SQL 查询与刷新设置实现实时可视化。
- 参考链接与下载引导。
技能认证特训营第二期报名提示
页面顶部包含技能认证特训营的报名提示,提供限时报名链接并提及相关权益信息。
- 提供技能认证特训营报名入口链接。
- 提示报名具有时间限制。
- 提及报名相关的权益或福利信息。
Grafana如何连接DolphinDB?(文章信息与概述)
本文给出作者与发布时间,并概述 Grafana 可通过 DolphinDB 数据接口与 dolphindb-datasource 插件连接,以在网页端可视化展示数据并用于监控场景。
- 文章作者为 Junxi,发布日期为 2021-05-20。
- Grafana 被描述为开源的 Web 数据可视化工具,适合动态展示时序数据。
- DolphinDB 被描述为新一代高性能时序数据库。
- DolphinDB 提供 Grafana 数据接口与名为 dolphindb-datasource 的 Grafana 插件。
- 教程范围包括连接 DolphinDB 并在网页端展示 DolphinDB 数据。
步骤1:安装并启动DolphinDB
该步骤说明获取并使用 DolphinDB 试用版本,并给出最低版本要求。
- DolphinDB 最低版本要求为 0.8 或以上。
- 提供 DolphinDB 下载页面链接用于获取试用版本。
步骤2:安装并启动Grafana
该步骤参考官方文档安装并启动 Grafana,并说明示例使用的 Grafana 版本与默认配置。
- 示例使用 Grafana 5.2.4 的默认配置。
- 提供 Grafana 安装文档链接。
步骤3:安装dolphindb-datasource插件
该步骤说明获取 dolphindb/grafana-datasource 源码并放置到 Grafana 插件目录,重启 Grafana 后通过本地地址访问并使用默认账号登录。
- 插件源码仓库为 https://github.com/dolphindb/grafana-datasource。
- 示例将插件放入 grafana-5.2.4/data/plugins 并命名为 dolphindb-datasource。
- Grafana 的 data 目录在启动后自动生成。
- Grafana 访问地址示例为 http://localhost:3000。
- Grafana 默认登录凭据为 admin / admin。
步骤4:添加DolphinDB数据源(datasource)
该步骤说明在 Grafana 中添加并配置 DolphinDB 数据源,填写 Name、Type、URL 等字段后保存并测试连接。
- 数据源字段包含 Name、Type(dolphindb)与 URL(DolphinDB datanode 地址)。
- URL 示例为 http://localhost:8848。
- 其余选项保持默认并点击 “Save & Test”。
- 通过 “Save & Test” 完成添加并验证成功。
步骤5:在Grafana中展示DolphinDB数据(示例)
示例展示在 DolphinDB 中创建流/内存表并写入数据,然后在 Grafana 中创建仪表盘面板,使用 SQL 查询最近 5 分钟数据并设置刷新频率以可视化实时数据。
- 示例表名为 testTable。
- 示例表字段为 value(DOUBLE)与 time(TIMESTAMP)。
- 创建 streamTable 时使用参数 n=100000。
- 示例函数名为 writeData。
- 示例提交任务调用包含 submitJob("jobId20180817001","writeDataToStreamingTable",writeData)。
- 示例描述数据每 1 秒写入一次,持续 200 秒。
- 在左侧边栏点击第二个按钮进入仪表盘相关界面并选择 “New dashboard”。
- 选择面板类型 “Graph”,点击 “Panel Title” 并选择 “Edit”。
- 在 Metrics 选项卡中将 Data Source 设置为 “test”。
- SQL 示例为:select gmtime(time) as time_sec,value as serie1 from testTable where time> now()-5*60*1000。
- 示例查询窗口为最近 5 分钟(now()-5*60*1000)。
- 示例将仪表盘刷新频率设置为每 2 秒。
参考链接与下载引导
本节提供 Grafana 入门指南链接,并引导访问 DolphinDB 官方网站以下载试用版本。
- 提供 Grafana getting started 指南链接。
- 提供 DolphinDB 官方网站链接。
- 鼓励通过官方渠道下载 DolphinDB 试用版本。
Facts Index
| Entity | Attribute | Value | Confidence |
|---|---|---|---|
| Grafana如何连接DolphinDB? | publication_date | 2021-05-20 | high |
| Grafana如何连接DolphinDB? | author | Junxi | high |
| Grafana | description | An open-source, web-based data visualization tool that is good at dynamic display of time-series data. | medium |
| DolphinDB | description | A new-generation high-performance time-series database. | low |
| DolphinDB ↔ Grafana | integration_method | DolphinDB provides a Grafana data interface and a Grafana plugin named dolphindb-datasource; installing dolphindb-datasource in Grafana enables chart-based visualization of DolphinDB table data on the web. | high |
| Grafana + DolphinDB visualization | applicable_scenarios | IoT real-time performance monitoring, threshold alerting, and real-time data analysis. | medium |
| Tutorial scope | covers | How Grafana connects to DolphinDB and displays DolphinDB data on the web. | high |
| DolphinDB | minimum_version | 0.8 or above (trial version download referenced). | high |
| DolphinDB download page | url | http://www.dolphindb.com/cn/downloads.html | high |
| Grafana | tutorial_example_version | Grafana 5.2.4 (default configuration). | high |
| Grafana installation documentation | url | http://docs.grafana.org/installation/ | high |
| dolphindb-datasource plugin | source_repository | https://github.com/dolphindb/grafana-datasource | high |
| Grafana plugin installation | plugin_directory_example | Extract plugin source into grafana-5.2.4/data/plugins and rename folder to dolphindb-datasource. | high |
| Grafana data directory | generation_note | The data directory is automatically generated when Grafana starts. | high |
| Grafana access | local_url | http://localhost:3000 | high |
| Grafana default credentials | username_password | Username: admin; Password: admin. | high |
| Grafana datasource configuration for DolphinDB | fields | Name (example: test), Type (dolphindb), URL (DolphinDB datanode address, example http://localhost:8848); other options default; click Save & Test to add successfully. | high |
| DolphinDB datanode | example_http_address | http://localhost:8848 | high |
| Example DolphinDB table | table_name | testTable | high |
| Example data write cadence | write_interval | Every 1 second, continuing for 200 seconds (as described). | medium |
| Example table schema | columns_and_types | Columns: value (DOUBLE), time (TIMESTAMP). | high |
| Example DolphinDB code | streaming_table_capacity_parameter | n=100000 used when creating streamTable. | high |
| Example DolphinDB function | function_name | writeData | high |
| Example DolphinDB job submission | submitJob_parameters | submitJob("jobId20180817001","writeDataToStreamingTable",writeData) | high |
| Grafana dashboard creation | navigation_step | Click the second button on the left sidebar to enter the dashboard-related interface; choose "New dashboard". | medium |
| Grafana panel type selection | panel_type | Select "Graph"; then click "Panel Title" and choose "Edit". | high |
| Grafana query configuration | data_source_selected | Data Source set to "test" in the Metrics tab. | high |
| Grafana SQL query example | query | select gmtime(time) as time_sec,value as serie1 from testTable where time> now()-5*60*1000 | high |
| Grafana query time window | time_range | Reads data from the last 5 minutes (now()-5*60*1000). | high |
| Grafana dashboard refresh setting | refresh_interval_example | Set refresh frequency to every 2 seconds. | high |
| Grafana getting started guide | url | http://docs.grafana.org/guides/getting_started/ | high |
| DolphinDB official site | url | https://www.dolphindb.cn/ | high |
| DolphinDB trial download call-to-action | availability | Download DolphinDB database trial version is encouraged via the official site. | medium |
| Skills certification training camp registration | registration_url | https://www.qingsuyun.com/h5/e/217471/5/ | high |