Receiver
2 分钟阅读
参数解析
启动参数
名称 | 默认值 | 说明 |
---|---|---|
grpc-address | 0.0.0.0:10901 | gRPC服务 StoreAPI 监听的地址 |
grpc-grace-period | 2m | gRPC服务接收到停止需等待时间,通过配置 context.WithTimeout 的实现 |
grpc-server-max-connection-age | 60m | TODO; |
grpc-server-tls-cert | "" | 是否开启tls认证,为空表示禁用 |
grpc-server-tls-client-ca | "" | TLS CA,为空表示不对客户端验证 |
grpc-server-tls-key | "" | 是否开启tls认证,为空表示禁用 |
hash-func | "" | TODO; 如:"", “SHA256” |
http-address | 0.0.0.0:10902 | 监听 HTTP 服务地址 |
http-grace-period | 2m | HTTP服务接收到停止需等待时间,通过配置 context.WithTimeout 的实现 |
http.config | "" | TODO; http的配置,用于开启TLS、认证等 |
label | "" | 格式:="",植入标签,用于标识 |
log.format | logfmt | 日志格式,可取值:logfmt、json |
log.level | info | 日志级别 |
objstore.config | "" | 功能同 ‘objstore.config-file’ 对象存储地址 |
objstore.config-file | "" | 对象存储地址 |
receive.default-tenant-id | default-tenant | 如果未设置租户ID,则以此为默认值 |
receive.hashrings | "" | 功能同 ‘receive.hashrings-file’,优先级高 |
receive.hashrings-algorithm | hashmod | 用于 hashrings 算法,可取:hashmod, ketama |
receive.hashrings-file | "" | TODO; |
receive.hashrings-file-refresh-interval | 5m | 刷新 hashrings-file 指向文件的时间 |
receive.local-endpoint | "" | 在hashring文件列表配置的所有地址,指明哪个为该节点,如果为空且配置了hashring则开启"RoutingOnly"模式 |
receive.relabel-config | "" | 功能同 ‘receive.relabel-config-file’ |
receive.relabel-config-file | "" | TODO; |
receive.replica-header | THANOS-REPLICA | TODO; 用于表示副本数的HTTP请求头 |
receive.replication-factor | 1 | TODO; int((h.options.ReplicationFactor / 2) + 1) |
receive.tenant-certificate-field | "" | 使用 tls 证书中的属性表示租户,必须是 organization, organizationalUnit or commonName 之一,优先级高于 receive.tenant-header |
receive.tenant-header | THANOS-TENANT | HTTP请求头,值代表写入的租户 |
receive.tenant-label-name | tenant_id | 植入到指标里租户的标签名 |
remote-write.address | 0.0.0.0:19291 | 用于 remote write 的http服务地址 |
remote-write.client-server-name | "" | TODO; |
remote-write.client-tls-ca | "" | 用于验证客户端 |
remote-write.client-tls-cert | "" | 同上 |
remote-write.client-tls-key | "" | 同上 |
remote-write.server-tls-cert | "" | 用于 remote write 服务是否开启tls,为空表示关闭 |
remote-write.server-tls-key | "" | 同上 |
remote-write.server-tls-client-ca | "" | 用于验证客户端,未配置则不开启 |
request.logging-config | "" | 功能同 ‘request.logging-config-file’ |
request.logging-config-file | "" | TODO; |
tracing.config | "" | 功能同 ’tracing.config-file’ |
tracing.config-file | "" | TODO; |
tsdb.allow-overlapping-blocks | - | TODO; |
tsdb.max-exemplars | 0 | TODO; |
tsdb.no-lockfile | "" | TODO; |
tsdb.path | ./data | TODO; |
tsdb.retention | 15d | 性能数据保留的时间,设置0表示不过期 |
tsdb.wal-compression | "" | 是否压缩 wal |
- 隐藏参数
名称 | 默认值 | 说明 |
---|---|---|
receive-forward-timeout | 5s | 转发的超时时间 |
tsdb.min-block-duration | 2h | TODO; |
tsdb.max-block-duration | 2h | TODO; |
shipper.ignore-unequal-block-size | false | TODO; |
shipper.allow-out-of-order-uploads | false | TODO; |
两种模式
Routing Receiver
在启动参数不配置以下时,为该模式,仅做流量转发
--receive.local-endpoint=RECEIVE.LOCAL-ENDPOINT
该模式需明确指定
--receive.hashrings-file
参数。
Ingesting Receiver
在启动参数不配置以下时,为该模式,仅做数据存储
--receive.hashrings-file=<path>
该模式需明确指定
--receive.local-endpoint
参数。
RouterIngestor
既是Routing也是Ingesting
// determineMode returns the ReceiverMode that this receiver is configured to run in.
// This is used to configure this Receiver's forwarding and ingesting behavior at runtime.
func (rc *receiveConfig) determineMode() receive.ReceiverMode {
// Has the user provided some kind of hashring configuration?
hashringSpecified := rc.hashringsFileContent != "" || rc.hashringsFilePath != ""
// Has the user specified the --receive.local-endpoint flag?
localEndpointSpecified := rc.endpoint != ""
switch {
case hashringSpecified && localEndpointSpecified:
return receive.RouterIngestor
case hashringSpecified && !localEndpointSpecified:
// Be careful - if the hashring contains an address that routes to itself and does not specify a local
// endpoint - you've just created an infinite loop / fork bomb :)
return receive.RouterOnly
default:
// hashring configuration has not been provided so we ingest all metrics locally.
return receive.IngestorOnly
}
}
最后修改 2023.02.13: feat: 可对外发布 ingress-nginx thanos (64e761e)