目录
摘要:
环境准备:
freetsdb组建集群官方说明:
本地虚拟机部署freetsdb:
以192.168.58.132为例, 配置文件:
运行:
组建集群:
查看集群组建情况:
摘要:
记录使用freetsdb组建集群.
环境准备: 至少三台独立的虚拟机 编译安装freetsdb freetsdb组建集群官方说明:
## 部署FreeTSDB原生支持分布式集群能力,FreeTSDB集群的部署主要涉及到meta节点和DATA节点,meta节点存放的是系统运行所必须的元数据,DATA节点存放的是实际的时序数据。本文档将以3 meta节点、2 DATA节点的集群为例演示如何搭建FreeTSDB集群。### 部署meta节点基于可用性和资源成本的考虑,meta节点推荐为3节点。#### 配置meta接地那##### Step 1: 修改/etc/hosts文件,配置主机名字信息。将各meta节点的名字(比如cluster-meta-node-01)和对应的地址信息(比如
本地虚拟机部署freetsdb:
至少准备三台虚拟机, 为了增加对比, 使用四台虚拟机, ip地址分别为:
192.168.58.128192.168.58.131192.168.58.132192.168.58.133
以192.168.58.132为例, 配置文件:
完整的58.132上的配置的文件夹: freetsdb-v0.0.2-58.132-其它文档类资源-CSDN下载
meta配置:
freetsd-meta.conf
bind-address = ":8089"hostname = "192.168.58.132"[meta] enabled = true dir = "/var/lib/freetsdb/meta" bind-address = ":8089" http-bind-address = ":8091" https-enabled = false https-certificate = "" retention-autocreate = true election-timeout = "1s" heartbeat-timeout = "1s" leader-lease-timeout = "500ms" commit-timeout = "50ms" cluster-tracing = false raft-promotion-enabled = true logging-enabled = true pprof-enabled = false lease-duration = "1m0s"
data配置:
freetsd.conf
reporting-disabled = falsebind-address = ":8088"hostname = "192.168.58.132"[data] enabled = true dir = "/var/lib/freetsdb/data" engine = "tsm1" wal-dir = "/var/lib/freetsdb/wal" wal-logging-enabled = true query-log-enabled = true cache-max-memory-size = 1073741824 cache-snapshot-memory-size = 26214400 cache-snapshot-write-cold-duration = "10m0s" compact-full-write-cold-duration = "24h0m0s" max-points-per-block = 0 data-logging-enabled = true[cluster] force-remote-mapping = false write-timeout = "5s" shard-writer-timeout = "5s" max-remote-write-connections = 3 shard-mapper-timeout = "5s"[retention] enabled = true check-interval = "30m0s"[shard-precreation] enabled = true check-interval = "10m0s" advance-period = "30m0s"[admin] enabled = true bind-address = ":8083" https-enabled = false https-certificate = "/etc/ssl/freetsdb.pem" Version = ""[monitor] store-enabled = true store-database = "_internal" store-interval = "10s"[subscriber] enabled = true[http] enabled = true bind-address = ":8086" auth-enabled = false log-enabled = true write-tracing = false pprof-enabled = false https-enabled = false https-certificate = "/etc/ssl/freetsdb.pem" json-write-enabled = false[[graphite]] enabled = false bind-address = ":2003" database = "graphite" protocol = "tcp" batch-size = 5000 batch-pending = 10 batch-timeout = "1s" consistency-level = "one" separator = "." udp-read-buffer = 0[collectd] enabled = false bind-address = ":25826" database = "collectd" retention-policy = "" batch-size = 5000 batch-pending = 10 batch-timeout = "10s" read-buffer = 0 typesdb = "/usr/share/collectd/types.db"[opentsdb] enabled = false bind-address = ":4242" database = "opentsdb" retention-policy = "" consistency-level = "one" tls-enabled = false certificate = "/etc/ssl/freetsdb.pem" batch-size = 1000 batch-pending = 5 batch-timeout = "1s" log-point-errors = true[[udp]] enabled = false bind-address = ":8089" database = "udp" retention-policy = "" batch-size = 5000 batch-pending = 10 read-buffer = 0 batch-timeout = "1s" precision = "" udp-payload-size = 0[continuous_queries] log-enabled = true enabled = true run-interval = "1s"[hinted-handoff] enabled = true dir = "/var/lib/freetsdb/hh" max-size = 1073741824 max-age = "168h0m0s" retry-rate-limit = 0 retry-interval = "1s" retry-max-interval = "1m0s" purge-interval = "1h0m0s"
其他虚拟机需要修改对应的hostname为本机的ip.
运行:
启动meta
nohup ./freetsd-meta -config ./freetsd-meta.conf > freetsd-meta.log &
启动data:
nohup ./freetsd -config ./freetsd.conf > freetsd.log &
组建集群:
添加meta:
在任意部署meta的机器上, 执行:
./freetsd-ctl add-meta 192.168.58.128:8091./freetsd-ctl add-meta 192.168.58.131:8091./freetsd-ctl add-meta 192.168.58.132:8091./freetsd-ctl add-meta 192.168.58.133:8091
./freetsd-ctl add-data 192.168.58.128:8088./freetsd-ctl add-data 192.168.58.131:8088./freetsd-ctl add-data 192.168.58.132:8088./freetsd-ctl add-data 192.168.58.133:8088
查看集群组建情况:
./freetsd-ctl showmeta Nodes: {1 192.168.58.128:8091 192.168.58.128:8089} {5 192.168.58.132:8091 192.168.58.132:8089} {6 192.168.58.133:8091 192.168.58.133:8089} {8 192.168.58.131:8091 192.168.58.131:8089}Data Nodes: {2 192.168.58.128:8086 192.168.58.128:8088} {7 192.168.58.133:8086 192.168.58.133:8088} {10 192.168.58.132:8086 192.168.58.132:8088} {11 192.168.58.131:8086 192.168.58.131:8088}