配置
OpenTSDB 可以通过本地文件来配置, 通过命令行参数或者命令集合或者两者都有.
配置文件
配置文件符合Java规范. 多字符串直接不允许有空格. 每个名称后跟随一个等号, 然后是该值. 所有 OpenTSDB 配置项以tsd
开始.说明和无效项以#
注释. 例如:
# List of Zookeeper hosts that manage the HBase cluster
tsd.storage.hbase.zk_quorum = 192.168.1.100
配置TSD通过192.168.1.100
连接到Zookeeper.
在组合配置文件和命令行参数时,处理顺序如下:
- 加载默认值
- 加载配置项,覆盖默认值
- 载入命令行参数, 覆盖配置文件和默认值
文件位置
你可以使用--config
命令行参数来指定配置文件的路径. 如果没有明确指定, OpenTSDB 和一些命令行工具会在以下位置尝试搜索有效的配置文件:
- ./opentsdb.conf
- /etc/opentsdb.conf
- /etc/opentsdb/opentsdb.conf
- /opt/opentsdb/opentsdb.conf
如果没有找到有效的配置文件,也没有设置有效的命令行参数, TSD不会启动. 请参见下面的属性表,列出所需的配置设置.
属性
下面是所有配置项的列表.如果适用,则提供相应的命令行覆盖. 请注意有些命令行工具会有它们自己的值,你应该查看它们的文档.
注意
额外的配置参数用于调试AsyncHBase客户端.请查看AsyncHBase Configuration
属性 | 类型 | 需求 | 描述 | 默认 | CLI |
---|---|---|---|---|---|
tsd.core.auto_create_metrics | Boolean | Optional | Whether or not a data point with a new metric will assign a UID to the metric. When false, a data point with a metric that is not in the database will be rejected and an exception will be thrown. | False | --auto-metric |
tsd.core.auto_create_tagks(2.1) | Boolean | Optional | Whether or not a data point with a new tag name will assign a UID to the tagk. When false, a data point with a tag name that is not in the database will be rejected and an exception will be thrown. | True | |
tsd.core.auto_create_tagvs(2.1) | Boolean | Optional | Whether or not a data point with a new tag value will assign a UID to the tagv. When false, a data point with a tag value that is not in the database will be rejected and an exception will be thrown. | True | |
tsd.core.connections.limit(2.3) | Integer | Optional | Sets the maximum number of connections a TSD will handle, additional connections are immediately closed. | 0 | |
tsd.core.enable_api(2.3) | Boolean | Optional | Whether or not to allow the 2.x HTTP API to function. When disabled, calls to endpoints such as/api/query or/api/suggest will return a 404. |
True | --disable-api |
tsd.core.enable_ui(2.3) | Boolean | Optional | Whether or not to allow the built-in GUI and legacy HTTP API to function. When disabled, calls to the root endpoint or other such as/logs or/suggest will return a 404. |
True | --disable-ui |
tsd.core.histograms.config(2.4) | JSON/File Path | Optional | A mapping of histogram codec class names to numeric identifications for storing multi-measurement data. For simple configurations, the value may be a quote-escaped JSON map, e.g.{\"net.opentsdb.core.SimpleHistogramDecoder\":0,\"net.opentsdb.core.CompactQuantilesSketchCodec\":1} . If the value ends with.json then it will be treated as a file path and the given file will be opened and parsed. Numeric IDs must be between 0 and 255. |
||
tsd.core.meta.enable_realtime_ts | Boolean | Optional | Whether or not to enable real-time TSMeta object creation. SeeMetadata | False | |
tsd.core.meta.enable_realtime_uid | Boolean | Optional | Whether or not to enable real-time UIDMeta object creation. SeeMetadata | False | |
tsd.core.meta.enable_tsuid_incrementing | Boolean | Optional | Whether or not to enable tracking of TSUIDs by incrementing a counter every time a data point is recorded. SeeMetadata(Overrides "tsd.core.meta.enable_tsuid_tracking") | False | |
tsd.core.meta.enable_tsuid_tracking | Boolean | Optional | Whether or not to enable tracking of TSUIDs by storing a1 with the current timestamp every time a data point is recorded. SeeMetadata |
False | |
tsd.core.plugin_path | String | Optional | A path to search for plugins when the TSD starts. If the path is invalid, the TSD will fail to start. Plugins can still be enabled if they are in the class path. | ||
tsd.core.preload_uid_cache(2.1) | Boolean | Optional | Enables pre-population of the UID caches when starting a TSD. | False | |
tsd.core.preload_uid_cache.max_entries(2.1) | Integer | Optional | The number of rows to scan for UID pre-loading. | 300,000 | |
tsd.core.storage_exception_handler.enable(2.2) | Boolean | Optional | Whether or not to enable the configured storage exception handler plugin. | False | |
tsd.core.storage_exception_handler.plugin(2.2) | String | Optional | The full class name of the storage exception handler plugin you wish to use. | ||
tsd.core.timezone | String | Optional | A localized timezone identification string used to override the local system timezone used when converting absolute times to UTC when executing a query. This does not affect incoming data timestamps. E.g. America/Los_Angeles | System Configured | |
tsd.core.tree.enable_processing | Boolean | Optional | Whether or not to enable processing new/edited TSMeta through tree rule sets | false | |
tsd.core.uid.random_metrics(2.2) | Boolean | Optional | Whether or not to randomly assign UIDs to new metrics as they are created | false | |
tsd.core.bulk.allow_out_of_order_timestamps*(2.3) | Boolean | Optional | Whether or not to allow out-of-order values when bulk importing data from a text file. | false | |
tsd.http.cachedir | String | Required | The full path to a location where temporary files can be written. E.g. /tmp/opentsdb | --cachedir | |
tsd.http.query.allow_delete | Boolean | Optional | Whether or not to allow deleting data points from storage during query time. | False | |
tsd.query.enable_fuzzy_filter | Boolean | Optional | Whether or not to enable the FuzzyRowFilter for HBase when making queries using theexplicitTags flag. |
True | |
tsd.http.request.cors_domains | String | Optional | A comma separated list of domain names to allow access to OpenTSDB when theOrigin header is specified by the client. If empty, CORS requests are passed through without validation. The list may not contain the public wildcard* and specific domains at the same time. |
||
tsd.http.request.cors_headers(2.1) | String | Optional | A comma separated list of headers sent to clients when executing a CORs request. The literal value of this option will be passed to clients. | Authorization, Content-Type, Accept, Origin, User-Agent, DNT, Cache-Control, X-Mx-ReqToken, Keep-Alive, X-Requested-With, If-Modified-Since | |
tsd.http.request.enable_chunked | Boolean | Optional | Whether or not to enable incoming chunk support for the HTTP RPC | false | |
tsd.http.request.max_chunk | Integer | Optional | The maximum request body size to support for incoming HTTP requests when chunking is enabled. | 4096 | |
tsd.http.rpc.plugins(2.2) | String | Optional | A comma delimited list of RPC plugins to load when starting a TSD. Must contain the entire class name. | ||
tsd.http.show_stack_trace | Boolean | Optional | Whether or not to return the stack trace with an API query response when an exception occurs. | false | |
tsd.http.staticroot | String | Required | Location of a directory where static files, such as JavaScript files for the web interface, are located. E.g. /opt/opentsdb/staticroot | --staticroot | |
tsd.mode(2.1) | String | Optional | Whether or not the TSD will allow writing data points. Must be eitherrw to allow writing data orro to block data point writes. Note that meta data such as UIDs can still be written/modified. |
rw | |
tsd.network.async_io | Boolean | Optional | Whether or not to use NIO or traditional blocking IO | True | --async-io |
tsd.network.backlog | Integer | Optional | The connection queue depth for completed or incomplete connection requests depending on OS. The default may be limited by the 'somaxconn' kernel setting or set by Netty to 3072. | See Description | --backlog |
tsd.network.bind | String | Optional | An IPv4 address to bind to for incoming requests. The default is to listen on all interfaces. E.g. 127.0.0.1 | 0.0.0.0 | --bind |
tsd.network.keep_alive | Boolean | Optional | Whether or not to allow keep-alive connections | True | |
tsd.network.port | Integer | Required | The TCP port to use for accepting connections | --port | |
tsd.network.reuse_address | Boolean | Optional | Whether or not to allow reuse of the bound port within Netty | True | |
tsd.network.tcp_no_delay | Boolean | Optional | Whether or not to disable TCP buffering before sending data | True | |
tsd.network.worker_threads | Integer | Optional | The number of asynchronous IO worker threads for Netty | #CPU cores * 2 | --worker-threads |
tsd.no_diediedie(2.1) | Boolean | Optional | Enable or disable thediediedie HTML and ASCII commands to shutdown a TSD. |
False | |
tsd.query.allow_simultaneous_duplicates(2.2) | Boolean | Optional | Whether or not to allow simultaneous duplicate queries from the same host. If disabled, a second query that comes in matching one already running will receive an exception. | False | |
tsd.query.filter.expansion_limit(2.2) | Integer | Optional | The maximum number of tag values to include in the regular expression sent to storage during scanning for data. A larger value means more computation on the HBase region servers. | 4096 | |
tsd.query.skip_unresolved_tagvs(2.2) | Boolean | Optional | Whether or not to continue querying when the query includes a tag value that hasn't been assigned a UID yet and may not exist. | False | |
tsd.query.timeout(2.2) | Integer | Optional | How long, in milliseconds, before canceling a running query. A value of 0 means queries will not timeout. | 0 | |
tsd.rollups.config(2.4) | String | Optional | The path to a configuration file detailing available rollup tables and aggregations. Must settsd.rollups.enable totrue for this option to be parsed. SeeRollup And Pre-Aggregates |
rollup_config.json | |
tsd.rollups.enable(2.4) | Boolean | Optional | Whether or not to enable rollup and pre-aggregation storage and writing. | false | |
tsd.rollups.tag_raw(2.4) | Boolean | Optional | Whether or not to tag non-rolled-up and non-pre-aggregated values with the tag key configured intsd.rollups.agg_tag_key and value configured intsd.rollups.raw_agg_tag_value |
false | |
tsd.rollups.agg_tag_key(2.4) | String | Optional | A special key to tag pre-aggregated data with when writing to storage | _aggregate | |
tsd.rollups.raw_agg_tag_value(2.4) | String | Optional | A special tag value to non-rolled-up and non-pre-aggregated data with when writing to storage.tsd.rollups.tag_raw must be set to true. |
RAW | |
tsd.rollups.block_derived(2.4) | Boolean | Optional | Whether or not to block storing derived aggregations such asAVG andDEV . |
true | |
tsd.rpc.plugins | String | Optional | A comma delimited list of RPC plugins to load when starting a TSD. Must contain the entire class name. | ||
tsd.rpc.telnet.return_errors(2.4) | Boolean | Optional | Whether or not to return errors to the Telnet style socket when writing data viaput orrollup |
true | |
tsd.rtpublisher.enable | Boolean | Optional | Whether or not to enable a real time publishing plugin. If true, you must supply a validtsd.rtpublisher.plugin class name |
False | |
tsd.rtpublisher.plugin | String | Optional | The class name of a real time publishing plugin to instantiate. Iftsd.rtpublisher.enable is set to false, this value is ignored. E.g. net.opentsdb.tsd.RabbitMQPublisher |
||
tsd.search.enable | Boolean | Optional | Whether or not to enable search functionality. If true, you must supply a validtsd.search.plugin class name |
False | |
tsd.search.plugin | String | Optional | The class name of a search plugin to instantiate. Iftsd.search.enable is set to false, this value is ignored. E.g. net.opentsdb.search.ElasticSearch |
||
tsd.stats.canonical | Boolean | Optional | Whether or not the FQDN should be returned with statistics requests. The default stats are returned withhost=<hostname> which is not guaranteed to perform a lookup and return the FQDN. Setting this to true will perform a name lookup and return the FQDN if found, otherwise it may return the IP. The stats output should befqdn=<hostname> |
false | |
tsd.storage.compaction.flush_interval(2.2) | Integer | Optional | How long, in seconds, to wait in between compaction queue flush calls | 10 | |
tsd.storage.compaction.flush_speed(2.2) | Integer | Optional | A multiplier used to determine how quickly to attempt flushing the compaction queue. E.g. a value of 2 means it will try to flush the entire queue within 30 minutes. A value of 1 would take an hour. | 2 | |
tsd.storage.compaction.max_concurrent_flushes(2.2) | Integer | Optional | The maximum number of compaction calls inflight to HBase at any given time | 10000 | |
tsd.storage.compaction.min_flush_threshold(2.2) | Integer | Optional | Size of the compaction queue that must be exceeded before flushing is triggered | 100 | |
tsd.storage.enable_appends(2.2) | Boolean | Optional | Whether or not to append data to columns when writing data points instead of creating new columns for each value. Avoids the need for compactions after each hour but can use more resources on HBase. | False | |
tsd.storage.enable_compaction | Boolean | Optional | Whether or not to enable compactions | True | |
tsd.storage.fix_duplicates(2.1) | Boolean | Optional | Whether or not to accept the last written value when parsing data points with duplicate timestamps. When enabled in conjunction with compactions, a compacted column will be written with the latest data points. | False | |
tsd.storage.flush_interval | Integer | Optional | How often, in milliseconds, to flush the data point storage write buffer | 1000 | --flush-interval |
tsd.storage.hbase.data_table | String | Optional | Name of the HBase table where data points are stored | tsdb | --table |
tsd.storage.hbase.meta_table | String | Optional | Name of the HBase table where meta data are stored | tsdb-meta | |
tsd.storage.hbase.prefetch_meta(2.2) | Boolean | Optional | Whether or not to prefetch the regions for the TSDB tables before starting the network interface. This can improve performance. | False | |
tsd.storage.hbase.tree_table | String | Optional | Name of the HBase table where tree data are stored | tsdb-tree | |
tsd.storage.hbase.uid_table | String | Optional | Name of the HBase table where UID information is stored | tsdb-uid | --uidtable |
tsd.storage.hbase.zk_basedir | String | Optional | Path under which the znode for the -ROOT- region is located | /hbase | --zkbasedir |
tsd.storage.hbase.zk_quorum | String | Optional | A comma-separated list of ZooKeeper hosts to connect to, with or without port specifiers. E.g.192.168.1.1:2181,192.168.1.2:2181 |
localhost | --zkquorum |
tsd.storage.repair_appends(2.2) | Boolean | Optional | Whether or not to re-write appended data point columns at query time when the columns contain duplicate or out of order data. | False | |
tsd.storage.max_tags(2.2) | Integer | Optional | The maximum number of tags allowed per data point.NOTEPlease be aware of the performance tradeoffs of overusing tagswriting |
8 | |
tsd.storage.salt.buckets(2.2) | Integer | Optional | The number of salt buckets used to distribute load across regions.NOTEChanging this value after writing data may cause TSUID based queries to fail. | 20 | |
tsd.storage.salt.width(2.2) | Integer | Optional | The width, in bytes, of the salt prefix used to indicate which bucket a time series belongs in. A value of 0 means salting is disabled.WARNINGDo not change after writing data to HBase or you will corrupt your tables and not be able to query any more. | 0 | |
tsd.storage.uid.width.metric(2.2) | Integer | Optional | The width, in bytes, of metric UIDs.WARNINGDo not change after writing data to HBase or you will corrupt your tables and not be able to query any more. | 3 | |
tsd.storage.uid.width.tagk(2.2) | Integer | Optional | The width, in bytes, of tag name UIDs.WARNINGDo not change after writing data to HBase or you will corrupt your tables and not be able to query any more. | 3 | |
tsd.storage.uid.width.tagv(2.2) | Integer | Optional | The width, in bytes, of tag value UIDs.WARNINGDo not change after writing data to HBase or you will corrupt your tables and not be able to query any more. | 3 |
数据类型
一些配置值需要额外的理解:
Booleans - 下面的字面量会解析为
True
:1
true
yes
其他任意值都为
False
. 不区分大小写Strings - 字符串, 即使存在空格, 也不需要引号, 但是有一些注意事项:
一些特殊字符必须使用反引号:
#
,!
,=
, 和:
E.g.:my.property = Hello World\!
Unicode 字符必须使用16进制表示, e.g.:
my.property = \u0009