taosdata / TDengine

TDengine is an open source, high-performance, cloud native time-series database optimized for Internet of Things (IoT), Connected Cars, Industrial IoT and DevOps.

Home Page:https://tdengine.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how can I configure spring header in a three-node cluster?

WhiteNarcissus opened this issue · comments

Bug Description
我有三个节点,节点1 主,节点2从2,节点3从3。spring配置数据源应该怎么配置

spring:
datasource:
druid:
initial-size: 5
min-idle: 5
maxActive: 20
maxWait: 60000
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
validationQuery: SELECT SERVER_STATUS();
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true
maxPoolPreparedStatementPerConnectionSize: 20
filters: stat,slf4j
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
datasource:
# 主库数据源
master:
driver-class-name: com.taosdata.jdbc.rs.RestfulDriver
url: jdbc:TAOS-RS://从2:6041/${spring.datasource.dynamic.datasource.master.dbName}?user=${spring.datasource.dynamic.datasource.master.username}&password=${spring.datasource.dynamic.datasource.master.password}&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8
dbName: test
username: test
password: test
# 从库数据源
# slave:
# username:
# password:
# url:
# driver-class-name:
目前是这样配置,实际上数据查询,只用了从2,导致改台服务器cpu压力过大(经常98%),想问下如果要吧压力分摊下去该怎么配置。官网也没找到demo

查询的负载是由数据分布造成的,假如 3 副本,你的leader vnode 在 2 节点上,查询就会打到 2节点上。和你怎么配置链接没关系。