Skip to content

配置管理

Atlas 支持通过 命令行环境变量配置文件 三种方式配置启动参数。如果同一个值同时在多个位置设置,优先级为:

命令行 > 环境变量 > atlas.conf

命令行

常见启动示例:

bash
# 使用默认配置启动
atlas --config configs/atlas.conf

# 打印版本
atlas --version

# 守护进程方式启动并写入 pid 文件
atlas --daemon --pidfile atlas.pid --config configs/atlas.conf

# 停止当前运行中的 Atlas
atlas --stop --pidfile atlas.pid

# 临时关闭 HTTP API 鉴权
atlas --disable_auth --config configs/atlas.conf

主要参数:

参数说明
-c, --configTOML 配置文件路径,默认 configs/atlas.conf
-d, --daemon以守护进程方式运行
--debug开启调试日志
--pidfilePID 文件路径,默认 atlas.pid
--stop根据 PID 文件停止当前运行中的 Atlas
--disable_auth关闭本地 HTTP API 鉴权
-v, --version输出版本信息

环境变量

Atlas 支持通过环境变量覆盖 atlas.conf[agent] 下的每一个已加载配置项。

命名规则:

ATLAS_ + 配置路径转大写下划线

示例:

bash
ATLAS_AGENT_SERVICE_ADDRESS=":9090"
ATLAS_AGENT_DATA_PATH="/var/lib/atlas"
ATLAS_AGENT_DISABLE_AUTH="true"
ATLAS_AGENT_JWT_SECRET="replace-me"

补充说明:

  • 可以通过 ATLAS_MACHINE_ID 覆盖运行时机器标识

配置文件

开发环境默认配置文件为 configs/atlas.conf,deb/rpm 安装后的默认路径通常为 /etc/atlas/atlas.conf

示例:

toml
[agent]
  service_address = ":8080"
  path = "/jelly"
  measurement = "jelly"
  schema_dir = "./configs/schema"
  simulator_address = "127.0.0.1"
  simulator_port = 5502
  enable_access_log = false
  disable_auth = false
  jwt_secret = "atlas-jelly-secret"
  jwt_expire_sec = 86400
  data_path = "./data"