环境
- DEV 开发环境
- FAT 测试环境,相当于alpha环境(功能测试)
- UAT 集成环境,相当于beta环境(回归测试)
- PRO 生产环境
配置
- Java 环境变量 (System.getProperty)
- 系统环境变量 (System.getenv)
-
server.properties 文件
- Window /opt/settings/server.properties
- Linux /opt/settings/server.properties
- META-INF/app.properties
Java 环境变量
变量名 | 说明 |
---|---|
env | 所属环境 |
app.id | 应用ID |
apollo.accesskey.secret | 访问秘钥 |
apollo.configService | 配置服务,多个逗号分隔 |
apollo.cacheDir | 缓存根目录 |
apollo.cluster | 集群,默认值default |
apollo.connectTimeout | 连接超时时间,默认 1000(毫秒) |
apollo.refreshInterval | 刷新时间, 默认 5 (分钟) |
apollo.readTimeout | 默认 5000 (毫秒) |
apollo.meta | 元数据中心地址 |
apollo.cluster | 集群,默认default |
apollo.loadConfigQPS | 每秒几次,默认 2 |
apollo.longPollQPS | 每秒几次,默认 2 |
apollo.configCacheSize | 最大缓存key个数,默认 500 |
apollo.longPollingInitialDelayInMills | 默认 2000(毫秒) |
apollo.autoUpdateInjectedSpringPropertie | 自动更新spring propertie,默认true |
apollo.property.order.enable | 属性排序,默认false |
idc | Data Center |
local_meta | |
dev_meta | |
fat_meta | |
uat_meta | |
lpt_meta | |
pro_meta |
系统环境变
变量名 | 说明 |
---|---|
ENV | 所属环境 |
APP_ID | 应用ID |
APOLLO_ACCESSKEY_SECRET | 访问秘钥 |
APOLLO_CONFIGSERVICE | 配置服务,多个逗号分隔 |
APOLLO_CACHEDIR | 缓存根目录 |
APOLLO_META | 元数据中心地址 |
IDC | Data Center |
LOCAL_META | |
DEV_META | |
FAT_META | |
UAT_META | |
LPT_META | |
PRO_META |
server.properties 文件
变量名 | 说明 |
---|---|
env | 所属环境 |
apollo.configService | 配置服务,多个逗号分隔 |
apollo.cacheDir | 缓存根目录 |
apollo.meta | 元数据中心地址 |
idc | Data Center |
META-INF/app.properties
变量名 | 说明 |
---|---|
app.id | 应用ID |
apollo.accesskey.secret | 访问秘钥 |
apollo.configService | 配置服务,多个逗号分隔 |
apollo.meta | 元数据中心地址 |
apollo.cacheDir | 缓存根目录 |
apollo.autoUpdateInjectedSpringPropertie | 自动更新spring propertie,默认true |
apollo.property.order.enable | 属性排序,默认false |
spring boot 配置
app.id=
apollo.meta=
apollo.cluster=
apollo.cacheDir=
apollo.accesskey.secret=
# Configuration to keep properties order as same as line order in .yml/.yaml/.properties file.
apollo.property.order.enable=false
apollo.bootstrap.enabled= true
# EnvironmentPostProcessor should not be triggered if you don't want Apollo Loading before Logging System Initialization
apollo.bootstrap.eagerLoad.enabled= true
# 需要加载namespces
apollo.bootstrap.namespaces= application,application-dev
本地配置文件(apollo.cacheDir)
本地配置目录位于:
Mac/Linux:
/opt/data/{appId}/config-cache
Windows:
C:\opt\data{appId}\config-cache
文件名:
{appId}+{cluster}+{namespace}.properties
apollo-env.properties
文件位置
-
user.dir 目录
- config/
- ./
- classpath:/
内容
local.meta=
dev.meta=
fat.meta=
uat.meta=
lpt.meta=
pro.meta
版权声明:本文为paozixiaopu原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。