|
19 | 19 | <meta name="description" content="从Apache IoTDB 0.13.0版本之后可以启动监控模块对系统进行监控,并且可以使用Prometheus、Grafana等工具进行可视化"> |
20 | 20 | <meta property="og:type" content="article"> |
21 | 21 | <meta property="og:title" content="一文带你使用Apache IoTDB系统监控模块"> |
22 | | -<meta property="og:url" content="https://spricoder.github.io/2022/04/06/Apache%20IoTDB/%E4%B8%80%E6%96%87%E5%B8%A6%E4%BD%A0%E4%BD%BF%E7%94%A8Apache%20IoTDB%E7%B3%BB%E7%BB%9F%E7%9B%91%E6%8E%A7/index.html"> |
| 22 | +<meta property="og:url" content="https://spricoder.github.io/2022/04/06/Apache%20IoTDB/metric/%E4%B8%80%E6%96%87%E5%B8%A6%E4%BD%A0%E4%BD%BF%E7%94%A8Apache%20IoTDB%E7%B3%BB%E7%BB%9F%E7%9B%91%E6%8E%A7/index.html"> |
23 | 23 | <meta property="og:site_name" content="SpriCoder的博客"> |
24 | 24 | <meta property="og:description" content="从Apache IoTDB 0.13.0版本之后可以启动监控模块对系统进行监控,并且可以使用Prometheus、Grafana等工具进行可视化"> |
25 | 25 | <meta property="og:locale" content="zh_CN"> |
@@ -281,85 +281,77 @@ <h1 style="display: none">一文带你使用Apache IoTDB系统监控模块</h1> |
281 | 281 |
|
282 | 282 | <div class="markdown-body"> |
283 | 283 |
|
284 | | - <h2 id="一文带你使用apache-iotdb系统监控模块"><a class="markdownIt-Anchor" href="#一文带你使用apache-iotdb系统监控模块"></a> 一文带你使用Apache IoTDB系统监控模块</h2> |
285 | | -<p>在Apache IoTDB 0.13.0版本开始,我们引入了系统监控模块,本文主要介绍了如何在单机版开启系统监控模块,并且使用Prometheus + Grafana完成系统监控的可视化。</p> |
286 | | -<h1 id="相关配置信息"><a class="markdownIt-Anchor" href="#相关配置信息"></a> 相关配置信息</h1> |
287 | | -<ol> |
| 284 | + <h2 id="一文带你使用Apache-IoTDB系统监控模块"><a href="#一文带你使用Apache-IoTDB系统监控模块" class="headerlink" title="一文带你使用Apache IoTDB系统监控模块"></a>一文带你使用Apache IoTDB系统监控模块</h2><p>在Apache IoTDB 0.13.0版本开始,我们引入了系统监控模块,本文主要介绍了如何在单机版开启系统监控模块,并且使用Prometheus + Grafana完成系统监控的可视化。</p> |
| 285 | +<h1 id="相关配置信息"><a href="#相关配置信息" class="headerlink" title="相关配置信息"></a>相关配置信息</h1><ol> |
288 | 286 | <li>Apache IoTDB:0.13.0,可以前往官网下载:<a target="_blank" rel="noopener" href="https://iotdb.apache.org/Download/">https://iotdb.apache.org/Download/</a></li> |
289 | 287 | <li>Prometheus:2.30.3,可以前往官网下载:<a target="_blank" rel="noopener" href="https://prometheus.io/download/">https://prometheus.io/download/</a></li> |
290 | 288 | <li>Grafana:8.4.2,可以前往官网下载:<a target="_blank" rel="noopener" href="https://grafana.com/grafana/download">https://grafana.com/grafana/download</a></li> |
291 | 289 | </ol> |
292 | | -<h1 id="修改配置文件启动iotdb"><a class="markdownIt-Anchor" href="#修改配置文件启动iotdb"></a> 修改配置文件,启动IoTDB</h1> |
293 | | -<ol> |
| 290 | +<h1 id="修改配置文件,启动IoTDB"><a href="#修改配置文件,启动IoTDB" class="headerlink" title="修改配置文件,启动IoTDB"></a>修改配置文件,启动IoTDB</h1><ol> |
294 | 291 | <li>首先,进入到<code>apache-iotdb-0.13.0-all-bin</code></li> |
295 | 292 | <li>找到监控相关配置文件<code>conf/iotdb-metric.yml</code>,修改如下配置,其他配置保持不变:</li> |
296 | 293 | </ol> |
297 | 294 | <figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><code class="hljs yml"><span class="hljs-comment"># whether enable the module</span><br><span class="hljs-attr">enableMetric:</span> <span class="hljs-literal">true</span><br></code></pre></td></tr></table></figure> |
298 | | -<ol start="3"> |
| 295 | +<ol> |
299 | 296 | <li>运行脚本启动IoTDB:<code>./sbin/start-server.sh</code>,出现如下提示则为启动成功</li> |
300 | 297 | </ol> |
301 | | -<p><img src="https://spricoder.oss-cn-shanghai.aliyuncs.com/Apache%20IoTDB/metric/introduce/1.png" srcset="/img/loading.gif" lazyload alt="" /></p> |
302 | | -<ol start="4"> |
| 298 | +<p><img src="https://spricoder.oss-cn-shanghai.aliyuncs.com/Apache%20IoTDB/metric/introduce/1.png" srcset="/img/loading.gif" lazyload alt=""></p> |
| 299 | +<ol> |
303 | 300 | <li>在浏览器进入<code>http://localhost:9091/metrics</code>网址,可以查看到如下的监控项信息:</li> |
304 | 301 | </ol> |
305 | | -<p><img src="https://spricoder.oss-cn-shanghai.aliyuncs.com/Apache%20IoTDB/metric/introduce/2.png" srcset="/img/loading.gif" lazyload alt="" /></p> |
306 | | -<h1 id="配置prometheus进行数据采集"><a class="markdownIt-Anchor" href="#配置prometheus进行数据采集"></a> 配置Prometheus进行数据采集</h1> |
307 | | -<ol> |
| 302 | +<p><img src="https://spricoder.oss-cn-shanghai.aliyuncs.com/Apache%20IoTDB/metric/introduce/2.png" srcset="/img/loading.gif" lazyload alt=""></p> |
| 303 | +<h1 id="配置Prometheus进行数据采集"><a href="#配置Prometheus进行数据采集" class="headerlink" title="配置Prometheus进行数据采集"></a>配置Prometheus进行数据采集</h1><ol> |
308 | 304 | <li>下载Prometheus的二进制包到本地,解压后进入对应文件夹:</li> |
309 | 305 | </ol> |
310 | 306 | <figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><code class="hljs sh">tar xvfz prometheus-*.tar.gz<br><span class="hljs-built_in">cd</span> prometheus-*<br></code></pre></td></tr></table></figure> |
311 | | -<ol start="2"> |
| 307 | +<ol> |
312 | 308 | <li>首先,我们修改Prometheus的配置文件<code>prometheus.yml</code>如下:新增<code>iotdb</code>任务收集IoTDB的监控数据</li> |
313 | 309 | </ol> |
314 | 310 | <figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><code class="hljs yml"><span class="hljs-attr">global:</span><br> <span class="hljs-attr">scrape_interval:</span> <span class="hljs-string">15s</span><br><br><span class="hljs-attr">scrape_configs:</span><br> <span class="hljs-bullet">-</span> <span class="hljs-attr">job_name:</span> <span class="hljs-string">"iotdb"</span><br> <span class="hljs-attr">static_configs:</span><br> <span class="hljs-bullet">-</span> <span class="hljs-attr">targets:</span> [<span class="hljs-string">"localhost:9091"</span>]<br></code></pre></td></tr></table></figure> |
315 | | -<ol start="3"> |
| 311 | +<ol> |
316 | 312 | <li>启动Promethues:</li> |
317 | 313 | </ol> |
318 | 314 | <figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs sh">./prometheus --config.file=prometheus.yml<br></code></pre></td></tr></table></figure> |
319 | | -<ol start="4"> |
320 | | -<li>在浏览器中输入 <a target="_blank" rel="noopener" href="http://localhost:9090">http://localhost:9090</a>,进入Prometheus</li> |
| 315 | +<ol> |
| 316 | +<li>在浏览器中输入 <a href="http://localhost:9090,进入Prometheus">http://localhost:9090,进入Prometheus</a></li> |
321 | 317 | <li>查看配置是否成功:我们点击进入Status下的Target界面</li> |
322 | 318 | </ol> |
323 | | -<p><img src="https://spricoder.oss-cn-shanghai.aliyuncs.com/Apache%20IoTDB/metric/introduce/3.png" srcset="/img/loading.gif" lazyload alt="" /></p> |
324 | | -<ol start="6"> |
| 319 | +<p><img src="https://spricoder.oss-cn-shanghai.aliyuncs.com/Apache%20IoTDB/metric/introduce/3.png" srcset="/img/loading.gif" lazyload alt=""></p> |
| 320 | +<ol> |
325 | 321 | <li>当我们看到如下图State为Up时表示配置成功并已经联通</li> |
326 | 322 | </ol> |
327 | | -<p><img src="https://spricoder.oss-cn-shanghai.aliyuncs.com/Apache%20IoTDB/metric/introduce/4.png" srcset="/img/loading.gif" lazyload alt="" /></p> |
328 | | -<h1 id="使用grafana进行数据可视化"><a class="markdownIt-Anchor" href="#使用grafana进行数据可视化"></a> 使用Grafana进行数据可视化</h1> |
329 | | -<h2 id="grafana启动与配置"><a class="markdownIt-Anchor" href="#grafana启动与配置"></a> Grafana启动与配置</h2> |
330 | | -<ol> |
| 323 | +<p><img src="https://spricoder.oss-cn-shanghai.aliyuncs.com/Apache%20IoTDB/metric/introduce/4.png" srcset="/img/loading.gif" lazyload alt=""></p> |
| 324 | +<h1 id="使用Grafana进行数据可视化"><a href="#使用Grafana进行数据可视化" class="headerlink" title="使用Grafana进行数据可视化"></a>使用Grafana进行数据可视化</h1><h2 id="Grafana启动与配置"><a href="#Grafana启动与配置" class="headerlink" title="Grafana启动与配置"></a>Grafana启动与配置</h2><ol> |
331 | 325 | <li>下载Grafana的二进制包到本地,解压后进入对应文件夹:</li> |
332 | 326 | </ol> |
333 | 327 | <figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><code class="hljs sh">tar -zxvf grafana-*.tar.gz<br><span class="hljs-built_in">cd</span> grafana-*<br></code></pre></td></tr></table></figure> |
334 | | -<ol start="2"> |
| 328 | +<ol> |
335 | 329 | <li>启动Grafana:</li> |
336 | 330 | </ol> |
337 | 331 | <figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs sh">./bin/grafana-server web <br></code></pre></td></tr></table></figure> |
338 | | -<ol start="3"> |
339 | | -<li>在浏览器中输入 <a target="_blank" rel="noopener" href="http://localhost:3000">http://localhost:3000</a>,进入Prometheus</li> |
| 332 | +<ol> |
| 333 | +<li>在浏览器中输入 <a href="http://localhost:3000,进入Prometheus">http://localhost:3000,进入Prometheus</a></li> |
340 | 334 | <li>首先我们在Configuration中配置Data Source为Prometheus</li> |
341 | 335 | </ol> |
342 | | -<p><img src="https://spricoder.oss-cn-shanghai.aliyuncs.com/Apache%20IoTDB/metric/introduce/5.png" srcset="/img/loading.gif" lazyload alt="" /></p> |
343 | | -<ol start="5"> |
| 336 | +<p><img src="https://spricoder.oss-cn-shanghai.aliyuncs.com/Apache%20IoTDB/metric/introduce/5.png" srcset="/img/loading.gif" lazyload alt=""></p> |
| 337 | +<ol> |
344 | 338 | <li>在配置Data Source时注意Prometheus所在的URL,配置好后点击Save & Test 出现Data source is working提示则为配置成功</li> |
345 | 339 | </ol> |
346 | | -<p><img src="https://spricoder.oss-cn-shanghai.aliyuncs.com/Apache%20IoTDB/metric/introduce/6.png" srcset="/img/loading.gif" lazyload alt="" /></p> |
347 | | -<h2 id="在grafana中创建dashboard进行数据可视化"><a class="markdownIt-Anchor" href="#在grafana中创建dashboard进行数据可视化"></a> 在Grafana中创建Dashboard进行数据可视化</h2> |
348 | | -<ol> |
| 340 | +<p><img src="https://spricoder.oss-cn-shanghai.aliyuncs.com/Apache%20IoTDB/metric/introduce/6.png" srcset="/img/loading.gif" lazyload alt=""></p> |
| 341 | +<h2 id="在Grafana中创建Dashboard进行数据可视化"><a href="#在Grafana中创建Dashboard进行数据可视化" class="headerlink" title="在Grafana中创建Dashboard进行数据可视化"></a>在Grafana中创建Dashboard进行数据可视化</h2><ol> |
349 | 342 | <li>首先创建Dashboard,然后创建Panel</li> |
350 | 343 | </ol> |
351 | | -<p><img src="https://spricoder.oss-cn-shanghai.aliyuncs.com/Apache%20IoTDB/metric/introduce/7.png" srcset="/img/loading.gif" lazyload alt="" /></p> |
352 | | -<ol start="2"> |
| 344 | +<p><img src="https://spricoder.oss-cn-shanghai.aliyuncs.com/Apache%20IoTDB/metric/introduce/7.png" srcset="/img/loading.gif" lazyload alt=""></p> |
| 345 | +<ol> |
353 | 346 | <li>之后就可以在面板根据自己的需求对监控相关的数据进行可视化(所有相关的监控指标可以先在job中选择iotdb筛选)</li> |
354 | 347 | </ol> |
355 | | -<p><img src="https://spricoder.oss-cn-shanghai.aliyuncs.com/Apache%20IoTDB/metric/introduce/8.png" srcset="/img/loading.gif" lazyload alt="" /></p> |
356 | | -<ol start="3"> |
| 348 | +<p><img src="https://spricoder.oss-cn-shanghai.aliyuncs.com/Apache%20IoTDB/metric/introduce/8.png" srcset="/img/loading.gif" lazyload alt=""></p> |
| 349 | +<ol> |
357 | 350 | <li>选择关注的监控指标可视化完成后,我们就得到了这样的面板:</li> |
358 | 351 | </ol> |
359 | | -<p><img src="https://spricoder.oss-cn-shanghai.aliyuncs.com/Apache%20IoTDB/metric/introduce/9.png" srcset="/img/loading.gif" lazyload alt="" /></p> |
| 352 | +<p><img src="https://spricoder.oss-cn-shanghai.aliyuncs.com/Apache%20IoTDB/metric/introduce/9.png" srcset="/img/loading.gif" lazyload alt=""></p> |
360 | 353 | <p>后续我们还会继续分享Apache IoTDB监控模块,敬请期待!</p> |
361 | | -<h1 id="参考"><a class="markdownIt-Anchor" href="#参考"></a> 参考</h1> |
362 | | -<p><a target="_blank" rel="noopener" href="https://iotdb.apache.org/UserGuide/Master/Maintenance-Tools/Metric-Tool.html">https://iotdb.apache.org/UserGuide/Master/Maintenance-Tools/Metric-Tool.html</a></p> |
| 354 | +<h1 id="参考"><a href="#参考" class="headerlink" title="参考"></a>参考</h1><p><a target="_blank" rel="noopener" href="https://iotdb.apache.org/UserGuide/Master/Maintenance-Tools/Metric-Tool.html">https://iotdb.apache.org/UserGuide/Master/Maintenance-Tools/Metric-Tool.html</a></p> |
363 | 355 |
|
364 | 356 |
|
365 | 357 | </div> |
@@ -405,7 +397,7 @@ <h1 id="参考"><a class="markdownIt-Anchor" href="#参考"></a> 参考</h1> |
405 | 397 | <div class="license-box my-3"> |
406 | 398 | <div class="license-title"> |
407 | 399 | <div>一文带你使用Apache IoTDB系统监控模块</div> |
408 | | - <div>https://spricoder.github.io/2022/04/06/Apache%20IoTDB/%E4%B8%80%E6%96%87%E5%B8%A6%E4%BD%A0%E4%BD%BF%E7%94%A8Apache%20IoTDB%E7%B3%BB%E7%BB%9F%E7%9B%91%E6%8E%A7/</div> |
| 400 | + <div>https://spricoder.github.io/2022/04/06/Apache%20IoTDB/metric/%E4%B8%80%E6%96%87%E5%B8%A6%E4%BD%A0%E4%BD%BF%E7%94%A8Apache%20IoTDB%E7%B3%BB%E7%BB%9F%E7%9B%91%E6%8E%A7/</div> |
409 | 401 | </div> |
410 | 402 | <div class="license-meta"> |
411 | 403 |
|
|
0 commit comments