InfluxDB 最新版本是 v2.x . 因官方开源版本不支持集群,有基于 v1.8.x 的InfluxDB开源集群方案 influxdb-cluster 。因此在集群环境中我们选用 InfluxDB v1.8.x 版本。
文档地址:https://github.com/chengshiwen/influxdb-cluster/wiki
集群主机
共计3台 InfluxDB 集群 8G x 3(1T硬盘)+ 4G x 3 (200G) 虚拟机。
序号 | IP | 角色 | Hostname |
---|---|---|---|
1 | 192.168.3.114 | Meta | influxdb-meta-01 |
2 | 192.168.3.115 | Meta | influxdb-meta-02 |
3 | 192.168.3.116 | Meta | influxdb-meta-03 |
4 | 192.168.3.117 | Data | influxdb-data-01 |
5 | 192.168.3.118 | Data | influxdb-data-02 |
6 | 192.168.3.119 | Data | influxdb-data-03 |
分别设置主机的Hostname
主机 - 01
$ cat > /etc/hostname<<'EOF'
influxdb-meta-01
EOF
主机 - 02
$ cat > /etc/hostname<<'EOF'
influxdb-meta-02
EOF
主机 - 03
$ cat > /etc/hostname<<'EOF'
influxdb-meta-03
EOF
主机 - 04
$ cat > /etc/hostname<<'EOF'
influxdb-data-01
EOF
主机 - 05
$ cat > /etc/hostname<<'EOF'
influxdb-data-02
EOF
主机 - 06
$ cat > /etc/hostname<<'EOF'
influxdb-data-03
EOF
安装 InfluxDB Cluster
我们建议使用 预构建版本 中的一个来安装 InfluxDB Cluster。
下载安装 InfluxDB Cluster
官方地址:https://github.com/chengshiwen/influxdb-cluster/releases
创建专用的数据存储目录
$ mkdir -p /etc/influxdb/
$ mkdir -p /home/influxdb/data
$ mkdir -p /home/influxdb/logs
下载安装最新的 InfluxDB Cluster 版本(选择适合的安装包,如:Linux x86_64).
注意:因GitHub下载较慢,可先网页下载到本地,上传到 /usr/local/src
目录下;
$ cd /usr/local/src && tar -xzf influxdb-cluster_1.8.10-c1.1.2_linux_amd64.tar.gz -C /usr/local
$ cd .. && mv influxdb-cluster-1.8.10-c1.1.2-1 influxdb-cluster
# 将配置文件拷贝到默认位置
$ cp -f influxdb-cluster/etc/influxdb/influxdb-meta.conf /etc/influxdb;
$ cp -f influxdb-cluster/etc/influxdb/influxdb.conf /etc/influxdb;
# 为提取的可执行二进制文件创建软连接,放入系统中$PATH
$ ln -s influxdb-cluster/usr/bin/influx /usr/local/bin/influx;
$ ln -s influxdb-cluster/usr/bin/influx_inspect /usr/local/bin/influx_inspect;
$ ln -s influxdb-cluster/usr/bin/influx_stress /usr/local/bin/influx_stress;
$ ln -s influxdb-cluster/usr/bin/influxd /usr/local/bin/influxd;
$ ln -s influxdb-cluster/usr/bin/influxd-ctl /usr/local/bin/influxd-ctl;
$ ln -s influxdb-cluster/usr/bin/influxd-meta /usr/local/bin/influxd-meta;
可参考 InfluxDB Enterprise 相关资料完成 InfluxDB 集群环境的安装:
注: InfluxDB Cluster 的安装与 InfluxDB Enterprise 的安装完全相同,可以参考 安装 InfluxDB Enterprise 集群 / Install an InfluxDB Enterprise cluster。
Meta 节点设置
0. 设置说明和要求
生产环境安装过程设置三个 Meta 节点,每个 Meta 节点在自己的服务器上运行。
InfluxDB Cluster 需要 至少三个 Meta 节点 和 奇数个 Meta 节点 以实现高可用和冗余。
注 1:InfluxDB Cluster 不建议超过三个 Meta 节点,除非您的服务器之间的通信存在长期可靠性问题。
注 2:强烈建议不要在同一服务器上部署多个 Meta 节点,因为如果该特定服务器无响应,它会产生更大的潜在故障。InfluxDB Cluster 建议在占用空间相对较小的服务器上部署 Meta 节点。
注 3:要使用单个 Meta 节点启动集群,请在启动单个 Meta 节点时传递
-single-server
标志。假设有三台服务器:
influxdb-meta-01
,influxdb-meta-02
和influxdb-meta-03
。
端口: Meta 节点通过端口 8088
、8089
和 8091
进行通信。
1. 为每个服务器添加适当的 DNS 条目
修改/etc文件(将服务器的主机名和IP地址添加到每个群集服务器的/etc/hosts 文件中)
# <Meta_n_IP> <Hostname>
echo '192.168.3.114 influxdb-meta-01' >>/etc/hosts;
echo '192.168.3.115 influxdb-meta-02' >>/etc/hosts;
echo '192.168.3.116 influxdb-meta-03' >>/etc/hosts;
注: 如果您只想使用 IP 地址而不是主机名,请跳过当前步骤并转到步骤 2。
确保将服务器的主机名和 IP 地址添加到网络的 DNS 环境中。
验证步骤:
在继续安装之前,请在每台服务器上验证其他服务器是否可解析。下面是一组使用
ping
的 shell 命令示例:
ping -qc 1 influxdb-meta-01
ping -qc 1 influxdb-meta-02
ping -qc 1 influxdb-meta-03
2. 编辑配置文件
在 /etc/influxdb/influxdb-meta.conf
:
- 取消注释
hostname
并设置为 Meta 节点的完整主机名。
hostname="influxdb-meta-0x"
注意: 如果您只想使用 IP 地址而不是主机名,必须将
hostname
设置为 IP 地址。
3. 启动 Meta 服务
分别在服务器 influxdb-meta-01
、influxdb-meta-02
和 influxdb-meta-03
上启动 Meta 服务
/usr/bin/influxd-meta -config /etc/influxdb/influxdb-meta.conf
4. 将 Meta 节点加入集群
在一个且仅一个 Meta 节点上,加入所有 Meta 节点,包括它自己。在我们的示例中,从 influxdb-meta-01
运行:
influxd-ctl add-meta influxdb-meta-01:8091
influxd-ctl add-meta influxdb-meta-02:8091
influxd-ctl add-meta influxdb-meta-03:8091
预期的输出是:
Added meta node x at influxdb-meta-0x:8091
验证步骤:
在任何 Meta 节点上发出以下命令:
influxd-ctl show
预期的输出是:
Data Nodes
ID TCP Address Version
Meta Nodes
ID TCP Address Version
1 influxdb-meta-01:8091 1.8.10-c1.1.2
2 influxdb-meta-02:8091 1.8.10-c1.1.2
3 influxdb-meta-03:8091 1.8.10-c1.1.2
Data 节点设置
0. 设置说明和要求
生产环境安装过程设置两个 Data 节点,每个 Data 节点在自己的服务器上运行。
InfluxDB Cluster 需要 至少两个 Data 节点 才能实现高可用性和冗余。
注 1:没有要求每个 Data 节点都运行在自己的服务器上。但是,最佳实践是将每个 Data 节点部署在专用服务器上。
注 2:InfluxDB Cluster 不能用作负载均衡器。您需要配置自己的负载均衡器以将客户端流量发送到端口
8086
(HTTP API 的默认端口)。假设有两台服务器:
influxdb-data-01
和influxdb-data-02
。
端口: Data 节点通过端口 8088
、8089
和 8091
进行通信。
1. 为每个服务器添加适当的 DNS 条目
修改/etc文件(将服务器的主机名和IP地址添加到每个群集服务器的/etc/hosts 文件中)
# <Meta_n_IP> <Hostname>
$ echo '192.168.3.114 influxdb-data-01' >>/etc/hosts
$ echo '192.168.3.115 influxdb-data-02' >>/etc/hosts
$ echo '192.168.3.116 influxdb-data-03' >>/etc/hosts
注: 如果您只想使用 IP 地址而不是主机名,请跳过当前步骤并转到步骤 2。
确保将服务器的主机名和 IP 地址添加到网络的 DNS 环境中。
验证步骤:
在继续安装之前,请在每台服务器上验证其他服务器是否可解析。下面是一组使用
ping
的 shell 命令示例:ping -qc 1 influxdb-data-01
ping -qc 1 influxdb-data-02
2. 编辑配置文件
在 /etc/influxdb/influxdb.conf
:
- 取消注释
hostname
并设置为 Data 节点的完整主机名。
hostname="influxdb-data-0x"
注意: 如果您只想使用 IP 地址而不是主机名,必须将
hostname
设置为 IP 地址。
3. 启动 Data 服务
分别在服务器 influxdb-data-01
和 influxdb-data-02
上启动 Data 服务
/usr/bin/influxd -config /etc/influxdb/influxdb.conf
注: Data 节点在未被加入集群之前,出现
Failed to create storage
,failed to store statistics
或meta service unavailable
日志是正常情况。
4. 将 Data 节点加入集群
只有在添加全新节点时才应将 Data 节点加入集群,无论是在集群的初始创建期间还是在增加 Data 节点数量时。
如果您要使用influxd-ctl update-data
替换现有 Data 节点,请跳过本步骤的其余部分。
对要加入集群的每个 Data 节点运行一次且仅一次的 add-data
命令:
influxd-ctl add-data influxdb-data-01:8088
influxd-ctl add-data influxdb-data-02:8088
预期的输出是:
Added data node y at influxdb-data-0x:8088
验证步骤:
在任何 Meta 节点上发出以下命令:
influxd-ctl show
预期的输出是:Data Nodes
ID TCP Address Version
4 influxdb-data-01:8088 1.8.10-c1.1.2
5 influxdb-data-02:8088 1.8.10-c1.1.2Meta Nodes
ID TCP Address Version
1 influxdb-meta-01:8091 1.8.10-c1.1.2
2 influxdb-meta-02:8091 1.8.10-c1.1.2
3 influxdb-meta-03:8091 1.8.10-c1.1.2
配置
配置集群
请参考
注: InfluxDB Cluster 的配置项几乎和 InfluxDB Enterprise 完全一样,
唯一的差别是,InfluxDB Cluster 使用[coordinator]
配置项, 而 InfluxDB Enterprise 使用[cluster]
。
尚未支持的配置项
相比于 InfluxDB Enterprise,下列配置项目前尚未支持,未来将逐渐得到支持。
Data 节点:
[coordinator]
shard-reader-timeout
[monitor]
remote-collect-interval
[hinted-handoff]
retry-concurrency
batch-size
[anti-entropy]
max-fetch
max-sync
auto-repair-missing
Meta 节点:
[meta]
ldap-allowed
consensus-timeout
编辑 /etc/influxdb/influxdb.conf 文件:
### Welcome to the InfluxDB Cluster configuration file.
# The values in this file override the default values used by the system if
# a config option is not specified. The commented out lines are the configuration
# field and the default value used. Uncommenting a line and changing the value
# will change the value used at runtime when the process is restarted.
# Once every 24 hours InfluxDB Cluster will report usage data in log output
# The data includes a random ID, os, arch, version, the number of series and other
# usage data. No data from user databases is ever transmitted.
# Change this option to true to disable reporting.
# reporting-disabled = false
# The TCP bind address to use for cluster-internal services.
# bind-address = ":8088"
# Hostname advertised by this host for remote addresses. This must be resolvable by all
# other nodes in the cluster.
# hostname = "localhost"
# How often to update the cluster with this node's internal status.
# gossip-frequency = "3s"
###
### [meta]
###
### Controls the parameters for the Raft consensus group that stores metadata
### about the InfluxDB cluster.
###
[meta]
# Directory where the cluster metadata is stored.
dir = "/var/lib/influxdb/meta"
# Whether to use TLS when connecting to meta nodes.
# meta-tls-enabled = false
# The shared secret used by the internal API for JWT authentication. This setting
# must have the same value as the meta nodes' meta.auth-enabled configuration.
# meta-auth-enabled = false
# This setting must have the same value as the meta nodes' meta.internal-shared-secret configuration
# and must be non-empty if set.
# meta-internal-shared-secret = ""
# Allows insecure TLS connections to meta nodes. This is useful when testing with self-
# signed certificates.
# meta-insecure-tls = false
# Automatically create a default retention policy when creating a database.
# retention-autocreate = true
# If log messages are printed for the meta service
# logging-enabled = true
###
### [data]
###
### Controls where the actual shard data for InfluxDB lives and how it is
### flushed from the WAL. "dir" may need to be changed to a suitable place
### for your system, but the WAL settings are an advanced configuration. The
### defaults should work for most systems.
###
[data]
# The directory where the TSM storage engine stores TSM files.
dir = "/var/lib/influxdb/data"
# The directory where the TSM storage engine stores WAL files.
wal-dir = "/var/lib/influxdb/wal"
# The amount of time that a write will wait before fsyncing. A duration
# greater than 0 can be used to batch up multiple fsync calls. This is useful for slower
# disks or when WAL write contention is seen. A value of 0s fsyncs every write to the WAL.
# Values in the range of 0-100ms are recommended for non-SSD disks.
# wal-fsync-delay = "0s"
# The type of shard index to use for new shards. The default is an in-memory index that is
# recreated at startup. A value of "tsi1" will use a disk based index that supports higher
# cardinality datasets.
# index-version = "inmem"
# Trace logging provides more verbose output around the tsm engine. Turning
# this on can provide more useful output for debugging tsm engine issues.
# trace-logging-enabled = false
# Whether queries should be logged before execution. Very useful for troubleshooting, but will
# log any sensitive data contained within a query.
# query-log-enabled = true
# Provides more error checking. For example, SELECT INTO will err out inserting an +/-Inf value
# rather than silently failing.
# strict-error-handling = false
# Validates incoming writes to ensure keys only have valid unicode characters.
# This setting will incur a small overhead because every key must be checked.
# validate-keys = false
# Settings for the TSM engine
# CacheMaxMemorySize is the maximum size a shard's cache can
# reach before it starts rejecting writes.
# Valid size suffixes are k, m, or g (case insensitive, 1024 = 1k).
# Values without a size suffix are in bytes.
# cache-max-memory-size = "1g"
# CacheSnapshotMemorySize is the size at which the engine will
# snapshot the cache and write it to a TSM file, freeing up memory
# Valid size suffixes are k, m, or g (case insensitive, 1024 = 1k).
# Values without a size suffix are in bytes.
# cache-snapshot-memory-size = "25m"
# CacheSnapshotWriteColdDuration is the length of time at
# which the engine will snapshot the cache and write it to
# a new TSM file if the shard hasn't received writes or deletes
# cache-snapshot-write-cold-duration = "10m"
# CompactFullWriteColdDuration is the duration at which the engine
# will compact all TSM files in a shard if it hasn't received a
# write or delete
# compact-full-write-cold-duration = "4h"
# The maximum number of concurrent full and level compactions that can run at one time. A
# value of 0 results in 50% of runtime.GOMAXPROCS(0) used at runtime. Any number greater
# than 0 limits compactions to that value. This setting does not apply
# to cache snapshotting.
# max-concurrent-compactions = 0
# CompactThroughput is the rate limit in bytes per second that we
# will allow TSM compactions to write to disk. Note that short bursts are allowed
# to happen at a possibly larger value, set by CompactThroughputBurst
# compact-throughput = "48m"
# CompactThroughputBurst is the rate limit in bytes per second that we
# will allow TSM compactions to write to disk.
# compact-throughput-burst = "48m"
# If true, then the mmap advise value MADV_WILLNEED will be provided to the kernel with respect to
# TSM files. This setting has been found to be problematic on some kernels, and defaults to off.
# It might help users who have slow disks in some cases.
# tsm-use-madv-willneed = false
# Settings for the inmem index
# The maximum series allowed per database before writes are dropped. This limit can prevent
# high cardinality issues at the database level. This limit can be disabled by setting it to
# 0.
# max-series-per-database = 1000000
# The maximum number of tag values per tag that are allowed before writes are dropped. This limit
# can prevent high cardinality tag values from being written to a measurement. This limit can be
# disabled by setting it to 0.
# max-values-per-tag = 100000
# Settings for the tsi1 index
# The threshold, in bytes, when an index write-ahead log file will compact
# into an index file. Lower sizes will cause log files to be compacted more
# quickly and result in lower heap usage at the expense of write throughput.
# Higher sizes will be compacted less frequently, store more series in-memory,
# and provide higher write throughput.
# Valid size suffixes are k, m, or g (case insensitive, 1024 = 1k).
# Values without a size suffix are in bytes.
# max-index-log-file-size = "1m"
# The size of the internal cache used in the TSI index to store previously
# calculated series results. Cached results will be returned quickly from the cache rather
# than needing to be recalculated when a subsequent query with a matching tag key/value
# predicate is executed. Setting this value to 0 will disable the cache, which may
# lead to query performance issues.
# This value should only be increased if it is known that the set of regularly used
# tag key/value predicates across all measurements for a database is larger than 100. An
# increase in cache size may lead to an increase in heap usage.
series-id-set-cache-size = 100
###
### [coordinator]
###
### Controls the clustering service configuration.
###
[coordinator]
# The default timeout when establishing a new connection to a node.
# dial-timeout = "1s"
# The default time a stream will remain idle in the connection pool before being reaped.
# pool-max-idle-time = "60s"
# The default maximum number of streams that can be idle in a pool, per node.
# The number of active streams can exceed the maximum, but they will not return to the pool when released.
# pool-max-idle-streams = 100
# By default, this option is set to false and writes are processed in the order that they are received.
# This means if any points are in the hinted handoff (HH) queue for a shard, all incoming points must go into the HH queue.
# If true, writes may process in a different order than they were received.
# This can reduce the time required to drain the HH queue and increase throughput during recovery.
# allow-out-of-order-writes = false
# The default timeout set on shard readers.
# shard-reader-timeout = "0"
# Determines whether data nodes use HTTPS to communicate with each other.
# https-enabled = false
# The SSL certificate to use when HTTPS is enabled. The certificate should be a PEM encoded
# bundle of the certificate and key. If it is just the certificate, a key must be
# specified in https-private-key.
# https-certificate = ""
# Use a separate private key location.
# https-private-key = ""
# Whether data nodes will skip certificate validation communicating with each other over HTTPS.
# This is useful when testing with self-signed certificates.
# https-insecure-tls = false
# Enables cluster trace logging.
# cluster-tracing = false
# The default time a write request will wait until a "timeout" error is returned to the caller.
# write-timeout = "10s"
# The maximum number of concurrent queries allowed to be executing at one time. If a query is
# executed and exceeds this limit, an error is returned to the caller. This limit can be disabled
# by setting it to 0.
# max-concurrent-queries = 0
# The maximum time a query will is allowed to execute before being killed by the system. This limit
# can help prevent run away queries. Setting the value to 0 disables the limit.
# query-timeout = "0s"
# The time threshold when a query will be logged as a slow query. This limit can be set to help
# discover slow or resource intensive queries. Setting the value to 0 disables the slow query logging.
# log-queries-after = "0s"
# The maximum number of points a SELECT can process. A value of 0 will make
# the maximum point count unlimited. This will only be checked every second so queries will not
# be aborted immediately when hitting the limit.
# max-select-point = 0
# The maximum number of series a SELECT can run. A value of 0 will make the maximum series
# count unlimited.
# max-select-series = 0
# The maximum number of group by time bucket a SELECT can create. A value of zero will max the maximum
# number of buckets unlimited.
# max-select-buckets = 0
###
### [retention]
###
### Controls the enforcement of retention policies for evicting old data.
###
[retention]
# Determines whether retention policy enforcement enabled.
# enabled = true
# The interval of time when retention policy enforcement checks run.
# check-interval = "30m"
###
### [shard-precreation]
###
### Controls the precreation of shards, so they are available before data arrives.
### Only shards that, after creation, will have both a start- and end-time in the
### future, will ever be created. Shards are never precreated that would be wholly
### or partially in the past.
[shard-precreation]
# Determines whether shard pre-creation service is enabled.
# enabled = true
# The interval of time when the check to pre-create new shards runs.
# check-interval = "10m"
# The default period ahead of the endtime of a shard group that its successor
# group is created.
# advance-period = "30m"
###
### Controls the system self-monitoring, statistics and diagnostics.
###
### The internal database for monitoring data is created automatically if
### if it does not already exist. The target retention within this database
### is called 'monitor' and is also created with a retention period of 7 days
### and a replication factor of 1, if it does not exist. In all cases the
### this retention policy is configured as the default for the database.
[monitor]
# Whether to record statistics internally.
# store-enabled = true
# The destination database for recorded statistics
# store-database = "_internal"
# The interval at which to record statistics
# store-interval = "10s"
# How often to poll other data nodes' stats when aggregating cluster stats.
# remote-collect-interval = "10s"
###
### [http]
###
### Controls how the HTTP endpoints are configured. These are the primary
### mechanism for getting data into and out of InfluxDB.
###
[http]
# Determines whether HTTP endpoint is enabled.
# enabled = true
# Determines whether the Flux query endpoint is enabled.
# flux-enabled = false
# Determines whether the Flux query logging is enabled.
# flux-log-enabled = false
# The bind address used by the HTTP service.
# bind-address = ":8086"
# Determines whether user authentication is enabled over HTTP/HTTPS.
# auth-enabled = false
# The default realm sent back when issuing a basic auth challenge.
# realm = "InfluxDB"
# Determines whether HTTP request logging is enabled.
# log-enabled = true
# Determines whether the HTTP write request logs should be suppressed when the log is enabled.
# suppress-write-log = false
# When HTTP request logging is enabled, this option specifies the path where
# log entries should be written. If unspecified, the default is to write to stderr, which
# intermingles HTTP logs with internal InfluxDB logging.
#
# If influxd is unable to access the specified path, it will log an error and fall back to writing
# the request log to stderr.
# access-log-path = ""
# Filters which requests should be logged. Each filter is of the pattern NNN, NNX, or NXX where N is
# a number and X is a wildcard for any number. To filter all 5xx responses, use the string 5xx.
# If multiple filters are used, then only one has to match. The default is to have no filters which
# will cause every request to be printed.
# access-log-status-filters = []
# Determines whether detailed write logging is enabled.
# write-tracing = false
# Determines whether the pprof endpoint is enabled. This endpoint is used for
# troubleshooting and monitoring.
# pprof-enabled = true
# Enables authentication on pprof endpoints. Users will need admin permissions
# to access the pprof endpoints when this setting is enabled. This setting has
# no effect if either auth-enabled or pprof-enabled are set to false.
# pprof-auth-enabled = false
# Enables a pprof endpoint that binds to localhost:6060 immediately on startup.
# This is only needed to debug startup issues.
# debug-pprof-enabled = false
# Enables authentication on the /ping, /metrics, and deprecated /status
# endpoints. This setting has no effect if auth-enabled is set to false.
# ping-auth-enabled = false
# Determines whether HTTPS is enabled.
# https-enabled = false
# The SSL certificate to use when HTTPS is enabled.
# https-certificate = "/etc/ssl/influxdb.pem"
# Use a separate private key location.
# https-private-key = ""
# The JWT auth shared secret to validate requests using JSON web tokens.
# shared-secret = ""
# The default chunk size for result sets that should be chunked.
# max-row-limit = 0
# The maximum number of HTTP connections that may be open at once. New connections that
# would exceed this limit are dropped. Setting this value to 0 disables the limit.
# max-connection-limit = 0
# Enable http service over unix domain socket
# unix-socket-enabled = false
# The path of the unix domain socket.
# bind-socket = "/var/run/influxdb.sock"
# The maximum size of a client request body, in bytes. Setting this value to 0 disables the limit.
# max-body-size = 25000000
# The maximum number of writes processed concurrently.
# Setting this to 0 disables the limit.
# max-concurrent-write-limit = 0
# The maximum number of writes queued for processing.
# Setting this to 0 disables the limit.
# max-enqueued-write-limit = 0
# The maximum duration for a write to wait in the queue to be processed.
# Setting this to 0 or setting max-concurrent-write-limit to 0 disables the limit.
# enqueued-write-timeout = "30s"
# User supplied HTTP response headers
#
# [http.headers]
# X-Header-1 = "Header Value 1"
# X-Header-2 = "Header Value 2"
###
### [logging]
###
### Controls how the logger emits logs to the output.
###
[logging]
# Determines which log encoder to use for logs. Available options
# are auto, logfmt, and json. auto will use a more a more user-friendly
# output format if the output terminal is a TTY, but the format is not as
# easily machine-readable. When the output is a non-TTY, auto will use
# logfmt.
# format = "auto"
# Determines which level of logs will be emitted. The available levels
# are error, warn, info, and debug. Logs that are equal to or above the
# specified level will be emitted.
# level = "info"
# Suppresses the logo output that is printed when the program is started.
# The logo is always suppressed if STDOUT is not a TTY.
# suppress-logo = false
###
### [subscriber]
###
### Controls the subscriptions, which can be used to fork a copy of all data
### received by the InfluxDB host.
###
[subscriber]
# Determines whether the subscriber service is enabled.
# enabled = true
# The default timeout for HTTP writes to subscribers.
# http-timeout = "30s"
# Allows insecure HTTPS connections to subscribers. This is useful when testing with self-
# signed certificates.
# insecure-skip-verify = false
# The path to the PEM encoded CA certs file. If the empty string, the default system certs will be used
# ca-certs = ""
# The number of writer goroutines processing the write channel.
# write-concurrency = 40
# The number of in-flight writes buffered in the write channel.
# write-buffer-size = 1000
###
### [[graphite]]
###
### Controls one or many listeners for Graphite data.
###
[[graphite]]
# Determines whether the graphite endpoint is enabled.
# enabled = false
# database = "graphite"
# retention-policy = ""
# bind-address = ":2003"
# protocol = "tcp"
# consistency-level = "one"
# These next lines control how batching works. You should have this enabled
# otherwise you could get dropped metrics or poor performance. Batching
# will buffer points in memory if you have many coming in.
# Flush if this many points get buffered
# batch-size = 5000
# number of batches that may be pending in memory
# batch-pending = 10
# Flush at least this often even if we haven't hit buffer limit
# batch-timeout = "1s"
# UDP Read buffer size, 0 means OS default. UDP listener will fail if set above OS max.
# udp-read-buffer = 0
### This string joins multiple matching 'measurement' values providing more control over the final measurement name.
# separator = "."
### Default tags that will be added to all metrics. These can be overridden at the template level
### or by tags extracted from metric
# tags = ["region=us-east", "zone=1c"]
### Each template line requires a template pattern. It can have an optional
### filter before the template and separated by spaces. It can also have optional extra
### tags following the template. Multiple tags should be separated by commas and no spaces
### similar to the line protocol format. There can be only one default template.
# templates = [
# "*.app env.service.resource.measurement",
# # Default template
# "server.*",
# ]
###
### [collectd]
###
### Controls one or many listeners for collectd data.
###
[[collectd]]
# enabled = false
# bind-address = ":25826"
# database = "collectd"
# retention-policy = ""
#
# The collectd service supports either scanning a directory for multiple types
# db files, or specifying a single db file.
# typesdb = "/usr/local/share/collectd"
#
# security-level = "none"
# auth-file = "/etc/collectd/auth_file"
# These next lines control how batching works. You should have this enabled
# otherwise you could get dropped metrics or poor performance. Batching
# will buffer points in memory if you have many coming in.
# Flush if this many points get buffered
# batch-size = 5000
# Number of batches that may be pending in memory
# batch-pending = 10
# Flush at least this often even if we haven't hit buffer limit
# batch-timeout = "10s"
# UDP Read buffer size, 0 means OS default. UDP listener will fail if set above OS max.
# read-buffer = 0
# Multi-value plugins can be handled two ways.
# "split" will parse and store the multi-value plugin data into separate measurements
# "join" will parse and store the multi-value plugin as a single multi-value measurement.
# "split" is the default behavior for backward compatibility with previous versions of influxdb.
# parse-multivalue-plugin = "split"
###
### [opentsdb]
###
### Controls one or many listeners for OpenTSDB data.
###
[[opentsdb]]
# enabled = false
# bind-address = ":4242"
# database = "opentsdb"
# retention-policy = ""
# consistency-level = "one"
# tls-enabled = false
# certificate= "/etc/ssl/influxdb.pem"
# Log an error for every malformed point.
# log-point-errors = true
# These next lines control how batching works. You should have this enabled
# otherwise you could get dropped metrics or poor performance. Only points
# metrics received over the telnet protocol undergo batching.
# Flush if this many points get buffered
# batch-size = 1000
# Number of batches that may be pending in memory
# batch-pending = 5
# Flush at least this often even if we haven't hit buffer limit
# batch-timeout = "1s"
###
### [[udp]]
###
### Controls the listeners for InfluxDB line protocol data via UDP.
###
[[udp]]
# enabled = false
# bind-address = ":8089"
# database = "udp"
# retention-policy = ""
# InfluxDB precision for timestamps on received points ("" or "n", "u", "ms", "s", "m", "h")
# precision = ""
# These next lines control how batching works. You should have this enabled
# otherwise you could get dropped metrics or poor performance. Batching
# will buffer points in memory if you have many coming in.
# Flush if this many points get buffered
# batch-size = 5000
# Number of batches that may be pending in memory
# batch-pending = 10
# Will flush at least this often even if we haven't hit buffer limit
# batch-timeout = "1s"
# UDP Read buffer size, 0 means OS default. UDP listener will fail if set above OS max.
# read-buffer = 0
###
### [continuous_queries]
###
### Controls how continuous queries are run within InfluxDB.
###
[continuous_queries]
# Determines whether the continuous query service is enabled.
# enabled = true
# Controls whether queries are logged when executed by the CQ service.
# log-enabled = true
# Controls whether queries are logged to the self-monitoring data store.
# query-stats-enabled = false
# interval for how often continuous queries will be checked if they need to run
# run-interval = "1s"
###
### [tls]
###
### Global configuration settings for TLS in InfluxDB.
###
###
### [hinted-handoff]
###
### Settings for how write data is queued locally when the remote node is unable to accept a write.
###
[hinted-handoff]
# Determines whether hinted handoff is enabled.
# enabled = true
# The directory where the hinted handoff queues are stored.
dir = "/var/lib/influxdb/hh"
# The default maximum size of all hinted handoff queues in bytes.
# max-size = "10g"
# The default maximum amount of time that a hinted handoff write can stay in the queue.
# After this time, the write will be purged.
# max-age = "168h0m0s"
# The maximum number of concurrent queued writes to process at a time.
# retry-concurrency = 20
# The default rate that hinted handoffs will be retried. The rate is in bytes per second
# and applies across all nodes when retried. A value of 0 disables the rate limit.
# retry-rate-limit = 0
# The default amount of time the system waits before attempting to flush hinted handoff
# queues. With each failure of a hinted handoff write, this retry interval increases
# exponentially until it reaches the maximum.
# retry-interval = "1s"
# The maximum the hinted handoff retry interval will ever be.
# retry-max-interval = "10s"
# The amount of time the system waits before attempting to purge hinted handoff data due
# to age or inactive nodes.
# purge-interval = "1m0s"
# Maximum number of bytes to write to a shard in a single request
# batch-size = 512000
# Maximum number of writes into the hinted-handoff queue that can be pending.
# This is writes incoming to the hh queue, not outbound from the queue.
# max-writes-pending = 1024
###
### [anti-entropy]
###
### Controls the copying and repairing of shards to ensure that data nodes contain
### the shard data they are supposed to. The Anti-Entropy feature is disabled by
### default.
[anti-entropy]
# Determines whether the service is enabled.
# enabled = false
# The interval of time when anti-entropy checks run on each data node.
# check-interval = "5m"
# The maximum number of shards that a single data node will copy or repair
# concurrently.
# max-fetch = 10
# How many concurrent sync operations should be performed.
# max-sync = 1
# When set to true, missing shards will be automatically repaired.
# auto-repair-missing = true
[tls]
# Determines the available set of cipher suites. See https://golang.org/pkg/crypto/tls/#pkg-constants
# for a list of available ciphers, which depends on the version of Go (use the query
# SHOW DIAGNOSTICS to see the version of Go used to build InfluxDB). If not specified, uses
# the default settings from Go's crypto/tls package.
# ciphers = [
# "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305",
# "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305",
# ]
# Minimum version of the tls protocol that will be negotiated. If not specified, uses the
# default settings from Go's crypto/tls package.
# min-version = "tls1.2"
# Maximum version of the tls protocol that will be negotiated. If not specified, uses the
# default settings from Go's crypto/tls package.
# max-version = "tls1.3"
编辑 /etc/influxdb/influxdb-meta.conf 文件:
### Welcome to the InfluxDB Cluster configuration file.
# The values in this file override the default values used by the system if
# a config option is not specified. The commented out lines are the configuration
# field and the default value used. Uncommenting a line and changing the value
# will change the value used at runtime when the process is restarted.
# Once every 24 hours InfluxDB Cluster will report usage data in log output
# The data includes a random ID, os, arch, version, the number of series and other
# usage data. No data from user databases is ever transmitted.
# Change this option to true to disable reporting.
# reporting-disabled = false
# The TCP bind address to use for cluster-internal services.
# bind-address = ":8091"
# Hostname advertised by this host for remote addresses. This must be resolvable by all
# other nodes in the cluster.
# hostname = ""
###333
### [meta]
###
### Settings specific to meta node operation.
###
[meta]
# Directory where cluster meta data is stored.
dir = "/var/lib/influxdb/meta"
# The default address for meta node communication
# bind-address = ":8089"
# The default address to bind the API to.
# http-bind-address = ":8091"
# Determines whether meta nodes use HTTPS to communicate with each other.
# https-enabled = false
# The SSL certificate to use when HTTPS is enabled. The certificate should be a PEM encoded
# bundle of the certificate and key. If it is just the certificate, a key must be
# specified in https-private-key.
# https-certificate = ""
# Use a separate private key location.
# https-private-key = ""
# Whether meta nodes will skip certificate validation communicating with each other over HTTPS.
# This is useful when testing with self-signed certificates.
# https-insecure-tls = false
# Whether to use TLS to communicate with data nodes.
# data-use-tls = false
# Whether meta nodes will skip certificate validation communicating with data nodes over TLS.
# This is useful when testing with self-signed certificates.
# data-insecure-tls = false
# The default frequency with which the node will gossip its known announcements.
# gossip-frequency = "5s"
# The default length of time an announcement is kept before it is considered too old.
# announcement-expiration = "30s"
# Automatically create a default retention policy when creating a database.
# retention-autocreate = true
# The amount of time in candidate state without a leader before we attempt an election.
# election-timeout = "1s"
# The amount of time in follower state without a leader before we attempt an election.
# heartbeat-timeout = "1s"
# Control how long the "lease" lasts for being the leader without being able to contact a quorum
# of nodes. If we reach this interval without contact, we will step down as leader.
# leader-lease-timeout = "500ms"
# The amount of time without an Apply() operation before we heartbeat to ensure a timely
# commit. Due to random staggering, may be delayed as much as 2x this value.
# commit-timeout = "50ms"
# Timeout waiting for consensus before getting the latest Raft snapshot.
# consensus-timeout = "30s"
# Enables cluster level trace logging.
# cluster-tracing = false
# Enables cluster API level trace logging.
# logging-enabled = true
# Determines whether the pprof endpoint is enabled. This endpoint is used for
# troubleshooting and monitoring.
# pprof-enabled = true
# The default duration of leases.
# lease-duration = "1m0s"
# If true, HTTP endpoints require authentication.
# This setting must have the same value as the data nodes' meta.meta-auth-enabled
# configuration.
# auth-enabled = false
# Whether LDAP is allowed to be set.
# If true, you will need to use `influxd ldap set-config` and set enabled=true to use LDAP authentication.
# ldap-allowed = false
# The shared secret used by the API for JWT authentication.
# shared-secret = ""
# The shared secret used by the internal API for JWT authentication.
# This setting must have the same value as the data nodes'
# meta.meta-internal-shared-secret configuration.
# internal-shared-secret = ""
###
### [logging]
###
### Controls how the logger emits logs to the output.
###
[logging]
# Determines which log encoder to use for logs. Available options
# are auto, logfmt, and json. auto will use a more a more user-friendly
# output format if the output terminal is a TTY, but the format is not as
# easily machine-readable. When the output is a non-TTY, auto will use
# logfmt.
# format = "auto"
# Determines which level of logs will be emitted. The available levels
# are error, warn, info, and debug. Logs that are equal to or above the
# specified level will be emitted.
# level = "info"
# Suppresses the logo output that is printed when the program is started.
# The logo is always suppressed if STDOUT is not a TTY.
# suppress-logo = false
[tls]
# Determines the available set of cipher suites. See https://golang.org/pkg/crypto/tls/#pkg-constants
# for a list of available ciphers, which depends on the version of Go (use the query
# SHOW DIAGNOSTICS to see the version of Go used to build InfluxDB). If not specified, uses
# the default settings from Go's crypto/tls package.
# ciphers = [
# "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305",
# "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305",
# ]
# Minimum version of the tls protocol that will be negotiated. If not specified, uses the
# default settings from Go's crypto/tls package.
# min-version = "tls1.2"
# Maximum version of the tls protocol that will be negotiated. If not specified, uses the
# default settings from Go's crypto/tls package.
# max-version = "tls1.3"
最后编辑:Jeebiz 更新时间:2024-02-26 11:18