Skip to main content

Dash 配置

Dash 配置文件是 YAML。管理员密码不写入配置文件,只从环境变量 monitor_dash_pwd 读取。

查找顺序

未显式指定配置路径时按顺序查找:

  1. config.local.yaml
  2. config.yaml
  3. configs/config.local.yaml
  4. configs/config.yaml
  5. $DASH_HOME/configs/config.local.yaml
  6. $DASH_HOME/configs/config.yaml

最小可运行配置

app:
listen: ":8080"
public_url: "https://dash.example.com"
database:
driver: "postgres"
host: "127.0.0.1"
port: 5432
user: "ithiltir"
password: "secret"
name: "ithiltir"
sslmode: "disable"
redis:
addr: "127.0.0.1:6379"
auth:
jwt_signing_key: "replace-with-high-entropy-secret"
http:
trusted_proxies: []

运行前设置:

export monitor_dash_pwd='<admin-password>'

app

字段默认/限制说明
name应用名
env影响静态资源开发模式
dash_ip安装脚本中保留的地址字段
listen必填HTTP 监听地址
grpc_port当前不作为公开入口保留字段
public_url必填公开根 URL;不能带路径前缀
timezone空值用 time.Local告警消息和账期 fallback 时区
language默认 zhzhcnchinesezh-cnzh_hans 归一为 zhenenglish 归一为 en
log_levelinfodebuginfowarnerror
log_formattexttextjson
node_offline_threshold14sGo duration,例如 14s2m

public_url may omit the scheme. IP addresses default to http; domain names default to https.

Production deployments should explicitly use an HTTPS domain such as https://dash.example.com, with Nginx or Caddy reverse-proxying to the Dash backend. IP+HTTP is only for temporary validation.

http

字段说明
trusted_proxies可信代理 CIDR 列表

本机反代:

http:
trusted_proxies:
- 127.0.0.1/32
- ::1/128

没有反代:

http:
trusted_proxies: []

database

字段说明
driver当前使用 postgres
hostPostgreSQL 地址
portPostgreSQL 端口
user数据库用户
password数据库密码
name数据库名
sslmodePostgreSQL SSL 模式
max_open_conns最大打开连接数
max_idle_conns最大空闲连接数
conn_max_lifetimeGo duration,空值表示不设置
retention_days普通指标保留天数;省略或 0 使用 45
traffic_retention_days流量 5 分钟事实表保留天数;省略时为 max(retention_days, 45)

负数保留天数会导致配置校验失败。

redis

字段默认/说明
addrRedis 地址
usernameRedis ACL 用户名
passwordRedis 密码
dbRedis DB
pool_size连接池大小
min_idle_conns最小空闲连接数
dial_timeout默认 5s
read_timeout默认 3s
write_timeout默认 3s

启动时不使用 --no-redis 时,Dash 会连接并 ping Redis,失败即退出。

auth

字段说明
jwt_signing_keyHS256 签名密钥,必须是高熵随机值

管理员密码:

monitor_dash_pwd

密码必须是可见 ASCII 字符。