環境准備
influxdb enterprise運行條件最低需要三個meta nodes節點以及兩個data nodes
Meta nodes之間使用TCP和Raft一致性協議通信,默認端口為8089
Meta nodes對外暴露8091,用於influxd-ctl命令進行交互
Data nodes通過8088進行數據同步,8086對於用戶進行讀寫服務
在集群中,所有meta nodes節點必須要與data nodes節點保持通信。
mata nodes主要保存以下所有的元數據信息
- 集群中所有的節點以及角色
- 集群中所有存在的數據庫和保留策略(retention policy)
- 保存所有分片和分片組信息
- 保存集群用戶權限
data node保存所有原始時序數據以及元數據,包括
- measurement(數據表)
- tag key和value
- field key和value;
#wget https://dl.influxdata.com/enterprise/releases/influxdb-meta_1.7.8-c1.7.8_amd64.deb
# dpkg -i influxdb-meta_1.7.8-c1.7.8_amd64.deb
influxdb-meda01
# egrep -v "#|^$" /etc/influxdb/influxdb-meta.conf hostname = "enterprise-meta-01" [enterprise] license-key = "224bca5e-514d-441e-b2c2-31b29dd79811" [meta] dir = "/var/lib/influxdb/meta" internal-shared-secret = "123.com"
influxdb-meda02
# egrep -v "#|^$" /etc/influxdb/influxdb-meta.conf hostname = "enterprise-meta-02" [enterprise] license-key = "224bca5e-514d-441e-b2c2-31b29dd79811" [meta] dir = "/var/lib/influxdb/meta" internal-shared-secret = "123.com"
influxdb-meda03
# egrep -v "#|^$" /etc/influxdb/influxdb-meta.conf hostname = "enterprise-meta-03" [enterprise] license-key = "224bca5e-514d-441e-b2c2-31b29dd79811" [meta] dir = "/var/lib/influxdb/meta" internal-shared-secret = "123.com"
# systemctl start influxdb-meta
# systemctl enable influxdb-meta
將meta node節點加入集群
#influxd-ctl add-meta enterprise-meta-02:8091
#influxd-ctl add-meta enterprise-meta-03:8091
【部署influxdb-node節點】
#wget https://dl.influxdata.com/enterprise/releases/influxdb-data-1.8.2_c1.8.2.x86_64.rpm
#dpkg -i influxdb-data_1.8.2-c1.8.2_amd64.deb
#egrep -v "#|^$" /etc/influxdb/influxdb.conf
bind-address = "0.0.0.0:8088" hostname = "enterprise-data-01" [enterprise] license-key = "224bca5e-514d-441e-b2c2-31b29dd79811" [meta] dir = "/var/lib/influxdb/meta" meta-internal-shared-secret = "123.com" [data] dir = "/var/lib/influxdb/data" wal-dir = "/var/lib/influxdb/wal" cache-max-memory-size = "1g" cache-snapshot-memory-size = "25m" cache-snapshot-write-cold-duration = "10m" max-series-per-database = 0 max-values-per-tag = 0 max-index-log-file-size = "128k" [cluster] [hinted-handoff] dir = "/var/lib/influxdb/hh" [anti-entropy] [retention] [shard-precreation] [monitor] store-enabled = false [http] log-enabled = true [logging] [subscriber] [[graphite]] [[collectd]] [[opentsdb]] [[udp]] [continuous_queries] [tls]
# egrep -v "#|^$" /etc/influxdb/influxdb.conf
bind-address = "0.0.0.0:8088" hostname = "enterprise-data-02" [enterprise] license-key = "224bca5e-514d-441e-b2c2-31b29dd79811" [meta] dir = "/var/lib/influxdb/meta" meta-internal-shared-secret = "123.com" [data] dir = "/var/lib/influxdb/data" wal-dir = "/var/lib/influxdb/wal" cache-max-memory-size = "1g" cache-snapshot-memory-size = "25m" cache-snapshot-write-cold-duration = "10m" max-series-per-database = 0 max-values-per-tag = 0 max-index-log-file-size = "128k" [cluster] [hinted-handoff] dir = "/var/lib/influxdb/hh" [anti-entropy] [retention] [shard-precreation] [monitor] store-enabled = true [http] [logging] [subscriber] [[graphite]] [[collectd]] [[opentsdb]] [[udp]] [continuous_queries] log-enabled = true [tls]
#systemctl start influxd
#systemctl enable influxd
#將date node加入集群
#influxd-ctl add-data enterprise-data-01:8088
#influxd-ctl add-data enterprise-data-02:8088
最后我們在influxdb-meta節點上執行 influxd-ctl show查看集群節點狀態
截止目前influxdb集群部署完畢!END
【部署Telegrat】
Telegrat是一個用golang寫的開源數據庫收集agent,基於插件驅動,本身提供的輸入和輸出的插件非常豐富,當然有需求也可以自行編寫,Telegraf是influxdbdb公司的時間序列平台TICK技術棧中的“T”,主要就是數據采集,用於主機性能數據,包括主機CPU,內存,io,進程狀態,服務狀態;
# yum install wget;wget https://dl.influxdata.com/kapacitor/releases/kapacitor-1.5.6-1.x86_64.rpm
# yum localinstall -y kapacitor-1.5.6-1.x86_64.rpm
# wget https://dl.influxdata.com/chronograf/releases/chronograf-1.8.7.x86_64.rpm
# yum localinstall -y chronograf-1.8.7.x86_64.rpm
#yum install -y telegraf
#vim /etc/telegraf/telegraf.conf
[global_tags] [agent] interval = "10s" round_interval = true metric_batch_size = 1000 metric_buffer_limit = 10000 collection_jitter = "0s" flush_interval = "10s" flush_jitter = "0s" precision = "" hostname = "" omit_hostname = false [[outputs.influxdb]] urls = ["http://192.168.60.101:8086"] database = "telegraf" retention_policy = "" timeout = "5s" username = "admin" password = "admin" [[inputs.cpu]] percpu = true totalcpu = true collect_cpu_time = false report_active = false [[inputs.disk]] ignore_fs = ["tmpfs", "devtmpfs", "devfs", "iso9660", "overlay", "aufs", "squashfs"] [[inputs.diskio]] [[inputs.kernel]] [[inputs.mem]] [[inputs.processes]] [[inputs.swap]] [[inputs.system]]
#systemctl restart telegraf
#systemctl enable telegraf
# telegraf --config /etc/telegraf/telegraf.conf --input-filter cpu:mem --output-filter influxdb #生成具有特定輸入和輸出的配置文件,可以使用--input-filter和--output-filter標志
此時我們可以去192.168.60.101上的influxdb數據庫中查看一下是否已經生成相應的庫文件
接下來我們可配置Chronograf的數據源,讓chronorag連接influxdb數據庫,並進行數據可視化展示
瀏覽器訪問chronnoragweb界面:192.168.60.103:8888
Configuration===>+Add Connection==>