# config.yaml 配置文件 # @Link https://github.com/xiujiecn/xiu-admin # @Copyright Copyright (c) 2025 LiXiujie # @Author Lxj # @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE # 系统配置 system: name: "IotLCM" version: "1.0" description: "IotLCM Server" gfmode: "dev" upload: local: path: "resource/upload" # 日志配置 logger: path: "/app/logs" # 日志文件路径。默认为空,表示关闭,仅输出到终端 file: "{Y-m-d-H}.log" # 日志文件格式。默认为"{Y-m-d}.log" prefix: "" # 日志内容输出前缀。默认为空 level: "dev" # 日志输出级别 timeFormat: "2006-01-02T15:04:05" # 自定义日志输出的时间格式,使用Golang标准的时间格式配置 ctxKeys: [] # 自定义Context上下文变量名称,自动打印Context的变量到日志中。默认为空 header: true # 是否打印日志的头信息。默认true stdout: true # 日志是否同时输出到终端。默认true rotateSize: 0 # 按照日志文件大小对文件进行滚动切分。默认为0,表示关闭滚动切分特性 rotateExpire: 0 # 按照日志文件时间间隔对文件滚动切分。默认为0,表示关闭滚动切分特性 rotateBackupLimit: 0 # 按照切分的文件数量清理切分文件,当滚动切分特性开启时有效。默认为0,表示不备份,切分则删除 rotateBackupExpire: 0 # 按照切分的文件有效期清理切分文件,当滚动切分特性开启时有效。默认为0,表示不备份,切分则删除 rotateBackupCompress: 0 # 滚动切分文件的压缩比(0-9)。默认为0,表示不压缩 rotateCheckInterval: "1h" # 滚动切分的时间检测间隔,一般不需要设置。默认为1小时 stdoutColorDisabled: false # 关闭终端的颜色打印。默认开启 writerColorEnable: false # 日志文件是否带上颜色。默认false,表示不带颜色 # 数据库配置 database: logger: path: "/app/logs/sql" level: "all" stdout: true default: # 分组名称,可自定义,默认为default link: "${DB_DSN}" debug: true #开启调试模式 charset: "utf8mb4" # (可选)数据库编码(如: utf8mb4/utf8/gbk/gb2312),一般设置为utf8mb4。默认为utf8。 dryRun: false #ORM空跑(只读不写) maxIdle: 30 #连接池最大闲置的连接数 maxOpen: 100 #连接池最大打开的连接数 maxLifetime: 120 #(单位秒)连接对象可重复使用的时间长度 memorydb: # link: "sqlite::@file(jieiotmem.db)?journal_mode=WAL" link: "${DB_DSN}" # link: "" debug: true maxIdle: 1 maxOpen: 1 maxLifetime: 30 # 缓存配置 cache: adapter: "redis" # 缓存适配器,支持:file|redis fileDir: "resource/cache" # 缓存文件目录 # Redis 配置 redis: # 单实例配置 default: mode: "single" #redis模式,支持:single|cluster|sentinel sentinelMasterName: "iotlcm-master" #哨兵模式主节点名称 address: 127.0.0.1:6379 db: 0 pass: "${SERVICE_PASSWORD}" minIdle: 5 #最小空闲连接数 maxIdle: 30 #允许闲置的最大连接数 maxActive: 5000 #最大活跃连接数 idleTimeout: "60s" #连接最大空闲时间,使用时间字符串例如30s/2m/2d ClientName: "SystemCache" alipay: appId: "${APP_ID}" privateKey: "${PRIVATE_KEY}" alipayPublicKey: "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA8Df1EPFkA2xy8NgF0UdRYxsshslUi2XSGTG01oQKsrYNB+rhAw9MJdMlunVQxSrBZsw5N7htXGdiTceaLo/n8Wuibp0cRHdErJSp9GhP4pW2IR3FoCCPYlJlyiCUR/NInI3XMai0UdjgiPX03bvYLRAKE8lLiOSgxNagQmOFLmQYRYfFhGbxDe98XMg83YdSWvZKrlM+vzgk8/aPgq7BFLpbRKqLvd8OXXBHDCaWMSSGwCN0whhdEiwbIhSVgwTgkhWXUuNDmT741/+7D46djp8wX/84SDts0fWb63/in9ATTGtNivJX7HPDyqrmcN2iUi5xFHS9XwYBdT4yu/xFQwIDAQAB" notifyUrl: "https://evolution-starless-municipal.ngrok-free.dev/api/v1/pay/alipay/notify" returnUrl: "http://localhost:5666/enterpriseManagement/tBalanceDetail/tAgentBalance" isProduction: false # RabbitMQ 配置(worker 核心依赖) rabbitmq: enabled: true # 示例:${SERVICE_DSN} # dsn: "${SERVICE_DSN}" dsn: "${SERVICE_DSN}" balanceRecharge: retryDelay: "1m" # Alipay 查询失败后的延时重试时间 maxRetry: 100 # 最大重试次数,超过后投递到 iotlcm.balance.recharge.dlq batchExecute: executionTimeout: "0s" finalizationTimeout: "10s" retryDelay: "30s" maxRetries: 3 batch: inbound: upstreamBatchSize: 1 upstreamConcurrency: 8 upstreamRateLimit: enabled: true mode: "redis" redisGroup: "default" keyPrefix: "iotlcm:worker:inbound:upstream_basic_info" redisFailureFallback: "error" default: qps: 20 burst: 1 requestCost: 1 channels: {} # 本月流量全量同步。开发环境常驻监听,Admin 未配置定时任务时不会自动启动全量扫描。 trafficUsageFullSync: enabled: true redisKeyPrefix: "flow:" retry: enabled: true maxRounds: 5 failureRetention: "720h" producer: # channel requires idx_card_chan_key; never creates or rebuilds an index. scanConcurrency: 4 # SQL burst protection, not a measured optimum pageSize: 100 globalHighWaterMark: 10000 channelHighWaterMark: 2000 pollInterval: "2s" runLockKey: "flow:producer:active" runLockTTL: "5m" consumer: enabled: true chanClientName: "127.0.0.1:8110" chanClientTimeout: "90s" lockKey: "flow:consumer:active" lockTTL: "1m" pollInterval: "1s" leaseTTL: "3m" taskTimeout: "2m" retryDelay: "30s" maxRetryDelay: "30m" claimBatch: 1 mobileConcurrency: 30 telecomConcurrency: 20 genericConcurrency: 1 maxChannels: 8 channelConcurrency: 1 maxInFlight: 8 maxAttempts: 5 # 失败池告警阀值(条目数):单条 FailureRecord 约 1KB 且保留整个 # failureRetention,超阀值只打 WARN 日志,绝不截断 Run。 failurePoolAlertThreshold: 50000 # 独立的日流量同步链路,与月流量/状态同步同构。 # 发布配置默认仍关闭:先用手动 API + 单通道 scope 预演,确认产出与旧链路逐字段一致后再打开。 trafficUsageDailySync: enabled: false redisKeyPrefix: "daily:" retry: enabled: true maxRounds: 3 failureRetention: "720h" producer: pageSize: 100 globalHighWaterMark: 0 channelHighWaterMark: 0 pollInterval: "2s" runLockKey: "daily:producer:active" runLockTTL: "5m" consumer: enabled: false lockKey: "daily:consumer:active" lockTTL: "1m" pollInterval: "1s" leaseTTL: "3m" taskTimeout: "2m" claimBatch: 100 mobileConcurrency: 30 telecomConcurrency: 8 genericConcurrency: 1 genericQPS: 1.5 templateQPS: sim_yd_v5: 30 sim_yd_mock_v5: 30 sim_onelink_tengyu_v1: 30 sim_onelink_beixin_v1: 30 sim_onelink_xuzhou_mobile_v1: 30 sim_onelink_lelian_v1: 30 sim_onelink_qianxun_v1: 30 sim_onelink_henan_xinjing_v1: 30 sim_onelink_daihe_v1: 30 sim_dx_v1: 25 # 独立的月流量历史同步链路(写 TDengine 月表),与日流量/状态同步同构。 # 注意:这与 trafficUsageFullSync 不是一回事——后者填的是 MySQL 当月快照。 # 默认关闭:日流量验证通过后再单独打开。 trafficUsageMonthlyHistorySync: enabled: false redisKeyPrefix: "monthly-history:" retry: enabled: true maxRounds: 3 failureRetention: "720h" producer: pageSize: 100 globalHighWaterMark: 0 channelHighWaterMark: 0 pollInterval: "2s" runLockKey: "monthly-history:producer:active" runLockTTL: "5m" consumer: enabled: false lockKey: "monthly-history:consumer:active" lockTTL: "1m" pollInterval: "1s" leaseTTL: "3m" taskTimeout: "2m" claimBatch: 100 mobileConcurrency: 30 telecomConcurrency: 8 genericConcurrency: 1 genericQPS: 1.5 # 三条链路共用出口 IP,各自独立限速,避免互相挤占运营商配额。 templateQPS: sim_yd_v5: 30 sim_yd_mock_v5: 30 sim_onelink_tengyu_v1: 30 sim_onelink_beixin_v1: 30 sim_onelink_xuzhou_mobile_v1: 30 sim_onelink_lelian_v1: 30 sim_onelink_qianxun_v1: 30 sim_onelink_henan_xinjing_v1: 30 sim_onelink_daihe_v1: 30 sim_dx_v1: 25 # 独立的状态同步队列链路,默认关闭以保留旧逻辑作为切换期兜底。 simStatusQueueSync: enabled: true redisKeyPrefix: "sim-status:" retry: enabled: true maxRounds: 3 failureRetention: "720h" producer: pageSize: 1000 globalHighWaterMark: 0 pollInterval: "1s" runLockKey: "sim-status:producer:active" runLockTTL: "5m" consumer: enabled: true lockKey: "sim-status:consumer:active" lockTTL: "1m" pollInterval: "1s" leaseTTL: "3m" taskTimeout: "2m" claimBatch: 100 mobileConcurrency: 100 telecomConcurrency: 8 genericConcurrency: 1 genericQPS: 1.5 networkRetries: 2 # 失败池告警阀值(条目数):单条 FailureRecord 约 1KB 且保留整个 # failureRetention,超阀值只打 WARN 日志,绝不截断 Run。 failurePoolAlertThreshold: 50000 templateQPS: sim_yd_v5: 100 sim_yd_mock_v5: 100 sim_onelink_tengyu_v1: 100 sim_onelink_xuzhou_mobile_v1: 100 sim_onelink_lelian_v1: 100 sim_dx_v1: 5 # 独立的 IMEI 全量同步链路。 # 默认关闭:先完成预演验证(含 lanshang_8000/8003 是否支持 IMEI 的实测) # 再按环境开启,否则未验证的通道会直接进失败池。 imeiFullSync: enabled: false redisKeyPrefix: "imei:" retry: enabled: true maxRounds: 5 failureRetention: "720h" producer: pageSize: 1000 globalHighWaterMark: 0 pollInterval: "1s" runLockKey: "imei:producer:active" runLockTTL: "5m" consumer: enabled: false chanClientName: "iotlcm.example.com:8110" chanClientTimeout: "30s" lockKey: "imei:consumer:active" lockTTL: "1m" pollInterval: "1s" leaseTTL: "3m" taskTimeout: "2m" claimBatch: 100 mobileConcurrency: 100 telecomConcurrency: 8 genericConcurrency: 1 genericQPS: 1.5 networkRetries: 2 # 失败池告警阀值(条目数):单条 FailureRecord 约 1KB 且保留整个 # failureRetention,超阀值只打 WARN 日志,绝不截断 Run。 failurePoolAlertThreshold: 50000 templateQPS: sim_yd_v5: 100 sim_yd_mock_v5: 100 sim_onelink_tengyu_v1: 100 sim_onelink_xuzhou_mobile_v1: 100 sim_onelink_lelian_v1: 100 sim_dx_v1: 5 # 诊断消费者开关(仅本地调试开) workerDiagnostic: enabled: true # 时序数据库配置 tsdb: database: "TdEngine" #可选择 TdEngine、Influxdb tdengine: # type: "taosRestful" #http连接方式,端口是6041 # dsn: "${SERVICE_DSN}" type: "taosWS" #websocket连接方式,端口是6041 # dsn: "${SERVICE_DSN}" dsn: "${SERVICE_DSN}" dbName: "iotlcm" maxOpenConns: 100 maxIdleConns: 10 # 上游服务调用 upstream: proxy: address: "iotlcm.example.com:8510" # address: "localhost:8510" timeout: 10s gateway: address: "iotlcm.example.com:8110" timeout: 10s