InfluxDB是一款用Go語言編寫的開源分佈式時序、事件和指標數據庫,無需外部依賴。該數據庫如今主要用於存儲涉及大量的時間戳數據,如DevOps監控數據,APP metrics, loT傳感器數據和實時分析數據。mysql
(py3) [root@zabbix_server src]# wget https://dl.influxdata.com/influxdb/releases/influxdb-1.1.0.x86_64.rpm --2019-10-30 15:22:01-- https://dl.influxdata.com/influxdb/releases/influxdb-1.1.0.x86_64.rpm 正在解析主機 dl.influxdata.com... 13.226.77.23, 13.226.77.76, 13.226.77.125, ... 正在鏈接 dl.influxdata.com|13.226.77.23|:443... 已鏈接。 已發出 HTTP 請求,正在等待迴應... 200 OK 長度:15343957 (15M) [application/x-redhat-package-manager] 正在保存至: 「influxdb-1.1.0.x86_64.rpm」 39% [=============================> ] 6,019,708 1.77M/s eta(英國中部時42% [================================> ] 6,543,996 1.80M/s eta(英國中部時51% [=======================================> ] 7,838,332 2.01M/s eta(英國中部時57% [============================================> ] 8,755,836 2.00M/s eta(英國中部時60% [===============================================> ] 9,345,660 2.10M/s eta(英國中部時63% [=================================================> ] 9,771,644 2.18M/s eta(英國中部時71% [=======================================================> ] 10,934,908 2.58M/s eta(英國中部時74% [=========================================================> ] 11,426,428 2.62M/s eta(英國中部時77% [============================================================> ] 11,950,716 2.71M/s eta(英國中部時83% [================================================================> ] 12,786,300 2.71M/s eta(英國中部時86% [===================================================================> ] 13,326,972 2.81M/s eta(英國中部時90% [======================================================================> ] 13,867,644 2.75M/s eta(英國中部時94% [=========================================================================> ] 14,539,388 2.63M/s eta(英國中部時100%[==============================================================================>] 15,343,957 2.77M/s in 6.7s 2019-10-30 15:22:09 (2.18 MB/s) - 已保存 「influxdb-1.1.0.x86_64.rpm」 [15343957/15343957]) (py3) [root@zabbix_server src]# yum localinstall influxdb-1.1.0.x86_64.rpm 已加載插件:fastestmirror, security 設置本地安裝進程 診斷 influxdb-1.1.0.x86_64.rpm: influxdb-1.1.0-1.x86_64 influxdb-1.1.0.x86_64.rpm 將被安裝 Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com * webtatic: uk.repo.webtatic.com base | 3.7 kB 00:00 dell-system-update_dependent | 2.3 kB 00:00 dell-system-update_independent | 2.3 kB 00:00 extras | 3.4 kB 00:00 mysql-connectors-community | 2.5 kB 00:00 mysql-tools-community | 2.5 kB 00:00 mysql57-community | 2.5 kB 00:00 nginx | 2.9 kB 00:00 updates | 3.4 kB 00:00 webtatic | 3.6 kB 00:00 解決依賴關係 --> 執行事務檢查 ---> Package influxdb.x86_64 0:1.1.0-1 will be 安裝 --> 完成依賴關係計算 依賴關係解決 ======================================================================================================================== 軟件包 架構 版本 倉庫 大小 ======================================================================================================================== 正在安裝: influxdb x86_64 1.1.0-1 /influxdb-1.1.0.x86_64 47 M 事務概要 ======================================================================================================================== Install 1 Package(s) 總文件大小:47 M Installed size: 47 M 肯定嗎?[y/N]:y 下載軟件包: 運行 rpm_check_debug 執行事務測試 事務測試成功 執行事務 正在安裝 : influxdb-1.1.0-1.x86_64 1/1 Verifying : influxdb-1.1.0-1.x86_64 1/1 已安裝: influxdb.x86_64 0:1.1.0-1 完畢!
在/usr/bin目錄下有以下文件nginx
(py3) [root@zabbix_server bin]# ll inf* -rwxr-xr-x 1 root root 6192647 11月 12 2016 influx -rwxr-xr-x 1 root root 16898710 11月 12 2016 influxd -rwxr-xr-x 1 root root 5964784 11月 12 2016 influx_inspect -rwxr-xr-x 1 root root 7857550 11月 12 2016 influx_stress -rwxr-xr-x 1 root root 12534956 11月 12 2016 influx_tsm -rwxr-xr-x. 1 root root 186096 8月 20 2010 info -rwxr-xr-x. 1 root root 55720 3月 16 2015 infocmp -rwxr-xr-x. 1 root root 25664 8月 20 2010 infokey lrwxrwxrwx. 1 root root 3 11月 28 2018 infotocap -> tic
influxd:服務器 influx:客戶端 數據文件存放在 /var/lib/influxdb/目錄下web
啓動服務器sql
(py3) [root@zabbix_server influxdb]# influxd 8888888 .d888 888 8888888b. 888888b. 888 d88P" 888 888 "Y88b 888 "88b 888 888 888 888 888 888 .88P 888 88888b. 888888 888 888 888 888 888 888 888 8888888K. 888 888 "88b 888 888 888 888 Y8bd8P' 888 888 888 "Y88b 888 888 888 888 888 888 888 X88K 888 888 888 888 888 888 888 888 888 Y88b 888 .d8""8b. 888 .d88P 888 d88P 8888888 888 888 888 888 "Y88888 888 888 8888888P" 8888888P" [run] 2019/10/30 15:45:39 InfluxDB starting, version 1.1.0, branch master, commit 800da5732b91c816b0a097acf8887fa2af1efa1a [run] 2019/10/30 15:45:39 Go version go1.7.3, GOMAXPROCS set to 24 [run] 2019/10/30 15:45:39 Using configuration at: /etc/influxdb/influxdb.conf [store] 2019/10/30 15:45:39 Using data dir: /var/lib/influxdb/data [subscriber] 2019/10/30 15:45:39 opened service [monitor] 2019/10/30 15:45:39 Starting monitor system [monitor] 2019/10/30 15:45:39 'build' registered for diagnostics monitoring [monitor] 2019/10/30 15:45:39 'runtime' registered for diagnostics monitoring [monitor] 2019/10/30 15:45:39 'network' registered for diagnostics monitoring [monitor] 2019/10/30 15:45:39 'system' registered for diagnostics monitoring [shard-precreation] 2019/10/30 15:45:39 Starting precreation service with check interval of 10m0s, advance period of 30m0s [snapshot] 2019/10/30 15:45:39 Starting snapshot service [continuous_querier] 2019/10/30 15:45:39 Starting continuous query service [httpd] 2019/10/30 15:45:39 Starting HTTP service [httpd] 2019/10/30 15:45:39 Authentication enabled: false [httpd] 2019/10/30 15:45:39 Listening on HTTP: [::]:8086 [retention] 2019/10/30 15:45:39 Starting retention policy enforcement service with check interval of 30m0s [monitor] 2019/10/30 15:45:39 Storing statistics in database '_internal' retention policy 'monitor', at interval 10s 2019/10/30 15:45:39 Sending usage statistics to usage.influxdata.com [run] 2019/10/30 15:45:39 Listening for signals
啓動客戶端shell
(py3) [root@zabbix_server dianwang]# influx Visit https://enterprise.influxdata.com to register for updates, InfluxDB server management, and monitoring. Connected to http://localhost:8086 version 1.1.0 InfluxDB shell version: 1.1.0 >
建立數據庫數據庫
> create database test; > show databases; name: databases name ---- _internal test
打開數據庫api
> use test
Using database test
>
建立表,InfluxDB沒有提供單獨的建表語句,能夠經過並添加數據的方式建表服務器
> insert test,province=安徽 count=464 > show measurements name: measurements name ---- test > select * from test name: test time count province ---- ----- -------- 1572422964532967343 464 安徽
添加數據架構
> insert test,province=廣東 count=1702 > select * From test name: test time count province ---- ----- -------- 1572422964532967343 464 安徽 1572423041812200700 1702 廣東
刪除表app
> drop measurement test > show measurements >
添加表格插件,設置以下:
選擇展現字段:count,按province分組,按時間排序
這樣就完成了數據的展現。
6、安裝grafana的worldsmap插件
[root@zabbix_server bin]# ./grafana-cli plugins install grafana-worldmap-panel installing grafana-worldmap-panel @ 0.2.1 from url: https://grafana.com/api/plugins/grafana-worldmap-panel/versions/0.2.1/download into: ../data/plugins ? Installed grafana-worldmap-panel successfully Restart grafana after installing plugins . <service grafana-server restart>
7、重啓grafana服務
root@zabbix_server bin]# ./grafana-server start
查看面板
地圖插件已經安裝上了
8、建立地圖數據表(座標模式)