Influxdb 企业版搭建文档
测试环境
- 云平台 : aws
- 测试机型: t3.medium x 6 (Meta节点 3 个 , Data 节点 2 个)
- 测试配置:2 core 4G mem
- 操作系统: aws linux2
Influxdb 集群部署
Meta节点
1. Meta节点要求
端口开放:8088,8089,8091
InfluxDB Enterprise集群至少需要三个元节点或多于三个的奇数节点,以实现高可用性和冗余。
强烈建议不要在同一服务器上部署多个元节点,因为如果该特定服务器无响应,则会造成更大的潜在故障点。
2. Meta节点安装配置
1) 设置hosts
172.16.0.2 meta1
172.16.0.3 meta2
172.16.0.4 meta3
172.16.0.5 node1
172.16.0.6 node2
2)安装、配置、启动 meta 节点
- 下载并安装 meta 软件包
wget https://dl.influxdata.com/enterprise/releases/influxdb-meta-1.8.2_c1.8.2.x86_64.rpm sudo rpm -ivh influxdb-meta-1.8.2-c1.8.2.x86_64.rpm
- 配置 meta 节点
Tips: license-key 与 license-path 二选一,另一个留空。
# Hostname advertised by this host for remote addresses. This must be resolvable by all # other nodes in the cluster hostname="<enterprise-meta-0x>" [enterprise] # license-key and license-path are mutually exclusive, use only one and leave the other blank license-key = "<your_license_key>" # Mutually exclusive with license-path # license-key and license-path are mutually exclusive, use only one and leave the other blank license-path = "/path/to/readable/JSON.license.file" # Mutually exclusive with license-key
- 启动 meta节点
sudo systemctl start influxdb-meta
- 验证
ps aux | grep -v grep | grep influxdb-meta
输出:
influxdb 3207 0.8 4.4 483000 22168 ? Ssl 17:05 0:08 /usr/bin/influxd-meta -config /etc/influxdb/influxdb-meta.conf
3)加入集群
- 在一个meta节点上执行加入节点命令(其余meta节点会自动同步)
influxd-ctl add-meta meta1:8091 influxd-ctl add-meta meta2:8091 influxd-ctl add-meta meta3:8091
- 验证
influxd-ctl show
输出:
Data Nodes ========== ID TCP Address Version Meta Nodes ========== TCP Address Version meta1:8091 1.8.2-c1.8.2 meta2:8091 1.8.2-c1.8.2 meta3:8091 1.8.2-c1.8.2
Data节点
1. Data节点要求
端口开放:8088,8089,8091
InfluxDB Enterprise集群至少需要2个data节点或多于2个的偶数节点,以实现高可用性和冗余。
2. Data节点安装配置
1)安装、配置、启动data节点
- 下载 并 安装 软件包
wget https://dl.influxdata.com/enterprise/releases/influxdb-data-1.8.2_c1.8.2.x86_64.rpm rpm -ivh influxdb-data-1.8.2_c1.8.2.x86_64.rpm
- 配置data节点
# Change this option to true to disable reporting. # reporting-disabled = false # bind-address = ":8088" hostname="<enterprise-data-0x>" [enterprise] # license-key and license-path are mutually exclusive, use only one and leave the other blank license-key = "<your_license_key>" # Mutually exclusive with license-path # The path to a valid license file. license-key and license-path are mutually exclusive, # use only one and leave the other blank. license-path = "/path/to/readable/JSON.license.file" # Mutually exclusive with license-key [meta] # Where the cluster metadata is stored dir = "/var/lib/influxdb/meta" # data nodes do require a local meta directory ... # This setting must have the same value as the meta nodes' meta.auth-enabled configuration. meta-auth-enabled = true [...] [http] # Determines whether HTTP endpoint is enabled. # enabled = true # The bind address used by the HTTP service. # bind-address = ":8086" # Determines whether HTTP authentication is enabled. auth-enabled = true # Recommended, but not required [...] # The JWT auth shared secret to validate requests using JSON web tokens. shared-secret = "long pass phrase used for signing tokens"
- 启动data节点服务
sudo systemctl start influxdb
- 验证
ps aux | grep -v grep | grep influxdb
输出:
influxdb 2706 0.2 7.0 571008 35376 ? Sl 15:37 0:16 /usr/bin/influxd -config /etc/influxdb/influxdb.conf
2. 加入集群
- 在一个meta节点执行以下命令
influxd-ctl add-data data1:8088 influxd-ctl add-data data2:8088
- 验证
influxd-ctl show
输出
Data Nodes ========== ID TCP Address Version 4 data1:8088 1.8.2-c1.8.2 5 data2:8088 1.8.2-c1.8.2