参数配置说明
local-read-async-double-write配置示例:
devspore: dcs: props: version: v1 app-id: xxxx monitor-id: xxxx cloud: xxxx region: xxxx azs: xxxx etcd: # 可选 address: xxx.xxx.xxx.xxx:xxxx api-version: v3 username: xxxx password: xxxx https-enable: false redis: nearest: dc1 servers: dc1: // 和MAS服务监控页中的名称保持一致:dc1和dc2 hosts: xxx.xxx.xxx.xxx:xxxx password: xxxxxx type: normal cloud: xxxx region: xxxx azs: az1 pool: max-total: 8 max-idle: 8 min-idle: 8 max-wait-millis: 10000 time-between-eviction-runs-millis: 60000 dc2: hosts: xxx.xxx.xxx.xxx:xxxx password: xxxxxx type: normal cloud: xxxx region: xxxx azs: az1 pool: max-total: 8 max-idle: 8 min-idle: 8 max-wait-millis: 10000 time-between-eviction-runs-millis: 60000 route-algorithm: local-read-async-double-write
single-read-async-double-write配置示例:
devspore: dcs: props: version: v1 app-id: xxxx monitor-id: xxxx cloud: xxxx region: xxxx azs: xxxx etcd: # 可选 address: xxx.xxx.xxx.xxx:xxxx api-version: v3 username: xxxx password: xxxx https-enable: false active: dc1 redis: servers: dc1: // 和MAS服务监控页中的名称保持一致:dc1和dc2 hosts: xxx.xxx.xxx.xxx:xxxx password: xxxxxx type: normal cloud: xxxx region: xxxx azs: az1 pool: max-total: 16 max-idle: 16 min-idle: 16 max-wait-millis: 10000 time-between-eviction-runs-millis: 60000 dc2: hosts: xxx.xxx.xxx.xxx:xxxx password: xxxxxx type: normal cloud: xxxx region: xxxx azs: az1 pool: max-total: 16 max-idle: 16 min-idle: 16 max-wait-millis: 10000 time-between-eviction-runs-millis: 60000 route-algorithm: single-read-async-double-write
参数名称 |
是否必选 |
参数类型 |
取值范围 |
描述 |
---|---|---|---|---|
props |
否 |
PropertiesConfiguration object |
请参考表2 |
MAS监控配置,配合etcd使用。同MAS-DB-SDK配置。 |
etcd |
否 |
EtcdConfiguration object |
请参考表3 |
etcd配置,如配置,则会从远端拉取。RedisServer配置对本地配置进行覆盖。同MAS-DB-SDK配置。 |
redis |
是 |
RedisClusterConfiguration object |
请参考表4 |
RedisServer配置。 |
route-algorithm |
是 |
String |
local-read-async-double-write single-read-async-double-write single-read-write |
路由算法。 |
active |
是 |
String |
只能是“dc1”或“dc2” |
激活的Redis。 |
参数名称 |
是否必选 |
参数类型 |
取值范围 |
描述 |
---|---|---|---|---|
version |
是 |
String |
- |
项目版本号。 |
appId |
是 |
String |
- |
项目组名称。 |
monitorId |
是 |
String |
- |
监控组名称。 |
cloud |
是 |
String |
- |
项目部署云组。 |
region |
是 |
String |
- |
项目部署region。 |
azs |
是 |
String |
- |
项目部署AZ。 |
decipherClassName |
是 |
String |
- |
自定义加密类的全类名 |
参数名称 |
是否必选 |
参数类型 |
取值范围 |
描述 |
---|---|---|---|---|
address |
是 |
String |
- |
Etcd地址。 |
apiVersion |
是 |
String |
v2/v3 |
Etcd版本。 |
username |
是 |
String |
- |
Etcd用户名。 |
password |
是 |
String |
- |
Etcd密码。 |
httpsEnable |
是 |
Boolean |
true/false |
是否启用https。 |
certificatePath |
否 |
String |
- |
证书路径,用于https认证(>=1.2.1-RELEASE)。 |
参数名称 |
是否必选 |
参数类型 |
取值范围 |
描述 |
---|---|---|---|---|
local |
否 |
String |
只能是“dc1”或“dc2”。 |
指明哪个是近端Redis。仅需要在本地读单边写模式下设置。 |
asyncRemoteWrite.retryTimes |
是 |
Integer |
默认为3。 |
异步写远端操作重试次数。 |
connectionPool.enable |
否 |
Boolean |
true/false,默认值为true。 |
是否启用连接池。 |
asyncRemotePool |
否 |
ThreadPoolConfiguration object |
请参考表5。 |
异步写线程池配置。 |
servers |
是 |
Map of ServerConfiguration |
key为dc1/dc2 单个维度请参考表6。 |
dc1,dc2的RedisServer连接配置。 |
参数名称 |
是否必选 |
参数类型 |
取值范围 |
描述 |
---|---|---|---|---|
threadCoreSize |
否 |
Integer |
默认为8 |
线程池的基本大小。 |
maximumPoolSize |
否 |
Integer |
默认为8 |
最大线程池大小。 |
keepAliveTime |
否 |
Long |
默认为60L |
空闲线程存活时间。 |
task-queue-size |
否 |
Integer |
默认150000 |
缓冲队列数。 |
参数名称 |
是否必选 |
参数类型 |
取值范围 |
描述 |
---|---|---|---|---|
hosts |
是 |
String |
- |
RedisServer地址。 |
password |
是 |
String |
- |
RedisServer密码。 |
type |
是 |
String |
|
RedisServer类型。 |
cloud |
是 |
String |
- |
RedisServer所属云。 |
region |
是 |
String |
- |
RedisServer所属Region。 |
azs |
是 |
String |
- |
RedisServer所属AZ。 |
pool |
否 |
ConnectionPoolConfiguration object |
请参考表7。 |
Jedis连接池配置。 |
timeout |
否 |
Integer |
默认为2000。 |
连接和执行命令的超时时间。 |
maxAttempts |
否 |
Integer |
默认为5。 |
最大重试次数。 |
masterName |
否 |
String |
- |
type选择为sentinel哨兵模式时Redis名字。 |
sentinelPassword |
否 |
String |
- |
哨兵模式的密码。 |
参数名称 |
是否必选 |
参数类型 |
取值范围 |
描述 |
---|---|---|---|---|
maxTotal |
否 |
int |
- |
最大活动对象数。 |
maxIdle |
否 |
int |
- |
最大能够保持idle状态的对象数。 |
minIdle |
否 |
int |
- |
最小能够保持idle状态的对象数。 |
maxWaitMillis |
否 |
long |
- |
当池内没有返回对象时,最大等待时间。 |
lifo |
否 |
boolean |
- |
设置连接对象是否后进先出,默认true。 |
fairness |
否 |
boolean |
- |
当从池中获取资源或者将资源还回池中时 是否使用。java.util.concurrent.locks.ReentrantLock.ReentrantLock 的公平锁机制,默认为false。 |
minEvictableIdleTime |
否 |
long |
- |
连接最小空闲时间, 默认60000L。 |
evictorShutdownTimeout |
否 |
long |
- |
驱逐线程关闭的超时时间。 |
softMinEvictableIdleTime |
否 |
long |
- |
对象空闲多久后逐出, 当空闲时间>该值且空闲连接>最大空闲数时直接逐出,不再根据MinEvictableIdleTimeMillis判断。 |
numTestsPerEvictionRun |
否 |
int |
- |
次释放连接的最大数目。 |
evictionPolicyClassName |
否 |
String |
- |
设置逐出策略,默认策略为 “org.apache.commons.pool2.impl.DefaultEvictionPolicy” |
testOnCreate |
否 |
boolean |
- |
在连接对象创建时测试连接对象的有效性,默认false。 |
testOnBorrow |
否 |
boolean |
- |
从池中获取连接时是否测试连接的有效性,默认false ,建议在对性能要求不高的情况下配置为true。 |
testOnReturn |
否 |
boolean |
- |
在连接对象返回时,是否测试对象的有效性,默认false。 |
testWhileIdle |
否 |
boolean |
- |
在连接池空闲时是否测试连接对象的有效性,默认true (建议配置为true)。 |
blockWhenExhausted |
否 |
boolean |
- |
当池中的资源耗尽时是否进行阻塞,设置false直接报错,true表示会一直等待,直到有可用资源。 |
jmxEnabled |
否 |
boolean |
- |
设置是否启用JMX,默认true。 |
jmxNamePrefix |
否 |
String |
- |
设置JMX前缀名,默认值pool。 |
jmxNameBase |
否 |
String |
- |
设置JMX基础名。 |
timeBetweenEvictionRuns |
否 |
long |
- |
空闲连接检测线程,检测的周期,毫秒数。如果为负值,表示不运行检测线程。默认30000L。 |
timeBetweenEvictionRunsMillis |
否 |
long |
- |
空闲连接检测线程,检测的周期,毫秒数。如果为负值,表示不运行检测线程。默认为30000L。 |