启动配置项
Eric Zhao edited this page Aug 14, 2019
·
25 revisions
Sentinel 启动配置项允许在启动程序的时候设置相关参数。
上述参数所有均可通过 JVM -D 参数指定。除 project.name
以及日志的配置项(如 csp.sentinel.log.dir
)之外,其余参数还可通过 properties 文件指定,路径为 ${user_home}/logs/csp/${project.name}.properties
。
优先级顺序:JVM -D 参数的优先级最高,若 properties 和 JVM 参数中有相同项的配置,以 JVM -D 参数配置的为准。
注:若您的应用为 Spring Boot 或 Spring Cloud 应用,您可以使用 Spring Cloud Alibaba,通过 Spring 配置文件来指定配置,详情请参考 Spring Cloud Alibaba Sentinel 文档 以及 示例。
名称 | 含义 | 类型 | 默认值 | 是否必需 | 备注 |
---|---|---|---|---|---|
project.name |
指定应用的名称 | String |
null |
否 | |
csp.sentinel.app.type |
指定应用的类型 | int |
0 (APP_TYPE_COMMON ) |
否 | 1.6.0 引入 |
csp.sentinel.metric.file.single.size |
单个监控日志文件的大小 | long |
52428800 (50MB) | 否 | |
csp.sentinel.metric.file.total.count |
监控日志文件的总数上限 | int |
6 | 否 | |
csp.sentinel.statistic.max.rt |
最大的有效响应时长(ms),超出此值则按照此值记录 | int |
4900 | 否 | 1.4.1 引入 |
csp.sentinel.log.dir |
Sentinel 日志文件目录 | String |
${user.home}/logs/csp/ |
否 | 1.3.0 引入 |
csp.sentinel.log.use.pid |
日志文件名中是否加入进程号,用于单机部署多个应用的情况 | boolean |
false |
否 | 1.3.0 引入 |
csp.sentinel.log.output.type |
Record 日志输出的类型,file 代表输出至文件,console 代表输出至终端 |
String |
file |
否 | 1.6.2 引入 |
其中 project.name
项用于指定应用名(appName)。若未指定,则默认解析 main 函数的类名作为应用名。实际项目使用中建议手动指定应用名。
注意:若需要在单台机器上运行相同服务的多个实例,则需要加入
-Dcsp.sentinel.log.use.pid=true
来保证不同实例日志的独立性。
名称 | 含义 | 类型 | 默认值 | 是否必需 |
---|---|---|---|---|
csp.sentinel.dashboard.server |
控制台的地址,指定控制台后客户端会自动向该地址发送心跳包。地址格式为:hostIp:port
|
String |
null |
是 |
csp.sentinel.heartbeat.interval.ms |
心跳包发送周期,单位毫秒 | long |
null |
非必需,若不进行配置,则会从相应的 HeartbeatSender 中提取默认值 |
csp.sentinel.api.port |
本地启动 HTTP API Server 的端口号 | int |
null |
否 |
-
文档
-
Documents
- Read Me
- Introduction
- How to Use
- How it Works
- Flow Control
- Parameter Flow Control
- Cluster Flow Control
- API Gateway Flow Control
- Circuit Breaking
- Adaptive System Protection
- Metrics
- General Configuration
- Dynamic Rule Configuration
- Dashboard
- Integrations with open-source frameworks
- Contribution Guideline