Skip to content

Commit

Permalink
feat: add configMap cache docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dyx1234 committed Sep 19, 2024
1 parent 31e6486 commit 315e7f9
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions docs/zh/client/java-sdk-user-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ request.timeout=2000
batch=2000
```

> 注:若部署在Kubernetes环境,可以同时开启configMap缓存以进一步提高可用性
#### 1.2.3.1 自定义缓存路径

1.0.0版本开始支持以下方式自定义缓存路径,按照优先级从高到低分别为:
Expand Down Expand Up @@ -398,6 +400,35 @@ apollo.label=YOUR-APOLLO-LABEL
3. 通过`app.properties`配置文件
* 可以在`classpath:/META-INF/app.properties`指定`apollo.override-system-properties=true`

#### 1.2.4.10 ConfigMap缓存设置

> 适用于2.4.0及以上版本
在2.4.0版本开始,客户端在Kubernetes环境下的可用性得到了加强,开启configMap缓存后,客户端会将从服务端拉取到的配置信息在configMap中缓存一份,在服务不可用,或网络不通,且本地缓存文件丢失的情况下,依然能从configMap恢复配置。以下是相关配置

> 由于需要对configmap进行读写操作,所以客户端所在pod必须有相应读写权限,具体配置方法见[]()
`apollo.cache.kubernetes.enable`:是否启动configMap缓存机制,默认false

`apollo.configmap-namespace`:将使用的configMap所在的namespace(Kubernetes中的namespace),默认值为"default"

配置信息会以下面的对应关系放置于指定的configmap中:

namespace:使用指定的值,若未指定默认为"default"

configMapName:{appId}

key:{cluster}+{namespace}

value:内容为对应的配置信息的json格式字符串


> appId是应用自己的appId,如100004458
> cluster是应用使用的集群,一般在本地模式下没有做过配置的话,是default
> namespace就是应用使用的配置namespace,一般是application
// TODO 开读写权限的指南

# 二、Maven Dependency
Apollo的客户端jar包已经上传到中央仓库,应用在实际使用时只需要按照如下方式引入即可。
```xml
Expand Down

0 comments on commit 315e7f9

Please sign in to comment.