更新时间:2023-05-06 GMT+08:00
分享

参数配置说明

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
表1 配置参数详解

参数名称

是否必选

参数类型

取值范围

描述

props

PropertiesConfiguration object

请参考表2

Mas监控配置,配合etcd使用。同db。

etcd

EtcdConfiguration object

请参考表3

etcd配置,如配置,则会从远端拉取。RedisServer配置对本地配置进行覆盖。同db。

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。

表2 PropertiesConfiguration数据结构说明

参数名称

是否必选

参数类型

取值范围

描述

version

String

-

项目版本号。

appId

String

-

项目组名称。

monitorId

String

-

监控组名称。

cloud

String

-

项目部署云组。

region

String

-

项目部署region。

azs

String

-

项目部署AZ。

decipherClassName

String

-

自定义加密类的全类名

表3 EtcdConfiguration数据结构说明

参数名称

是否必选

参数类型

取值范围

描述

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)。

表4 RedisClusterConfiguration数据结构说明

参数名称

是否必选

参数类型

取值范围

描述

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连接配置。

表5 ThreadPoolConfiguration数据结构说明

参数名称

是否必选

参数类型

取值范围

描述

threadCoreSize

Integer

-默认为8

线程池的基本大小。

maximumPoolSize

Integer

-默认为8

最大线程池大小。

keepAliveTime

Long

-默认为60L

空闲线程存活时间。

task-queue-size

Integer

-默认150000

缓冲队列数。

表6 RedisServerConfiguration数据结构说明

参数名称

是否必选

参数类型

取值范围

描述

hosts

String

-

RedisServer地址。

password

String

-

RedisServer密码。

type

String

cluster, master-slave, normal

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

-

哨兵模式的密码。

表7 ConnectionPoolConfiguration数据结构说明

参数名称

是否必选

参数类型

取值范围

描述

maxTotal

int

-

最大活动对象数。

maxIdle

int

-

最大能够保持idel状态的对象数。

minIdle

int

-

最小能够保持idel状态的对象数。

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。

分享:

    相关文档

    相关产品